From 32095f5bad81b3519eaec7774fe28ee45f667eb2 Mon Sep 17 00:00:00 2001 From: Andrei Podkovyrin Date: Thu, 9 Jan 2025 14:32:04 +0100 Subject: [PATCH 1/5] Update podfile - pod install --- swift/Podfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swift/Podfile.lock b/swift/Podfile.lock index a8504fac8bd..88093ba1a0d 100644 --- a/swift/Podfile.lock +++ b/swift/Podfile.lock @@ -13,4 +13,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: aac2324ba35cdd5631cb37618cd483887bab9cfd -COCOAPODS: 1.11.3 +COCOAPODS: 1.16.2 From 5ba19f30682c9f029427fa0319d811d96970cb8d Mon Sep 17 00:00:00 2001 From: Andrei Podkovyrin Date: Wed, 8 Jan 2025 10:19:31 +0100 Subject: [PATCH 2/5] Disable podspec generation --- tools/ios-release | 51 ----------------------------------------------- 1 file changed, 51 deletions(-) diff --git a/tools/ios-release b/tools/ios-release index 85a70879c09..f14563cf7b7 100755 --- a/tools/ios-release +++ b/tools/ios-release @@ -41,55 +41,4 @@ echo "download_url is $download_url" download_url=$(tr -d '"' <<< $download_url) echo "trimmed download_url is ${download_url}" -# create podspec -podspec_name=TrustWalletCore -podspec=${podspec_name}.podspec -cat > $podspec < 'al@isaza.ca' } - s.module_name = 'WalletCore' - s.ios.deployment_target = '12.0' - s.osx.deployment_target = '10.14' - s.swift_version = '5.1' - s.source = { - http: '${download_url}' - } - s.default_subspec = 'Core' - s.subspec 'Types' do |ss| - ss.source_files = - 'Sources/Types/*.swift', - 'Sources/Generated/Enums/*.swift', - 'Sources/Generated/Protobuf/*.swift' - ss.dependency 'SwiftProtobuf' - end - s.subspec 'Core' do |ss| - ss.vendored_frameworks = '*.xcframework' - ss.exclude_files = 'Sources/Generated/WalletCore.h' - ss.source_files = - 'include/**/*.h', - 'Sources/*.{swift,h,m,cpp}', - 'Sources/Extensions/*.swift', - 'Sources/Generated/*.{swift,h}' - ss.public_header_files = - 'include/**/*.h', - 'Sources/*.h' - ss.libraries = 'c++' - ss.dependency 'TrustWalletCore/Types' - end -end -EOF - -echo "generated podspec: " -cat ${podspec} - -# pod trunk push -echo "Done. running: pod trunk push --allow-warnings ${podspec}" - -pod trunk push --verbose --allow-warnings ${podspec} - popd From 7f947eb8dad3e719baaece4a3d531bbc2f9d380e Mon Sep 17 00:00:00 2001 From: Andrei Podkovyrin Date: Thu, 9 Jan 2025 14:34:30 +0100 Subject: [PATCH 3/5] Change uploading destination to 1inch repo --- tools/library | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/library b/tools/library index 46891c22dc9..f52ee50fbff 100755 --- a/tools/library +++ b/tools/library @@ -11,12 +11,12 @@ wc_read_version() { wc_release_url() { tag="$1" - id=$(curl -u ${GITHUB_USER}:${GITHUB_TOKEN} "https://api.github.com/repos/trustwallet/wallet-core/releases/tags/${tag}" | jq ".id") + id=$(curl -u ${GITHUB_USER}:${GITHUB_TOKEN} "https://api.github.com/repos/1inch/wallet-core/releases/tags/${tag}" | jq ".id") if [[ $id == "null" ]]; then echo "Failed to get release id for tag ${tag}" exit 22 fi - release_url="https://uploads.github.com/repos/trustwallet/wallet-core/releases/${id}" + release_url="https://uploads.github.com/repos/1inch/wallet-core/releases/${id}" echo ${release_url} } From eb3f6a486e68c68618aec5f34941cca2c0456227 Mon Sep 17 00:00:00 2001 From: Andrei Podkovyrin Date: Thu, 9 Jan 2025 11:26:48 +0100 Subject: [PATCH 4/5] Fix reading git tags with '-' in the name --- tools/library | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/library b/tools/library index f52ee50fbff..6b8cd6bbebc 100755 --- a/tools/library +++ b/tools/library @@ -3,7 +3,7 @@ wc_read_version() { version=$1 if [ -z "${version}" ]; then - version=$(git describe --long --tags | cut -f 1 -d "-") + version=$(git describe --tags --abbrev=0) fi echo ${version} } From cb2a52788b65bfa46d8c01448696b1df0f36eedb Mon Sep 17 00:00:00 2001 From: Andrei Podkovyrin Date: Thu, 9 Jan 2025 14:34:00 +0100 Subject: [PATCH 5/5] Rename dependency SwiftProtobuf to TWSwiftProtobuf --- README.md | 2 +- swift/Podfile | 2 +- swift/Podfile.lock | 14 +++++++------- swift/Sources/AnySigner.swift | 2 +- swift/TWSwiftProtobuf.podspec | 24 ++++++++++++++++++++++++ swift/fastlane/Fastfile | 2 +- tools/generate-files | 3 +++ tools/ios-xcframework-release | 12 ++++++------ 8 files changed, 44 insertions(+), 17 deletions(-) create mode 100644 swift/TWSwiftProtobuf.podspec diff --git a/README.md b/README.md index 7456046acbd..10817ddae7b 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ Then add libraries to target's `dependencies`: ```swift .product(name: "WalletCore", package: "WalletCore"), -.product(name: "SwiftProtobuf", package: "WalletCore"), +.product(name: "TWSwiftProtobuf", package: "WalletCore"), ``` ### CocoaPods diff --git a/swift/Podfile b/swift/Podfile index ab704127b08..56cac40bb1d 100644 --- a/swift/Podfile +++ b/swift/Podfile @@ -9,7 +9,7 @@ project 'TrustWalletCore.xcodeproj' target 'WalletCore' do use_frameworks! - pod 'SwiftProtobuf' + pod 'TWSwiftProtobuf', podspec: 'TWSwiftProtobuf.podspec' target 'WalletCoreTests' end diff --git a/swift/Podfile.lock b/swift/Podfile.lock index 88093ba1a0d..1c6e7032061 100644 --- a/swift/Podfile.lock +++ b/swift/Podfile.lock @@ -1,16 +1,16 @@ PODS: - - SwiftProtobuf (1.13.0) + - TWSwiftProtobuf (1.28.2) DEPENDENCIES: - - SwiftProtobuf + - TWSwiftProtobuf (from `TWSwiftProtobuf.podspec`) -SPEC REPOS: - trunk: - - SwiftProtobuf +EXTERNAL SOURCES: + TWSwiftProtobuf: + :podspec: TWSwiftProtobuf.podspec SPEC CHECKSUMS: - SwiftProtobuf: fd4693388a96c8c2df35d3b063272b0e7c499d00 + TWSwiftProtobuf: 6ce3d3b3899a76ae9219a87d3e980a896bbf0f6b -PODFILE CHECKSUM: aac2324ba35cdd5631cb37618cd483887bab9cfd +PODFILE CHECKSUM: 3f07a34852b9957137f600a69cfb61f90652ddd9 COCOAPODS: 1.16.2 diff --git a/swift/Sources/AnySigner.swift b/swift/Sources/AnySigner.swift index 5abf730b95d..14a44d8f9e0 100644 --- a/swift/Sources/AnySigner.swift +++ b/swift/Sources/AnySigner.swift @@ -5,7 +5,7 @@ // file LICENSE at the root of the source code distribution tree. import Foundation -import SwiftProtobuf +import TWSwiftProtobuf public typealias SigningInput = Message public typealias SigningOutput = Message diff --git a/swift/TWSwiftProtobuf.podspec b/swift/TWSwiftProtobuf.podspec new file mode 100644 index 00000000000..2e5f8728434 --- /dev/null +++ b/swift/TWSwiftProtobuf.podspec @@ -0,0 +1,24 @@ +# Original podspec: +# https://github.com/apple/swift-protobuf/blob/main/SwiftProtobuf.podspec +Pod::Spec.new do |s| + s.name = 'TWSwiftProtobuf' + s.version = '1.28.2' + s.license = { :type => 'Apache 2.0', :file => 'LICENSE.txt' } + s.summary = 'Swift Protobuf Runtime Library' + s.homepage = 'https://github.com/apple/swift-protobuf' + s.author = 'Apple Inc.' + s.source = { :git => 'https://github.com/apple/swift-protobuf.git', :tag => s.version } + + s.requires_arc = true + s.ios.deployment_target = '11.0' + s.osx.deployment_target = '10.13' + s.tvos.deployment_target = '11.0' + s.watchos.deployment_target = '4.0' + + s.cocoapods_version = '>= 1.7.0' + + s.source_files = 'Sources/SwiftProtobuf/**/*.swift' + s.resource_bundle = {'TWSwiftProtobuf' => ['Sources/SwiftProtobuf/PrivacyInfo.xcprivacy']} + + s.swift_versions = ['5.0'] +end diff --git a/swift/fastlane/Fastfile b/swift/fastlane/Fastfile index 5fa18ea4945..ad35985347a 100644 --- a/swift/fastlane/Fastfile +++ b/swift/fastlane/Fastfile @@ -23,7 +23,7 @@ platform :ios do lane :swift_protobuf_xcframework do create_xcframework( workspace: 'TrustWalletCore.xcworkspace', - scheme: 'SwiftProtobuf', + scheme: 'TWSwiftProtobuf', destinations: ['iOS'], xcframework_output_directory: 'build', enable_bitcode: false diff --git a/tools/generate-files b/tools/generate-files index de3abc7f906..4cd8178aa8c 100755 --- a/tools/generate-files +++ b/tools/generate-files @@ -69,6 +69,9 @@ tools/rust-bindgen "$@" if [ -x "$(command -v protoc-gen-swift)" ] && isTargetSpecified "ios"; then "$PROTOC" -I=$PREFIX/include -I=src/proto --cpp_out=src/proto --java_out=lite:jni/proto --swift_out=swift/Sources/Generated/Protobuf --swift_opt=Visibility=Public src/proto/*.proto + # Replace SwiftProtobuf with TWSwiftProtobuf + find swift/Sources/Generated/Protobuf -name "*.swift" -exec sed -i '' 's/import SwiftProtobuf/import TWSwiftProtobuf/g' {} \; + find swift/Sources/Generated/Protobuf -name "*.swift" -exec sed -i '' 's/SwiftProtobuf./TWSwiftProtobuf./g' {} \; else "$PROTOC" -I=$PREFIX/include -I=src/proto --cpp_out=src/proto --java_out=lite:jni/proto src/proto/*.proto fi diff --git a/tools/ios-xcframework-release b/tools/ios-xcframework-release index 0ce859a8cc1..c4fcb207960 100755 --- a/tools/ios-xcframework-release +++ b/tools/ios-xcframework-release @@ -18,8 +18,8 @@ pushd ${base_dir}/../swift/build # archive xcframeworks core_zip_filename="WalletCore.xcframework.zip" core_dsyms_filename="WalletCore.xcframework.dSYM.zip" -protobuf_zip_filename="SwiftProtobuf.xcframework.zip" -protobuf_dsyms_filename="SwiftProtobuf.xcframework.dSYM.zip" +protobuf_zip_filename="TWSwiftProtobuf.xcframework.zip" +protobuf_dsyms_filename="TWSwiftProtobuf.xcframework.dSYM.zip" rm -rf ${core_zip_filename} ${core_dsyms_filename} ${protobuf_zip_filename} ${protobuf_dsyms_filename} @@ -28,9 +28,9 @@ zip -r ${core_dsyms_filename} WalletCore.dSYMs zip -r ${core_zip_filename} WalletCore.xcframework core_hash=$(/usr/bin/shasum -a 256 ${core_zip_filename} | awk '{printf $1}') -zip -r ${protobuf_dsyms_filename} SwiftProtobuf.dSYMs +zip -r ${protobuf_dsyms_filename} TWSwiftProtobuf.dSYMs -zip -r ${protobuf_zip_filename} SwiftProtobuf.xcframework +zip -r ${protobuf_zip_filename} TWSwiftProtobuf.xcframework protobuf_hash=$(/usr/bin/shasum -a 256 ${protobuf_zip_filename} | awk '{printf $1}') # upload to release @@ -52,7 +52,7 @@ let package = Package( platforms: [.iOS(.v13)], products: [ .library(name: "WalletCore", targets: ["WalletCore"]), - .library(name: "SwiftProtobuf", targets: ["SwiftProtobuf"]) + .library(name: "TWSwiftProtobuf", targets: ["TWSwiftProtobuf"]) ], dependencies: [], targets: [ @@ -62,7 +62,7 @@ let package = Package( checksum: "${core_hash}" ), .binaryTarget( - name: "SwiftProtobuf", + name: "TWSwiftProtobuf", url: ${protobuf_download_url}, checksum: "${protobuf_hash}" )