version: "3"
silent: true
tasks:
swift-build:
run: once
sources:
- src/**/*.rs
- Cargo.toml
- Cargo.lock
generates:
- ../swift/CHedera.xcframework/macos-universal
- ../swift/CHedera.xcframework/ios-arm64
- ../swift/CHedera.xcframework/ios-universal-simulator
cmds:
- rustup component add rust-src 2> /dev/null
- rustup target add x86_64-apple-darwin 2> /dev/null
- cargo build --features ffi -p hedera --target x86_64-apple-darwin
- rustup target add x86_64-apple-ios 2> /dev/null
- cargo build --features ffi -p hedera --target x86_64-apple-ios
- rustup target add aarch64-apple-darwin 2> /dev/null
- cargo build --features ffi -p hedera --target aarch64-apple-darwin
- rustup target add aarch64-apple-ios 2> /dev/null
- cargo build --features ffi -p hedera --target aarch64-apple-ios
- rustup target add aarch64-apple-ios-sim 2> /dev/null
- cargo build --features ffi -p hedera --target aarch64-apple-ios-sim
- rm -rf ../swift/CHedera.xcframework/{ios,macos}-*/
- mkdir -p ../swift/CHedera.xcframework/macos-universal/Headers/
- mkdir -p ../swift/CHedera.xcframework/ios-{universal-simulator,arm64}/Headers/
- lipo target/{x86_64,aarch64}-apple-darwin/debug/libhedera.a -output ../swift/CHedera.xcframework/macos-universal/libhedera.a -create
- lipo target/{x86_64-apple-ios,aarch64-apple-ios-sim}/debug/libhedera.a -output ../swift/CHedera.xcframework/ios-universal-simulator/libhedera.a -create
- cp target/aarch64-apple-ios/debug/libhedera.a ../swift/CHedera.xcframework/ios-arm64/
- cp ../c/include/hedera.h ../swift/CHedera.xcframework/macos-universal/Headers/
- cp ../c/include/hedera.h ../swift/CHedera.xcframework/ios-universal-simulator/Headers/
- cp ../c/include/hedera.h ../swift/CHedera.xcframework/ios-arm64/Headers/
- cp ../swift/CHedera.xcframework/module.modulemap ../swift/CHedera.xcframework/macos-universal/Headers/
- cp ../swift/CHedera.xcframework/module.modulemap ../swift/CHedera.xcframework/ios-universal-simulator/Headers/
- cp ../swift/CHedera.xcframework/module.modulemap ../swift/CHedera.xcframework/ios-arm64/Headers/
build:
run: once
generates:
- target/debug/libhedera.a
sources:
- src/**/*.rs
cmds:
- cmd: cargo build --message-format=short --features=ffi
format:
cmds:
- cargo fmt
lint:
cmds:
- cargo clippy --features=ffi --message-format=short
test:
cmds:
- cargo test
example:
deps: ["build"]
cmds:
- cargo run --example {{.CLI_ARGS}}
package:
run: once
sources:
- src/**/*.rs
- Cargo.toml
- Cargo.lock
generates:
- ../c/lib/macos-x86_64/libhedera.a
- ../c/lib/ios-x86_64/libhedera.a
- ../c/lib/macos-arm64/libhedera.a
- ../c/lib/ios-arm64/libhedera.a
- ../c/lib/linux-x86_64/libhedera.a
- ../c/lib/windows-x86_64/libhedera.a
cmds:
- rustup component add rust-src 2> /dev/null
- rustup target add x86_64-apple-darwin 2> /dev/null
- cargo build --features ffi --release -p hedera -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target x86_64-apple-darwin
- strip -X -S -N -x ./target/x86_64-apple-darwin/release/libhedera.a 2> /dev/null
- rustup target add x86_64-apple-ios 2> /dev/null
- cargo build --features ffi --release -p hedera -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target x86_64-apple-ios
- strip -X -S -N -x ./target/x86_64-apple-ios/release/libhedera.a 2> /dev/null
- rustup target add aarch64-apple-darwin 2> /dev/null
- cargo build --features ffi --release -p hedera -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target aarch64-apple-darwin
- strip -X -S -N -x ./target/aarch64-apple-darwin/release/libhedera.a 2> /dev/null
- rustup target add aarch64-apple-ios 2> /dev/null
- cargo build --features ffi --release -p hedera -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target aarch64-apple-ios
- strip -X -S -N -x ./target/aarch64-apple-ios/release/libhedera.a 2> /dev/null
- rustup target add aarch64-apple-ios-sim 2> /dev/null
- cargo build --features ffi --release -p hedera -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target aarch64-apple-ios-sim
- strip -X -S -N -x ./target/aarch64-apple-ios-sim/release/libhedera.a 2> /dev/null
- rustup target add x86_64-unknown-linux-gnu 2> /dev/null
- env
CC_x86_64_unknown_linux_gnu=x86_64-unknown-linux-gnu-gcc
CXX_x86_64_unknown_linux_gnu=x86_64-unknown-linux-gnu-g++
AR_x86_64_unknown_linux_gnu=x86_64-unknown-linux-gnu-ar
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-unknown-linux-gnu-gcc
cargo build --features ffi --release -p hedera -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target x86_64-unknown-linux-gnu
- x86_64-unknown-linux-gnu-strip --strip-unneeded target/x86_64-unknown-linux-gnu/release/libhedera.a 2> /dev/null
- rustup target add x86_64-pc-windows-gnu 2> /dev/null
- cargo build --features ffi --release -p hedera -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort --target x86_64-pc-windows-gnu
- x86_64-w64-mingw32-strip --strip-unneeded target/x86_64-pc-windows-gnu/release/libhedera.a 2> /dev/null
- mkdir -p ../c/lib/{macos,ios}-{x86_64,arm64}/
- mkdir -p ../c/lib/ios-arm64-sim/
- mkdir -p ../c/lib/{linux,windows}-x86_64/
- cp target/x86_64-apple-darwin/release/libhedera.a ../c/lib/macos-x86_64/
- cp target/x86_64-apple-ios/release/libhedera.a ../c/lib/ios-x86_64/
- cp target/aarch64-apple-darwin/release/libhedera.a ../c/lib/macos-arm64/
- cp target/aarch64-apple-ios/release/libhedera.a ../c/lib/ios-arm64/
- cp target/aarch64-apple-ios-sim/release/libhedera.a ../c/lib/ios-arm64-sim/
- cp target/x86_64-unknown-linux-gnu/release/libhedera.a ../c/lib/linux-x86_64/
- cp target/x86_64-pc-windows-gnu/release/libhedera.a ../c/lib/windows-x86_64/
- rm -rf ../swift/CHedera.xcframework/{ios,macos}-*/
- mkdir -p ../swift/CHedera.xcframework/macos-universal/Headers/
- mkdir -p ../swift/CHedera.xcframework/ios-{universal-simulator,arm64}/Headers/
- lipo ../c/lib/macos-x86_64/libhedera.a ../c/lib/macos-arm64/libhedera.a -output ../swift/CHedera.xcframework/macos-universal/libhedera.a -create
- lipo ../c/lib/ios-x86_64/libhedera.a ../c/lib/ios-arm64-sim/libhedera.a -output ../swift/CHedera.xcframework/ios-universal-simulator/libhedera.a -create
- cp ../c/lib/ios-arm64/libhedera.a ../swift/CHedera.xcframework/ios-arm64/
- cp ../c/include/hedera.h ../swift/CHedera.xcframework/macos-universal/Headers/
- cp ../c/include/hedera.h ../swift/CHedera.xcframework/ios-universal-simulator/Headers/
- cp ../c/include/hedera.h ../swift/CHedera.xcframework/ios-arm64/Headers/
- cp ../swift/CHedera.xcframework/module.modulemap ../swift/CHedera.xcframework/macos-universal/Headers/
- cp ../swift/CHedera.xcframework/module.modulemap ../swift/CHedera.xcframework/ios-universal-simulator/Headers/
- cp ../swift/CHedera.xcframework/module.modulemap ../swift/CHedera.xcframework/ios-arm64/Headers/