Skip to content

Commit 19e3420

Browse files
authored
Don't enable development on iOS device CI builds (#800)
1 parent 049692e commit 19e3420

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

scripts/gha/build_testapps.py

+2
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,8 @@ def build_testapp(dir_helper, api_config, ios_config, target):
472472
"-AppBuilderHelper.outputDir", dir_helper.output_dir,
473473
"-buildTarget", target
474474
]
475+
if FLAGS.ci:
476+
build_flags.append("-AppBuilderHelper.buildForCI")
475477
if target == _IOS or target == _TVOS:
476478
for device_type in ios_config.ios_sdk:
477479
build_flags += ["-AppBuilderHelper.targetIosSdk", _IOS_SDK[device_type]]

scripts/gha/integration_testing/AppBuilderHelper.cs

+13-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
* Set to 'proguard' to cause unity to use proguarding for the android
3838
* minification stage. The default is to not minify.
3939
*
40+
* -AppBuilderHelper.buildForCI (optional)
41+
* Flag to determine if the apps are being built for use with a CI.
42+
*
4043
* In addition to flags, this script depends on optional environment variables:
4144
*
4245
* UNITY_ANDROID_SDK
@@ -73,6 +76,7 @@ public sealed class AppBuilderHelper {
7376
static readonly bool symlinkLibraries = true;
7477
static readonly bool forceXcodeProject;
7578
static readonly string minify;
79+
static readonly bool buildForCI = false;
7680

7781
// General extensionless name for a testapp executable, apk, ipa, etc.
7882
// Having a unified name makes it easier to grab artifacts with a script.
@@ -117,6 +121,10 @@ static AppBuilderHelper() {
117121
buildTarget = args[++i];
118122
continue;
119123
}
124+
if (args[i] == "-AppBuilderHelper.buildForCI") {
125+
buildForCI = true;
126+
continue;
127+
}
120128
}
121129
// This will set the appropriate values in Unity Preferences -> External Tools.
122130
SetUnityPrefWithEnvVar(ANDROID_SDK_KEY, ANDROID_SDK_ENVVAR);
@@ -407,7 +415,11 @@ private static BuildPlayerOptions GetBuildOptions(BuildTarget target, string bui
407415
playerOptions.scenes = GetScenes();
408416
playerOptions.locationPathName = buildPath;
409417
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+
}
411423
playerOptions.options |= BuildOptions.StrictMode;
412424
if (symlinkLibraries) {
413425
playerOptions.options |= BuildOptions.SymlinkLibraries;

0 commit comments

Comments
 (0)