Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ build:remote_cache --remote_timeout=3600
# Configure for explicit module compilation
build:explicit_modules --features=swift.use_c_modules
build:explicit_modules --features=swift.emit_c_module
build:explicit_modules --repo_env=EXPLICIT_MODULES=1

# By default don't upload local results to remote cache, only CI does this.
build --noremote_upload_local_results
Expand Down
11 changes: 11 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,14 @@ use_repo(
apple_non_module_deps,
"xctestrunner",
)

# Load xcode_sdk_frameworks
xcode_sdk_frameworks = use_extension(
"//rules:module_extensions.bzl",
"xcode_sdk_frameworks",
dev_dependency = True,
)
use_repo(
xcode_sdk_frameworks,
"xcode_sdk_frameworks",
)
7 changes: 7 additions & 0 deletions rules/explicit_module/sdk_clang_module.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@build_bazel_rules_swift//swift/internal:feature_names.bzl", "SWIFT_FEATURE_SYSTEM_MODULE")
load("@build_bazel_rules_swift//swift/internal:providers.bzl", "create_swift_info")
load("@build_bazel_rules_swift//swift/internal:swift_common.bzl", "swift_common")

def _sdk_clang_module_impl(ctx):
Expand All @@ -11,10 +12,16 @@ def _sdk_clang_module_impl(ctx):
# We need to return CcInfo and its compilation_context. We may also consider to update swift_clang_module_aspect.
# See https://github.com/bazelbuild/rules_swift/blob/d68b21471e4e9d922b75e2b0621082b8ce017d11/swift/internal/swift_clang_module_aspect.bzl#L548
CcInfo(compilation_context = cc_common.create_compilation_context()),
# Required to add sdk_clang_module targets to the deps of swift_module_alias.
# TODO(cshi): create the SwiftInfo correctly
create_swift_info(),
]

sdk_clang_module = rule(
attrs = {
"deps": attr.label_list(
doc = "The deps of the SDK clang module",
),
"module_map": attr.string(
doc = """\
The path to a SDK framework module map.
Expand Down
9 changes: 9 additions & 0 deletions rules/module_extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ load(
"rules_ios_dependencies",
"rules_ios_dev_dependencies",
)
load(
"//rules:xcode_sdk_frameworks.bzl",
"load_xcode_sdk_frameworks",
)
load(
"//tools/toolchains/xcode_configure:xcode_configure.bzl",
_xcode_configure = "xcode_configure",
Expand Down Expand Up @@ -41,3 +45,8 @@ xcode_configure = module_extension(
),
},
)

def _xcode_sdk_frameworks_impl(_):
load_xcode_sdk_frameworks()

xcode_sdk_frameworks = module_extension(implementation = _xcode_sdk_frameworks_impl)
Loading