Skip to content

Commit

Permalink
Cleanup new entitlements logic
Browse files Browse the repository at this point in the history
  • Loading branch information
a-maurice committed Sep 25, 2024
1 parent b5e3a25 commit 3402c57
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 57 deletions.
8 changes: 0 additions & 8 deletions scripts/gha/build_testapps.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,14 +483,6 @@ def build_testapp(dir_helper, api_config, ios_config, target):
build_flags.append("-AppBuilderHelper.forceXcodeProject")
# This script will automatically configure the generated xcode project
dir_helper.copy_editor_script("XcodeCapabilities.cs")
# Some testapps have xcode entitlements
if api_config.entitlements:
logging.info("!!!!! Copying entitlement files %s -> %s",
os.path.join(dir_helper.root_dir, api_config.entitlements),
os.path.join(dir_helper.unity_project_editor_dir, "dev.entitlements"))
shutil.copy(
os.path.join(dir_helper.root_dir, api_config.entitlements),
os.path.join(dir_helper.unity_project_editor_dir, "dev.entitlements"))
_run(arg_builder.get_args_to_open_project(build_flags))
logging.info("Finished building target %s xcode project", target)
run_xcodebuild(dir_helper=dir_helper, ios_config=ios_config, device_type = device_type,
Expand Down
27 changes: 8 additions & 19 deletions scripts/gha/integration_testing/XcodeCapabilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@ public static void OnPostprocessBuild (BuildTarget buildTarget, string path)
tempProject.ReadFromString(File.ReadAllText(projectPath));
string targetId = GetMainTargetGUID(tempProject);

var capabilityManager = new ProjectCapabilityManager(projectPath, "dev.entitlements", null, targetId);

if (path.Contains("FirebaseMessaging")) {
MakeChangesForMessaging(capabilityManager);
}
if (path.Contains("FirebaseAuth")) {
MakeChangesForAuth(capabilityManager);
var capabilityManager = new ProjectCapabilityManager(projectPath, "dev.entitlements", null, targetId);
capabilityManager.AddPushNotifications(true);
capabilityManager.AddBackgroundModes(BackgroundModesOptions.RemoteNotifications);
capabilityManager.WriteToFile();
} else if (path.Contains("FirebaseAuth")) {
var capabilityManager = new ProjectCapabilityManager(projectPath, "dev.entitlements", null, targetId);
capabilityManager.AddPushNotifications(true);
capabilityManager.WriteToFile();
}
// Bitcode is being deprecated by xcode, but Unity defaults to it on, so turn it off.
tempProject.SetBuildProperty(targetId, "ENABLE_BITCODE", "NO");
Expand All @@ -87,19 +89,6 @@ public static void OnPostprocessBuild (BuildTarget buildTarget, string path)
File.WriteAllText(projectPath, tempProject.WriteToString());
}

static void MakeChangesForMessaging(ProjectCapabilityManager capabilityManager) {
Debug.Log("Messaging testapp detected.");
capabilityManager.AddPushNotifications(true);
capabilityManager.AddBackgroundModes(BackgroundModesOptions.RemoteNotifications);
Debug.Log("Finished making messaging-specific changes.");
}

static void MakeChangesForAuth(ProjectCapabilityManager capabilityManager) {
Debug.Log("Auth testapp detected.");
capabilityManager.AddPushNotifications(true);
Debug.Log("Finished making auth-specific changes.");
}

static string GetMainTargetGUID(object pbxProjectObj) {
var pbxProject = (PBXProject)pbxProjectObj;
// In 2019.3 Unity changed this API without an automated update path via the api-updater.
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 3402c57

Please sign in to comment.