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

Update supported Swift/Xcode Versions. #1438

Merged
merged 1 commit into from
Aug 15, 2023
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
15 changes: 0 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,11 @@ jobs:
- 5.8.1-jammy
- 5.7.3-jammy
- 5.6.3-focal
- 5.5.3-focal
- 5.4.3-focal
# protobuf_git can reference a commit, tag, or branch
# commit: "commits/6935eae45c99926a000ecbef0be20dfd3d159e71"
# tag: "ref/tags/v3.11.4"
# branch: "ref/heads/main"
protobuf_git: ["ref/heads/main"]
# We are not testing the SPM plugins on Swift version that don't support SPM plugins
include:
- swift: 5.8.1-jammy
test_spm_plugin: true
- swift: 5.7.3-jammy
test_spm_plugin: true
- swift: 5.6.3-focal
test_spm_plugin: true
- swift: 5.5.3-focal
test_spm_plugin: false
- swift: 5.4.3-focal
test_spm_plugin: false
container:
image: swift:${{ matrix.swift }}
steps:
Expand Down Expand Up @@ -114,7 +100,6 @@ jobs:
working-directory: main
run: make test-conformance CONFORMANCE_TEST_RUNNER=../protobuf/cmake_build/conformance_test_runner
- name: Test SPM plugin
if: ${{ matrix.test_spm_plugin }}
working-directory: main
run: make test-spm-plugin PROTOC=../protobuf/cmake_build/protoc

Expand Down
38 changes: 17 additions & 21 deletions Documentation/INTERNALS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,13 @@ behavior are always appreciated.

## Swift Language Support

We guarantee support for Swift versions that are up to one year old.
For example, in March 2022 (when Swift 5.6 was released), we still
guaranteed support for Swift 5.3.3 (released in January 2021, and still
current in March 2021).
Support for Swift versions older than one year is at the discretion
of the SwiftProtobuf developers and will depend on the amount of
effort required to maintain such support.
We do not as a rule expect to support Swift versions more than two years
old in any case.

(Originally, we tried to gaurantee "one full major version", which
was essentially the same as "one year" until Swift 5, at which point
we discovered that managing CI for 4-year-old releases was rather
problematic.)

Having said that, the issue is complicated by the fact that there are _toolchain
versions_ and _language versions_. As of Swift toolchain 5.x, the 4.2 _language
version_ is still supported. In that case of SwiftProtobuf, there's the question
of what _language version_ the core library supports, but also what _language
versions_ the generated code need to compile (since that code ends up in
whatever target developers pick).
SwiftProtobuf tries to support back to the oldest of:

* The
[Swift NIO guidelines support version](https://github.com/apple/swift-nio#supported-versions).
* Apple’s App Store submission requirements. This is announced on the
[Apple Developer News](https://developer.apple.com/news/) page; an
[example from March 2023](https://developer.apple.com/news/?id=jd9wcyov).

When the minimum Swift version gets updated, update:
- The `README.md` in the root of the project
Expand All @@ -48,6 +34,16 @@ When the minimum Swift version gets updated, update:
versions supported. Eventually the version specific `Package@*.swift`
files will go away.

NOTE: As the minimum Xcode version updates, that also implicitly updates
the minimum supports Apple OS versions. Those updates also go into the
podspec file. If the an older Xcode might support the NIO Swift version,
we still listed the lower Swift version but higher Xcode version in the
`README.md` and we adopt the deployment minimums from the Xcode in
`SwiftProtobuf.podspec`.

The deployment minimums for Xcode versions can be found on the [Developer
Support: Xcode](https://developer.apple.com/support/xcode/) page.

## Field Storage

The generated message structs follow one of several different patterns
Expand Down
19 changes: 7 additions & 12 deletions Documentation/PLUGIN.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ Swift runtime library to your project.

To use Swift with Protocol buffers, you'll need:

* A recent Swift 4.0 compiler that includes the Swift Package Manager.
We recommend using the latest release build from
[Swift.org](https://swift.org) or the command-line tools included
* A recent Swift compiler. We recommend using the latest release build
from [Swift.org](https://swift.org) or the command-line tools included
with the latest version of Xcode.

* Google's protoc compiler. You can get recent versions from
Expand All @@ -41,10 +40,6 @@ This will create a binary called `protoc-gen-swift` in the
`.build/release` directory. To install, just copy this one executable
anywhere in your PATH.

NOTE: The Swift runtime support is now included with macOS. If you are
using old Xcode versions or are on older system versions, you might need
to use also use `--static-swift-stdlib` with `swift build`.

### Converting .proto files into Swift

To generate Swift output for your .proto files, you run the `protoc`
Expand Down Expand Up @@ -165,8 +160,8 @@ The `proto_file_path` values here should match the paths used in the proto file
##### Generation Option: `ImplementationOnlyImports` - `@_implementationOnly`-annotated imports

By default, SwiftProtobuf does not annotate any imports with `@_implementationOnly`.
However, in some scenarios, such as when distributing an `XCFramework`, imports
for types used only internally should be annotated as `@_implementationOnly` to
However, in some scenarios, such as when distributing an `XCFramework`, imports
for types used only internally should be annotated as `@_implementationOnly` to
avoid exposing internal symbols to clients.
You can change this with the `ImplementationOnlyImports` option:

Expand All @@ -178,11 +173,11 @@ The possible values for `ImplementationOnlyImports` are:

* `false` (default): The `@_implementationOnly` annotation will never be used.
* `true`: Imports of internal dependencies and any modules defined in the module
mappings will be annotated as `@_implementationOnly`.
mappings will be annotated as `@_implementationOnly`.

**Important:** Modules cannot be imported as implementation-only if they're
**Important:** Modules cannot be imported as implementation-only if they're
exposed via public API, so even if `ImplementationOnlyImports` is set to `true`,
this will only work if the `Visibility` is set to `internal`.
this will only work if the `Visibility` is set to `internal`.


### Building your project
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ your project as explained below.

To use Swift with Protocol buffers, you'll need:

* A Swift 5.0 or later compiler (Xcode 10.2 or later). Support is included for
the Swift Package Manager. The Swift protobuf project is being developed and
tested against the latest release version of Swift available from
* A Swift 5.6 or later compiler (or, if building with Xcode, Xcode 14.1 or later
as required by the App Store). The Swift protobuf project is being developed
and tested against the latest release version of Swift available from
[Swift.org](https://swift.org)

* Google's protoc compiler. The Swift protoc plugin is being actively developed
Expand Down
8 changes: 4 additions & 4 deletions SwiftProtobuf.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ Pod::Spec.new do |s|
s.source = { :git => 'https://github.com/apple/swift-protobuf.git', :tag => s.version }

s.requires_arc = true
s.ios.deployment_target = '9.0'
s.osx.deployment_target = '10.11'
s.tvos.deployment_target = '9.0'
s.watchos.deployment_target = '2.0'
s.ios.deployment_target = '11.0'
s.osx.deployment_target = '10.13'
s.tvos.deployment_target = '11.0'
s.watchos.deployment_target = '4.0'

s.cocoapods_version = '>= 1.7.0'

Expand Down