cmd/gio: generate appID if not specified

Use the Go import path to create an appID based on the domain name
plus the last directory location in the import path.

Signed-off-by: Greg Pomerantz <gmp.gio@wow.st>
This commit is contained in:
Greg Pomerantz
2019-09-10 18:28:43 -04:00
committed by Elias Naur
parent 86b231ca28
commit a68d97f947
3 changed files with 74 additions and 9 deletions
+2 -5
View File
@@ -176,10 +176,10 @@ func archiveAndroid(tmpDir string, bi *buildInfo) (err error) {
aarw.Create("R.txt")
aarw.Create("res/")
manifest := aarw.Create("AndroidManifest.xml")
manifest.Write([]byte(`<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.gioui.app">
manifest.Write([]byte(fmt.Sprintf(`<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="%s">
<uses-sdk android:minSdkVersion="16"/>
<uses-feature android:glEsVersion="0x00030000" android:required="true" />
</manifest>`))
</manifest>`, bi.appID)))
proguard := aarw.Create("proguard.txt")
proguard.Write([]byte(`-keep class org.gioui.** { *; }`))
@@ -200,9 +200,6 @@ func archiveAndroid(tmpDir string, bi *buildInfo) (err error) {
}
func exeAndroid(tmpDir string, tools *androidTools, bi *buildInfo) (err error) {
if bi.appID == "" {
return errors.New("app id is empty; use -appid to set it")
}
classes := filepath.Join(tmpDir, "classes")
var classFiles []string
err = filepath.Walk(classes, func(path string, f os.FileInfo, err error) error {