cmd/gio: filter out unsupported architectures, specify MinimumOSVersion

For the App Store.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-08-14 16:43:44 +02:00
parent 5ac1b6ea3c
commit ed0bbe9dd2
+24 -7
View File
@@ -28,19 +28,34 @@ func buildIOS(tmpDir, target string, bi *buildInfo) error {
} }
return archiveIOS(tmpDir, target, framework, bi) return archiveIOS(tmpDir, target, framework, bi)
case "exe": case "exe":
tmpFramework := filepath.Join(tmpDir, "Gio.framework")
if err := archiveIOS(tmpDir, target, tmpFramework, bi); err != nil {
return err
}
out := *destPath out := *destPath
if out == "" { if out == "" {
out = appName + ".ipa" out = appName + ".ipa"
} }
isIPA := strings.HasSuffix(out, ".ipa") forDevice := strings.HasSuffix(out, ".ipa")
if !isIPA && !strings.HasSuffix(out, ".app") { // Filter out unsupported architectures.
for i := len(bi.archs) - 1; i >= 0; i-- {
switch bi.archs[i] {
case "arm", "arm64":
if forDevice {
continue
}
case "386", "amd64":
if !forDevice {
continue
}
}
bi.archs = append(bi.archs[:i], bi.archs[i+1:]...)
}
tmpFramework := filepath.Join(tmpDir, "Gio.framework")
if err := archiveIOS(tmpDir, target, tmpFramework, bi); err != nil {
return err
}
if !forDevice && !strings.HasSuffix(out, ".app") {
return fmt.Errorf("the specified output directory %q does not end in .app or .ipa", out) return fmt.Errorf("the specified output directory %q does not end in .app or .ipa", out)
} }
if !isIPA { if !forDevice {
return exeIOS(tmpDir, target, out, bi) return exeIOS(tmpDir, target, out, bi)
} }
payload := filepath.Join(tmpDir, "Payload") payload := filepath.Join(tmpDir, "Payload")
@@ -226,6 +241,8 @@ func buildInfoPlist(bi *buildInfo) string {
<key>DTPlatformName</key> <key>DTPlatformName</key>
<string>%s</string> <string>%s</string>
<key>DTPlatformVersion</key> <key>DTPlatformVersion</key>
<string>12.4</string>
<key>MinimumOSVersion</key>
<string>9.0</string> <string>9.0</string>
</dict> </dict>
</plist>`, bi.appID, appName, platform) </plist>`, bi.appID, appName, platform)