Skip to content

Commit 4f8f0d5

Browse files
authored
Merge pull request #54 from orchetect/addressspace-custom-type
AddressSpace Custom Method ID Type
2 parents 48d2db3 + 1b5dae3 commit 4f8f0d5

55 files changed

Lines changed: 1814 additions & 931 deletions

File tree

Some content is hidden

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

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ on:
2121

2222
workflow_dispatch:
2323

24-
# schedule:
25-
# - cron: '40 11 * * *' # once a day @ 11:40am UTC (4:40am PST)
24+
schedule:
25+
- cron: '40 11 * * *' # once a day @ 11:40am UTC (4:40am PST)
2626

2727
env:
2828
SCHEME: "OSCKit"

.spi.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ version: 1
22
builder:
33
configs:
44
- platform: macosSpm
5-
scheme: OSCKit-CI
5+
scheme: OSCKit
66
- platform: macosXcodebuild
7-
scheme: OSCKit-CI
7+
scheme: OSCKit
88
- platform: iOS
9-
scheme: OSCKit-CI
9+
scheme: OSCKit
1010
- platform: tvOS
11-
scheme: OSCKit-CI
11+
scheme: OSCKit
1212
- platform: watchOS
1313
scheme: NOT-SUPPORTED
1414
- platform: visionOS
15-
scheme: OSCKit-CI
15+
scheme: OSCKit
1616
external_links:
1717
documentation: "https://orchetect.github.io/OSCKit/"

