|
37 | 37 | * Set to 'proguard' to cause unity to use proguarding for the android |
38 | 38 | * minification stage. The default is to not minify. |
39 | 39 | * |
| 40 | + * -AppBuilderHelper.buildForCI (optional) |
| 41 | + * Flag to determine if the apps are being built for use with a CI. |
| 42 | + * |
40 | 43 | * In addition to flags, this script depends on optional environment variables: |
41 | 44 | * |
42 | 45 | * UNITY_ANDROID_SDK |
@@ -73,6 +76,7 @@ public sealed class AppBuilderHelper { |
73 | 76 | static readonly bool symlinkLibraries = true; |
74 | 77 | static readonly bool forceXcodeProject; |
75 | 78 | static readonly string minify; |
| 79 | + static readonly bool buildForCI = false; |
76 | 80 |
|
77 | 81 | // General extensionless name for a testapp executable, apk, ipa, etc. |
78 | 82 | // Having a unified name makes it easier to grab artifacts with a script. |
@@ -117,6 +121,10 @@ static AppBuilderHelper() { |
117 | 121 | buildTarget = args[++i]; |
118 | 122 | continue; |
119 | 123 | } |
| 124 | + if (args[i] == "-AppBuilderHelper.buildForCI") { |
| 125 | + buildForCI = true; |
| 126 | + continue; |
| 127 | + } |
120 | 128 | } |
121 | 129 | // This will set the appropriate values in Unity Preferences -> External Tools. |
122 | 130 | SetUnityPrefWithEnvVar(ANDROID_SDK_KEY, ANDROID_SDK_ENVVAR); |
@@ -407,7 +415,11 @@ private static BuildPlayerOptions GetBuildOptions(BuildTarget target, string bui |
407 | 415 | playerOptions.scenes = GetScenes(); |
408 | 416 | playerOptions.locationPathName = buildPath; |
409 | 417 | playerOptions.target = target; |
410 | | - playerOptions.options |= BuildOptions.Development; |
| 418 | + // Development builds on iOS can trigger a user permission prompt for Local Network access, |
| 419 | + // so when running on CI we do not want to include it. |
| 420 | + if (!(buildForCI && target == BuildTarget.iOS && targetIosSdk == "device")) { |
| 421 | + playerOptions.options |= BuildOptions.Development; |
| 422 | + } |
411 | 423 | playerOptions.options |= BuildOptions.StrictMode; |
412 | 424 | if (symlinkLibraries) { |
413 | 425 | playerOptions.options |= BuildOptions.SymlinkLibraries; |
|
0 commit comments