Skip to content

Commit

Permalink
Rename dependency SwiftProtobuf to TWSwiftProtobuf
Browse files Browse the repository at this point in the history
  • Loading branch information
podkovyrin committed Jan 9, 2025
1 parent eb3f6a4 commit cb2a527
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 17 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
14 changes: 7 additions & 7 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.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/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
Expand Down
12 changes: 6 additions & 6 deletions tools/ios-xcframework-release
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand All @@ -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
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

0 comments on commit cb2a527

Please sign in to comment.