Docs/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# OSCKit DocC Generation
2+
3+
## Build and Publish
4+
5+
The docs generation procedure is mostly automated, but requires a handful of manual procedures that are not yet automated in order to build and publish.
6+
7+
1. Run the `dev/Scripts/build-docc-cached-preview.sh` command from Terminal from within the repo directory
8+
9+
- If any DocC warnings are shown:
10+
11+
1. resolve the issues in the codebase
12+
2. re-run the build script and repeat resolving issues until no more warnings are present
13+
3. make a commit
14+
15+
- When finished the generated docs path will be output to the console, ie:
16+
17+
```
18+
Generated combined documentation archive at:
19+
/var/folders/pk/3smbhvrd0p701_rpq3t0c_2r0000gn/T/tmp.Oq9smpNmnD/docs-webroot/OSCKit
20+
```
21+
22+
As well, a local webserver on port 8080 will run to preview the documentation in a local web browser at this URL:
23+
24+
http://localhost:8080/OSCKit/documentation
25+
26+
2. Press `Ctrl+C` in the Terminal window to shut down the local webserver and return to the shell prompt
27+
28+
3. Navigate to the generated docs path using the path that was output to the console
29+
30+
```bash
31+
cd /var/folders/pk/3smbhvrd0p701_rpq3t0c_2r0000gn/T/tmp.Oq9smpNmnD/docs-webroot/OSCKit
32+
```
33+
34+
Then to open this folder in the Finder:
35+
36+
```bash
37+
open .
38+
```
39+
40+
4. In the local repo `docs` branch:
41+
42+
- remove all files within the `docs` subfolder except `index.html`
43+
- copy all files from the generated docs `except index.html` to replace the old docs that were deleted
44+
45+
5. See the [Post-Build](#Post-Build) section below
46+
47+
6. Commit and push to remote `docs` branch - GitHub Actions will automatically publish the site to GitHub Pages
48+
49+
## Post-Build
50+
51+
The root-level `index.html` file in the local repo `docs` branch needs to edited to include a meta event to redirect to the documentation subpath.
52+
53+
```html
54+
<head>
55+
<!-- ... -->
56+
<meta http-equiv="refresh" content="0; url=documentation/">
57+
```

Docs/build-docc-cached-preview.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Build docc documentation
2+
3+
# This invocation provides a stable scrach (build) directory location which allows repeated runs to
4+
# execute faster. This is useful when developing and debugging documentation generation compiler warnings.
5+
#
6+
# After building, a local web server is started to preview the documentation.
7+
8+
REPO_PATH="$(git rev-parse --show-toplevel)"
9+
BUILD_PATH="$REPO_PATH/.build"
10+
./build-docc.sh -w -s "$BUILD_PATH"

Docs/build-docc-cached.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Build docc documentation
2+
3+
# This invocation provides a stable scrach (build) directory location which allows repeated runs to
4+
# execute faster. This is useful when developing and debugging documentation generation compiler warnings.
5+
#
6+
# After building, the built documentation folder is opened in the Finder.
7+
8+
REPO_PATH="$(git rev-parse --show-toplevel)"
9+
BUILD_PATH="$REPO_PATH/.build"
10+
./build-docc.sh -o -s "$BUILD_PATH"

Docs/build-docc.sh

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Build docc documentation
2+
3+
# Arguments:
4+
#
5+
# [-s <path>] Optionally supply a scratch path (a.k.a. build path).
6+
# Defaults to temporary directory, which is unique on every script execution.
7+
# To provide a stable scratch folder, supply this argument with the path to a directory
8+
# (absolute path, or relative path to the current working directory.)
9+
#
10+
# For example, to use the default ".build" folder at the repo's root:
11+
# build-docc -s .build
12+
13+
# Swift-DocC Plugin Documentation:
14+
# https://swiftlang.github.io/swift-docc-plugin/documentation/swiftdoccplugin/
15+
16+
PACKAGE_NAME="OSCKit"
17+
18+
usageAndExit() { echo "$0 usage:" && grep "[[:space:]].)\ #" $0 | sed 's/#//' | sed -r 's/([a-z])\)/-\1/'; exit 0; }
19+
20+
while getopts "s::owh" flag; do
21+
case "${flag}" in
22+
s) # Optionally supply a scratch (build) directory path.
23+
BUILD_PATH="${OPTARG}"
24+
;;
25+
o) # Open folder in the Finder after building.
26+
OPEN_FOLDER_IN_FINDER=1
27+
;;
28+
w) # Start a local webserver to preview documentation after building.
29+
ALLOW_WEBSERVER=1
30+
;;
31+
h) # Display help.
32+
usageAndExit
33+
;;
34+
esac
35+
done
36+
37+
# Provide default(s) for arguments
38+
if [ "$OPEN_FOLDER_IN_FINDER" = "" ]; then OPEN_FOLDER_IN_FINDER=0; fi
39+
if [ "$ALLOW_WEBSERVER" = "" ]; then ALLOW_WEBSERVER=0; fi
40+
41+
# Set up base paths
42+
REPO_PATH="$(git rev-parse --show-toplevel)"
43+
TEMP_WORKING_PATH="$(mktemp -d)"
44+
DOCC_OUTPUT_WEBROOT="$TEMP_WORKING_PATH/docs-webroot"
45+
DOCC_OUTPUT_PATH="$DOCC_OUTPUT_WEBROOT/$PACKAGE_NAME"
46+
47+
echo "Package Name: $PACKAGE_NAME"
48+
echo "Repo Path: $REPO_PATH"
49+
echo "Temporary Working Path: $TEMP_WORKING_PATH"
50+
echo "DocC Output Path: $DOCC_OUTPUT_PATH"
51+
52+
# Create output folders
53+
mkdir "$DOCC_OUTPUT_WEBROOT"
54+
mkdir "$DOCC_OUTPUT_PATH"
55+
56+
cd "$REPO_PATH"
57+
58+
# Set up build paths
59+
if [ "$BUILD_PATH" = "" ]; then BUILD_PATH="$TEMP_WORKING_PATH/build"; fi
60+
echo "Scratch (Build) Path: $BUILD_PATH"
61+
PLUGIN_OUTPUTS_PATH="$BUILD_PATH/plugins/Swift-DocC/outputs"
62+
63+
# Delete old docs from build folder, if any
64+
if [ -d "$PLUGIN_OUTPUTS_PATH" ]; then
65+
echo "Removing old build products..."
66+
rm -r "$PLUGIN_OUTPUTS_PATH"
67+
fi
68+
69+
# Custom env flag that opts-in to using the plugin as a Package dependency
70+
export ENABLE_DOCC_PLUGIN=1
71+
72+
# --disable-indexing: Indexing is only relevant to IDEs like Xcode, and not relevant for hosting online
73+
echo "Compiling docs..."
74+
swift package \
75+
--scratch-path "$BUILD_PATH" \
76+
--disable-sandbox \
77+
--allow-writing-to-directory "$DOCC_OUTPUT_PATH" \
78+
generate-documentation \
79+
--target OSCKit \
80+
--target OSCKitCore \
81+
--disable-indexing \
82+
--output-path "$DOCC_OUTPUT_PATH" \
83+
--transform-for-static-hosting \
84+
--enable-experimental-combined-documentation \
85+
--hosting-base-path "$PACKAGE_NAME"
86+
87+
# Reveal output folder in finder
88+
if [ $OPEN_FOLDER_IN_FINDER == 1 ]; then
89+
echo "Opening built documentation in Finder."
90+
open "$DOCC_OUTPUT_PATH"
91+
fi
92+
93+
# Start local webserver
94+
if [ $ALLOW_WEBSERVER == 1 ]; then
95+
echo Starting localhost webserver on port 8080. Press Ctrl+C to end.
96+
echo Browse: http://localhost:8080/$PACKAGE_NAME/documentation/
97+
cd "$DOCC_OUTPUT_WEBROOT"
98+
ruby -run -ehttpd . -p8080
99+
fi

