mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 01:45:36 +00:00
cmd/gio: add -version flag
For Android and iOS. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -280,8 +280,8 @@ func exeAndroid(tmpDir string, tools *androidTools, bi *buildInfo) (err error) {
|
|||||||
manifestSrc := fmt.Sprintf(`<?xml version="1.0" encoding="utf-8"?>
|
manifestSrc := fmt.Sprintf(`<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="%s"
|
package="%s"
|
||||||
android:versionCode="1"
|
android:versionCode="%d"
|
||||||
android:versionName="1.0">
|
android:versionName="1.0.%d">
|
||||||
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="28" />
|
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="28" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-feature android:glEsVersion="0x00030000"/>
|
<uses-feature android:glEsVersion="0x00030000"/>
|
||||||
@@ -297,7 +297,7 @@ func exeAndroid(tmpDir string, tools *androidTools, bi *buildInfo) (err error) {
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
</manifest>`, *appID, appName)
|
</manifest>`, *appID, bi.version, bi.version, appName)
|
||||||
manifest := filepath.Join(tmpDir, "AndroidManifest.xml")
|
manifest := filepath.Join(tmpDir, "AndroidManifest.xml")
|
||||||
if err := ioutil.WriteFile(manifest, []byte(manifestSrc), 0660); err != nil {
|
if err := ioutil.WriteFile(manifest, []byte(manifestSrc), 0660); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
+7
-4
@@ -20,6 +20,7 @@ var (
|
|||||||
buildMode = flag.String("buildmode", "exe", "specify buildmode: archive or exe")
|
buildMode = flag.String("buildmode", "exe", "specify buildmode: archive or exe")
|
||||||
destPath = flag.String("o", "", `output path. Specify a path with the ".app" suffix for iOS simulators.`)
|
destPath = flag.String("o", "", `output path. Specify a path with the ".app" suffix for iOS simulators.`)
|
||||||
appID = flag.String("appid", "org.gioui.app", "app identifier (for -buildmode=exe)")
|
appID = flag.String("appid", "org.gioui.app", "app identifier (for -buildmode=exe)")
|
||||||
|
version = flag.Int("version", 1, "app version (for -buildmode=exe)")
|
||||||
printCommands = flag.Bool("x", false, "print the commands")
|
printCommands = flag.Bool("x", false, "print the commands")
|
||||||
keepWorkdir = flag.Bool("work", false, "print the name of the temporary work directory and do not delete it when exiting.")
|
keepWorkdir = flag.Bool("work", false, "print the name of the temporary work directory and do not delete it when exiting.")
|
||||||
)
|
)
|
||||||
@@ -30,6 +31,7 @@ type buildInfo struct {
|
|||||||
ldflags string
|
ldflags string
|
||||||
target string
|
target string
|
||||||
appID string
|
appID string
|
||||||
|
version int
|
||||||
archs []string
|
archs []string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,10 +69,11 @@ func main() {
|
|||||||
}
|
}
|
||||||
name = filepath.Base(name)
|
name = filepath.Base(name)
|
||||||
bi := &buildInfo{
|
bi := &buildInfo{
|
||||||
name: name,
|
name: name,
|
||||||
pkg: pkg,
|
pkg: pkg,
|
||||||
target: *target,
|
target: *target,
|
||||||
appID: *appID,
|
appID: *appID,
|
||||||
|
version: *version,
|
||||||
}
|
}
|
||||||
switch *target {
|
switch *target {
|
||||||
case "js":
|
case "js":
|
||||||
|
|||||||
+3
-3
@@ -231,9 +231,9 @@ func buildInfoPlist(bi *buildInfo) string {
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.0</string>
|
<string>1.0.%d</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1</string>
|
<string>%d</string>
|
||||||
<key>UILaunchStoryboardName</key>
|
<key>UILaunchStoryboardName</key>
|
||||||
<string>LaunchScreen</string>
|
<string>LaunchScreen</string>
|
||||||
<key>UIRequiredDeviceCapabilities</key>
|
<key>UIRequiredDeviceCapabilities</key>
|
||||||
@@ -249,7 +249,7 @@ func buildInfoPlist(bi *buildInfo) string {
|
|||||||
<integer>1</integer>
|
<integer>1</integer>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>`, bi.appID, appName, platform)
|
</plist>`, bi.appID, appName, bi.version, bi.version, platform)
|
||||||
}
|
}
|
||||||
|
|
||||||
func archiveIOS(tmpDir, target, frameworkRoot string, bi *buildInfo) error {
|
func archiveIOS(tmpDir, target, frameworkRoot string, bi *buildInfo) error {
|
||||||
|
|||||||
Reference in New Issue
Block a user