bazel-ios / rules_ios

Bazel rules for building iOS applications and frameworks
Apache License 2.0
278 stars 85 forks source link

Adds the repository rule xcode_sdk_frameworks #898

Closed congt closed 2 months ago

congt commented 2 months ago

What

It scans and configures all SDK frameworks which are required for explicit module builds.

Specifically, it 1) uses the bazel_tools//tools/osx:xcode_configure.bzl to fetch all local Xcode infos, 2) finds all frameworks under the xcode SDK path, and 3) uses the swiftc -scan-dependencies mode to fetch the dependency graph among all Swift and Clang SDK modules.

We use swift_module_alias to represent a Swift SDK module and sdk_clang_module for a Clang SDK module.

This PR is based on the previous attempt to support SDK frameworks: https://github.com/bazel-ios/rules_ios/pull/562

Test

Runs bazel build --config=explicit_modules --nobuild @xcode_sdk_frameworks//... and inspects the generated repository at $(bazel info output_base)/external/_main~xcode_sdk_frameworks~xcode_sdk_frameworks.

Next steps:

The dependency among swift_module_alias and sdk_clang_module doesn't work yet. We need to fix that.