aboutsummaryrefslogtreecommitdiffhomepage
path: root/BuildFrameworks
diff options
context:
space:
mode:
authorGravatar Paul Beusterien <paulbeusterien@google.com>2017-05-15 12:27:07 -0700
committerGravatar Paul Beusterien <paulbeusterien@google.com>2017-05-15 12:27:07 -0700
commit98ba64449a632518bd2b86fe8d927f4a960d3ddc (patch)
tree131d9c4272fa6179fcda6c5a33fcb3b1bd57ad2e /BuildFrameworks
parent32461366c9e204a527ca05e6e9b9404a2454ac51 (diff)
Initial
Diffstat (limited to 'BuildFrameworks')
-rw-r--r--BuildFrameworks/FrameworkMaker.xcodeproj/project.pbxproj320
-rw-r--r--BuildFrameworks/Podfile12
-rw-r--r--BuildFrameworks/README.md32
-rwxr-xr-xBuildFrameworks/build.swift179
4 files changed, 543 insertions, 0 deletions
diff --git a/BuildFrameworks/FrameworkMaker.xcodeproj/project.pbxproj b/BuildFrameworks/FrameworkMaker.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..a66077c
--- /dev/null
+++ b/BuildFrameworks/FrameworkMaker.xcodeproj/project.pbxproj
@@ -0,0 +1,320 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ C8F75C1E8772455450E51C69 /* libPods-FrameworkMaker.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D25AC01A0F56F8BC5375DD2 /* libPods-FrameworkMaker.a */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 01F29B956E7F6E45EF34DE72 /* Pods-FrameworkMaker.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FrameworkMaker.release.xcconfig"; path = "Pods/Target Support Files/Pods-FrameworkMaker/Pods-FrameworkMaker.release.xcconfig"; sourceTree = "<group>"; };
+ 05A46BD71CC9B2BE007BDB33 /* FrameworkMaker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FrameworkMaker.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 1D25AC01A0F56F8BC5375DD2 /* libPods-FrameworkMaker.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-FrameworkMaker.a"; sourceTree = BUILT_PRODUCTS_DIR; };
+ C8DA4EE8A169B227B0576C02 /* Pods-FrameworkMaker.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FrameworkMaker.debug.xcconfig"; path = "Pods/Target Support Files/Pods-FrameworkMaker/Pods-FrameworkMaker.debug.xcconfig"; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 05A46BD41CC9B2BE007BDB33 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ C8F75C1E8772455450E51C69 /* libPods-FrameworkMaker.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 05A46BCE1CC9B2BE007BDB33 = {
+ isa = PBXGroup;
+ children = (
+ 05A46BD81CC9B2BE007BDB33 /* Products */,
+ AA03828B8B59297B5A3389B0 /* Pods */,
+ D3884AD1918E82D7FD21433D /* Frameworks */,
+ );
+ sourceTree = "<group>";
+ };
+ 05A46BD81CC9B2BE007BDB33 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 05A46BD71CC9B2BE007BDB33 /* FrameworkMaker.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ AA03828B8B59297B5A3389B0 /* Pods */ = {
+ isa = PBXGroup;
+ children = (
+ C8DA4EE8A169B227B0576C02 /* Pods-FrameworkMaker.debug.xcconfig */,
+ 01F29B956E7F6E45EF34DE72 /* Pods-FrameworkMaker.release.xcconfig */,
+ );
+ name = Pods;
+ sourceTree = "<group>";
+ };
+ D3884AD1918E82D7FD21433D /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 1D25AC01A0F56F8BC5375DD2 /* libPods-FrameworkMaker.a */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 05A46BD61CC9B2BE007BDB33 /* FrameworkMaker */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 05A46BEE1CC9B2BE007BDB33 /* Build configuration list for PBXNativeTarget "FrameworkMaker" */;
+ buildPhases = (
+ AC1C2B143A86214CE77C9932 /* [CP] Check Pods Manifest.lock */,
+ 05A46BD31CC9B2BE007BDB33 /* Sources */,
+ 05A46BD41CC9B2BE007BDB33 /* Frameworks */,
+ 05A46BD51CC9B2BE007BDB33 /* Resources */,
+ 11182BBE1E5DB1C0F58623BB /* [CP] Embed Pods Frameworks */,
+ 5040608D1004852F08A22A14 /* [CP] Copy Pods Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = FrameworkMaker;
+ productName = FrameworkMaker;
+ productReference = 05A46BD71CC9B2BE007BDB33 /* FrameworkMaker.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 05A46BCF1CC9B2BE007BDB33 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0730;
+ ORGANIZATIONNAME = "Google, Inc.";
+ TargetAttributes = {
+ 05A46BD61CC9B2BE007BDB33 = {
+ CreatedOnToolsVersion = 7.3;
+ };
+ };
+ };
+ buildConfigurationList = 05A46BD21CC9B2BE007BDB33 /* Build configuration list for PBXProject "FrameworkMaker" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = 05A46BCE1CC9B2BE007BDB33;
+ productRefGroup = 05A46BD81CC9B2BE007BDB33 /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 05A46BD61CC9B2BE007BDB33 /* FrameworkMaker */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 05A46BD51CC9B2BE007BDB33 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ 11182BBE1E5DB1C0F58623BB /* [CP] Embed Pods Frameworks */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "[CP] Embed Pods Frameworks";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FrameworkMaker/Pods-FrameworkMaker-frameworks.sh\"\n";
+ showEnvVarsInLog = 0;
+ };
+ 5040608D1004852F08A22A14 /* [CP] Copy Pods Resources */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "[CP] Copy Pods Resources";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-FrameworkMaker/Pods-FrameworkMaker-resources.sh\"\n";
+ showEnvVarsInLog = 0;
+ };
+ AC1C2B143A86214CE77C9932 /* [CP] Check Pods Manifest.lock */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "[CP] Check Pods Manifest.lock";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
+ showEnvVarsInLog = 0;
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 05A46BD31CC9B2BE007BDB33 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 05A46BEC1CC9B2BE007BDB33 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 9.3;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ };
+ name = Debug;
+ };
+ 05A46BED1CC9B2BE007BDB33 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 9.3;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 05A46BEF1CC9B2BE007BDB33 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = C8DA4EE8A169B227B0576C02 /* Pods-FrameworkMaker.debug.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ INFOPLIST_FILE = FrameworkMaker/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = google.FrameworkMaker;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 05A46BF01CC9B2BE007BDB33 /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 01F29B956E7F6E45EF34DE72 /* Pods-FrameworkMaker.release.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ INFOPLIST_FILE = FrameworkMaker/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = google.FrameworkMaker;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 05A46BD21CC9B2BE007BDB33 /* Build configuration list for PBXProject "FrameworkMaker" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 05A46BEC1CC9B2BE007BDB33 /* Debug */,
+ 05A46BED1CC9B2BE007BDB33 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 05A46BEE1CC9B2BE007BDB33 /* Build configuration list for PBXNativeTarget "FrameworkMaker" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 05A46BEF1CC9B2BE007BDB33 /* Debug */,
+ 05A46BF01CC9B2BE007BDB33 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 05A46BCF1CC9B2BE007BDB33 /* Project object */;
+}
diff --git a/BuildFrameworks/Podfile b/BuildFrameworks/Podfile
new file mode 100644
index 0000000..e7bf344
--- /dev/null
+++ b/BuildFrameworks/Podfile
@@ -0,0 +1,12 @@
+platform :ios, '7.0'
+
+project 'FrameworkMaker.xcodeproj'
+
+target 'FrameworkMaker' do
+ pod 'FirebaseAuth', :path => '../Firebase/Auth'
+ pod 'FirebaseCore', :path => '../Firebase/Core'
+ pod 'FirebaseDatabase', :path => '../Firebase/Database'
+ pod 'FirebaseMessaging', :path => '../Firebase/Messaging'
+ pod 'FirebaseStorage', :path => '../Firebase/Storage'
+end
+
diff --git a/BuildFrameworks/README.md b/BuildFrameworks/README.md
new file mode 100644
index 0000000..3eb3061
--- /dev/null
+++ b/BuildFrameworks/README.md
@@ -0,0 +1,32 @@
+# Build Firebase static frameworks
+
+[build.swift](build.swift) is a script that will build a static framework for
+one or more of FirebaseAuth, FirebaseCore, FirebaseDatabase, FirebaseMessaging,
+and FirebaseStorage.
+
+Frameworks built with this script can be used alongside the official Firebase
+CocoaPods and
+[zip](https://firebase.google.com/docs/ios/setup#frameworks) distributions.
+
+
+## Usage
+
+```
+$ ./build.swift -f FirebaseAuth -f FirebaseMessaging ....
+```
+or
+```
+$ ./build.swift -all
+```
+
+The script will output the location of the new frameworks when it finishes
+the build.
+
+
+## Issues
+
+* Xcode's module cache may not properly update after a framework is replaced.
+The workaround is `rm -rf ~/Library/Developer/Xcode/DerivedData/ModuleCache/`
+
+* To replace the 4.0.0 version of FirebaseDatabase, the leveldb-library pod
+will need to be linked in. Add `pod 'leveldb-library'` to your Podfile.
diff --git a/BuildFrameworks/build.swift b/BuildFrameworks/build.swift
new file mode 100755
index 0000000..7bcda2f
--- /dev/null
+++ b/BuildFrameworks/build.swift
@@ -0,0 +1,179 @@
+#!/usr/bin/env xcrun swift
+
+/*
+ * Copyright 2017 Google
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import Foundation
+
+enum Colors: String {
+ case black = "\u{001B}[0;30m"
+ case red = "\u{001B}[0;31m"
+ case green = "\u{001B}[0;32m"
+ case yellow = "\u{001B}[0;33m"
+ case blue = "\u{001B}[0;34m"
+ case magenta = "\u{001B}[0;35m"
+ case cyan = "\u{001B}[0;36m"
+ case white = "\u{001B}[0;37m"
+}
+
+func colorPrint(color: Colors, text: String) {
+ print(color.rawValue + text + "\u{001B}[0;0m")
+}
+
+let allFrameworks = ["FirebaseAuth",
+ "FirebaseCore",
+ "FirebaseDatabase",
+ "FirebaseMessaging",
+ "FirebaseStorage"]
+
+let currentDirectoryURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath)
+let url = URL(fileURLWithPath: CommandLine.arguments[0], relativeTo: currentDirectoryURL)
+let commandPath = url.deletingLastPathComponent().path
+
+func usage() -> Never {
+ print("usage: ./build.swift -f {framework1} -f {framework2} ....")
+ print("usage: ./build.swift -all")
+ print("Valid frameworks are \(allFrameworks)")
+ exit(1)
+}
+
+func processOptions() -> [String] {
+ guard CommandLine.arguments.count > 1 else {
+ usage()
+ }
+ var doFrameworks = [String]()
+ var optIndex = 1
+ whileLoop: while optIndex < CommandLine.arguments.count {
+ switch CommandLine.arguments[optIndex] {
+ case "-all":
+ guard doFrameworks.count == 0, CommandLine.arguments.count == 2 else {
+ colorPrint(color:Colors.red, text:"-all must be a solo option")
+ usage()
+ }
+ doFrameworks = allFrameworks
+ break whileLoop
+ case "-f":
+ optIndex += 1
+ guard optIndex < CommandLine.arguments.count else {
+ colorPrint(color:Colors.red, text:"The -f option must be followed by a framework name")
+ usage()
+ }
+ let framework = CommandLine.arguments[optIndex]
+ guard allFrameworks.contains(framework) else {
+ colorPrint(color:Colors.red, text:"\(framework) is not a valid framework")
+ usage()
+ }
+ doFrameworks += [framework]
+ optIndex += 1
+ default:
+ colorPrint(color:Colors.red, text: "Invalid option: \(CommandLine.arguments[optIndex])")
+ usage()
+ }
+ }
+ return doFrameworks
+}
+
+func tempDir() -> String {
+ let directory = NSTemporaryDirectory()
+ let fileName = NSUUID().uuidString
+ guard let dir = NSURL.fileURL(withPathComponents:[directory, fileName]) else {
+ colorPrint(color:Colors.red, text:"Failed to create temp directory")
+ exit(1)
+ }
+ return dir.path
+}
+
+func syncExec(command: String, args: [String] = []) {
+ let task = Process()
+ task.launchPath = command
+ task.arguments = args
+ task.currentDirectoryPath = commandPath
+ task.launch()
+ task.waitUntilExit()
+ guard (task.terminationStatus == 0) else {
+ colorPrint(color:Colors.red, text:"Command failed:")
+ colorPrint(color:Colors.red, text:command + " " + args.joined(separator:" "))
+ exit(1)
+ }
+}
+
+func buildThin(framework: String, arch: String, sdk: String, parentDir: String) -> [String] {
+ let buildDir = parentDir + "/" + arch
+ let standardOptions = [ "build",
+ "-configuration", "release",
+ "-workspace", "FrameworkMaker.xcworkspace",
+ "-scheme", framework,
+ "GCC_GENERATE_DEBUGGING_SYMBOLS=No"]
+ let bitcode = (sdk == "iphoneos") ? ["OTHER_CFLAGS=\"" + "-fembed-bitcode\""] : []
+ let args = standardOptions + ["ARCHS=" + arch, "BUILD_DIR=" + buildDir, "-sdk", sdk] + bitcode
+ syncExec(command:"/usr/bin/xcodebuild", args:args)
+ return [buildDir + "/Release-" + sdk + "/" + framework + "/lib" + framework + ".a"]
+}
+
+func createFile(file: String, content: String) {
+ let data = content.data(using:String.Encoding.utf8)
+ guard FileManager.default.createFile(atPath:file, contents: data, attributes: nil) else {
+ print("Error creating " + file)
+ exit(1)
+ }
+}
+
+// TODO: Add support for adding library and framework dependencies to makeModuleMap
+func makeModuleMap(framework: String, dir: String) {
+ let moduleDir = dir + "/Modules"
+ syncExec(command:"/bin/mkdir", args:["-p", moduleDir])
+ let moduleFile = moduleDir + "/module.modulemap"
+ let content = "framework module " + framework + " {\n" +
+ " umbrella header \"" + framework + ".h\"\n" +
+ " export *\n" +
+ " module * { export *}\n" +
+ "}\n"
+ createFile(file:moduleFile, content:content)
+}
+
+func buildFramework(withName framework: String, outputDir: String) {
+ let buildDir = tempDir()
+ var thinArchives = [String]()
+ thinArchives += buildThin(framework:framework, arch:"arm64", sdk:"iphoneos", parentDir:buildDir)
+ thinArchives += buildThin(framework:framework, arch:"armv7", sdk:"iphoneos", parentDir:buildDir)
+ thinArchives += buildThin(framework:framework, arch:"i386", sdk:"iphonesimulator", parentDir:buildDir)
+ thinArchives += buildThin(framework:framework, arch:"x86_64", sdk:"iphonesimulator", parentDir:buildDir)
+
+ let frameworkDir = outputDir + "/" + framework + ".framework"
+ syncExec(command:"/bin/mkdir", args:["-p", frameworkDir])
+ let fatArchive = frameworkDir + "/" + framework
+ syncExec(command:"/usr/bin/lipo", args:["-create", "-output", fatArchive] + thinArchives)
+ syncExec(command:"/bin/rm", args:["-rf"] + thinArchives)
+ let headersDir = frameworkDir + "/Headers"
+ syncExec(command:"/bin/mv", args:[NSString(string:thinArchives[0]).deletingLastPathComponent, headersDir])
+ syncExec(command:"/bin/rm", args:["-rf", buildDir])
+ makeModuleMap(framework:framework, dir:frameworkDir)
+}
+
+let frameworks = processOptions()
+colorPrint(color:Colors.green, text:"Building \(frameworks)")
+
+let outputDir = tempDir()
+
+syncExec(command:"/usr/local/bin/pod", args:["update"])
+
+for f in frameworks {
+ buildFramework(withName:f, outputDir:outputDir)
+}
+
+print()
+colorPrint(color:Colors.magenta, text:"The frameworks are available at the locations below:")
+syncExec(command:"/usr/bin/find", args:[outputDir, "-depth", "1"])