mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 09:55:40 +00:00
cmd/gio: set DTPlatformName, DTPlatformVersion, UIRequiredDeviceCapabilities
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+6
-2
@@ -28,6 +28,8 @@ type buildInfo struct {
|
|||||||
name string
|
name string
|
||||||
pkg string
|
pkg string
|
||||||
ldflags string
|
ldflags string
|
||||||
|
target string
|
||||||
|
appID string
|
||||||
archs []string
|
archs []string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,8 +67,10 @@ func main() {
|
|||||||
}
|
}
|
||||||
name = filepath.Base(name)
|
name = filepath.Base(name)
|
||||||
bi := &buildInfo{
|
bi := &buildInfo{
|
||||||
name: name,
|
name: name,
|
||||||
pkg: pkg,
|
pkg: pkg,
|
||||||
|
target: *target,
|
||||||
|
appID: *appID,
|
||||||
}
|
}
|
||||||
switch *target {
|
switch *target {
|
||||||
case "js":
|
case "js":
|
||||||
|
|||||||
+27
-10
@@ -179,8 +179,27 @@ int main(int argc, char * argv[]) {
|
|||||||
if _, err := runCmd(lipo); err != nil {
|
if _, err := runCmd(lipo); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
infoPlist := buildInfoPlist(bi)
|
||||||
|
plistFile := filepath.Join(app, "Info.plist")
|
||||||
|
if err := ioutil.WriteFile(plistFile, []byte(infoPlist), 0660); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if _, err := runCmd(exec.Command("plutil", "-convert", "binary1", plistFile)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func buildInfoPlist(bi *buildInfo) string {
|
||||||
appName := strings.Title(bi.name)
|
appName := strings.Title(bi.name)
|
||||||
infoPlistSrc := fmt.Sprintf(`<?xml version="1.0" encoding="UTF-8"?>
|
var platform string
|
||||||
|
switch bi.target {
|
||||||
|
case "ios":
|
||||||
|
platform = "iphoneos"
|
||||||
|
case "tvos":
|
||||||
|
platform = "appletvos"
|
||||||
|
}
|
||||||
|
return fmt.Sprintf(`<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
@@ -202,16 +221,14 @@ int main(int argc, char * argv[]) {
|
|||||||
<string>1</string>
|
<string>1</string>
|
||||||
<key>UILaunchStoryboardName</key>
|
<key>UILaunchStoryboardName</key>
|
||||||
<string>LaunchScreen</string>
|
<string>LaunchScreen</string>
|
||||||
|
<key>UIRequiredDeviceCapabilities</key>
|
||||||
|
<array><string>arm64</string></array>
|
||||||
|
<key>DTPlatformName</key>
|
||||||
|
<string>%s</string>
|
||||||
|
<key>DTPlatformVersion</key>
|
||||||
|
<string>9.0</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>`, *appID, appName)
|
</plist>`, bi.appID, appName, platform)
|
||||||
infoPlist := filepath.Join(app, "Info.plist")
|
|
||||||
if err := ioutil.WriteFile(infoPlist, []byte(infoPlistSrc), 0660); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if _, err := runCmd(exec.Command("plutil", "-convert", "binary1", infoPlist)); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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