Skip to content

Commit 4d11500

Browse files
committed
build: added developing with VSCode support
1 parent 3f3dd36 commit 4d11500

7 files changed

Lines changed: 119 additions & 21 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "Swift",
3+
"image": "swift:5.6-focal",
4+
"features": {
5+
"ghcr.io/devcontainers/features/common-utils:2": {
6+
"installZsh": "false",
7+
"username": "vscode",
8+
"userUid": "1000",
9+
"userGid": "1000",
10+
"upgradePackages": "false"
11+
},
12+
"ghcr.io/devcontainers/features/git:1": {
13+
"version": "os-provided",
14+
"ppa": "false"
15+
}
16+
},
17+
"runArgs": [
18+
"--cap-add=SYS_PTRACE",
19+
"--security-opt",
20+
"seccomp=unconfined"
21+
],
22+
// Configure tool-specific properties.
23+
"customizations": {
24+
// Configure properties specific to VS Code.
25+
"vscode": {
26+
// Set *default* container specific settings.json values on container create.
27+
"settings": {
28+
"lldb.library": "/usr/lib/liblldb.so"
29+
},
30+
// Add the IDs of extensions you want installed when the container is created.
31+
"extensions": [
32+
"sswg.swift-lang",
33+
"vadimcn.vscode-lldb"
34+
]
35+
}
36+
},
37+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
38+
"forwardPorts": [8080],
39+
40+
// Use 'postCreateCommand' to run commands after the container is created.
41+
"postCreateCommand": "swift --version",
42+
43+
// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
44+
"remoteUser": "vscode"
45+
}

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"sswg.swift-lang",
4+
"vadimcn.vscode-lldb",
5+
"ms-vscode-remote.vscode-remote-extensionpack"
6+
]
7+
}

.vscode/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,14 @@
55
"**/.docc-build": true,
66
"**/node_modules": true,
77
"Package.resolved": true
8+
},
9+
"swift.swiftEnvironmentVariables": {
10+
"ASYNCOBJECTS_ENABLE_DEV": "1",
11+
"ASYNCOBJECTS_USE_CHECKEDCONTINUATION": "1",
12+
"SWIFTCI_CONCURRENCY_CHECKS": "1",
13+
"ASYNCOBJECTS_ENABLE_LOGGING_LEVEL": "INFO"
14+
},
15+
"swift.testEnvironmentVariables": {
16+
"LIBDISPATCH_COOPERATIVE_POOL_STRICT": "1"
817
}
918
}

.vscode/tasks.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "swift",
6+
"args": [
7+
"build",
8+
"--build-tests"
9+
],
10+
"cwd": ".",
11+
"problemMatcher": [
12+
"$swiftc"
13+
],
14+
"group": {
15+
"kind": "build",
16+
"isDefault": true
17+
},
18+
"label": "swift: Build All",
19+
"detail": "swift build --build-tests"
20+
}
21+
]
22+
}

Package.swift

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,29 @@
33
import PackageDescription
44
import class Foundation.ProcessInfo
55