Examples/Custom Type/Custom OSC Type.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
mainGroup = E2D003C8289882820073ED8F;
124124
packageReferences = (
125125
E2D003F2289884030073ED8F /* XCRemoteSwiftPackageReference "CocoaAsyncSocket" */,
126-
E2CE6F062CCF22A800F81BCE /* XCLocalSwiftPackageReference "../../../OSCKit" */,
126+
E2CE6F062CCF22A800F81BCE /* XCLocalSwiftPackageReference "../../" */,
127127
);
128128
productRefGroup = E2D003D2289882820073ED8F /* Products */;
129129
projectDirPath = "";
@@ -379,9 +379,9 @@
379379
/* End XCConfigurationList section */
380380

381381
/* Begin XCLocalSwiftPackageReference section */
382-
E2CE6F062CCF22A800F81BCE /* XCLocalSwiftPackageReference "../../../OSCKit" */ = {
382+
E2CE6F062CCF22A800F81BCE /* XCLocalSwiftPackageReference "../../" */ = {
383383
isa = XCLocalSwiftPackageReference;
384-
relativePath = ../../../OSCKit;
384+
relativePath = ../../;
385385
};
386386
/* End XCLocalSwiftPackageReference section */
387387

Examples/Method Blocks/OSC Method Blocks.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
mainGroup = E2D003C8289882820073ED8F;
124124
packageReferences = (
125125
E2D003F2289884030073ED8F /* XCRemoteSwiftPackageReference "CocoaAsyncSocket" */,
126-
E2CE6F092CCF238500F81BCE /* XCLocalSwiftPackageReference "../../../OSCKit" */,
126+
E2CE6F092CCF238500F81BCE /* XCLocalSwiftPackageReference "../../" */,
127127
);
128128
productRefGroup = E2D003D2289882820073ED8F /* Products */;
129129
projectDirPath = "";
@@ -379,9 +379,9 @@
379379
/* End XCConfigurationList section */
380380

381381
/* Begin XCLocalSwiftPackageReference section */
382-
E2CE6F092CCF238500F81BCE /* XCLocalSwiftPackageReference "../../../OSCKit" */ = {
382+
E2CE6F092CCF238500F81BCE /* XCLocalSwiftPackageReference "../../" */ = {
383383
isa = XCLocalSwiftPackageReference;
384-
relativePath = ../../../OSCKit;
384+
relativePath = ../../;
385385
};
386386
/* End XCLocalSwiftPackageReference section */
387387

0 commit comments

Comments
 (0)