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

[CHANGE] Restructure Swift Package #374

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
[CHANGE] Restructure Swift Package
- Moved source files to Sources/Web3Swift
- Moved test files to Tests/Web3SwiftTests
- Moved libs on root
- Moved ZKSync source files to Sources/Web3ZkSync
  • Loading branch information
dioKaratzas committed Aug 13, 2024
commit 67b0296a47a3bd13d0e63935537ff19862fa3eec
27 changes: 13 additions & 14 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.3
// swift-tools-version:5.6
import PackageDescription

let package = Package(
Expand All @@ -13,11 +13,11 @@ let package = Package(
.library(name: "web3-zksync.swift", targets: ["web3-zksync"])
],
dependencies: [
.package(name: "BigInt", url: "https://github.com/attaswift/BigInt", from: "5.3.0"),
.package(name: "GenericJSON", url: "https://github.com/iwill/generic-json-swift", .upToNextMajor(from: "2.0.0")),
.package(url: "https://github.com/attaswift/BigInt", .upToNextMajor(from: "5.3.0")),
.package(url: "https://github.com/iwill/generic-json-swift", .upToNextMajor(from: "2.0.0")),
.package(url: "https://github.com/GigaBitcoin/secp256k1.swift.git", .upToNextMajor(from: "0.6.0")),
.package(url: "https://github.com/vapor/websocket-kit.git", from: "2.0.0"),
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0")
.package(url: "https://github.com/vapor/websocket-kit.git", .upToNextMajor(from: "2.0.0")),
.package(url: "https://github.com/apple/swift-log.git", .upToNextMajor(from: "1.0.0"))
],
targets: [
.target(
Expand All @@ -27,44 +27,43 @@ let package = Package(
.target(name: "keccaktiny"),
.target(name: "aes"),
.target(name: "Internal_CryptoSwift_PBDKF2"),
"BigInt",
"GenericJSON",
.product(name: "BigInt", package: "BigInt"),
.product(name: "GenericJSON", package: "generic-json-swift"),
.product(name: "secp256k1", package: "secp256k1.swift"),
.product(name: "WebSocketKit", package: "websocket-kit"),
.product(name: "Logging", package: "swift-log")
],
path: "web3swift/src",
exclude: ["ZKSync"]
path: "Sources/Web3Swift"
),
.target(
name: "web3-zksync",
dependencies:
[
.target(name: "web3")
],
path: "web3swift/src/ZKSync"
path: "Sources/Web3ZKSync"
),
.target(
name: "keccaktiny",
dependencies: [],
path: "web3swift/lib/keccak-tiny",
path: "libs/keccak-tiny",
exclude: ["module.map"]
),
.target(
name: "aes",
dependencies: [],
path: "web3swift/lib/aes",
path: "libs/aes",
exclude: ["module.map"]
),
.target(
name: "Internal_CryptoSwift_PBDKF2",
dependencies: [],
path: "web3swift/lib/CryptoSwift"
path: "libs/CryptoSwift"
),
.testTarget(
name: "web3swiftTests",
dependencies: ["web3", "web3-zksync"],
path: "web3sTests",
path: "Tests/Web3SwiftTests",
resources: [
.copy("Resources/rlptests.json"),
.copy("Account/cryptofights_712.json"),
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions scripts/prepareForPush.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/sh

SWIFT_VERSION=5.3

cd "$(dirname "$0")"

./runSwiftFormat.sh
6 changes: 3 additions & 3 deletions scripts/runSwiftFormat.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

SWIFT_VERSION=5.3
SWIFT_VERSION=5.10

cd "$(dirname "$0")"

Expand All @@ -17,8 +17,8 @@ if ! which bin/swiftformat >/dev/null; then
cd bin
rm -r ./*

downloadAndUnzip "SwiftFormatTmp" "https://github.com/nicklockwood/SwiftFormat/releases/download/0.50.3/swiftformat.artifactbundle.zip"
mv -f ./SwiftFormatTmp/swiftformat.artifactbundle/swiftformat-0.50.3-macos/bin/swiftformat .
downloadAndUnzip "SwiftFormatTmp" "https://github.com/nicklockwood/SwiftFormat/releases/download/0.54.3/swiftformat.artifactbundle.zip"
mv -f ./SwiftFormatTmp/swiftformat.artifactbundle/swiftformat-0.54.3-macos/bin/swiftformat .
find . -name "*Tmp" -type d -prune -exec rm -rf '{}' +
for entry in ./*
do
Expand Down
7 changes: 5 additions & 2 deletions scripts/setupKey.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/sh

# write first argument to a Test
echo "extension TestConfig {\nstatic let privateKey = \"$1\"\nstatic let publicKey = \"0xE78e5ecb061fE3DD1672dDDA7b5116213B23B99A\"\n}" > web3sTests/TestConfig_private.swift
# Move one directory up from the script directory
cd "$(dirname "$0")/.."

# Write the first argument to TestConfig_private.swift
echo "extension TestConfig {\nstatic let privateKey = \"$1\"\nstatic let publicKey = \"0xE78e5ecb061fE3DD1672dDDA7b5116213B23B99A\"\n}" > Tests/Web3SwiftTests/TestConfigPrivate.swift
16 changes: 0 additions & 16 deletions web3swift/web3swift.h

This file was deleted.