Skip to content

Commit 68d5460

Browse files
xtremekforevershahmishaleuanhMaxDesiatovxavgru12
authored
Main merge, more ideas for experimental README changes (#215)
- Merge from `main`, probably a good idea to start with. - Only add `experimental-` prefix to success message when running under Swift 5.x. Under 6.0 and later, you'll just get the correct message based on your Swift version: ``` All done! Install the newly generated SDK with this command: swift sdk install /home/xtremek/Programming/xtremekforever/swift-sdk-generator/Bundles/6.1- RELEASE_ubuntu_jammy_x86_64.artifactbundle After that, use the newly installed SDK when building with this command: swift build --swift-sdk 6.1-RELEASE_ubuntu_jammy_x86_64 ``` - Added more info to the `Swift SDK Distribution` section of the README on how to generate checksums. Let me know what you think, maybe some good inclusions or could use some tweaks. --------- Co-authored-by: Mishal Shah <[email protected]> Co-authored-by: Euan Harris <[email protected]> Co-authored-by: Max Desiatov <[email protected]> Co-authored-by: xavgru12 <[email protected]>
1 parent 9d3a02e commit 68d5460

File tree

58 files changed

+2334
-1125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2334
-1125
lines changed

.github/workflows/pull_request.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Pull request
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize]
6+
7+
jobs:
8+
tests:
9+
name: Test
10+
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
11+
with:
12+
linux_pre_build_command: apt-get update && apt-get install -y locales locales-all libsqlite3-dev
13+
enable_windows_checks: false
14+
soundness:
15+
name: Soundness
16+
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
17+
with:
18+
api_breakage_check_enabled: false

.license_header_template

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@@===----------------------------------------------------------------------===@@
2+
@@
3+
@@ This source file is part of the Swift open source project
4+
@@
5+
@@ Copyright (c) YEARS Apple Inc. and the Swift project authors
6+
@@ Licensed under Apache License v2.0 with Runtime Library Exception
7+
@@
8+
@@ See https://swift.org/LICENSE.txt for license information
9+
@@ See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
@@
11+
@@===----------------------------------------------------------------------===@@
12+

.licenseignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.gitignore
2+
.swiftformat
3+
.swiftformatignore
4+
.editorconfig
5+
.unacceptablelanguageignore
6+
Brewfile
7+
Package.swift
8+
Package.resolved
9+
*.md
10+
*.txt
11+
*.yml
12+
**/.editorconfig
13+
**/*.docc/**
14+
**/*.entitlements
15+
**/*.input
16+
**/*.modulemap
17+
**/*.plist
18+
**/*.xcodeproj/**
19+
**/CODEOWNERS
20+
**/Dockerfile
21+
**/Package.swift
22+
Utilities/git.commit.template

.swift-format

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"fileScopedDeclarationPrivacy" : {
3+
"accessLevel" : "private"
4+
},
5+
"indentConditionalCompilationBlocks" : true,
6+
"indentSwitchCaseLabels" : false,
7+
"indentation" : {
8+
"spaces" : 2
9+
},
10+
"lineBreakAroundMultilineExpressionChainComponents" : false,
11+
"lineBreakBeforeControlFlowKeywords" : false,
12+
"lineBreakBeforeEachArgument" : true,
13+
"lineBreakBeforeEachGenericRequirement" : false,
14+
"lineLength" : 120,
15+
"maximumBlankLines" : 1,
16+
"multiElementCollectionTrailingCommas" : true,
17+
"noAssignmentInExpressions" : {
18+
"allowedFunctions" : [
19+
"XCTAssertNoThrow"
20+
]
21+
},
22+
"prioritizeKeepingFunctionOutputTogether" : false,
23+
"respectsExistingLineBreaks" : true,
24+
"rules" : {
25+
"AllPublicDeclarationsHaveDocumentation" : false,
26+
"AlwaysUseLiteralForEmptyCollectionInit" : false,
27+
"AlwaysUseLowerCamelCase" : false,
28+
"AmbiguousTrailingClosureOverload" : true,
29+
"BeginDocumentationCommentWithOneLineSummary" : false,
30+
"DoNotUseSemicolons" : true,
31+
"DontRepeatTypeInStaticProperties" : true,
32+
"FileScopedDeclarationPrivacy" : true,
33+
"FullyIndirectEnum" : true,
34+
"GroupNumericLiterals" : true,
35+
"IdentifiersMustBeASCII" : true,
36+
"NeverForceUnwrap" : false,
37+
"NeverUseForceTry" : false,
38+
"NeverUseImplicitlyUnwrappedOptionals" : false,
39+
"NoAccessLevelOnExtensionDeclaration" : true,
40+
"NoAssignmentInExpressions" : true,
41+
"NoBlockComments" : true,
42+
"NoCasesWithOnlyFallthrough" : true,
43+
"NoEmptyTrailingClosureParentheses" : true,
44+
"NoLabelsInCasePatterns" : true,
45+
"NoLeadingUnderscores" : false,
46+
"NoParensAroundConditions" : true,
47+
"NoPlaygroundLiterals" : true,
48+
"NoVoidReturnOnFunctionSignature" : true,
49+
"OmitExplicitReturns" : false,
50+
"OneCasePerLine" : true,
51+
"OneVariableDeclarationPerLine" : true,
52+
"OnlyOneTrailingClosureArgument" : true,
53+
"OrderedImports" : true,
54+
"ReplaceForEachWithForLoop" : true,
55+
"ReturnVoidInsteadOfEmptyTuple" : true,
56+
"TypeNamesShouldBeCapitalized" : true,
57+
"UseEarlyExits" : false,
58+
"UseExplicitNilCheckInConditions" : true,
59+
"UseLetInEveryBoundCaseVariable" : false,
60+
"UseShorthandTypeNames" : true,
61+
"UseSingleLinePropertyGetter" : true,
62+
"UseSynthesizedInitializer" : true,
63+
"UseTripleSlashForDocumentationComments" : true,
64+
"UseWhereClausesInForLoops" : false,
65+
"ValidateDocumentationComments" : false
66+
},
67+
"spacesAroundRangeFormationOperators" : false,
68+
"tabWidth" : 8,
69+
"version" : 1
70+
}

.swiftformatignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Sources/Helpers/Vendor/*
2+
Sources/AsyncProcess/ProcessExecutor.swift

.unacceptablelanguageignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Sources/AsyncProcess/ProcessExecutor.swift
2+
Tests/AsyncProcessTests/IntegrationTests.swift

CONTRIBUTING.md

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -58,29 +58,6 @@ We require that your commit messages match our template. The easiest way to do t
5858

5959
git config commit.template Utilities/git.commit.template
6060

61-
### Run `./Utilities/soundness.sh`
62-
63-
The scripts directory contains a [`soundness.sh` script](https://github.com/apple/swift-sdk-generator/blob/main/Utilities/soundness.sh)
64-
that enforces additional checks, like license headers and formatting style.
65-
66-
Please make sure to run `./Utilities/soundness.sh` before pushing a change upstream, otherwise it is likely the PR validation will fail
67-
on minor changes such as formatting issues.
68-
69-
For frequent contributors, we recommend adding the script as a [git pre-push hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks), which you can do via executing the following command in the project root directory:
70-
71-
```bash
72-
cat << EOF > .git/hooks/pre-push
73-
74-
if [[ -f "Utilities/soundness.sh" ]]; then
75-
Utilities/soundness.sh
76-
fi
77-
EOF
78-
```
79-
80-
Which makes the script execute, and only allow the `git push` to complete if the check has passed.
81-
82-
In the case of formatting issues, you can then `git add` the formatting changes, and attempt the push again.
83-
8461
## How to contribute your work
8562

86-
Please open a pull request at https://github.com/apple/swift-sdk-generator. Make sure the CI passes, and then wait for code review.
63+
Please open a pull request at https://github.com/apple/swift-sdk-generator. Make sure the CI passes, and then wait for code review.

Docker/docker-compose.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ services:
1919
- ..:/code:z
2020
working_dir: /code
2121

22-
soundness:
23-
<<: *common
24-
command: /bin/bash -xcl "swift -version && uname -a && ./Utilities/soundness.sh"
25-
2622
test:
2723
<<: *common
2824
environment:

Package.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version: 5.8
1+
// swift-tools-version: 5.9
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
@@ -11,7 +11,7 @@ let package = Package(
1111
.executable(
1212
name: "swift-sdk-generator",
1313
targets: ["GeneratorCLI"]
14-
),
14+
)
1515
],
1616
targets: [
1717
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
@@ -23,7 +23,7 @@ let package = Package(
2323
.product(name: "ArgumentParser", package: "swift-argument-parser"),
2424
],
2525
swiftSettings: [
26-
.enableExperimentalFeature("StrictConcurrency=complete"),
26+
.enableExperimentalFeature("StrictConcurrency=complete")
2727
]
2828
),
2929
.target(
@@ -38,22 +38,22 @@ let package = Package(
3838
],
3939
exclude: ["Dockerfiles"],
4040
swiftSettings: [
41-
.enableExperimentalFeature("StrictConcurrency=complete"),
41+
.enableExperimentalFeature("StrictConcurrency=complete")
4242
]
4343
),
4444
.testTarget(
4545
name: "SwiftSDKGeneratorTests",
4646
dependencies: [
47-
"SwiftSDKGenerator",
47+
"SwiftSDKGenerator"
4848
],
4949
swiftSettings: [
50-
.enableExperimentalFeature("StrictConcurrency=complete"),
50+
.enableExperimentalFeature("StrictConcurrency=complete")
5151
]
5252
),
5353
.testTarget(
5454
name: "GeneratorEngineTests",
5555
dependencies: [
56-
"Helpers",
56+
"Helpers"
5757
]
5858
),
5959
.target(
@@ -66,13 +66,13 @@ let package = Package(
6666
],
6767
exclude: ["Vendor/README.md"],
6868
swiftSettings: [
69-
.enableExperimentalFeature("StrictConcurrency=complete"),
69+
.enableExperimentalFeature("StrictConcurrency=complete")
7070
]
7171
),
7272
.testTarget(
7373
name: "HelpersTests",
7474
dependencies: [
75-
"Helpers",
75+
"Helpers"
7676
]
7777
),
7878
.systemLibrary(name: "SystemSQLite", pkgConfig: "sqlite3"),

README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ The generator also allows cross-compiling between any Linux distributions offici
5454
| macOS (arm64) | ✅ macOS 13.0+ ||
5555
| macOS (x86_64) | ✅ macOS 13.0+[^1] ||
5656
| Ubuntu | ✅ 20.04+ | ✅ 20.04+ |
57-
| RHEL | ✅ Fedora 39[^2], UBI 9 | ✅ UBI 9 |
57+
| Debian | ✅ 11, 12[^2] | ✅ 11, 12[^2] |
58+
| RHEL | ✅ Fedora 39, UBI 9 | ✅ Fedora 39, UBI 9[^3] |
5859
| Amazon Linux 2 | ✅ Supported | ✅ Supported[^3] |
59-
| Debian 12 | ✅ Supported[^2] | ✅ Supported[^2][^3] |
6060

6161
[^1]: Since LLVM project doesn't provide pre-built binaries of `lld` for macOS on x86_64, it will be automatically built
6262
from sources by the generator, which will increase its run by at least 15 minutes on recent hardware. You will also
6363
need CMake and Ninja preinstalled (e.g. via `brew install cmake ninja`).
64-
[^2]: These distributions are only supported by Swift 5.10.1 and later as both host and target platforms.
64+
[^2]: Swift does not officially support Debian 11 or Debian 12 with Swift versions before 5.10.1. However, the Ubuntu 20.04/22.04 toolchains can be used with Debian 11 and 12 (respectively) since they are binary compatible.
6565
[^3]: These versions are technically supported but require custom commands and a Docker container to build the Swift SDK, as the generator will not download dependencies for these distributions automatically. See [issue #138](https://github.com/swiftlang/swift-sdk-generator/issues/138).
6666

6767
## How to use it
@@ -94,7 +94,7 @@ subsequently as `<generated_sdk_id>`.
9494
Create a new project to verify that the SDK works:
9595

9696
```
97-
mkdir cross-compilation test
97+
mkdir cross-compilation-test
9898
cd cross-compilation-test
9999
swift package init --type executable
100100
```
@@ -185,6 +185,19 @@ The `.artifactbundle` directory produced in the previous section can be packaged
185185
in this form. Users of such Swift SDK bundle archive can easily install it with `swift sdk install`
186186
command, which supports both local file system paths and public `http://` and `https://` URLs as an argument.
187187

188+
To make an `.artifactbundle.tar.gz` archive installable directly from `http://` and `https://` URLs, a checksum must be
189+
generated. This can be done using the `swift package compute-checksum` command, like this:
190+
191+
```console
192+
swift package compute-checksum ./Bundles/6.1-RELEASE_ubuntu_jammy_x86_64.artifactbundle.tar.gz
193+
<checksum>
194+
```
195+
196+
This checksum should be provided along with the artifact bundles to be included with the sdk install invocation:
197+
198+
```console
199+
swift sdk install https://my-public-site/sdks/6.1-RELEASE_ubuntu_jammy_x86_64.artifactbundle.tar.gz --checksum <checksum>
200+
```
188201

189202
## Contributing
190203

0 commit comments

Comments
 (0)