Skip to content

Commit

Permalink
build xcode project as part of the build process
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Kaile committed Sep 4, 2023
1 parent 878245e commit 57217df
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

### ? - ?

##### Fixes :wrench:

- Build the XCode project and verify it for errors during the iOS building proces. This ensures the iOS plugin from CI has all the required libraries.

### v1.6.1 - 2023-09-03

##### Fixes :wrench:
Expand Down
14 changes: 11 additions & 3 deletions Editor/BuildCesiumForUnity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,18 @@ public static void CompileForIOSAndExit()
Directory.CreateDirectory(buildPath);
try
{
BuildPlayer(BuildTargetGroup.iOS, BuildTarget.iOS, Path.Combine(buildPath, "iOS"));
BuildPlayer(BuildTargetGroup.iOS, BuildTarget.iOS, Path.Combine(buildPath, "iOS"), false);
// Check that XCode project is able to build
System.Diagnostics.Process p = System.Diagnostics.Process.Start("xcodebuild",
$"-project {Path.Combine(buildPath, "iOS/game/Unity-iPhone.xcodeproj")} CODE_SIGNING_ALLOWED=NO");
p.WaitForExit();
if (p.ExitCode != 0)
throw new Exception("xcodebuild failed");
}
finally
{
if (Directory.Exists(Path.Combine(buildPath, "iOS")))
Directory.Delete(Path.Combine(buildPath, "iOS"), true);
Directory.Delete(buildPath, true);
}
EditorApplication.Exit(0);
Expand Down Expand Up @@ -130,7 +138,7 @@ public static void PackAndExit()
};
}

private static void BuildPlayer(BuildTargetGroup targetGroup, BuildTarget target, string outputPath)
private static void BuildPlayer(BuildTargetGroup targetGroup, BuildTarget target, string outputPath, bool deleteProject = true)
{
BuildReport report = BuildPipeline.BuildPlayer(new BuildPlayerOptions()
{
Expand Down Expand Up @@ -161,7 +169,7 @@ private static void BuildPlayer(BuildTargetGroup targetGroup, BuildTarget target
}

// We don't actually need the built project; delete it.
if (Directory.Exists(outputPath))
if (deleteProject && Directory.Exists(outputPath))
Directory.Delete(outputPath, true);
}
}
Expand Down

0 comments on commit 57217df

Please sign in to comment.