Skip to content

Commit

Permalink
Fix module_name and bundle_name for test specs (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeykhliustin authored Mar 1, 2024
1 parent b812b6e commit 2df9f35
Show file tree
Hide file tree
Showing 29 changed files with 77 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct BaseAnalyzer<S: BaseInfoRepresentable> {
let name = spec.name
let version = spec.version
let platformVersion = try resolvePlatformVersion(platform)
let moduleName: String = spec.resolveModuleName(platform)
let moduleName: String = spec.resolveModuleName(platform, options: options)
let platforms = [platform.bazelKey: platformVersion]
let swiftVersion: String?
if let versions = spec.attr(\.swiftVersions).platform(platform)??.compactMap({ Double($0) }) {
Expand Down
4 changes: 0 additions & 4 deletions Sources/BazelPodsCore/Build/PodBuildFile+makeAppspecs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ extension PodBuildFile {
continue
}

for patch in options.patches {

}

let (resourceTargets, resourceInfoplists) = makeResourceBundles(
targetName: targetName,
baseInfo: analyzer.baseInfo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,13 @@ extension BaseInfoRepresentable {
}
}

func resolveModuleName(_ platform: Platform) -> String {
func resolveModuleName(_ platform: Platform, options: BuildOptions) -> String {
if let specModuleName = moduleName ?? platformRepresentable(platform)?.moduleName {
return specModuleName
} else if let buildSettings = self as? XCConfigRepresentable, let moduleName = buildSettings.moduleName {
return moduleName
} else if let testSpec = self as? TestSpecRepresentable {
return [options.podName, testSpec.testType.rawValue.capitalized, name].joined(separator: "_")
} else {
return name.replacingOccurrences(of: "-", with: "_")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ protocol XCConfigRepresentable: BaseRepresentable {
var xcconfig: [String: String] { get }
}

extension XCConfigRepresentable {
var moduleName: String? {
return podTargetXcconfig["SWIFT_MODULE_NAME"]
}
}

private enum Keys: String {
case pod_target_xcconfig
case user_target_xcconfig
Expand Down
1 change: 1 addition & 0 deletions Sources/BazelPodsCore/Targets/TestSpecs/iOSUITest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ struct iOSUITest: BazelTarget {

let lines: [StarlarkFunctionArgument] = [
.named(name: "name", value: name.toStarlark()),
.named(name: "bundle_name", value: info.moduleName.toStarlark()),
.named(name: "module_name", value: info.moduleName.toStarlark()),
.named(name: "minimum_os_version", value: info.minimumOsVersion.toStarlark()),
.named(name: "test_host", value: test_host.toStarlark()),
Expand Down
1 change: 1 addition & 0 deletions Sources/BazelPodsCore/Targets/TestSpecs/iOSUnitTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ struct iOSUnitTest: BazelTarget {

let lines: [StarlarkFunctionArgument] = [
.named(name: "name", value: name.toStarlark()),
.named(name: "bundle_name", value: info.moduleName.toStarlark()),
.named(name: "module_name", value: info.moduleName.toStarlark()),
.named(name: "minimum_os_version", value: info.minimumOsVersion.toStarlark()),
.named(name: "test_host", value: test_host.toStarlark()),
Expand Down
13 changes: 7 additions & 6 deletions Tests/Recorded/CoreStore/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Tests/Recorded/CwlCatchException/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Tests/Recorded/CwlPreconditionTesting/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Tests/Recorded/FirebaseABTesting/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Tests/Recorded/FirebaseAuth/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Tests/Recorded/FirebaseCore/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Tests/Recorded/FirebaseCoreInternal/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Tests/Recorded/FirebaseCrashlytics/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Tests/Recorded/FirebaseDatabase/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Tests/Recorded/FirebaseFunctions/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Tests/Recorded/FirebaseInstallations/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Tests/Recorded/FirebasePerformance/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Tests/Recorded/FirebaseRemoteConfig/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Tests/Recorded/FirebaseSessions/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Tests/Recorded/FirebaseSharedSwift/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Tests/Recorded/FirebaseStorage/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Tests/Recorded/GTMSessionFetcher/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Tests/Recorded/GoogleAPIClientForREST/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Tests/Recorded/GoogleDataTransport/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Tests/Recorded/GoogleUtilities/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Tests/Recorded/PromisesObjC/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Tests/Recorded/ViewInspector/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Tests/Recorded/Wire/BUILD.bazel

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2df9f35

Please sign in to comment.