Skip to content

Commit

Permalink
Add helper method for disabling bitcode
Browse files Browse the repository at this point in the history
  • Loading branch information
shepherd-l authored and jinliu9508 committed Mar 4, 2024
1 parent fe5b4c2 commit 53c7890
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions com.onesignal.unity.ios/Editor/BuildPostProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,7 @@ public void OnPostprocessBuild(BuildReport report) {
// Add the service extension
AddNotificationServiceExtension();

// Unity Tests
var unityTests = _project.TargetGuidByName(PBXProject.GetUnityTestTargetName());
_project.SetBuildProperty(unityTests, "ENABLE_BITCODE", "NO");

// Unity Framework
var unityFramework = _project.GetUnityFrameworkTargetGuid();
_project.SetBuildProperty(unityFramework, "ENABLE_BITCODE", "NO");
DisableBitcode();

// Save the project back out
File.WriteAllText(_projectPath, _project.WriteToString());
Expand Down Expand Up @@ -160,8 +154,6 @@ private void AddProjectCapabilities() {
var targetGuid = _project.GetMainTargetGuid();
var targetName = _project.GetMainTargetName();

_project.SetBuildProperty(targetGuid, "ENABLE_BITCODE", "NO");

var entitlementsPath = GetEntitlementsPath(targetGuid, targetName);
var projCapability = new ProjectCapabilityManager(_projectPath, entitlementsPath, targetName);

Expand Down Expand Up @@ -293,6 +285,20 @@ private void ExtensionAddPodsToTarget() {

File.WriteAllText(podfilePath, podfile);
}

private void DisableBitcode() {
// Main
var targetGuid = _project.GetMainTargetGuid();
_project.SetBuildProperty(targetGuid, "ENABLE_BITCODE", "NO");

// Unity Tests
var unityTests = _project.TargetGuidByName(PBXProject.GetUnityTestTargetName());
_project.SetBuildProperty(unityTests, "ENABLE_BITCODE", "NO");

// Unity Framework
var unityFramework = _project.GetUnityFrameworkTargetGuid();
_project.SetBuildProperty(unityFramework, "ENABLE_BITCODE", "NO");
}
}
}
#endif

0 comments on commit 53c7890

Please sign in to comment.