Skip to content

Commit

Permalink
Merge branch 'fix-swift-protobuf' into oneinch
Browse files Browse the repository at this point in the history
* fix-swift-protobuf:
  Rename dependency SwiftProtobuf to TWSwiftProtobuf
  Fix reading git tags with '-' in the name
  Change uploading destination to 1inch repo
  Disable podspec generation
  Update podfile - pod install
  • Loading branch information
podkovyrin committed Feb 21, 2025
2 parents efd6aa6 + cb2a527 commit ec28d3d
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 72 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion swift/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ project 'TrustWalletCore.xcodeproj'
target 'WalletCore' do
use_frameworks!

pod 'SwiftProtobuf'
pod 'TWSwiftProtobuf', podspec: 'TWSwiftProtobuf.podspec'

target 'WalletCoreTests'
end
Expand Down
16 changes: 8 additions & 8 deletions swift/Podfile.lock
Original file line number Diff line number Diff line change
@@ -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.14.3
COCOAPODS: 1.16.2
2 changes: 1 addition & 1 deletion swift/Sources/AnySigner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions swift/TWSwiftProtobuf.podspec
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion swift/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions tools/generate-files
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ tools/doxygen_convert_comments

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
Expand Down
51 changes: 0 additions & 51 deletions tools/ios-release
Original file line number Diff line number Diff line change
Expand Up @@ -40,55 +40,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 <<EOF
Pod::Spec.new do |s|
s.name = '${podspec_name}'
s.version = '${version}'
s.summary = 'Trust Wallet core data structures and algorithms.'
s.homepage = 'https://github.com/trustwallet/wallet-core'
s.license = 'MIT'
s.authors = { 'Alejandro Isaza' => '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
12 changes: 6 additions & 6 deletions tools/ios-xcframework-release
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,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}

Expand All @@ -26,9 +26,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
Expand All @@ -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: [
Expand All @@ -62,7 +62,7 @@ let package = Package(
checksum: "${core_hash}"
),
.binaryTarget(
name: "SwiftProtobuf",
name: "TWSwiftProtobuf",
url: ${protobuf_download_url},
checksum: "${protobuf_hash}"
)
Expand Down
6 changes: 3 additions & 3 deletions tools/library
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
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}
}

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}
}

Expand Down

0 comments on commit ec28d3d

Please sign in to comment.