-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support aspect_hints
for improved Swift interop compatibility
#1191
Support aspect_hints
for improved Swift interop compatibility
#1191
Commits on Apr 5, 2024
-
Add the
swift_interop_hint
rule to be used withaspect_hints
.The new `aspect_hints` attribute in Bazel, available on all rules, lets us attach arbitrary providers to targets that `swift_clang_module_aspect` can read. The `swift_interop_hint` rule uses this to provide the module name for whichever target references it in its `aspect_hints`. A canonical auto-deriving hint is also provided as part of the Swift build rules (in `.../swift:auto_module`), so that the default/recommended behavior of deriving a module name from the target label can be easily obtained without having to declare one's own `swift_module_hint` targets. This is a more principled approach to handling Swift interop than the current `tags` implementation (which will be removed in a future change), and lets us associate additional metadata easily in the future, including files (for example, custom module maps or APINotes). PiperOrigin-RevId: 387147846 (cherry picked from commit c42a37a)
Configuration menu - View commit details
-
Copy full SHA for eb5f6e5 - Browse repository at this point
Copy the full SHA eb5f6e5View commit details -
Add support for custom
module_map
s inswift_interop_hint
.This allows rules like `cc_library` to associate a custom module map if needed (however, this should be rare and used sparingly). It also eliminates the need for the `swift_c_module`, which will be removed. Added analysis tests around the propagation of the module map artifacts. PiperOrigin-RevId: 387195026 (cherry picked from commit 1356365)
Configuration menu - View commit details
-
Copy full SHA for 708c6cd - Browse repository at this point
Copy the full SHA 708c6cdView commit details -
Don't drop
SwiftInfo
providers from the target's dependencies when ……using `swift_interop_hint`. PiperOrigin-RevId: 387355219 (cherry picked from commit 81c3074)
Configuration menu - View commit details
-
Copy full SHA for a1ae533 - Browse repository at this point
Copy the full SHA a1ae533View commit details -
Delete the
swift_c_module
rule.Its functionality has been replaced by `swift_import_hint` and `aspect_hints`. PiperOrigin-RevId: 387358449 (cherry picked from commit 553f697)
Configuration menu - View commit details
-
Copy full SHA for e480aca - Browse repository at this point
Copy the full SHA e480acaView commit details -
Replace the
swift_module
tag in the gRPC BUILD overlay with a `swif……t_interop_hint`. PiperOrigin-RevId: 388242317 (cherry picked from commit 6ded44e)
Configuration menu - View commit details
-
Copy full SHA for 5856821 - Browse repository at this point
Copy the full SHA 5856821View commit details -
Revert "Generate module maps for
cc_library
deps"This reverts commit 15e8c3d.
Configuration menu - View commit details
-
Copy full SHA for 15013e8 - Browse repository at this point
Copy the full SHA 15013e8View commit details -
Remove support for interop using the
swift_module
tag.Interop for non-Obj-C rules should now exclusively use `aspect_hints` (see the documentation for `swift_interop_hint`). PiperOrigin-RevId: 388940287 (cherry picked from commit a67043f)
Configuration menu - View commit details
-
Copy full SHA for 69fa0f0 - Browse repository at this point
Copy the full SHA 69fa0f0View commit details -
Add a way for
swift_interop_hint
to suppress the module for targets…… that generate them by default, like `objc_library`. PiperOrigin-RevId: 391087374 (cherry picked from commit de0f604)
Configuration menu - View commit details
-
Copy full SHA for 4cf19d2 - Browse repository at this point
Copy the full SHA 4cf19d2View commit details -
Add
exclude_hdrs
toswift_interop_hint
.This attribute can be used to exclude a list of headers from the Swift-generated module map (via `exclude header` declarations) without removing them from the hinted target completely. This is often helpful in cases where some subset of headers are not Swift-compatible but still needed as part of the library for other reasons (e.g., they are private headers used by implementation source files, or still used by other non-Swift dependents). PiperOrigin-RevId: 398076709 (cherry picked from commit ef6662c)
Configuration menu - View commit details
-
Copy full SHA for ea19476 - Browse repository at this point
Copy the full SHA ea19476View commit details -
Correctly exclude both the actual and virtual header when using `swif…
…t_interop_hint.exclude_hdrs` on a `cc_library` that has `include_prefix` and/or `strip_include_prefix` set. PiperOrigin-RevId: 412917671 (cherry picked from commit 6b13232)
Configuration menu - View commit details
-
Copy full SHA for 495edff - Browse repository at this point
Copy the full SHA 495edffView commit details -
Update Swift build rules to support, and enable, explicit modules for…
… J2ObjC Targets processed by J2ObjC's aspects have a new compilation context created that treats the generated J2ObjC headers as textual headers, and the "umbrella" header as a regular header. The root path of the generated headers is added to the compilation context as an include path so the headers can be found by dependents. To handle `java_libary`'s `exports` attribute (this lists targets that should be treated as a direct dependency when depending on the `java_libary` in question), the `SwiftInfos` from dependencies are split into direct and indirect. These are then propagated as `direct_swift_infos` vs `swift_infos` respectively to provide the semantics of `exports`. The modular import header rewriter was updated to accommodate the fact that the J2ObjC "umbrella" header is no longer marked as being an umbrella header in the module map. It still needs to be rewritten for the same reason as before, but must now be detected by a portion of the file path (🤮). PiperOrigin-RevId: 416355827 (cherry picked from commit dd22a51)
Configuration menu - View commit details
-
Copy full SHA for 3ee3129 - Browse repository at this point
Copy the full SHA 3ee3129View commit details -
Represent symlinks from
cc_inc_library
targets as textual headers s……o that layering checks are still satisfied correctly. PiperOrigin-RevId: 416824355 (cherry picked from commit 7c7ee72)
Configuration menu - View commit details
-
Copy full SHA for 8095662 - Browse repository at this point
Copy the full SHA 8095662View commit details -
Migrate ObjcProvider's direct headers usage to CcInfo
The direct_headers field in ObjcProvider is being deprecated and will be removed. The same information can be found in CcInfo. J2ObjcAspect has been modified so that the CcInfo is accessible via Starlark. PiperOrigin-RevId: 417648590 (cherry picked from commit 612725e)
Configuration menu - View commit details
-
Copy full SHA for 6920972 - Browse repository at this point
Copy the full SHA 6920972View commit details -
Copy
strict_includes
intoSwiftInfo
provider's Clang module descr……iptor in `swift_clang_module_aspect`. This makes it so that the `apple_common.Objc` provider no longer needs to be handled separately for compilation by Swift build APIs. (It is still used for linking until that is migrated entirely onto `CcInfo`.) PiperOrigin-RevId: 423822059 (cherry picked from commit 8ce9595)
Configuration menu - View commit details
-
Copy full SHA for 0eadb3d - Browse repository at this point
Copy the full SHA 0eadb3dView commit details -
Remove unused variable & function.
RELNOTES: None PiperOrigin-RevId: 430276243 (cherry picked from commit 01b9d32)
Configuration menu - View commit details
-
Copy full SHA for af1f5c6 - Browse repository at this point
Copy the full SHA af1f5c6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 318172f - Browse repository at this point
Copy the full SHA 318172fView commit details