-
Notifications
You must be signed in to change notification settings - Fork 623
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create script to create SPM artifact bundle (#1215)
- Loading branch information
1 parent
378543f
commit c58df80
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
REGEX="let swiftFormatVersion = \"([0-9]+.[0-9]+.[0-9]+)\"" | ||
while IFS= read -r line; do | ||
if [[ $line =~ $REGEX ]] | ||
then | ||
echo "${BASH_REMATCH[1]}" | ||
break | ||
fi | ||
done < Sources/SwiftFormat.swift |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
ARTIFACT_BUNDLE=swiftformat.artifactbundle | ||
INFO_TEMPLATE=Scripts/spm-macos-artifact-bundle-info.template | ||
VERSION=$(./Scripts/get-version.sh) | ||
BINARY_OUTPUT_DIR=$ARTIFACT_BUNDLE/swiftformat-$VERSION-macos/bin | ||
|
||
mkdir $ARTIFACT_BUNDLE | ||
|
||
# Copy license into bundle | ||
cp LICENSE.md $ARTIFACT_BUNDLE | ||
|
||
# Create bundle info.json from template, replacing version | ||
sed 's/__VERSION__/'"${VERSION}"'/g' $INFO_TEMPLATE > "${ARTIFACT_BUNDLE}/info.json" | ||
|
||
# Copy MacOS SwiftFormat binary into bundle | ||
mkdir -p $BINARY_OUTPUT_DIR | ||
cp CommandLineTool/swiftformat $BINARY_OUTPUT_DIR | ||
|
||
# Create ZIP | ||
zip -yr - $ARTIFACT_BUNDLE > "${ARTIFACT_BUNDLE}.zip" | ||
|
||
rm -rf $ARTIFACT_BUNDLE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"schemaVersion": "1.0", | ||
"artifacts": { | ||
"swiftformat": { | ||
"version": "__VERSION__", | ||
"type": "executable", | ||
"variants": [ | ||
{ | ||
"path": "swiftformat-__VERSION__-macos/bin/swiftformat", | ||
"supportedTriples": ["x86_64-apple-macosx", "arm64-apple-macosx"] | ||
} | ||
] | ||
} | ||
} | ||
} |