From e487073394d55fa963021dce5531fefe363a8b8e Mon Sep 17 00:00:00 2001 From: Sergii Khliustin <51409210+sergeykhliustin@users.noreply.github.com> Date: Wed, 29 May 2024 18:33:02 +0200 Subject: [PATCH] Add support for compiler_flags and ability to override objc_copts, swift_copts, cc_copts and linkopts via user options (#149) --- Makefile | 8 +- README.md | 18 ++-- .../Analyzers/BuildSettingsAnalyzer.swift | 8 +- Sources/BazelPodsCore/Core/UserOption.swift | 17 ++++ .../BazelPodsCore/Models/Specs/AppSpec.swift | 2 + .../BazelPodsCore/Models/Specs/PodSpec.swift | 5 +- .../Protocols/XCConfigRepresentable.swift | 7 ++ .../BazelPodsCore/Models/Specs/TestSpec.swift | 2 + .../Patches/UserOptionsPatch.swift | 36 ++++++++ .../XCConfig/XCConfigParser.swift | 33 ++++--- TestTools/Pods.json | 7 +- TestTools/Pods_Integration.json | 6 ++ Tests/Recorded/KSCrash/BUILD.bazel | 3 + Tests/Recorded/MMKV/BUILD.bazel | 6 +- Tests/Recorded/MMKVAppExtension/BUILD.bazel | 6 +- Tests/Recorded/MMKVCore/BUILD.bazel | 10 ++- Tests/Recorded/Nimble/BUILD.bazel | 3 + Tests/Recorded/Realm/BUILD.bazel | 6 +- Tests/Recorded/libwebp/BUILD.bazel | 3 + xcodeproj/BUILD | 85 ++++++++++--------- 20 files changed, 182 insertions(+), 89 deletions(-) diff --git a/Makefile b/Makefile index 813aed8..374f961 100644 --- a/Makefile +++ b/Makefile @@ -105,7 +105,9 @@ integration-generate-static: --patches bundle_deduplicate arm64_to_sim_forced missing_sdks \ -a -d \ --color yes \ - --log-level debug + --log-level debug \ + --user-options \ + "MMKVCore.cc_copts += -fno-objc-arc" integration-generate-dynamic: bazel run :bazelpods $(CONFIG) -- \ @@ -117,7 +119,9 @@ integration-generate-dynamic: --color yes \ --log-level debug \ --patches bundle_deduplicate arm64_to_sim_forced missing_sdks user_options \ - --user-options "CocoaLumberjack.platform_ios.sdk_frameworks += CoreGraphics" + --user-options \ + "CocoaLumberjack.platform_ios.sdk_frameworks += CoreGraphics" \ + "MMKVCore.cc_copts += -fno-objc-arc" integration-build-x86_64: bazel build $(CONFIG) //IntegrationTests:TestApp_iOS --ios_multi_cpus=x86_64 diff --git a/README.md b/README.md index d09153f..dff2456 100644 --- a/README.md +++ b/README.md @@ -96,10 +96,11 @@ OPTIONS: --patches Patches. It will be applied in the order listed here. Available options: bundle_deduplicate, arm64_to_sim, arm64_to_sim_forced, missing_sdks, user_options. user_options requires --user-options configured. - If 'user_options' not specified, but --user_options exist, user_options patch are applied automatically. + If 'user_options' not specified, but --user_options exist, user_options patch are applied automatically. (values: bundle_deduplicate, arm64_to_sim, arm64_to_sim_forced, missing_sdks, user_options) --user-options User extra options. - Supported fields: 'sdk_frameworks', 'sdk_dylibs', 'weak_sdk_frameworks', 'vendored_libraries', 'vendored_frameworks', 'vendored_xcframeworks', 'testonly', 'link_dynamic', 'data', 'objc_defines', 'runner', 'test_host', 'timeout'. + Supported fields: 'sdk_frameworks', 'sdk_dylibs', 'weak_sdk_frameworks', 'vendored_libraries', 'vendored_frameworks', 'vendored_xcframeworks', 'testonly', 'link_dynamic', 'data', 'objc_defines', 'runner', 'test_host', 'timeout', + 'objc_copts', 'swift_copts', 'cc_copts', 'linkopts'. Supported operators: '+=' (append), '-=' (delete), ':=' (replace). Example: 'SomePod.sdk_dylibs += something,something' @@ -115,10 +116,10 @@ OPTIONS: --pods-root Pods root relative to workspace. Used for headers search paths (default: Pods) -f, --frameworks Packaging pods in dynamic frameworks if possible (same as `use_frameworks!`) --no-concurrency Disable concurrency. - --log-level Log level (debug|info|warning|error|none) (default: info) + --log-level Log level (debug|info|warning|error|none) (values: debug, info, warning, error, none; default: info) --use-bundler Option to use `bundle exec` for `pod` calls --tests-timeout - (Optional) Default timeout for test targets (short|moderate|long|eternal) + (Optional) Default timeout for test targets (short|moderate|long|eternal) (values: short, moderate, long, eternal) --pods-json Pods.json (default: Pods/Pods.json) --print-output Print BUILD files contents to terminal output --dry-run Dry run. Files will not be written @@ -141,10 +142,11 @@ OPTIONS: --patches Patches. It will be applied in the order listed here. Available options: bundle_deduplicate, arm64_to_sim, arm64_to_sim_forced, missing_sdks, user_options. user_options requires --user-options configured. - If 'user_options' not specified, but --user_options exist, user_options patch are applied automatically. + If 'user_options' not specified, but --user_options exist, user_options patch are applied automatically. (values: bundle_deduplicate, arm64_to_sim, arm64_to_sim_forced, missing_sdks, user_options) --user-options User extra options. - Supported fields: 'sdk_frameworks', 'sdk_dylibs', 'weak_sdk_frameworks', 'vendored_libraries', 'vendored_frameworks', 'vendored_xcframeworks', 'testonly', 'link_dynamic', 'data', 'objc_defines', 'runner', 'test_host', 'timeout'. + Supported fields: 'sdk_frameworks', 'sdk_dylibs', 'weak_sdk_frameworks', 'vendored_libraries', 'vendored_frameworks', 'vendored_xcframeworks', 'testonly', 'link_dynamic', 'data', 'objc_defines', 'runner', 'test_host', 'timeout', + 'objc_copts', 'swift_copts', 'cc_copts', 'linkopts'. Supported operators: '+=' (append), '-=' (delete), ':=' (replace). Example: 'SomePod.sdk_dylibs += something,something' @@ -160,10 +162,10 @@ OPTIONS: --pods-root Pods root relative to workspace. Used for headers search paths (default: Pods) -f, --frameworks Packaging pods in dynamic frameworks if possible (same as `use_frameworks!`) --no-concurrency Disable concurrency. - --log-level Log level (debug|info|warning|error|none) (default: info) + --log-level Log level (debug|info|warning|error|none) (values: debug, info, warning, error, none; default: info) --use-bundler Option to use `bundle exec` for `pod` calls --tests-timeout - (Optional) Default timeout for test targets (short|moderate|long|eternal) + (Optional) Default timeout for test targets (short|moderate|long|eternal) (values: short, moderate, long, eternal) --podspec podspec.json --subspecs Subspecs list -h, --help Show help information. diff --git a/Sources/BazelPodsCore/Analyzer/Analyzers/BuildSettingsAnalyzer.swift b/Sources/BazelPodsCore/Analyzer/Analyzers/BuildSettingsAnalyzer.swift index 82e7bea..6155e0a 100644 --- a/Sources/BazelPodsCore/Analyzer/Analyzers/BuildSettingsAnalyzer.swift +++ b/Sources/BazelPodsCore/Analyzer/Analyzers/BuildSettingsAnalyzer.swift @@ -36,13 +36,7 @@ struct BuildSettingsAnalyzer { } private func run() -> Result { - let xcconfig = spec.collectAttribute(with: subspecs, keyPath: \.xcconfig).platform(platform) ?? [:] - let podTargetXcconfig = spec.collectAttribute(with: subspecs, keyPath: \.podTargetXcconfig).platform(platform) ?? [:] - let userTargetXcconfig = spec.collectAttribute(with: subspecs, keyPath: \.userTargetXcconfig).platform(platform) ?? [:] - let mergedConfig = xcconfig - .merging(podTargetXcconfig, uniquingKeysWith: { $1 }) - .merging(userTargetXcconfig, uniquingKeysWith: { $1 }) - let parser = XCConfigParser(mergedConfig, options: options) + let parser = XCConfigParser(spec: spec, subspecs: subspecs, platform: platform, options: options) return Result( swiftCopts: parser.swiftCopts, diff --git a/Sources/BazelPodsCore/Core/UserOption.swift b/Sources/BazelPodsCore/Core/UserOption.swift index aa16412..2b46139 100644 --- a/Sources/BazelPodsCore/Core/UserOption.swift +++ b/Sources/BazelPodsCore/Core/UserOption.swift @@ -58,6 +58,10 @@ public struct UserOption { case runner(String) case test_host(String) case timeout(TestsTimeout) + case objc_copts([String]) + case swift_copts([String]) + case cc_copts([String]) + case linkopts([String]) } public enum KeyPath: String, CaseIterable { case sdk_frameworks @@ -73,6 +77,10 @@ public struct UserOption { case runner case test_host case timeout + case objc_copts + case swift_copts + case cc_copts + case linkopts } public init?(_ string: String) { @@ -216,11 +224,20 @@ public struct UserOption { let timeout = TestsTimeout(rawValue: last) else { log_error( + // swiftlint:disable:next line_length "Incorrect value for \(string). Should be one of \(TestsTimeout.allCases.map({ $0.rawValue }).joined(separator: ", "))). Skipping..." ) return nil } attribute = .timeout(timeout) + case .objc_copts: + attribute = .objc_copts(value) + case .swift_copts: + attribute = .swift_copts(value) + case .cc_copts: + attribute = .cc_copts(value) + case .linkopts: + attribute = .linkopts(value) } self.name = name self.opt = opt diff --git a/Sources/BazelPodsCore/Models/Specs/AppSpec.swift b/Sources/BazelPodsCore/Models/Specs/AppSpec.swift index 3995fa7..8f3b1a0 100644 --- a/Sources/BazelPodsCore/Models/Specs/AppSpec.swift +++ b/Sources/BazelPodsCore/Models/Specs/AppSpec.swift @@ -38,6 +38,7 @@ public final class AppSpec: AppSpecRepresentable { let xcconfig: [String: String] let podTargetXcconfig: [String: String] let userTargetXcconfig: [String: String] + let compilerFlags: [String] let vendoredLibraries: [String] let vendoredFrameworks: [String] @@ -70,6 +71,7 @@ public final class AppSpec: AppSpecRepresentable { xcconfig = Self.xcconfig(json: json) podTargetXcconfig = Self.podTargetXcconfig(json: json) userTargetXcconfig = Self.userTargetXcconfig(json: json) + compilerFlags = Self.compilerFlags(json: json) vendoredLibraries = Self.vendoredLibraries(json: json) vendoredFrameworks = Self.vendoredFrameworks(json: json) infoPlist = Self.infoPlist(json: json) diff --git a/Sources/BazelPodsCore/Models/Specs/PodSpec.swift b/Sources/BazelPodsCore/Models/Specs/PodSpec.swift index c5bbbec..fdcf1eb 100644 --- a/Sources/BazelPodsCore/Models/Specs/PodSpec.swift +++ b/Sources/BazelPodsCore/Models/Specs/PodSpec.swift @@ -98,7 +98,6 @@ enum PodSpecField: String { case prefixHeaderFile = "prefix_header_file" case prefixHeaderContents = "prefix_header_contents" case preservePaths = "preserve_paths" - case compilerFlags = "compiler_flags" case subspecs case source case license @@ -145,9 +144,9 @@ public final class PodSpec: PodSpecRepresentable { let podTargetXcconfig: [String: String] let userTargetXcconfig: [String: String] let xcconfig: [String: String] + let compilerFlags: [String] let subspecs: [PodSpec] - let compilerFlags: [String] let source: PodSpecSource? let license: PodSpecLicense let defaultSubspecs: [String] @@ -221,6 +220,7 @@ public final class PodSpec: PodSpecRepresentable { xcconfig = Self.xcconfig(json: json) podTargetXcconfig = Self.podTargetXcconfig(json: json) userTargetXcconfig = Self.userTargetXcconfig(json: json) + compilerFlags = Self.compilerFlags(json: json) // VendoredDependenciesRepresentable vendoredLibraries = Self.vendoredLibraries(json: json) @@ -235,7 +235,6 @@ public final class PodSpec: PodSpecRepresentable { prefixHeaderContents = fieldMap[.prefixHeaderContents] as? String preservePaths = strings(fromJSON: fieldMap[.preservePaths]) - compilerFlags = strings(fromJSON: fieldMap[.compilerFlags]) defaultSubspecs = strings(fromJSON: fieldMap[.defaultSubspecs]) diff --git a/Sources/BazelPodsCore/Models/Specs/Protocols/XCConfigRepresentable.swift b/Sources/BazelPodsCore/Models/Specs/Protocols/XCConfigRepresentable.swift index a66ec7b..dc28965 100644 --- a/Sources/BazelPodsCore/Models/Specs/Protocols/XCConfigRepresentable.swift +++ b/Sources/BazelPodsCore/Models/Specs/Protocols/XCConfigRepresentable.swift @@ -11,6 +11,7 @@ protocol XCConfigRepresentable: BaseRepresentable { var podTargetXcconfig: [String: String] { get } var userTargetXcconfig: [String: String] { get } var xcconfig: [String: String] { get } + var compilerFlags: [String] { get } } extension XCConfigRepresentable { @@ -23,6 +24,7 @@ private enum Keys: String { case pod_target_xcconfig case user_target_xcconfig case xcconfig + case compiler_flags } extension XCConfigRepresentable { @@ -37,4 +39,9 @@ extension XCConfigRepresentable { static func xcconfig(json: JSONDict) -> [String: String] { return extractValue(fromJSON: json[Keys.xcconfig.rawValue], default: [:]) } + + static func compilerFlags(json: JSONDict) -> [String] { + let stringFlags = extractValue(fromJSON: json[Keys.compiler_flags.rawValue], default: "") + return stringFlags.split(separator: " ").map { String($0) } + } } diff --git a/Sources/BazelPodsCore/Models/Specs/TestSpec.swift b/Sources/BazelPodsCore/Models/Specs/TestSpec.swift index acc5236..6842def 100644 --- a/Sources/BazelPodsCore/Models/Specs/TestSpec.swift +++ b/Sources/BazelPodsCore/Models/Specs/TestSpec.swift @@ -45,6 +45,7 @@ public final class TestSpec: TestSpecRepresentable { let xcconfig: [String: String] let podTargetXcconfig: [String: String] let userTargetXcconfig: [String: String] + let compilerFlags: [String] let vendoredLibraries: [String] let vendoredFrameworks: [String] @@ -84,6 +85,7 @@ public final class TestSpec: TestSpecRepresentable { xcconfig = Self.xcconfig(json: json) podTargetXcconfig = Self.podTargetXcconfig(json: json) userTargetXcconfig = Self.userTargetXcconfig(json: json) + compilerFlags = Self.compilerFlags(json: json) vendoredLibraries = Self.vendoredLibraries(json: json) vendoredFrameworks = Self.vendoredFrameworks(json: json) infoPlist = Self.infoPlist(json: json) diff --git a/Sources/BazelPodsCore/Patches/UserOptionsPatch.swift b/Sources/BazelPodsCore/Patches/UserOptionsPatch.swift index 3f3b788..eee64ff 100644 --- a/Sources/BazelPodsCore/Patches/UserOptionsPatch.swift +++ b/Sources/BazelPodsCore/Patches/UserOptionsPatch.swift @@ -109,6 +109,42 @@ struct UserOptionsPatch: Patch, TestSpecSpecificPatch { case .timeout: // test spec specific option break + case .objc_copts(let value): + switch option.opt { + case .append: + buildSettings.objcCopts += value + case .delete: + buildSettings.objcCopts.removeAll(where: { value.contains($0) }) + case .replace: + buildSettings.objcCopts = value + } + case .swift_copts(let value): + switch option.opt { + case .append: + buildSettings.swiftCopts += value + case .delete: + buildSettings.swiftCopts.removeAll(where: { value.contains($0) }) + case .replace: + buildSettings.swiftCopts = value + } + case .cc_copts(let value): + switch option.opt { + case .append: + buildSettings.ccCopts += value + case .delete: + buildSettings.ccCopts.removeAll(where: { value.contains($0) }) + case .replace: + buildSettings.ccCopts = value + } + case .linkopts(let value): + switch option.opt { + case .append: + buildSettings.linkOpts += value + case .delete: + buildSettings.linkOpts.removeAll(where: { value.contains($0) }) + case .replace: + buildSettings.linkOpts = value + } } } } diff --git a/Sources/BazelPodsCore/XCConfig/XCConfigParser.swift b/Sources/BazelPodsCore/XCConfig/XCConfigParser.swift index 0691f62..bb6f584 100644 --- a/Sources/BazelPodsCore/XCConfig/XCConfigParser.swift +++ b/Sources/BazelPodsCore/XCConfig/XCConfigParser.swift @@ -7,7 +7,7 @@ import Foundation -final class XCConfigParser { +final class XCConfigParser { private(set) var xcconfig: [String: StarlarkNode] = [:] private(set) var swiftCopts: [String] = [] private(set) var objcCopts: [String] = [] @@ -16,7 +16,7 @@ final class XCConfigParser { private(set) var ccCopts: [String] = [] private let transformers: [String: XCConfigSettingTransformer] private let options: BuildOptions - private static let defaultTransformers: [XCConfigSettingTransformer] = [ + private let defaultTransformers: [XCConfigSettingTransformer] = [ HeaderSearchPathTransformer(), UserHeaderSearchPathTransformer(), ApplicationExtensionAPIOnlyTransformer(), @@ -27,21 +27,23 @@ final class XCConfigParser { ObjcDefinesListTransformer("GCC_PREPROCESSOR_DEFINITIONS") ] - convenience init(spec: PodSpec, subspecs: [PodSpec] = [], options: BuildOptions) { - let resolved = - spec.collectAttribute(with: subspecs, keyPath: \.xcconfig) <> - spec.collectAttribute(with: subspecs, keyPath: \.podTargetXcconfig) <> - spec.collectAttribute(with: subspecs, keyPath: \.userTargetXcconfig) + convenience init(spec: S, subspecs: [S] = [], platform: Platform, options: BuildOptions) { + let xcconfig = spec.collectAttribute(with: subspecs, keyPath: \.xcconfig).platform(platform) ?? [:] + let podTargetXcconfig = spec.collectAttribute(with: subspecs, keyPath: \.podTargetXcconfig).platform(platform) ?? [:] + let userTargetXcconfig = spec.collectAttribute(with: subspecs, keyPath: \.userTargetXcconfig).platform(platform) ?? [:] + let mergedConfig = xcconfig + .merging(podTargetXcconfig, uniquingKeysWith: { $1 }) + .merging(userTargetXcconfig, uniquingKeysWith: { $1 }) - self.init(resolved.multi.ios ?? [:], options: options) + let compilerFlags = spec.collectAttribute(with: subspecs, keyPath: \.compilerFlags).platform(platform) ?? [] + + self.init(mergedConfig, compilerFlags: compilerFlags, options: options) } - init(_ config: [String: String], - options: BuildOptions, - transformers: [XCConfigSettingTransformer] = defaultTransformers) { + private init(_ config: [String: String], compilerFlags: [String], options: BuildOptions) { self.options = options - self.transformers = transformers.reduce([String: XCConfigSettingTransformer](), { result, transformer in + self.transformers = defaultTransformers.reduce([String: XCConfigSettingTransformer](), { result, transformer in var result = result result[transformer.key] = transformer return result @@ -82,6 +84,13 @@ final class XCConfigParser { log_debug("unhandled xcconfig \(key)") } } + + for flag in compilerFlags { + let normalized = replacePodsEnvVars(flag, options: options, absolutePath: false) + if !normalized.isEmpty { + ccCopts.append(normalized) + } + } } private func replaceEnvVars(in config: [String: String]) -> [String: String] { diff --git a/TestTools/Pods.json b/TestTools/Pods.json index a60cb7d..3550b1e 100644 --- a/TestTools/Pods.json +++ b/TestTools/Pods.json @@ -388,13 +388,10 @@ "version": "3.7.6" }, "MMKV": { - "version": "1.3.3" + "version": "1.3.5" }, "MMKVAppExtension": { - "version": "1.3.3" - }, - "MMKVCore": { - "version": "1.3.3" + "version": "1.3.5" }, "MTHawkeye": { "version": "0.12.8" diff --git a/TestTools/Pods_Integration.json b/TestTools/Pods_Integration.json index 24ba50d..2aa8d0b 100644 --- a/TestTools/Pods_Integration.json +++ b/TestTools/Pods_Integration.json @@ -63,6 +63,9 @@ "LTMorphingLabel": { "version": "0.9.3" }, + "MMKV": { + "version": "1.3.5" + }, "Material": { "version": "3.1.8" }, @@ -182,6 +185,9 @@ "Kingfisher": { "version": "7.6.2" }, + "MMKV": { + "version": "1.3.5" + }, "Moya": { "version": "15.0.0" }, diff --git a/Tests/Recorded/KSCrash/BUILD.bazel b/Tests/Recorded/KSCrash/BUILD.bazel index 9804634..721467a 100644 --- a/Tests/Recorded/KSCrash/BUILD.bazel +++ b/Tests/Recorded/KSCrash/BUILD.bazel @@ -86,6 +86,9 @@ apple_framework( "Foundation", "CoreFoundation" ], + cc_copts = [ + "-fno-optimize-sibling-calls" + ], xcconfig = { "GCC_ENABLE_CPP_EXCEPTIONS": "YES" }, diff --git a/Tests/Recorded/MMKV/BUILD.bazel b/Tests/Recorded/MMKV/BUILD.bazel index 683ad2c..1ede6fd 100644 --- a/Tests/Recorded/MMKV/BUILD.bazel +++ b/Tests/Recorded/MMKV/BUILD.bazel @@ -19,7 +19,7 @@ apple_framework( ":MMKV_InfoPlist" ], platforms = { - "ios": "11.0" + "ios": "12.0" }, non_arc_srcs = glob( [ @@ -109,7 +109,7 @@ genrule( CFBundlePackageType FMWK CFBundleShortVersionString - 1.3.3 + 1.3.5 CFBundleSignature ???? CFBundleSupportedPlatforms @@ -120,7 +120,7 @@ genrule( CFBundleVersion 1 MinimumOSVersion - 11.0 + 12.0 UIDeviceFamily 1 diff --git a/Tests/Recorded/MMKVAppExtension/BUILD.bazel b/Tests/Recorded/MMKVAppExtension/BUILD.bazel index 1050bd9..0234262 100644 --- a/Tests/Recorded/MMKVAppExtension/BUILD.bazel +++ b/Tests/Recorded/MMKVAppExtension/BUILD.bazel @@ -19,7 +19,7 @@ apple_framework( ":MMKVAppExtension_InfoPlist" ], platforms = { - "ios": "11.0" + "ios": "12.0" }, non_arc_srcs = glob( [ @@ -113,7 +113,7 @@ genrule( CFBundlePackageType FMWK CFBundleShortVersionString - 1.3.3 + 1.3.5 CFBundleSignature ???? CFBundleSupportedPlatforms @@ -124,7 +124,7 @@ genrule( CFBundleVersion 1 MinimumOSVersion - 11.0 + 12.0 UIDeviceFamily 1 diff --git a/Tests/Recorded/MMKVCore/BUILD.bazel b/Tests/Recorded/MMKVCore/BUILD.bazel index c006186..f9f5ca5 100644 --- a/Tests/Recorded/MMKVCore/BUILD.bazel +++ b/Tests/Recorded/MMKVCore/BUILD.bazel @@ -19,7 +19,7 @@ apple_framework( ":MMKVCore_InfoPlist" ], platforms = { - "ios": "11.0" + "ios": "12.0" }, srcs = glob( [ @@ -109,7 +109,9 @@ apple_framework( "UIKit" ], cc_copts = [ - "-std=gnu++17" + "-std=gnu++17", + "-x", + "objective-c++" ], xcconfig = { "CLANG_CXX_LIBRARY": "libc++", @@ -139,7 +141,7 @@ genrule( CFBundlePackageType FMWK CFBundleShortVersionString - 1.3.3 + 1.3.5 CFBundleSignature ???? CFBundleSupportedPlatforms @@ -150,7 +152,7 @@ genrule( CFBundleVersion 1 MinimumOSVersion - 11.0 + 12.0 UIDeviceFamily 1 diff --git a/Tests/Recorded/Nimble/BUILD.bazel b/Tests/Recorded/Nimble/BUILD.bazel index 9e0bf4c..2fd5f6a 100644 --- a/Tests/Recorded/Nimble/BUILD.bazel +++ b/Tests/Recorded/Nimble/BUILD.bazel @@ -68,6 +68,9 @@ apple_framework( swift_copts = [ "-application-extension" ], + cc_copts = [ + "-DPRODUCT_NAME=Nimble/Nimble" + ], linkopts = [ "-weak-lXCTestSwiftSupport", "-Xlinker", diff --git a/Tests/Recorded/Realm/BUILD.bazel b/Tests/Recorded/Realm/BUILD.bazel index ea8f2b4..ad1d282 100644 --- a/Tests/Recorded/Realm/BUILD.bazel +++ b/Tests/Recorded/Realm/BUILD.bazel @@ -343,7 +343,11 @@ apple_framework( "-ITests/Pods/Realm/include/Realm" ], cc_copts = [ - "-std=c++20" + "-std=c++20", + "-DREALM_COCOA_VERSION='@"10.46.0"'", + "-DREALM_ENABLE_SYNC", + "-DREALM_HAVE_CONFIG", + "-D__ASSERTMACROS__" ], linkopts = [ "-Wl,-unexported_symbols_list,Tests/Pods/Realm/Configuration/Realm/PrivateSymbols.txt" diff --git a/Tests/Recorded/libwebp/BUILD.bazel b/Tests/Recorded/libwebp/BUILD.bazel index 0345895..f957b82 100644 --- a/Tests/Recorded/libwebp/BUILD.bazel +++ b/Tests/Recorded/libwebp/BUILD.bazel @@ -90,6 +90,9 @@ apple_framework( "-Xcc", "-ITests/Pods/libwebp/" ], + cc_copts = [ + "-D_THREAD_SAFE" + ], visibility = [ "//visibility:public" ] diff --git a/xcodeproj/BUILD b/xcodeproj/BUILD index 99f669c..90bb943 100644 --- a/xcodeproj/BUILD +++ b/xcodeproj/BUILD @@ -2,7 +2,7 @@ load( "@rules_xcodeproj//xcodeproj:defs.bzl", "top_level_target", "xcodeproj", - "xcode_schemes", + "xcschemes" ) BAZELPODS = "bazelpods" @@ -23,81 +23,84 @@ fi top_level_target("//:bazelpods", target_environments = []), top_level_target("//:Analyzer", target_environments = []), ], - schemes = [ - xcode_schemes.scheme( + generation_mode = "incremental", + xcschemes = [ + xcschemes.scheme( name = BAZELPODS, - build_action = xcode_schemes.build_action(targets = ["//:%s" % BAZELPODS]), - launch_action = xcode_schemes.launch_action(target = "//:%s" % BAZELPODS), + run = xcschemes.run( + build_targets = ["//:%s" % BAZELPODS], + launch_target = "//:%s" % BAZELPODS + ), ), - xcode_schemes.scheme( + xcschemes.scheme( name = BAZELPODS + " Compile", - build_action = xcode_schemes.build_action(targets = ["//:%s" % BAZELPODS]), - launch_action = xcode_schemes.launch_action( - target = "//:%s" % BAZELPODS, + run = xcschemes.run( + build_targets = ["//:%s" % BAZELPODS], + launch_target = "//:%s" % BAZELPODS, args = ["compile --src $SRCROOT/Tests --log-level debug --patches bundle_deduplicate arm64_to_sim missing_sdks --no-concurrency --podspec $SRCROOT/Tests/Pods/FirebaseDatabase/FirebaseDatabase.json"] ), ), - xcode_schemes.scheme( + xcschemes.scheme( name = BAZELPODS + " Tests", - build_action = xcode_schemes.build_action(targets = ["//:%s" % BAZELPODS]), - launch_action = xcode_schemes.launch_action( - target = "//:%s" % BAZELPODS, + run = xcschemes.run( + build_targets = ["//:%s" % BAZELPODS], + launch_target = "//:%s" % BAZELPODS, args = ["--src $SRCROOT/Tests -a --log-level debug --patches bundle_deduplicate arm64_to_sim missing_sdks --diff --no-concurrency --deps-prefix //Tests/Pods"] ), ), - xcode_schemes.scheme( + xcschemes.scheme( name = BAZELPODS + " Tests Frameworks", - build_action = xcode_schemes.build_action(targets = ["//:%s" % BAZELPODS]), - launch_action = xcode_schemes.launch_action( - target = "//:%s" % BAZELPODS, + run = xcschemes.run( + build_targets = ["//:%s" % BAZELPODS], + launch_target = "//:%s" % BAZELPODS, args = ["--src $SRCROOT/Tests -a -f --log-level debug --patches bundle_deduplicate arm64_to_sim missing_sdks --diff"] ), ), - xcode_schemes.scheme( + xcschemes.scheme( name = BAZELPODS + " arm64sim Tests", - build_action = xcode_schemes.build_action(targets = ["//:%s" % BAZELPODS]), - launch_action = xcode_schemes.launch_action( - target = "//:%s" % BAZELPODS, + run = xcschemes.run( + build_targets = ["//:%s" % BAZELPODS], + launch_target = "//:%s" % BAZELPODS, args = ["arm64sim --src $SRCROOT/Tests --log-level debug"] ), ), - xcode_schemes.scheme( + xcschemes.scheme( name = BAZELPODS + " arm64sim Tests Frameworks", - build_action = xcode_schemes.build_action(targets = ["//:%s" % BAZELPODS]), - launch_action = xcode_schemes.launch_action( - target = "//:%s" % BAZELPODS, + run = xcschemes.run( + build_targets = ["//:%s" % BAZELPODS], + launch_target = "//:%s" % BAZELPODS, args = ["arm64sim --src $SRCROOT/Tests -f --log-level debug"] ), ), - xcode_schemes.scheme( + xcschemes.scheme( name = BAZELPODS + " IntegrationTests", - build_action = xcode_schemes.build_action(targets = ["//:%s" % BAZELPODS]), - launch_action = xcode_schemes.launch_action( - target = "//:%s" % BAZELPODS, + run = xcschemes.run( + build_targets = ["//:%s" % BAZELPODS], + launch_target = "//:%s" % BAZELPODS, args = ["--src $SRCROOT/IntegrationTests -a --log-level debug --patches bundle_deduplicate arm64_to_sim missing_sdks --diff"] ), ), - xcode_schemes.scheme( + xcschemes.scheme( name = BAZELPODS + " IntegrationTests Frameworks", - build_action = xcode_schemes.build_action(targets = ["//:%s" % BAZELPODS]), - launch_action = xcode_schemes.launch_action( - target = "//:%s" % BAZELPODS, + run = xcschemes.run( + build_targets = ["//:%s" % BAZELPODS], + launch_target = "//:%s" % BAZELPODS, args = ["--src $SRCROOT/IntegrationTests -a -f --log-level debug --patches bundle_deduplicate arm64_to_sim missing_sdks --diff"] ), ), - xcode_schemes.scheme( + xcschemes.scheme( name = BAZELPODS + " arm64sim IntegrationTests", - build_action = xcode_schemes.build_action(targets = ["//:%s" % BAZELPODS]), - launch_action = xcode_schemes.launch_action( - target = "//:%s" % BAZELPODS, + run = xcschemes.run( + build_targets = ["//:%s" % BAZELPODS], + launch_target = "//:%s" % BAZELPODS, args = ["arm64sim --src $SRCROOT/IntegrationTests --log-level debug"] ), ), - xcode_schemes.scheme( + xcschemes.scheme( name = BAZELPODS + " arm64sim IntegrationTests Frameworks", - build_action = xcode_schemes.build_action(targets = ["//:%s" % BAZELPODS]), - launch_action = xcode_schemes.launch_action( - target = "//:%s" % BAZELPODS, + run = xcschemes.run( + build_targets = ["//:%s" % BAZELPODS], + launch_target = "//:%s" % BAZELPODS, args = ["arm64sim --src $SRCROOT/IntegrationTests -f --log-level debug"] ), ),