Skip to content

Commit

Permalink
Install iOS platform with xcodebuild for Mac SDK (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
hach-que authored Nov 23, 2024
1 parent 10d69ab commit 51cdc9b
Showing 1 changed file with 47 additions and 1 deletion.
48 changes: 47 additions & 1 deletion UET/Redpoint.Uet.SdkManagement/Sdk/MacSdkSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public MacSdkSetup(

public async Task<string> ComputeSdkPackageId(string unrealEnginePath, CancellationToken cancellationToken)
{
return await _versionNumberResolver.For<IMacVersionNumbers>(unrealEnginePath).GetXcodeVersion(unrealEnginePath).ConfigureAwait(false);
var versionNumber = await _versionNumberResolver.For<IMacVersionNumbers>(unrealEnginePath).GetXcodeVersion(unrealEnginePath).ConfigureAwait(false);
return $"{versionNumber}-iOS";
}

public async Task GenerateSdkPackage(string unrealEnginePath, string sdkPackagePath, CancellationToken cancellationToken)
Expand Down Expand Up @@ -223,6 +224,51 @@ await monitor.MonitorAsync(
_logger.LogInformation($"Removing temporary .xip file to reduce disk space...");
File.Delete(xipPath);
}

// Perform first run.
_logger.LogInformation("Performing Xcode first-run...");
exitCode = await _processExecutor.ExecuteAsync(
new ProcessSpecification
{
FilePath = "/usr/bin/xcodebuild",
Arguments = new LogicalProcessArgument[]
{
"-runFirstLaunch"
},
EnvironmentVariables = new Dictionary<string, string>
{
{ "DEVELOPER_DIR", Path.Combine(sdkPackagePath, "Xcode.app") },
}
},
CaptureSpecification.Passthrough,
cancellationToken).ConfigureAwait(false);
if (exitCode != 0)
{
throw new SdkSetupPackageGenerationFailedException("Xcode was unable to perform first-run launch.");
}

// Install iOS platform if needed.
_logger.LogInformation("Installing iOS platform...");
exitCode = await _processExecutor.ExecuteAsync(
new ProcessSpecification
{
FilePath = "/usr/bin/xcodebuild",
Arguments = new LogicalProcessArgument[]
{
"-downloadPlatform",
"iOS"
},
EnvironmentVariables = new Dictionary<string, string>
{
{ "DEVELOPER_DIR", Path.Combine(sdkPackagePath, "Xcode.app") },
}
},
CaptureSpecification.Passthrough,
cancellationToken).ConfigureAwait(false);
if (exitCode != 0)
{
throw new SdkSetupPackageGenerationFailedException("Xcode was unable to install iOS platform support.");
}
}

public Task<AutoSdkMapping[]> GetAutoSdkMappingsForSdkPackage(string sdkPackagePath, CancellationToken cancellationToken)
Expand Down

0 comments on commit 51cdc9b

Please sign in to comment.