Skip to content

Commit

Permalink
Fix tests after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronsky committed Apr 3, 2024
1 parent d2979c0 commit a02747a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 56 deletions.
2 changes: 2 additions & 0 deletions swift/internal/compiling.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1592,6 +1592,8 @@ def _collect_clang_module_inputs(
# use include scanning from Starlark, we can't compute a more
# precise input set.
compilation_context = clang_module.compilation_context
if not compilation_context:
continue
transitive_inputs.append(compilation_context.headers)
transitive_inputs.append(
depset(compilation_context.direct_textual_headers),
Expand Down
4 changes: 3 additions & 1 deletion swift/internal/swift_clang_module_aspect.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,9 @@ def _handle_module(
else:
return []

compilation_contexts_to_merge_for_compilation = [compilation_context]
compilation_contexts_to_merge_for_compilation = []
if compilation_context:
compilation_contexts_to_merge_for_compilation.append(compilation_context)

# Fold the `strict_includes` from `apple_common.Objc` into the Clang module
# descriptor in `SwiftInfo` so that the `Objc` provider doesn't have to be
Expand Down
1 change: 0 additions & 1 deletion swift/internal/utils.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ def compilation_context_for_explicit_module_compilation(
includes = clang.strict_includes,
),
)

return cc_common.merge_compilation_contexts(
compilation_contexts = all_compilation_contexts,
)
Expand Down
34 changes: 0 additions & 34 deletions test/explicit_modules_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -52,40 +52,6 @@ def explicit_modules_test_suite(name):
target_compatible_with = ["@platforms//os:macos"],
)

# Verify that the swift_c_module precompiles.
explicit_modules_action_command_line_test(
name = "{}_enabled_c_module_side".format(name),
expected_argv = [
"-fsystem-module",
"-module-name SwiftShims",
"-emit-pcm",
"-fno-implicit-module-maps",
"-fno-implicit-modules",
],
mnemonic = "SwiftPrecompileCModule",
tags = [name],
target_under_test = "@build_bazel_rules_swift//test/fixtures/explicit_modules:shims",
target_compatible_with = ["@platforms//os:macos"],
)

# Verify that a swift_c_module with dependencies precompiles.
explicit_modules_action_command_line_test(
name = "{}_enabled_c_module_deps".format(name),
expected_argv = [
"-fsystem-module",
"-fmodule-file=_Builtin_stddef_max_align_t",
"-fmodule-map-file=__BAZEL_XCODE_DEVELOPER_DIR__/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/clang/include/module.modulemap",
"-module-name Darwin",
"-emit-pcm",
"-fno-implicit-module-maps",
"-fno-implicit-modules",
],
mnemonic = "SwiftPrecompileCModule",
tags = [name],
target_under_test = "@build_bazel_rules_swift//test/fixtures/explicit_modules:Darwin",
target_compatible_with = ["@platforms//os:macos"],
)

# Verify that the default behavior isn't impacted.
implicit_modules_action_command_line_test(
name = "{}_disabled_test".format(name),
Expand Down
23 changes: 3 additions & 20 deletions test/fixtures/explicit_modules/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//swift:swift.bzl", "swift_c_module", "swift_library")
load("//swift:swift.bzl", "swift_interop_hint", "swift_library")
load("//test/fixtures:common.bzl", "FIXTURE_TAGS")

package(
Expand All @@ -17,26 +17,9 @@ swift_library(
deps = [":shims"],
)

swift_c_module(
swift_interop_hint(
name = "shims",
module_name = "SwiftShims",
system_module_map = "__BAZEL_XCODE_SDKROOT__/usr/lib/swift/shims/module.modulemap",
tags = FIXTURE_TAGS,
)

swift_c_module(
name = "Darwin",
module_name = "Darwin",
system_module_map = "__BAZEL_XCODE_SDKROOT__/usr/include/module.modulemap",
tags = FIXTURE_TAGS,
deps = [
":_Builtin_stddef_max_align_t",
],
)

swift_c_module(
name = "_Builtin_stddef_max_align_t",
module_name = "_Builtin_stddef_max_align_t",
system_module_map = "__BAZEL_XCODE_DEVELOPER_DIR__/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/clang/include/module.modulemap",
module_map = "__BAZEL_XCODE_SDKROOT__/usr/lib/swift/shims/module.modulemap",
tags = FIXTURE_TAGS,
)

0 comments on commit a02747a

Please sign in to comment.