diff --git a/Package.swift b/Package.swift index e957966..f4f269c 100644 --- a/Package.swift +++ b/Package.swift @@ -1,22 +1,5 @@ // swift-tools-version: 5.10 import PackageDescription -import Foundation - -let isDevelopment = ProcessInfo.processInfo.environment["YTTRIUM_DEVELOPMENT"] == "false" - -let rustBinaryTarget: Target = { - guard isDevelopment else { - return rustBinaryTarget = .binaryTarget( - name: "RustXcframework", - url: "$REPO_URL/releases/download/$PACKAGE_VERSION/$RUST_XCFRAMEWORK_ZIP", - checksum: "$RUST_CHECKSUM" - ) - } - return .binaryTarget( - name: "RustXcframework", - path: "crates/ffi/YttriumCore/RustXcframework.xcframework" - ) -}() let package = Package( name: "yttrium", @@ -31,6 +14,10 @@ let package = Package( name: "Yttrium", targets: ["Yttrium"] ), + .library( + name: "YttriumDev", + targets: ["YttriumDev"] + ), ], dependencies: [ .package(url: "https://github.com/thebarndog/swift-dotenv.git", from: "2.0.0") @@ -44,18 +31,41 @@ let package = Package( ], path: "platforms/swift/Sources/Yttrium" ), + .target( + name: "YttriumDev", + dependencies: [ + "YttriumCoreDev", + .product(name: "SwiftDotenv", package: "swift-dotenv") + ], + path: "platforms/swift/Sources/Yttrium" + ), .target( name: "YttriumCore", dependencies: [ - "RustXcframework" + "RustXcframeworkRelease" + ], + path: "crates/ffi/YttriumCore/Sources/YttriumCore" + ), + .target( + name: "YttriumCoreDev", + dependencies: [ + "RustXcframeworkDev" ], path: "crates/ffi/YttriumCore/Sources/YttriumCore" ), - rustBinaryTarget, + .binaryTarget( + name: "RustXcframeworkRelease", + url: "$REPO_URL/releases/download/$PACKAGE_VERSION/$RUST_XCFRAMEWORK_ZIP", + checksum: "$RUST_CHECKSUM" + ), + .binaryTarget( + name: "RustXcframeworkDev", + path: "crates/ffi/YttriumCore/RustXcframework.xcframework" + ), .testTarget( name: "YttriumTests", dependencies: [ - "Yttrium" , + "Yttrium", .product(name: "SwiftDotenv", package: "swift-dotenv") ], path: "platforms/swift/Tests/YttriumTests" diff --git a/scripts/generate_package_swift.sh b/scripts/generate_package_swift.sh index fc66dcd..600e49f 100644 --- a/scripts/generate_package_swift.sh +++ b/scripts/generate_package_swift.sh @@ -3,7 +3,6 @@ set -e # Variables -# PACKAGE_VERSION="${GITHUB_VERSION:-0.0.1-alpha}" PACKAGE_VERSION="${GITHUB_VERSION:-0.0.1-alpha}-test" RUST_CHECKSUM=$(cat rust_checksum.txt) RUST_XCFRAMEWORK_ZIP="RustXcframework.xcframework.zip" @@ -13,23 +12,6 @@ REPO_URL="https://github.com/WalletConnect/yttrium" cat > Package.swift <