diff --git a/examples/resources_example/swift/Package.resolved b/examples/resources_example/swift/Package.resolved index 232ec9e23..2973637a5 100644 --- a/examples/resources_example/swift/Package.resolved +++ b/examples/resources_example/swift/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/openid/AppAuth-iOS.git", "state" : { - "revision" : "71cde449f13d453227e687458144bde372d30fc7", - "version" : "1.6.2" + "revision" : "7e2c09cbeb3bb799f26c268dbedb26325ea722a9", + "version" : "1.7.3" } }, { @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GoogleSignIn-iOS", "state" : { - "revision" : "7932d33686c1dc4d7df7a919aae47361d1cdfda4", - "version" : "7.0.0" + "revision" : "a7965d134c5d3567026c523e0a8a583f73b62b0d", + "version" : "7.1.0" } }, { @@ -23,8 +23,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/gtm-session-fetcher.git", "state" : { - "revision" : "d415594121c9e8a4f9d79cecee0965cf35e74dbd", - "version" : "3.1.1" + "revision" : "9534039303015a84837090d20fa21cae6e5eadb6", + "version" : "3.3.2" } }, { @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/google/GTMAppAuth.git", "state" : { - "revision" : "cee3c709307912d040bd1e06ca919875a92339c6", - "version" : "2.0.0" + "revision" : "5d7d66f647400952b1758b230e019b07c0b4b22a", + "version" : "4.1.1" } }, { diff --git a/examples/resources_example/swift/Package.swift b/examples/resources_example/swift/Package.swift index 50d678017..35ad93226 100644 --- a/examples/resources_example/swift/Package.swift +++ b/examples/resources_example/swift/Package.swift @@ -9,7 +9,7 @@ let package = Package( .package(path: "../third_party/app_lovin_sdk"), .package(path: "../third_party/package_with_resources"), .package(url: "https://github.com/SDWebImage/SDWebImageSwiftUI.git", from: "3.0.2"), - .package(url: "https://github.com/google/GoogleSignIn-iOS", from: "7.0.0"), + .package(url: "https://github.com/google/GoogleSignIn-iOS", from: "7.1.0"), .package( url: "https://github.com/GoogleCloudPlatform/recaptcha-enterprise-mobile-sdk", from: "18.4.2" diff --git a/examples/resources_example/swift_deps_index.json b/examples/resources_example/swift_deps_index.json index 78f3d8c37..e4db2d048 100644 --- a/examples/resources_example/swift_deps_index.json +++ b/examples/resources_example/swift_deps_index.json @@ -128,8 +128,9 @@ { "name": "GTMAppAuth", "c99name": "GTMAppAuth", - "src_type": "objc", + "src_type": "swift", "label": "@swiftpkg_gtmappauth//:GTMAppAuth.rspm", + "modulemap_label": "@swiftpkg_gtmappauth//:GTMAppAuth.rspm_modulemap", "package_identity": "gtmappauth", "product_memberships": [ "GTMAppAuth" @@ -336,36 +337,36 @@ "name": "swiftpkg_appauth_ios", "identity": "appauth-ios", "remote": { - "commit": "71cde449f13d453227e687458144bde372d30fc7", + "commit": "7e2c09cbeb3bb799f26c268dbedb26325ea722a9", "remote": "https://github.com/openid/AppAuth-iOS.git", - "version": "1.6.2" + "version": "1.7.3" } }, { "name": "swiftpkg_googlesignin_ios", "identity": "googlesignin-ios", "remote": { - "commit": "7932d33686c1dc4d7df7a919aae47361d1cdfda4", + "commit": "a7965d134c5d3567026c523e0a8a583f73b62b0d", "remote": "https://github.com/google/GoogleSignIn-iOS", - "version": "7.0.0" + "version": "7.1.0" } }, { "name": "swiftpkg_gtm_session_fetcher", "identity": "gtm-session-fetcher", "remote": { - "commit": "d415594121c9e8a4f9d79cecee0965cf35e74dbd", + "commit": "9534039303015a84837090d20fa21cae6e5eadb6", "remote": "https://github.com/google/gtm-session-fetcher.git", - "version": "3.1.1" + "version": "3.3.2" } }, { "name": "swiftpkg_gtmappauth", "identity": "gtmappauth", "remote": { - "commit": "cee3c709307912d040bd1e06ca919875a92339c6", + "commit": "5d7d66f647400952b1758b230e019b07c0b4b22a", "remote": "https://github.com/google/GTMAppAuth.git", - "version": "2.0.0" + "version": "4.1.1" } }, { diff --git a/swiftpkg/internal/deps_indexes.bzl b/swiftpkg/internal/deps_indexes.bzl index 3a19a83e3..66f6e3b2c 100644 --- a/swiftpkg/internal/deps_indexes.bzl +++ b/swiftpkg/internal/deps_indexes.bzl @@ -201,14 +201,12 @@ def _modulemap_label_for_module(module): package = module.label.package, ) -def _labels_for_module(module, depender_src_type): +def _labels_for_module(module): """Returns the dep labels that should be used for a module. Args: module: The dependent module (`struct` as returned by `dep_indexes.new_module`). - depender_src_type: The source type for the target (`string` value from - `src_types`) that will depend on the module. Returns: A `list` of Bazel label `struct` values as returned by `bazel_labels.new`, @@ -222,8 +220,7 @@ def _labels_for_module(module, depender_src_type): # See `swiftpkg_build_files.bzl` for more information. labels.append(_modulemap_label_for_module(module)) - elif (depender_src_type == src_types.objc and - module.src_type == src_types.swift and + elif (module.src_type == src_types.swift and module.modulemap_label != None): # If an Objc module wants to @import a Swift module, it will need the # modulemap target. diff --git a/swiftpkg/internal/pkginfo_target_deps.bzl b/swiftpkg/internal/pkginfo_target_deps.bzl index 9685ab631..e5fc75291 100644 --- a/swiftpkg/internal/pkginfo_target_deps.bzl +++ b/swiftpkg/internal/pkginfo_target_deps.bzl @@ -99,7 +99,7 @@ Unrecognized target dependency while generating a Bazel dependency label.\ labels = [product.label] elif module: labels = ( - deps_indexes.labels_for_module(module, depender_module.src_type) + deps_indexes.labels_for_module(module) ) else: labels = [] diff --git a/swiftpkg/internal/swiftpkg_build_files.bzl b/swiftpkg/internal/swiftpkg_build_files.bzl index 4581bae07..3696caf63 100644 --- a/swiftpkg/internal/swiftpkg_build_files.bzl +++ b/swiftpkg/internal/swiftpkg_build_files.bzl @@ -7,7 +7,7 @@ load(":bazel_apple_platforms.bzl", "bazel_apple_platforms") load(":build_decls.bzl", "build_decls") load(":build_files.bzl", "build_files") load(":bzl_selects.bzl", "bzl_selects") -load(":deps_indexes.bzl", "deps_indexes", "src_types") +load(":deps_indexes.bzl", "deps_indexes") load(":load_statements.bzl", "load_statements") load(":pkginfo_target_deps.bzl", "pkginfo_target_deps") load(":pkginfo_targets.bzl", "pkginfo_targets") @@ -717,13 +717,14 @@ def _library_product_build_file(deps_index_ctx, product): for tname in product.targets ] label_infos = lists.flatten([ - deps_indexes.labels_for_module(module, src_types.swift) + deps_indexes.labels_for_module(module) for module in modules ]) target_labels = [ bazel_labels.normalize(label_info) for label_info in label_infos ] + if len(target_labels) == 0: fail("No targets specified for a library product. name:", product.name) return build_files.new( diff --git a/swiftpkg/tests/deps_indexes_tests.bzl b/swiftpkg/tests/deps_indexes_tests.bzl index 9eade7574..54ea1de2c 100644 --- a/swiftpkg/tests/deps_indexes_tests.bzl +++ b/swiftpkg/tests/deps_indexes_tests.bzl @@ -163,7 +163,6 @@ def _labels_for_module_test(ctx): struct( msg = "Swift depend upon Swift", dep_module = "@example_cool_repo//:Foo", - depender_module = "@example_cool_repo//:Bar", exp = [ bazel_labels.parse("@example_cool_repo//:Foo"), ], @@ -171,7 +170,6 @@ def _labels_for_module_test(ctx): struct( msg = "Swift library depends upon Objc library", dep_module = "@example_cool_repo//:ObjcLibrary", - depender_module = "@example_cool_repo//:Bar", exp = [ bazel_labels.parse("@example_cool_repo//:ObjcLibrary"), bazel_labels.parse("@example_cool_repo//:ObjcLibrary_modulemap"), @@ -180,16 +178,13 @@ def _labels_for_module_test(ctx): struct( msg = "Objc library depends upon Swift library without modulemap", dep_module = "@example_cool_repo//:Foo", - depender_module = "@example_cool_repo//:ObjcLibrary", exp = [ bazel_labels.parse("@example_cool_repo//:Foo"), - # bazel_labels.parse("@example_cool_repo//:Foo_modulemap"), ], ), struct( msg = "Objc library depends upon Swift library with modulemap", dep_module = "@example_another_repo//Sources/Foo", - depender_module = "@example_cool_repo//:ObjcLibrary", exp = [ bazel_labels.parse("@example_another_repo//Sources/Foo"), bazel_labels.parse("@example_another_repo//Sources/Foo:Foo_modulemap"), @@ -198,12 +193,9 @@ def _labels_for_module_test(ctx): ] for t in tests: module = deps_indexes.get_module(_deps_index, t.dep_module) - depender = deps_indexes.get_module(_deps_index, t.depender_module) if module == None: fail("The module is `None` for {}.".format(t.label)) - if depender == None: - fail("The depender module is `None` for {}.".format(t.depender_label)) - actual = deps_indexes.labels_for_module(module, depender.src_type) + actual = deps_indexes.labels_for_module(module) asserts.equals(env, t.exp, actual, t.msg) return unittest.end(env)