Skip to content

Commit 4f45a19

Browse files
authored
Merge pull request #1 from iCharlesHu/charles/introduce-subprocess
Introducing Subprocess
2 parents 0637f28 + de15b67 commit 4f45a19

Some content is hidden

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

42 files changed

+39195
-1
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve Subprocess
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. What executable was running?
16+
2. What arguments are passed in?
17+
3. What environment values are used?
18+
19+
**Expected behavior**
20+
A clear and concise description of what you expected to happen.
21+
22+
**Environment (please complete the following information):**
23+
- OS [e.g. macOS 15]
24+
- Swift version (run `swift --version`) [e.g. swiftlang-6.2.0.1.23 clang-1700.3.1.3]
25+
26+
**Additional context**
27+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for Subprocess future directions
4+
title: "[Feature] Feature Request"
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.gitignore

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Xcode
2+
#
3+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4+
5+
**/.DS_Store
6+
7+
## User settings
8+
xcuserdata/
9+
10+
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
11+
*.xcscmblueprint
12+
*.xccheckout
13+
14+
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
15+
build/
16+
DerivedData/
17+
*.moved-aside
18+
*.pbxuser
19+
!default.pbxuser
20+
*.mode1v3
21+
!default.mode1v3
22+
*.mode2v3
23+
!default.mode2v3
24+
*.perspectivev3
25+
!default.perspectivev3
26+
27+
## Obj-C/Swift specific
28+
*.hmap
29+
30+
## App packaging
31+
*.ipa
32+
*.dSYM.zip
33+
*.dSYM
34+
35+
## Playgrounds
36+
timeline.xctimeline
37+
playground.xcworkspace
38+
39+
# Swift Package Manager
40+
#
41+
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
42+
# Packages/
43+
# Package.pins
44+
# Package.resolved
45+
# *.xcodeproj
46+
#
47+
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
48+
# hence it is not needed unless you have added a package configuration file to your project
49+
# .swiftpm
50+
51+
.build/
52+
53+
# CocoaPods
54+
#
55+
# We recommend against adding the Pods directory to your .gitignore. However
56+
# you should judge for yourself, the pros and cons are mentioned at:
57+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
58+
#
59+
# Pods/
60+
#
61+
# Add this line if you want to avoid checking in source code from the Xcode workspace
62+
# *.xcworkspace
63+
64+
# Carthage
65+
#
66+
# Add this line if you want to avoid checking in source code from Carthage dependencies.
67+
# Carthage/Checkouts
68+
69+
Carthage/Build/
70+
71+
# Accio dependency management
72+
Dependencies/
73+
.accio/
74+
75+
# fastlane
76+
#
77+
# It is recommended to not store the screenshots in the git repo.
78+
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
79+
# For more information about the recommended setup visit:
80+
# https://docs.fastlane.tools/best-practices/source-control/#source-control
81+
82+
fastlane/report.xml
83+
fastlane/Preview.html
84+
fastlane/screenshots/**/*.png
85+
fastlane/test_output
86+
87+
# Code Injection
88+
#
89+
# After new code Injection tools there's a generated folder /iOSInjectionProject
90+
# https://github.com/johnno1962/injectionforxcode
91+
92+
iOSInjectionProject/

.spi.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
version: 1
2+
builder:
3+
configs:
4+
- documentation_targets: [Subprocess]

CODEOWNERS

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

CODE_OF_CONDUCT.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Code of Conduct
2+
3+
The code of conduct for this project can be found at https://swift.org/code-of-conduct.
4+
5+
<!-- Copyright (c) 2025 Apple Inc and the Swift Project authors. All Rights Reserved. -->

