From 49025264e44faddb27b7c155ac5bacf4c51e234c Mon Sep 17 00:00:00 2001 From: Israel Soto Date: Fri, 18 Mar 2022 21:55:42 -0600 Subject: [PATCH] Cake now builds xcframeworks --- build.cake | 25 ++++--------------------- common.cake | 10 +++++----- 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/build.cake b/build.cake index bc01847a..a526d5d0 100644 --- a/build.cake +++ b/build.cake @@ -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 diff --git a/common.cake b/common.cake index 95a67ca7..d0c84bae 100644 --- a/common.cake +++ b/common.cake @@ -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..."); @@ -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}"); @@ -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 }); } }