Skip to content
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

feat: Support for SwiftSettings: swiftLanguageMode, enableUpcomingFeature, enableExperimentalFeature #1423

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

AttilaTheFun
Copy link
Contributor

@AttilaTheFun AttilaTheFun commented Dec 31, 2024

I'm trying to use some of the new GRPC and Protobuf package versions and some of them have adopted upcoming and experimental features as well as the Swift 6 language mode. These SwiftSettings are ignored in the current master. This PR adds support for these features to the repository rule.

Test Plan

SwiftProtobuf uses the experimental StrictConcurrency feature and the upcoming ExistentialAny feature, so it was a good test case for this feature. This is the generated BUILD file with this branch in the swift_protobuf example.

logan@Logans-MacBook-Pro swift_protobuf_example % bazel query --output=build 
...
swift_library(
  name = "SwiftProtobuf.rspm",
  visibility = ["@swiftpkg_swift_protobuf//:__subpackages__"],
  tags = ["manual"],
  features = ["swift.experimental.StrictConcurrency=complete", "swift.upcoming.ExistentialAny"],
  data = ["@swiftpkg_swift_protobuf//:SwiftProtobuf.rspm_resource_bundle"],
  copts = ["-DSWIFT_PACKAGE"],
  module_name = "SwiftProtobuf",
  srcs = [...],
  always_include_developer_search_paths = True,
  alwayslink = True,
)
...

@AttilaTheFun AttilaTheFun force-pushed the lshire-swift-settings branch from bbddd36 to 9df2645 Compare January 5, 2025 17:03
@AttilaTheFun AttilaTheFun changed the title Lshire swift settings feat: Support for SwiftSettings: swiftLanguageMode, enableUpcomingFeature, enableExperimentalFeature Jan 5, 2025
@AttilaTheFun AttilaTheFun marked this pull request as ready for review January 5, 2025 19:46
Copy link
Owner

@cgrindel cgrindel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, looks good. I left a few comments that we will need to address before we can merge.

examples/swift_protobuf_example/.bazelrc Outdated Show resolved Hide resolved
examples/swift_protobuf_example/BUILD.bazel Outdated Show resolved Hide resolved
examples/swift_protobuf_example/MODULE.bazel Outdated Show resolved Hide resolved
examples/swift_protobuf_example/Package.swift Outdated Show resolved Hide resolved
swiftpkg/internal/swiftpkg_build_files.bzl Outdated Show resolved Hide resolved
examples/swift_protobuf_example/MODULE.bazel Show resolved Hide resolved
@AttilaTheFun
Copy link
Contributor Author

@cgrindel Okay, I believe I've addressed all of your feedback.
CI is all green except for my new swift_protobuf_example which requires Swift 6.0 while CI is on an earlier swift version.
We could either merge it and upgrade CI later, or upgrade CI now so this will pass.

@cgrindel
Copy link
Owner

cgrindel commented Jan 7, 2025

@AttilaTheFun Based upon this website, it looks like we need Xcode 16.0 or higher for Swift 6. Do you agree?

@AttilaTheFun
Copy link
Contributor Author

@cgrindel yeah on macOS the swift version is tied to the Xcode version.

Swift 6 released with Xcode 16, so we'll need to update the CI machines to build with Xcode 16.

On Ubuntu you can just install the desired swift version directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants