This repository has been archived by the owner on Jan 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 77
Fix xcode paths #1040
Merged
Merged
Fix xcode paths #1040
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1ece36e
Postprocess xcode project to file search paths for different sdks
zeroZshadow febbcc6
changelog
zeroZshadow a49694c
Update CHANGELOG.md
zeroZshadow f9a264a
Everything is now reflection
zeroZshadow c16ae00
Merge branch 'feature/fix-xcode-paths' of github.com:spatialos/gdk-fo…
zeroZshadow 8cff1df
Feedback + This should fail buildkite as a test
zeroZshadow d38d042
Feedback
zeroZshadow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
workers/unity/Packages/io.improbable.worker.sdk.mobile/BuildPostProcessXCode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using System.IO; | ||
using System.Linq; | ||
using UnityEditor; | ||
using UnityEditor.Callbacks; | ||
using UnityEditor.iOS.Xcode; | ||
|
||
namespace Improbable.Gdk.Mobile | ||
{ | ||
public static class BuildPostProcessXCode | ||
{ | ||
[PostProcessBuild] | ||
public static void OnPostProcessBuild(BuildTarget buildTarget, string path) | ||
{ | ||
// Only run for iOS | ||
if (buildTarget != BuildTarget.iOS) | ||
{ | ||
return; | ||
} | ||
|
||
// Load xcode project | ||
var projPath = PBXProject.GetPBXProjectPath(path); | ||
var xcodeProject = new PBXProject(); | ||
xcodeProject.ReadFromString(File.ReadAllText(projPath)); | ||
|
||
// Get GUIDs for target and testing targets | ||
var targetGUID = xcodeProject.TargetGuidByName(PBXProject.GetUnityTargetName()); | ||
var targetTestingGUID = xcodeProject.TargetGuidByName(PBXProject.GetUnityTestTargetName()); | ||
|
||
// Generate list of all config guids | ||
var configGUIDs = xcodeProject.BuildConfigNames() | ||
.Select(configName => xcodeProject.BuildConfigByName(targetGUID, configName)) | ||
.Concat( | ||
xcodeProject.BuildConfigNames().Select(configName => | ||
xcodeProject.BuildConfigByName(targetTestingGUID, configName))); | ||
|
||
foreach (var configGUID in configGUIDs) | ||
{ | ||
// Remove search paths unity has added for all platforms | ||
xcodeProject.UpdateBuildPropertyForConfig(configGUID, "LIBRARY_SEARCH_PATHS", null, new[] | ||
{ | ||
"$(SRCROOT)/Libraries/io.improbable.worker.sdk.mobile/Plugins/Improbable/Core/iOS/arm", | ||
"$(SRCROOT)/Libraries/io.improbable.worker.sdk.mobile/Plugins/Improbable/Core/iOS/x86_64" | ||
}); | ||
|
||
// Add platform specific paths | ||
xcodeProject.UpdateBuildPropertyForConfig(configGUID, "LIBRARY_SEARCH_PATHS[sdk=iphoneos*]", new[] | ||
{ | ||
"$(inherited)", | ||
"$(SRCROOT)/Libraries/io.improbable.worker.sdk.mobile/Plugins/Improbable/Core/iOS/arm" | ||
}, null); | ||
|
||
xcodeProject.UpdateBuildPropertyForConfig(configGUID, "LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*]", | ||
new[] | ||
{ | ||
"$(inherited)", | ||
"$(SRCROOT)/Libraries/io.improbable.worker.sdk.mobile/Plugins/Improbable/Core/iOS/x86_64" | ||
}, null); | ||
} | ||
|
||
// Save it to file | ||
xcodeProject.WriteToFile(projPath); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
workers/unity/Packages/io.improbable.worker.sdk.mobile/BuildPostProcessXCode.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
workers/unity/Packages/io.improbable.worker.sdk.mobile/Improbable.Worker.Sdk.Mobile.asmdef
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "Improbable.Worker.Sdk.Mobile", | ||
"references": [], | ||
"optionalUnityReferences": [], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": false, | ||
"defineConstraints": [], | ||
"versionDefines": [] | ||
} |
7 changes: 7 additions & 0 deletions
7
...s/unity/Packages/io.improbable.worker.sdk.mobile/Improbable.Worker.Sdk.Mobile.asmdef.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need that comment? think that if check is pretty self-explanatory. that's a general comment: some of the comments are good, some of them are not needed like this one or the last one for example