Skip to content

Commit 8077715

Browse files
committed
Update Fastlane documentation scripts
1 parent 82124aa commit 8077715

File tree

4 files changed

+90
-17
lines changed

4 files changed

+90
-17
lines changed

Fastlane/Fastfile

+79-16
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ default_platform :ios
44

55
platform :ios do
66

7-
8-
# Documentation ==============
9-
10-
desc "Build documentation"
11-
lane :documentation do |options|
12-
sh('cd .. && fastlane/build-documentation.sh')
13-
end
14-
157

168
# Lint =======================
179

@@ -45,21 +37,92 @@ platform :ios do
4537
desc "Create a new version"
4638
lane :version do |options|
4739
ensure_release_ready
48-
4940
documentation
5041

5142
bump_type = options[:type]
52-
if bump_type == nil or bump_type.empty?
53-
bump_type = "patch"
54-
end
55-
56-
version = version_bump_podspec(path: "KeyboardKit.podspec", bump_type: bump_type)
43+
version = version_bump_podspec(
44+
path: "KeyboardKit.podspec",
45+
bump_type: bump_type)
46+
5747
git_commit(path: "*", message: "Bump to #{version}")
58-
5948
add_git_tag(tag: version)
6049
push_git_tags()
6150
push_to_git_remote()
6251
pod_push()
6352
end
64-
53+
54+
55+
# Docs =======================
56+
57+
desc "Build documentation for all platforms"
58+
lane :docc do
59+
sh('cd .. && rm -rf Docs')
60+
docc_platform(destination: 'iOS', name: 'ios')
61+
docc_platform(destination: 'OS X', name: 'osx')
62+
docc_platform(destination: 'tvOS', name: 'tvos')
63+
docc_platform(destination: 'watchOS', name: 'watchos')
64+
end
65+
66+
desc "Build documentation for a single platform"
67+
lane :docc_platform do |values|
68+
sh('cd .. && mkdir -p Docs')
69+
docc_delete_derived_data
70+
sh('cd .. && xcodebuild docbuild \
71+
-scheme KeyboardKit \
72+
-destination \'generic/platform=' + values[:destination] + '\'')
73+
sh('cd .. && \
74+
find ~/Library/Developer/Xcode/DerivedData \
75+
-name "KeyboardKit.doccarchive" \
76+
-exec cp -R {} Docs \;')
77+
sh('cd .. && \
78+
mv Docs/KeyboardKit.doccarchive Docs/KeyboardKit_' + values[:name] + '.doccarchive')
79+
end
80+
81+
desc "Delete documentation derived data (may be historic duplicates)"
82+
lane :docc_delete_derived_data do
83+
sh('find ~/Library/Developer/Xcode/DerivedData \
84+
-name "KeyboardKit.doccarchive" \
85+
-exec rm -Rf {} \; || true')
86+
end
87+
88+
desc "Build static documentation websites for all platforms"
89+
lane :docc_web do
90+
docc
91+
docc_web_platform(name: 'ios')
92+
docc_web_platform(name: 'osx')
93+
docc_web_platform(name: 'tvos')
94+
docc_web_platform(name: 'watchos')
95+
end
96+
97+
desc "Build static documentation website for a single platform"
98+
lane :docc_web_platform do |values|
99+
sh('cd .. && $(xcrun --find docc) process-archive \
100+
transform-for-static-hosting Docs/KeyboardKit_' + values[:name] + '.doccarchive \
101+
--output-path Docs/web_' + values[:name] + ' \
102+
--hosting-base-path KeyboardKit')
103+
end
104+
105+
desc "Build static web documentation (macOS only)"
106+
lane :docc_web_plugin do
107+
sh('cd .. && mkdir -p Docs')
108+
sh('cd .. && swift package \
109+
--allow-writing-to-directory Docs \
110+
generate-documentation \
111+
--disable-indexing \
112+
--transform-for-static-hosting \
113+
--hosting-base-path KeyboardKit \
114+
--output-path Docs/web')
115+
end
116+
117+
desc "Build and preview static documentation website (macOS only)"
118+
lane :docc_webpreview_plugin do
119+
sh('cd .. && mkdir -p Docs')
120+
sh('cd .. && swift package \
121+
--disable-sandbox \
122+
preview-documentation \
123+
--transform-for-static-hosting \
124+
--hosting-base-path KeyboardKit \
125+
--output-path Docs/web')
126+
end
127+
65128
end

Package.resolved

+9
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@
4545
"revision": "1efe9551db0ad6a6e979f33366969750123d14d9",
4646
"version": null
4747
}
48+
},
49+
{
50+
"package": "SwiftDocCPlugin",
51+
"repositoryURL": "https://github.com/apple/swift-docc-plugin",
52+
"state": {
53+
"branch": null,
54+
"revision": "3303b164430d9a7055ba484c8ead67a52f7b74f6",
55+
"version": "1.0.0"
56+
}
4857
}
4958
]
5059
},

Package.swift

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ let package = Package(
1717
targets: ["KeyboardKit"])
1818
],
1919
dependencies: [
20+
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
2021
.package(url: "https://github.com/danielsaidi/Quick.git", .branch("main")), // .upToNextMajor(from: "4.0.0")),
2122
.package(url: "https://github.com/danielsaidi/Nimble.git", .branch("main")), // .upToNextMajor(from: "9.0.0")),
2223
.package(url: "https://github.com/danielsaidi/MockingKit.git", .upToNextMajor(from: "1.0.0"))

Tests/KeyboardKitTests/Localization/KKL10nTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class KKL10nTests: QuickSpec {
1717
override func spec() {
1818

1919
describe("bundle path for locale") {
20-
20+
2121
it("is valid for all keyboard locales") {
2222
KeyboardLocale.allCases.forEach {
2323
let bundle = Bundle.module

0 commit comments

Comments
 (0)