Files
gomobile-java/internal/binres/genarsc.go
Daniel Skinner 4e994ac070 internal/binres: use pkg binres for manifest encode
Current output byte-for-byte of pkg binres is close,
but not exact, to output of aapt.
The current exceptions to this are as follows:
 * sort order of certain attributes
 * typed value of minSdkVersion
These differences do not appear to affect the encoded
manifest from working correctly. Further details on
the byte differences can be seen in TestEncode.

Fixes golang/go#13109

Change-Id: Ibfb7731143f0e2baeeb7dd5b04aa649566606a53
Reviewed-on: https://go-review.googlesource.com/20030
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2016-03-05 06:30:01 +00:00

42 lines
1.0 KiB
Go

// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build ignore
// Genarsc generates stripped down version of android.jar resources used
// for validation of manifest entries.
//
// Requires ANDROID_HOME be set to the path of the Android SDK and the
// current sdk platform installed that matches MinSDK.
package main
import (
"fmt"
"io/ioutil"
"log"
"strconv"
"golang.org/x/mobile/internal/binres"
)
const tmpl = `// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// File is automatically generated by genarsc.go. DO NOT EDIT.
package binres
var arsc = []byte(%s)`
func main() {
arsc, err := binres.PackResources()
if err != nil {
log.Fatal(err)
}
if err := ioutil.WriteFile("arsc.go", []byte(fmt.Sprintf(tmpl, strconv.Quote(string(arsc)))), 0644); err != nil {
log.Fatal(err)
}
}