Skip to content

Commit 0d85ffb

Browse files
committed
Package product installable on macOS 11
1 parent b8ffa4f commit 0d85ffb

File tree

5 files changed

+102
-17
lines changed

5 files changed

+102
-17
lines changed

.github/workflows/ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ '*' ]
6+
7+
jobs:
8+
build:
9+
runs-on: macos-11
10+
env:
11+
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Build
16+
run: make build
17+
18+
test:
19+
runs-on: macos-11
20+
env:
21+
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
- name: Test
26+
run: make test
27+
28+
install:
29+
runs-on: macos-11
30+
env:
31+
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app/Contents/Developer
32+
33+
steps:
34+
- uses: actions/checkout@v2
35+
- name: Install
36+
run: make install
37+
- name: Uninstall
38+
run: make uninstall

Makefile

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,37 @@
1+
SHELL = /bin/bash
2+
3+
prefix ?= /usr/local
4+
bindir ?= $(prefix)/bin
5+
libdir ?= $(prefix)/lib
6+
srcdir = Sources
7+
8+
REPODIR = $(shell pwd)
9+
BUILDDIR = $(REPODIR)/.build
10+
SOURCES = $(wildcard $(srcdir)/**/*.swift)
11+
12+
.DEFAULT_GOAL = all
13+
114
build:
215
swift build -c release
316

417
test:
518
swift test
619

7-
install: build
8-
install "$(shell swift build -c release --show-bin-path)/swift-release-notes" /usr/local/bin/
20+
swift-release-notes: $(SOURCES)
21+
@swift build \
22+
-c release \
23+
--disable-sandbox \
24+
--build-path "$(BUILDDIR)"
25+
26+
.PHONY: install
27+
install: swift-release-notes
28+
@install -d "$(bindir)"
29+
@install "$(wildcard $(BUILDDIR)/**/release/swift-release-notes)" "$(bindir)"
30+
31+
.PHONY: uninstall
32+
uninstall:
33+
@rm -rf "$(bindir)/swift-release-notes"
34+
35+
.PHONY: clean
36+
distclean:
37+
@rm -f $(BUILDDIR)/release

Package.swift

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import PackageDescription
66
let package = Package(
77
name: "swift-release-notes",
88
platforms: [
9-
.macOS(.v12)
9+
.macOS(.v11),
10+
],
11+
products: [
12+
.executable(name: "swift-release-notes", targets: ["swift-release-notes"]),
1013
],
1114
dependencies: [
1215
.package(name: "SemanticVersion",
@@ -16,22 +19,25 @@ let package = Package(
1619
url: "https://github.com/apple/swift-argument-parser",
1720
from: "1.0.0"),
1821
.package(name: "swift-parsing",
19-
url: "https://github.com/pointfreeco/swift-parsing",
20-
from: "0.4.1")
22+
url: "https://github.com/pointfreeco/swift-parsing",
23+
from: "0.4.1"),
2124
],
2225
targets: [
2326
.executableTarget(
2427
name: "swift-release-notes",
25-
dependencies: ["ReleaseNotesCore"]),
28+
dependencies: ["ReleaseNotesCore"]
29+
),
2630
.target(
2731
name: "ReleaseNotesCore",
2832
dependencies: [
2933
.product(name: "ArgumentParser", package: "swift-argument-parser"),
3034
.product(name: "Parsing", package: "swift-parsing"),
31-
"SemanticVersion"
32-
]),
35+
"SemanticVersion",
36+
]
37+
),
3338
.testTarget(
3439
name: "ReleaseNotesCoreTests",
35-
dependencies: ["ReleaseNotesCore"]),
40+
dependencies: ["ReleaseNotesCore"]
41+
),
3642
]
3743
)

README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,23 @@ https://github.com/apple/swift-driver/releases (main)
2424
https://github.com/apple/swift-nio/releases (2.36.0)
2525
```
2626

27-
##
27+
## Installation
28+
### Using [Mint](https://github.com/yonaskolb/mint)
2829

29-
To install:
30+
```
31+
$ mint install SwiftPackageIndex/ReleaseNotes
32+
```
33+
34+
### Installing from source
35+
36+
You can also build and install from source by cloning this project and running
37+
`make install` (macOS 11 or later).
3038

31-
- clone this repository
32-
- run `make install` to build and install the executable in `/usr/local/bin`
39+
Manually
40+
Run the following commands to build and install manually:
41+
42+
```
43+
$ git clone https://github.com/SwiftPackageIndex/ReleaseNotes.git
44+
$ cd ReleaseNotes
45+
$ make install
46+
```

Sources/ReleaseNotesCore/ParsableCommand+async.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@
22

33
import ArgumentParser
44

5-
6-
@available(macOS 12.0, *)
5+
@available(macOS 11.0, *)
76
protocol AsyncParsableCommand: ParsableCommand {
87
mutating func runAsync() async throws
98
}
109

11-
1210
extension ParsableCommand {
1311
static func main(_ arguments: [String]? = nil) async {
1412
do {
1513
var command = try parseAsRoot(arguments)
16-
if #available(macOS 12.0, *), var asyncCommand = command as? AsyncParsableCommand {
14+
if #available(macOS 11.0, *), var asyncCommand = command as? AsyncParsableCommand {
1715
try await asyncCommand.runAsync()
1816
} else {
1917
try command.run()

0 commit comments

Comments
 (0)