Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ad-hoc): sign vendored cmark framework #353

Merged
merged 2 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions Scripts/CMark/CreateXcframework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,20 @@ function cleanup {
}

# Configure cleanup
# trap cleanup EXIT
trap cleanup EXIT

# Constants
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
OUTPUT_DIR="$SCRIPT_DIR/../../Vendor"
WORK_DIR=$(mktemp -d)

# Script expects revision as a first and only argument
test $# -eq 1 || fail "Expected tag or branch reference."

# Exports version as environment variable
export CURRENT_VERSION=$1

# Go to temporary directory
cd $WORK_DIR

# Clone library
git clone --depth 1 --branch $CURRENT_VERSION https://github.com/swiftlang/swift-cmark .
git clone --depth 1 --branch $1 https://github.com/swiftlang/swift-cmark .

# Ensure modulemap represents darwin-style framework
MODULEMAP_PATH="src/include/module.modulemap"
Expand All @@ -44,11 +41,32 @@ xcodegen generate
xcodebuild archive -scheme cmark_gfm -destination "generic/platform=iOS" -archivePath ./cmark_gfm-iOS
xcodebuild archive -scheme cmark_gfm -destination "generic/platform=iOS Simulator" -archivePath ./cmark_gfm-Sim

# Define signing arguments
CODESIGN_ARGS=(
--timestamp
--force
--sign "Apple Distribution: ProcessOut Inc. (3Y9WMX63ZJ)"
--preserve-metadata\=identifier,entitlements,flags
)

# Sign iOS framework
/usr/bin/codesign "${CODESIGN_ARGS[@]}" ./cmark_gfm-iOS.xcarchive/Products/Library/Frameworks/cmark_gfm.framework

# Sign iOS Simulator framework
/usr/bin/codesign "${CODESIGN_ARGS[@]}" ./cmark_gfm-Sim.xcarchive/Products/Library/Frameworks/cmark_gfm.framework

# Define output directory
OUTPUT_DIR="$SCRIPT_DIR/../../Vendor"

# Generate XCFramework
xcodebuild -create-xcframework \
-framework ./cmark_gfm-iOS.xcarchive/Products/Library/Frameworks/cmark_gfm.framework \
-framework ./cmark_gfm-Sim.xcarchive/Products/Library/Frameworks/cmark_gfm.framework \
-output "$OUTPUT_DIR/cmark_gfm.xcframework"

# Sign XCFramework
/usr/bin/codesign "${CODESIGN_ARGS[@]}" "$OUTPUT_DIR/cmark_gfm.xcframework"

# Write metadata
echo $CURRENT_VERSION > "$OUTPUT_DIR/cmark_gfm.xcframework.version"
CURRENT_REVISION=$(git rev-parse --short HEAD)
echo $CURRENT_REVISION > "$OUTPUT_DIR/cmark_gfm.xcframework.version"
2 changes: 1 addition & 1 deletion Vendor/cmark_gfm.xcframework.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
gfm
b022b08
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Loading