CONTRIBUTING.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
By submitting a pull request, you represent that you have the right to license
2+
your contribution to Apple and the community, and agree by submitting the patch
3+
that your contributions are licensed under the [Swift
4+
license](https://swift.org/LICENSE.txt).
5+
6+
---
7+
8+
Before submitting the pull request, please make sure you have tested your
9+
changes and that they follow the Swift project [guidelines for contributing
10+
code](https://swift.org/contributing/#contributing-code).

Package.swift

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
// swift-tools-version: 6.1
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let availabilityMacro: SwiftSetting = .enableExperimentalFeature(
7+
"AvailabilityMacro=SubprocessSpan: macOS 9999",
8+
)
9+
10+
var dep: [Package.Dependency] = [
11+
.package(
12+
url: "https://github.com/apple/swift-system",
13+
from: "1.0.0"
14+
)
15+
]
16+
#if !os(Windows)
17+
dep.append(
18+
.package(
19+
url: "https://github.com/apple/swift-docc-plugin",
20+
from: "1.4.3"
21+
),
22+
)
23+
#endif
24+
25+
// Enable SubprocessFoundation by default
26+
var defaultTraits: Set<String> = ["SubprocessFoundation"]
27+
#if compiler(>=6.2)
28+
// Enable SubprocessSpan when Span is available
29+
defaultTraits.insert("SubprocessSpan")
30+
#endif
31+
32+
let package = Package(
33+
name: "Subprocess",
34+
platforms: [.macOS(.v13)],
35+
products: [
36+
.library(
37+
name: "Subprocess",
38+
targets: ["Subprocess"]
39+
)
40+
],
41+
traits: [
42+
"SubprocessFoundation",
43+
"SubprocessSpan",
44+
.default(
45+
enabledTraits: defaultTraits
46+
),
47+
],
48+
dependencies: dep,
49+
targets: [
50+
.target(
51+
name: "Subprocess",
52+
dependencies: [
53+
"_SubprocessCShims",
54+
.product(name: "SystemPackage", package: "swift-system"),
55+
],
56+
path: "Sources/Subprocess",
57+
swiftSettings: [
58+
.enableExperimentalFeature("StrictConcurrency"),
59+
.enableExperimentalFeature("NonescapableTypes"),
60+
.enableExperimentalFeature("LifetimeDependence"),
61+
.enableExperimentalFeature("Span"),
62+
availabilityMacro,
63+
]
64+
),
65+
.testTarget(
66+
name: "SubprocessTests",
67+
dependencies: [
68+
"_SubprocessCShims",
69+
"Subprocess",
70+
"TestResources",
71+
.product(name: "SystemPackage", package: "swift-system"),
72+
],
73+
swiftSettings: [
74+
.enableExperimentalFeature("Span"),
75+
availabilityMacro,
76+
]
77+
),
78+
79+
.target(
80+
name: "TestResources",
81+
dependencies: [
82+
.product(name: "SystemPackage", package: "swift-system")
83+
],
84+
path: "Tests/TestResources",
85+
resources: [
86+
.copy("Resources")
87+
]
88+
),
89+
90+
.target(
91+
name: "_SubprocessCShims",
92+
path: "Sources/_SubprocessCShims"
93+
),
94+
]
95+
)

[email protected]

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
// swift-tools-version: 6.0
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let availabilityMacro: SwiftSetting = .enableExperimentalFeature(
7+
"AvailabilityMacro=SubprocessSpan: macOS 9999"
8+
)
9+
10+
let package = Package(
11+
name: "Subprocess",
12+
platforms: [.macOS(.v13)],
13+
products: [
14+
.library(
15+
name: "Subprocess",
16+
targets: ["Subprocess"]
17+
)
18+
],
19+
dependencies: [
20+
.package(
21+
url: "https://github.com/apple/swift-system",
22+
from: "1.0.0"
23+
),
24+
.package(
25+
url: "https://github.com/apple/swift-docc-plugin",
26+
from: "1.4.3"
27+
),
28+
],
29+
targets: [
30+
.target(
31+
name: "Subprocess",
32+
dependencies: [
33+
"_SubprocessCShims",
34+
.product(name: "SystemPackage", package: "swift-system"),
35+
],
36+
path: "Sources/Subprocess",
37+
exclude: [
38+
"Span+Subprocess.swift",
39+
"SubprocessFoundation/Span+SubprocessFoundation.swift",
40+
],
41+
swiftSettings: [
42+
.enableExperimentalFeature("StrictConcurrency"),
43+
.define("SubprocessFoundation"),
44+
availabilityMacro,
45+
]
46+
),
47+
.testTarget(
48+
name: "SubprocessTests",
49+
dependencies: [
50+
"_SubprocessCShims",
51+
"Subprocess",
52+
"TestResources",
53+
.product(name: "SystemPackage", package: "swift-system"),
54+
],
55+
swiftSettings: [
56+
availabilityMacro
57+
]
58+
),
59+
60+
.target(
61+
name: "TestResources",
62+
dependencies: [
63+
.product(name: "SystemPackage", package: "swift-system")
64+
],
65+
path: "Tests/TestResources",
66+
resources: [
67+
.copy("Resources")
68+
]
69+
),
70+
71+
.target(
72+
name: "_SubprocessCShims",
73+
path: "Sources/_SubprocessCShims"
74+
),
75+
]
76+
)

0 commit comments

Comments
 (0)