6-
var dependencies: [Target.Dependency] = {
6+
let packages: [Package.Dependency] = {
7+
var dependencies: [Package.Dependency] = [
8+
.package(url: "https://github.com/apple/swift-collections.git", from: "1.0.0"),
9+
.package(url: "https://github.com/apple/swift-async-algorithms", from: "0.1.0"),
10+
]
11+
12+
if ProcessInfo.processInfo.environment["ASYNCOBJECTS_ENABLE_DEV"] != nil {
13+
dependencies.append(contentsOf: [
14+
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
15+
.package(url: "https://github.com/apple/swift-format", from: "0.50700.0"),
16+
])
17+
}
18+
19+
if ProcessInfo.processInfo.environment["ASYNCOBJECTS_ENABLE_LOGGING_LEVEL"] != nil {
20+
dependencies.append(
21+
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0")
22+
)
23+
}
24+
25+
return dependencies
26+
}()
27+
28+
let dependencies: [Target.Dependency] = {
729
var dependencies: [Target.Dependency] = [
830
.product(name: "OrderedCollections", package: "swift-collections"),
931
.product(name: "AsyncAlgorithms", package: "swift-async-algorithms"),
@@ -16,7 +38,7 @@ var dependencies: [Target.Dependency] = {
1638
return dependencies
1739
}()
1840

19-
var settings: [SwiftSetting] = {
41+
let settings: [SwiftSetting] = {
2042
var settings: [SwiftSetting] = []
2143

2244
if ProcessInfo.processInfo.environment["SWIFTCI_CONCURRENCY_CHECKS"] != nil {
@@ -26,7 +48,7 @@ var settings: [SwiftSetting] = {
2648
"-warn-concurrency",
2749
"-enable-actor-data-race-checks",
2850
"-require-explicit-sendable",
29-
"-strict-concurrency=complete"
51+
// "-strict-concurrency=complete"
3052
])
3153
)
3254
}
@@ -63,13 +85,7 @@ let package = Package(
6385
products: [
6486
.library(name: "AsyncObjects", targets: ["AsyncObjects"]),
6587
],
66-
dependencies: [
67-
.package(url: "https://github.com/apple/swift-collections.git", from: "1.0.0"),
68-
.package(url: "https://github.com/apple/swift-async-algorithms", from: "0.1.0"),
69-
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
70-
.package(url: "https://github.com/apple/swift-format", from: "0.50700.0"),
71-
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
72-
],
88+
dependencies: packages,
7389
targets: [
7490
.target(name: "AsyncObjects", dependencies: dependencies, swiftSettings: settings),
7591
.testTarget(name: "AsyncObjectsTests", dependencies: ["AsyncObjects"]),

Sources/AsyncObjects/CancellationSource/Cancellable.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ extension Task: Cancellable {
109109
/// explicitly as it defaults to `#line`).
110110
///
111111
/// - Throws: If waiting for the work completes with an error.
112-
@inlinable
113112
func waitHandlingCancelation(
114113
for work: Cancellable,
115114
associatedId id: UUID,

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
"swiftylab-ci": "github:SwiftyLab/ci"
2020
},
2121
"scripts": {
22-
"build": "npm exec --package=swiftylab-ci -- build.js",
23-
"xcodebuild": "npm exec --package=swiftylab-ci -- xcodebuild.js",
24-
"test": "ASYNCOBJECTS_ENABLE_LOGGING_LEVEL=info npm exec --package=swiftylab-ci -- test.js --parallel",
25-
"archive": "npm exec --package=swiftylab-ci -- archive.js",
26-
"pod-lint": "npm exec --package=swiftylab-ci -- pod-lint.js",
27-
"generate": "npm exec --package=swiftylab-ci -- generate.js",
28-
"format": "npm exec --package=swiftylab-ci -- format.js",
29-
"preview-doc": "npm exec --package=swiftylab-ci -- preview-doc.js AsyncObjects",
30-
"build-doc": "npm exec --package=swiftylab-ci -- build-doc.js AsyncObjects",
31-
"serve-doc": "npm exec --package=swiftylab-ci -- serve-doc.js AsyncObjects"
22+
"build": "cross-env ASYNCOBJECTS_ENABLE_DEV=1 SWIFTCI_CONCURRENCY_CHECKS=1 npm exec --package=swiftylab-ci -- build.js",
23+
"xcodebuild": "cross-env ASYNCOBJECTS_ENABLE_DEV=1 npm exec --package=swiftylab-ci -- xcodebuild.js",
24+
"test": "cross-env ASYNCOBJECTS_ENABLE_DEV=1 ASYNCOBJECTS_USE_CHECKEDCONTINUATION=1 ASYNCOBJECTS_ENABLE_LOGGING_LEVEL=info npm exec --package=swiftylab-ci -- test.js --parallel",
25+
"archive": "cross-env ASYNCOBJECTS_ENABLE_DEV=1 npm exec --package=swiftylab-ci -- archive.js",
26+
"pod-lint": "cross-env ASYNCOBJECTS_ENABLE_DEV=1 npm exec --package=swiftylab-ci -- pod-lint.js",
27+
"generate": "cross-env ASYNCOBJECTS_ENABLE_DEV=1 npm exec --package=swiftylab-ci -- generate.js",
28+
"format": "cross-env ASYNCOBJECTS_ENABLE_DEV=1 npm exec --package=swiftylab-ci -- format.js",
29+
"preview-doc": "cross-env ASYNCOBJECTS_ENABLE_DEV=1 npm exec --package=swiftylab-ci -- preview-doc.js AsyncObjects",
30+
"build-doc": "cross-env ASYNCOBJECTS_ENABLE_DEV=1 npm exec --package=swiftylab-ci -- build-doc.js AsyncObjects",
31+
"serve-doc": "cross-env ASYNCOBJECTS_ENABLE_DEV=1 npm exec --package=swiftylab-ci -- serve-doc.js AsyncObjects"
3232
}
3333
}

0 commit comments

Comments
 (0)