Skip to content

Commit da6e8e5

Browse files
authored
Pass the correct compiler flag for CoreDiagnostics. (#3312)
* Pass the correct compiler flag for CoreDiagnostics. When CoreDiagnostics is open sourced, we'll need to ensure that the right compiler flag is passed. This doesn't add support for Carthage yet but allows the frameworkbuilder to pass the flag for carthage as well. An update to the zipbuilder to allow for carthage will follow shortly. * Remove accidental change.
1 parent 0803972 commit da6e8e5

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

ZipBuilder/Sources/ZipBuilder/FrameworkBuilder.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,18 @@ struct FrameworkBuilder {
5555
/// The directory containing the Xcode project and Pods folder.
5656
private let projectDir: URL
5757

58+
/// A flag to indicate this build is for carthage. This is primarily used for CoreDiagnostics.
59+
private let carthageBuild: Bool
60+
5861
/// The Pods directory for building the framework.
5962
private var podsDir: URL {
6063
return projectDir.appendingPathComponent("Pods", isDirectory: true)
6164
}
6265

6366
/// Default initializer.
64-
init(projectDir: URL) {
67+
init(projectDir: URL, carthageBuild: Bool = false) {
6568
self.projectDir = projectDir
69+
self.carthageBuild = carthageBuild
6670
}
6771

6872
// MARK: - Public Functions
@@ -223,7 +227,8 @@ struct FrameworkBuilder {
223227
"ARCHS=\(arch.rawValue)",
224228
"BUILD_DIR=\(buildDir.path)",
225229
"-sdk", platform.rawValue]
226-
let args = standardOptions + platform.extraArguments()
230+
let distributionFlag = carthageBuild ? "-DFIREBASE_BUILD_CARTHAGE" : "-DFIREBASE_BUILD_ZIP_FILE"
231+
let args = standardOptions + platform.extraArguments() + [distributionFlag]
227232
print("""
228233
Compiling \(framework) for \(arch.rawValue) with command:
229234
/usr/bin/xcodebuild \(args.joined(separator: " "))

ZipBuilder/Sources/ZipBuilder/ZipBuilder.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,8 @@ struct ZipBuilder {
661661
/// .framework file already).
662662
private func generateFrameworks(fromPods pods: [CocoaPodUtils.PodInfo],
663663
inProjectDir projectDir: URL,
664-
useCache: Bool = false) -> [String: [URL]] {
664+
useCache: Bool = false,
665+
carthageBuild: Bool = false) -> [String: [URL]] {
665666
// Verify the Pods folder exists and we can get the contents of it.
666667
let fileManager = FileManager.default
667668

0 commit comments

Comments
 (0)