Skip to content

Commit 8087457

Browse files
authored
Fix OTHER_CFLAGS in zip build. (#3497)
* Fix OTHER_CFLAGS in zip build. * s/extra/other/g
1 parent 7044870 commit 8087457

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

ZipBuilder/Sources/ZipBuilder/FrameworkBuilder.swift

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ private enum Architecture: String, CaseIterable {
2323
case device = "iphoneos"
2424
case simulator = "iphonesimulator"
2525

26-
/// Arguments that should be included as part of the build process for each target platform.
27-
func extraArguments() -> [String] {
26+
/// Extra C flags that should be included as part of the build process for each target platform.
27+
func otherCFlags() -> [String] {
2828
switch self {
2929
case .device:
3030
// For device, we want to enable bitcode.
31-
return ["OTHER_CFLAGS=$(value) " + "-fembed-bitcode"]
31+
return ["-fembed-bitcode"]
3232
case .simulator:
3333
// No extra arguments are required for simulator builds.
3434
return []
@@ -220,16 +220,17 @@ struct FrameworkBuilder {
220220
let platform = arch.platform
221221
let workspacePath = projectDir.appendingPathComponent("FrameworkMaker.xcworkspace").path
222222
let distributionFlag = carthageBuild ? "-DFIREBASE_BUILD_CARTHAGE" : "-DFIREBASE_BUILD_ZIP_FILE"
223-
let standardOptions = ["build",
224-
"-configuration", "release",
225-
"-workspace", workspacePath,
226-
"-scheme", framework,
227-
"GCC_GENERATE_DEBUGGING_SYMBOLS=No",
228-
"ARCHS=\(arch.rawValue)",
229-
"BUILD_DIR=\(buildDir.path)",
230-
"-sdk", platform.rawValue,
231-
"OTHER_CFLAGS=$(value) \(distributionFlag)"]
232-
let args = standardOptions + platform.extraArguments()
223+
let platformSpecificFlags = platform.otherCFlags().joined(separator: " ")
224+
let cFlags = "OTHER_CFLAGS=$(value) \(distributionFlag) \(platformSpecificFlags)"
225+
let args = ["build",
226+
"-configuration", "release",
227+
"-workspace", workspacePath,
228+
"-scheme", framework,
229+
"GCC_GENERATE_DEBUGGING_SYMBOLS=No",
230+
"ARCHS=\(arch.rawValue)",
231+
"BUILD_DIR=\(buildDir.path)",
232+
"-sdk", platform.rawValue,
233+
cFlags]
233234
print("""
234235
Compiling \(framework) for \(arch.rawValue) with command:
235236
/usr/bin/xcodebuild \(args.joined(separator: " "))
@@ -418,7 +419,7 @@ struct FrameworkBuilder {
418419

419420
// Verify Firebase headers include an explicit umbrella header for Firebase.h.
420421
let headersDir = podsDir.appendingPathComponents(["Headers", "Public", framework])
421-
if framework.hasPrefix("Firebase") && framework != "FirebaseCoreDiagnostics" {
422+
if framework.hasPrefix("Firebase"), framework != "FirebaseCoreDiagnostics" {
422423
let frameworkHeader = headersDir.appendingPathComponent("\(framework).h")
423424
guard fileManager.fileExists(atPath: frameworkHeader.path) else {
424425
fatalError("Missing explicit umbrella header for \(framework).")

0 commit comments

Comments
 (0)