Skip to content

Commit

Permalink
fix(ad-hoc): vendored cmark version (#365)
Browse files Browse the repository at this point in the history
* Fix script to properly embed revision into generated framework's plist.
* Integrate recent 0.5.0 version instead of relying on gfm branch directly.
* Include dSYM when generating framework.
  • Loading branch information
andrii-vysotskyi-cko authored Oct 9, 2024
1 parent 62ff8c4 commit daf174d
Show file tree
Hide file tree
Showing 41 changed files with 1,706 additions and 185 deletions.
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-cmark",
"state" : {
"branch" : "gfm",
"revision" : "fc07ab5da47975c5ef5f336acadfc02e8f706d30"
"revision" : "3ccff77b2dc5b96b77db3da0d68d28068593fa53",
"version" : "0.5.0"
}
}
],
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/checkout/checkout-3ds-sdk-ios", exact: "3.2.4"),
.package(url: "https://github.com/swiftlang/swift-cmark", branch: "gfm")
.package(url: "https://github.com/swiftlang/swift-cmark", from: "0.5.0")
],
targets: [
.target(
Expand Down
11 changes: 6 additions & 5 deletions Scripts/CMark/CreateXcframework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ WORK_DIR=$(mktemp -d)
# Script expects revision as a first and only argument
test $# -eq 1 || fail "Expected tag or branch reference."

# Exports revision as environment variable
export CURRENT_REVISION=$1

# Go to temporary directory
cd $WORK_DIR

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

# Ensure modulemap represents darwin-style framework
MODULEMAP_PATH="src/include/module.modulemap"
Expand Down Expand Up @@ -61,12 +64,10 @@ OUTPUT_DIR="$SCRIPT_DIR/../../Vendor"
# Generate XCFramework
xcodebuild -create-xcframework \
-framework ./cmark_gfm-iOS.xcarchive/Products/Library/Frameworks/cmark_gfm.framework \
-debug-symbols "$WORK_DIR/cmark_gfm-iOS.xcarchive/dSYMs/cmark_gfm.framework.dSYM" \
-framework ./cmark_gfm-Sim.xcarchive/Products/Library/Frameworks/cmark_gfm.framework \
-debug-symbols "$WORK_DIR/cmark_gfm-Sim.xcarchive/dSYMs/cmark_gfm.framework.dSYM" \
-output "$OUTPUT_DIR/cmark_gfm.xcframework"

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

# Write metadata
CURRENT_REVISION=$(git rev-parse --short HEAD)
echo $CURRENT_REVISION > "$OUTPUT_DIR/cmark_gfm.xcframework.version"
2 changes: 1 addition & 1 deletion Scripts/CMark/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ targets:
SKIP_INSTALL: NO
BUILD_LIBRARY_FOR_DISTRIBUTION: YES
PRODUCT_BUNDLE_IDENTIFIER: com.swiftlang.cmark
MARKETING_VERSION: ${CURRENT_VERSION}
MARKETING_VERSION: ${CURRENT_REVISION}
CURRENT_PROJECT_VERSION: 1
MODULEMAP_FILE: src/include/module.modulemap
sources:
Expand Down
1 change: 0 additions & 1 deletion Vendor/cmark_gfm.xcframework.version

This file was deleted.

14 changes: 9 additions & 5 deletions Vendor/cmark_gfm.xcframework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,37 @@
<dict>
<key>BinaryPath</key>
<string>cmark_gfm.framework/cmark_gfm</string>
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>cmark_gfm.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>cmark_gfm.framework/cmark_gfm</string>
<key>DebugSymbolsPath</key>
<string>dSYMs</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>cmark_gfm.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
</array>
<key>CFBundlePackageType</key>
Expand Down
Binary file modified Vendor/cmark_gfm.xcframework/_CodeSignature/CodeDirectory
Binary file not shown.
Binary file modified Vendor/cmark_gfm.xcframework/_CodeSignature/CodeRequirements-1
Binary file not shown.
Loading

0 comments on commit daf174d

Please sign in to comment.