Skip to content

Commit

Permalink
Cake now builds xcframeworks
Browse files Browse the repository at this point in the history
  • Loading branch information
Israel Soto authored and SotoiGhost committed Apr 18, 2022
1 parent a62f996 commit 4902526
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 26 deletions.
25 changes: 4 additions & 21 deletions build.cake
Expand Up @@ -131,27 +131,10 @@ Task ("externals")
Information ("// Pods Repo Update Ended //");
Information ("////////////////////////////////////////");
if (string.IsNullOrWhiteSpace (NAMES)) {
foreach (var artifact in ARTIFACTS_TO_BUILD) {
UpdateVersionInCsproj (artifact);
CreateAndInstallPodfile (artifact);
BuildSdkOnPodfileV2 (artifact);
}
} else {
foreach (var artifact in ARTIFACTS_TO_BUILD) {
UpdateVersionInCsproj (artifact);
foreach (var podSpec in artifact.PodSpecs) {
if (podSpec.FrameworkSource != FrameworkSource.Pods)
continue;
if (DirectoryExists (EXTERNALS_PATH.Combine ($"{podSpec.FrameworkName}.framework")))
break;
CreateAndInstallPodfile (artifact);
BuildSdkOnPodfileV2 (artifact);
}
}
foreach (var artifact in ARTIFACTS_TO_BUILD) {
UpdateVersionInCsproj (artifact);
CreateAndInstallPodfile (artifact);
BuildSdkOnPodfileV2 (artifact);
}
// Call here custom methods created at custom_externals_download.cake file
Expand Down
10 changes: 5 additions & 5 deletions common.cake
Expand Up @@ -398,6 +398,7 @@ void BuildXcodeXcframework (FilePath xcodeProject, PodSpec [] podSpecs, Platform
var buildDirectory = workingDirectory.Combine (podSpec.FrameworkName);
var xcodeBuildArgs = new ProcessArgumentBuilder();
xcodeBuildArgs.Append ("-create-xcframework");
xcodeBuildArgs.Append($"-output {workingDirectory}/{podSpec.FrameworkName}.xcframework");

foreach (var platform in platforms) {
Information ($"Building {podSpec.FrameworkName} framework with {platform.Sdk} platform SDK...");
Expand Down Expand Up @@ -441,12 +442,13 @@ void BuildXcodeXcframework (FilePath xcodeProject, PodSpec [] podSpecs, Platform
Information (string.Join (",\n", builtFrameworkDirectories.Select (b => b.ToString ()).ToArray ()));

foreach (var directory in builtFrameworkDirectories) {
var frameworkName = directory.GetDirectoryName ().Replace (".framework", "");
var builtFrameworkName = directory.GetDirectoryName ().Replace (".framework", "");

if (string.Equals (frameworkName, podSpec.FrameworkName))
if (string.Equals (builtFrameworkName, podSpec.FrameworkName))
continue;

DirectoryPath destinationDirectory = Directory (archiveFrameworksDirectory.Combine ($"{frameworkName}.framework").ToString ().Replace (podSpec.FrameworkName, frameworkName));
DirectoryPath destinationDirectory = Directory (archiveFrameworksDirectory.ToString ().Replace ($"{podSpec.FrameworkName}", $"{builtFrameworkName}"));
destinationDirectory = destinationDirectory.Combine ($"{builtFrameworkName}.framework");

Information ($"Copying {directory} to {destinationDirectory}");

Expand All @@ -455,8 +457,6 @@ void BuildXcodeXcframework (FilePath xcodeProject, PodSpec [] podSpecs, Platform
}

Information ($"Building {podSpec.FrameworkName} xcframework...");

xcodeBuildArgs.Append($"-output {workingDirectory}/{podSpec.FrameworkName}.xcframework");
StartProcess("xcodebuild", new ProcessSettings { Arguments = xcodeBuildArgs });
}
}
Expand Down

0 comments on commit 4902526

Please sign in to comment.