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): update dependencies #345

Merged
merged 16 commits into from
Sep 10, 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
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"originHash" : "8f250d3cf19fc47446f324890a784ded5493b6143de5d0aef317488859119617",
"pins" : [
{
"identity" : "checkout-3ds-sdk-ios",
Expand All @@ -17,7 +18,16 @@
"revision" : "a914d754b4ffb1843730e8e1f8e7e60c4bf81cf9",
"version" : "1.2.4"
}
},
{
"identity" : "swift-cmark",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-cmark",
"state" : {
"branch" : "gfm",
"revision" : "fc07ab5da47975c5ef5f336acadfc02e8f706d30"
}
}
],
"version" : 2
"version" : 3
}
9 changes: 9 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
"revision" : "a914d754b4ffb1843730e8e1f8e7e60c4bf81cf9",
"version" : "1.2.4"
}
},
{
"identity" : "swift-cmark",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-cmark",
"state" : {
"branch" : "gfm",
"revision" : "fc07ab5da47975c5ef5f336acadfc02e8f706d30"
}
}
],
"version" : 2
Expand Down
8 changes: 4 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ 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")
],
targets: [
.target(
name: "ProcessOut",
dependencies: [
.target(name: "cmark")
.product(name: "cmark-gfm", package: "swift-cmark")
],
resources: [
.process("Resources")
Expand Down Expand Up @@ -49,12 +50,11 @@ let package = Package(
.target(
name: "ProcessOutCoreUI",
dependencies: [
.target(name: "cmark")
.product(name: "cmark-gfm", package: "swift-cmark")
],
resources: [
.process("Resources")
]
),
.binaryTarget(name: "cmark", path: "Vendor/cmark.xcframework")
)
]
)
2 changes: 1 addition & 1 deletion ProcessOut.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Pod::Spec.new do |s|
s.source = { :git => 'https://github.com/processout/processout-ios.git', :tag => s.version.to_s }
s.frameworks = 'Foundation', 'UIKit'
s.ios.deployment_target = '13.0'
s.vendored_frameworks = "Vendor/cmark.xcframework"
s.vendored_frameworks = "Vendor/cmark_gfm.xcframework"
s.ios.resources = 'Sources/ProcessOut/Resources/**/*'
s.source_files = 'Sources/ProcessOut/**/*.swift'
s.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-Xfrontend -module-interface-preserve-types-as-written' }
Expand Down
2 changes: 1 addition & 1 deletion ProcessOutCoreUI.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '14.0'
s.ios.resources = 'Sources/ProcessOutCoreUI/Resources/**/*'
s.source_files = 'Sources/ProcessOutCoreUI/**/*.swift'
s.dependency 'ProcessOut' # todo(andrii-vysotskyi): vendor cmark.xcframework instead after UI migration is completed
s.dependency 'ProcessOut' # todo(andrii-vysotskyi): vendor cmark_gfm.xcframework instead after UI migration is completed
end
41 changes: 18 additions & 23 deletions Scripts/CMark/CreateXcframework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@

set -euo pipefail

function fail {
echo "$@" 1>&2
exit 1
}

function cleanup {
rm -rf $WORK_DIR
}

# Configure cleanup
trap cleanup EXIT
# trap cleanup EXIT

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
test $# -eq 1 || fail "Expected tag or branch reference."

# Exports version as environment variable
export CURRENT_VERSION=$1
Expand All @@ -23,37 +28,27 @@ export CURRENT_VERSION=$1
cd $WORK_DIR

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

# Create temporary Xcode project
mkdir build && cd build && cmake -G Xcode .. && cd ../

# Copy generated headers
find build/src -name "*.h" -exec cp '{}' src/ \;

# Fix imports
sed -i'.bak' -e 's/<cmark_export.h>/"cmark_export.h"/g' src/cmark.h
sed -i'.bak' -e 's/<cmark_version.h>/"cmark_version.h"/g' src/cmark.h
rm src/cmark.h.bak
git clone --depth 1 --branch $CURRENT_VERSION https://github.com/swiftlang/swift-cmark .

# Copy modulemap
cp "$SCRIPT_DIR/module.modulemap" src/
# Ensure modulemap represents darwin-style framework
MODULEMAP_PATH="src/include/module.modulemap"
echo "framework $(cat $MODULEMAP_PATH)" > $MODULEMAP_PATH

# Copy project Configuration
# Copy project configuration
cp "$SCRIPT_DIR/project.yml" .

# Generate project
xcodegen generate

# Create frameworks for needed platforms
xcodebuild archive -scheme cmark -destination "generic/platform=iOS" -archivePath ./cmark-iOS
xcodebuild archive -scheme cmark -destination "generic/platform=iOS Simulator" -archivePath ./cmark-Sim
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

# Generate XCFramework
xcodebuild -create-xcframework \
-framework ./cmark-iOS.xcarchive/Products/Library/Frameworks/cmark.framework \
-framework ./cmark-Sim.xcarchive/Products/Library/Frameworks/cmark.framework \
-output "$OUTPUT_DIR/cmark.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"

# Write metadata
echo $CURRENT_VERSION > "$OUTPUT_DIR/cmark.xcframework.version"
echo $CURRENT_VERSION > "$OUTPUT_DIR/cmark_gfm.xcframework.version"
14 changes: 6 additions & 8 deletions Scripts/CMark/project.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
name: cmark
name: cmark_gfm
settings:
GENERATE_INFOPLIST_FILE: YES
CODE_SIGNING_ALLOWED: NO
targets:
cmark:
cmark_gfm:
type: framework
platform: iOS
deploymentTarget: "12.0"
settings:
SKIP_INSTALL: NO
BUILD_LIBRARY_FOR_DISTRIBUTION: YES
PRODUCT_BUNDLE_IDENTIFIER: com.processout.cmark-ios
PRODUCT_BUNDLE_IDENTIFIER: com.swiftlang.cmark
MARKETING_VERSION: ${CURRENT_VERSION}
CURRENT_PROJECT_VERSION: 1
MODULEMAP_FILE: src/module.modulemap
MODULEMAP_FILE: src/include/module.modulemap
sources:
- path: src
excludes:
- "main.c"
- "man.c"
- "*.inc"
- "*.re"
- "*.in"
- "*.txt"
schemes:
cmark:
cmark_gfm:
build:
targets:
cmark: all
cmark_gfm: all
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

set -euo pipefail

function fail {
echo "$@" 1>&2
exit 1
}

function cleanup {
rm -rf $WORK_DIR
}
Expand All @@ -10,11 +15,11 @@ function cleanup {
trap cleanup EXIT

SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
OUTPUT_DIR="$SCRIPT_DIR/../Sources/ProcessOut/Resources/PhoneNumberMetadata"
OUTPUT_DIR="$SCRIPT_DIR/../../Sources/ProcessOut/Resources/PhoneNumberMetadata"
WORK_DIR=$(mktemp -d)

# Validates arguments acount
test $# -eq 1
test $# -eq 1 || fail "Expected tag or branch reference."

# Go to temporary directory
cd $WORK_DIR
Expand All @@ -25,7 +30,7 @@ git clone --depth 1 --branch $1 https://github.com/google/libphonenumber libphon
mkdir -p $OUTPUT_DIR

# Convert XML metadata to JSON
"$SCRIPT_DIR/ConvertPhoneNumberMetadata.swift" "libphonenumber/resources/PhoneNumberMetadata.xml" "$OUTPUT_DIR/PhoneNumberMetadata.json"
"$SCRIPT_DIR/ConvertToJson.swift" "libphonenumber/resources/PhoneNumberMetadata.xml" "$OUTPUT_DIR/PhoneNumberMetadata.json"

# Write metadata
echo $1 > "$OUTPUT_DIR/PhoneNumberMetadata.version"

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
v8.13.20
v8.13.45
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Andrii Vysotskyi on 13.06.2023.
//

@_implementationOnly import cmark
import cmark_gfm

final class MarkdownNodeFactory {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import Foundation
@_implementationOnly import cmark
import cmark_gfm

enum MarkdownParser {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Andrii Vysotskyi on 15.06.2023.
//

@_implementationOnly import cmark
import cmark_gfm

final class MarkdownBlockQuote: MarkdownBaseNode {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
// Created by Andrii Vysotskyi on 15.06.2023.
//

@_implementationOnly import cmark
import cmark_gfm

final class MarkdownCodeBlock: MarkdownBaseNode {

/// Returns the info string from a fenced code block.
private(set) lazy var info: String? = {
guard let info = cmarkNode.pointee.as.code.info else {
return nil
}
return String(cString: info)
String(cString: cmarkNode.pointee.as.code.info.data)
}()

private(set) lazy var code: String = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Andrii Vysotskyi on 15.06.2023.
//

@_implementationOnly import cmark
import cmark_gfm

final class MarkdownCodeSpan: MarkdownBaseNode {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Andrii Vysotskyi on 11.06.2023.
//

@_implementationOnly import cmark
import cmark_gfm

final class MarkdownDocument: MarkdownBaseNode {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Andrii Vysotskyi on 12.06.2023.
//

@_implementationOnly import cmark
import cmark_gfm

final class MarkdownEmphasis: MarkdownBaseNode {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Andrii Vysotskyi on 15.06.2023.
//

@_implementationOnly import cmark
import cmark_gfm

final class MarkdownHeading: MarkdownBaseNode {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Andrii Vysotskyi on 15.06.2023.
//

@_implementationOnly import cmark
import cmark_gfm

final class MarkdownLinebreak: MarkdownBaseNode {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@
// Created by Andrii Vysotskyi on 15.06.2023.
//

@_implementationOnly import cmark
import cmark_gfm

final class MarkdownLink: MarkdownBaseNode {

private(set) lazy var url: String? = {
if let url = cmarkNode.pointee.as.link.url {
return String(cString: url)
}
return nil
String(cString: cmarkNode.pointee.as.link.url.data)
}()

// MARK: - MarkdownBaseNode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Andrii Vysotskyi on 12.06.2023.
//

@_implementationOnly import cmark
import cmark_gfm

final class MarkdownList: MarkdownBaseNode {

Expand All @@ -20,11 +20,11 @@ final class MarkdownList: MarkdownBaseNode {

private(set) lazy var type: ListType = {
let listNode = cmarkNode.pointee.as.list
switch UInt32(listNode.list_type) {
case CMARK_BULLET_LIST.rawValue:
switch listNode.list_type {
case CMARK_BULLET_LIST:
let marker = Character(Unicode.Scalar(listNode.bullet_char))
return .bullet(marker: marker)
case CMARK_ORDERED_LIST.rawValue:
case CMARK_ORDERED_LIST:
let delimiter: Character
switch cmark_node_get_list_delim(cmarkNode) {
case CMARK_PERIOD_DELIM:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Andrii Vysotskyi on 12.06.2023.
//

@_implementationOnly import cmark
import cmark_gfm

final class MarkdownListItem: MarkdownBaseNode {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Andrii Vysotskyi on 12.06.2023.
//

@_implementationOnly import cmark
import cmark_gfm

class MarkdownBaseNode {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Andrii Vysotskyi on 12.06.2023.
//

@_implementationOnly import cmark
import cmark_gfm

final class MarkdownParagraph: MarkdownBaseNode {

Expand Down
Loading
Loading