348 lines
8.8 KiB
TOML
348 lines
8.8 KiB
TOML
[env]
|
|
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
|
|
CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS = ["native/zcash-sync"]
|
|
ANDROID_PLATFORM_VERSION = "28"
|
|
LIB_OUT_DIR = "debug"
|
|
TARGET_OS = "unknown"
|
|
DEV = true
|
|
RELEASE = false
|
|
|
|
[env.release]
|
|
RELEASE = true
|
|
DEV = false
|
|
LIB_OUT_DIR = "release"
|
|
|
|
[tasks.test-flow]
|
|
disabled = true
|
|
|
|
[tasks.android-dev]
|
|
description = "development android x86_64 emulator"
|
|
category = "Build"
|
|
dependencies = [
|
|
"setup-crate-type-android",
|
|
"pre-android",
|
|
"android-x86_64",
|
|
"android-x86_64-release",
|
|
"post-android-x86_64",
|
|
"post-android",
|
|
]
|
|
|
|
[tasks.android-arm]
|
|
description = "build android ARM64 for actual device"
|
|
category = "Build"
|
|
dependencies = [
|
|
"setup-crate-type-android",
|
|
"pre-android",
|
|
"android-aarch64",
|
|
"android-aarch64-release",
|
|
"post-android-aarch64",
|
|
"post-android",
|
|
]
|
|
|
|
[tasks.build]
|
|
description = "Runs the rust compiler."
|
|
category = "Build"
|
|
dependencies = ["android"]
|
|
# TODO replace with "android"
|
|
args = ["build"]
|
|
|
|
[tasks.build.mac]
|
|
description = "Runs the rust compiler."
|
|
category = "Build"
|
|
dependencies = ["ios"]
|
|
|
|
[tasks.ios]
|
|
description = "build iOS targets"
|
|
category = "Build"
|
|
dependencies = ["ios-build", "ios-release", "post-ios"]
|
|
|
|
[tasks.ios-build]
|
|
condition = { platforms = ["mac"], env_true = ["DEV"] }
|
|
description = "Build ios targets."
|
|
category = "Build"
|
|
command = "cargo"
|
|
args = ["lipo"]
|
|
dependencies = [
|
|
"setup-crate-type-ios",
|
|
]
|
|
|
|
[tasks.ios-release]
|
|
condition = { platforms = ["mac"], env_true = ["RELEASE"] }
|
|
description = "Build ios targets."
|
|
category = "Build"
|
|
command = "cargo"
|
|
args = ["lipo", "--release", "--targets", "aarch64-apple-ios", "--features", "dart_ffi"]
|
|
dependencies = [
|
|
"setup-crate-type-ios",
|
|
]
|
|
|
|
[tasks.post-ios]
|
|
script_runner = "@duckscript"
|
|
condition = { platforms = ["mac"] }
|
|
script = [
|
|
"""
|
|
cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/universal/${LIB_OUT_DIR}/libwarp_api_ffi.a \
|
|
${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/packages/warp_api_ffi/ios/libwarp_api_ffi.a
|
|
""",
|
|
"""
|
|
cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/native/${CARGO_MAKE_CRATE_CURRENT_WORKSPACE_MEMBER}/binding.h \
|
|
${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/packages/warp_api_ffi/ios/Classes/binding.h
|
|
""",
|
|
]
|
|
dependencies = ["restore-crate-type"]
|
|
|
|
[tasks.android]
|
|
description = "Build android targets."
|
|
category = "Build"
|
|
dependencies = [
|
|
"setup-crate-type-android",
|
|
"pre-android",
|
|
"android-aarch64",
|
|
"android-aarch64-release",
|
|
"post-android-aarch64",
|
|
"android-armv7",
|
|
"android-armv7-release",
|
|
"post-android-armv7",
|
|
"post-android"
|
|
]
|
|
|
|
[tasks.android-build]
|
|
private = true
|
|
condition = { env_true = ["DEV"], env_set = ["ANDROID_BUILD_TARGET"] }
|
|
command = "cargo"
|
|
args = [
|
|
"ndk",
|
|
"--platform",
|
|
"${ANDROID_PLATFORM_VERSION}",
|
|
"--target",
|
|
"${ANDROID_BUILD_TARGET}",
|
|
"build",
|
|
"--features=dart_ffi"
|
|
]
|
|
|
|
[tasks.android-build-release]
|
|
private = true
|
|
condition = { env_true = ["RELEASE"], env_set = ["ANDROID_BUILD_TARGET"] }
|
|
command = "cargo"
|
|
args = [
|
|
"ndk",
|
|
"--platform",
|
|
"${ANDROID_PLATFORM_VERSION}",
|
|
"--target",
|
|
"${ANDROID_BUILD_TARGET}",
|
|
"build",
|
|
"--release",
|
|
"--features=dart_ffi"
|
|
]
|
|
|
|
[tasks.android-aarch64]
|
|
private = true
|
|
condition = { env_true = ["DEV"] }
|
|
env = { ANDROID_BUILD_TARGET = "arm64-v8a" }
|
|
run_task = "android-build"
|
|
|
|
[tasks.android-armv7]
|
|
private = true
|
|
condition = { env_true = ["DEV"] }
|
|
env = { ANDROID_BUILD_TARGET = "armeabi-v7a" }
|
|
run_task = "android-build"
|
|
|
|
[tasks.android-i686]
|
|
private = true
|
|
condition = { env_true = ["DEV"] }
|
|
env = { ANDROID_BUILD_TARGET = "x86" }
|
|
run_task = "android-build"
|
|
|
|
[tasks.android-x86_64]
|
|
private = true
|
|
condition = { env_true = ["DEV"] }
|
|
env = { ANDROID_BUILD_TARGET = "x86_64" }
|
|
run_task = "android-build"
|
|
|
|
[tasks.android-aarch64-release]
|
|
private = true
|
|
condition = { env_true = ["RELEASE"] }
|
|
env = { ANDROID_BUILD_TARGET = "arm64-v8a" }
|
|
run_task = "android-build-release"
|
|
|
|
[tasks.android-armv7-release]
|
|
private = true
|
|
condition = { env_true = ["RELEASE"] }
|
|
env = { ANDROID_BUILD_TARGET = "armeabi-v7a" }
|
|
run_task = "android-build-release"
|
|
|
|
[tasks.android-i686-release]
|
|
private = true
|
|
condition = { env_true = ["RELEASE"] }
|
|
env = { ANDROID_BUILD_TARGET = "x86" }
|
|
run_task = "android-build-release"
|
|
|
|
|
|
[tasks.android-x86_64-release]
|
|
private = true
|
|
condition = { env_true = ["RELEASE"] }
|
|
env = { ANDROID_BUILD_TARGET = "x86_64" }
|
|
run_task = "android-build-release"
|
|
|
|
[tasks.pre-android]
|
|
private = true
|
|
script_runner = "@duckscript"
|
|
script = [
|
|
"mkdir ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/packages/warp_api_ffi/android/src/main/jniLibs/arm64-v8a",
|
|
"mkdir ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/packages/warp_api_ffi/android/src/main/jniLibs/armeabi-v7a",
|
|
"mkdir ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/packages/warp_api_ffi/android/src/main/jniLibs/x86",
|
|
"mkdir ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/packages/warp_api_ffi/android/src/main/jniLibs/x86_64",
|
|
]
|
|
|
|
[tasks.copy-lib]
|
|
private = true
|
|
condition = { env_set = ["ANDROID_TARGET", "JNI_LIB_DIR"] }
|
|
script_runner = "@duckscript"
|
|
script = [
|
|
"""
|
|
cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/${ANDROID_TARGET}/${LIB_OUT_DIR}/libwarp_api_ffi.so \
|
|
${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/packages/warp_api_ffi/android/src/main/jniLibs/${JNI_LIB_DIR}/libwarp_api_ffi.so
|
|
""",
|
|
]
|
|
|
|
[tasks.post-android-aarch64]
|
|
private = true
|
|
env = { ANDROID_TARGET = "aarch64-linux-android", JNI_LIB_DIR = "arm64-v8a" }
|
|
run_task = "copy-lib"
|
|
|
|
[tasks.post-android-armv7]
|
|
private = true
|
|
env = { ANDROID_TARGET = "armv7-linux-androideabi", JNI_LIB_DIR = "armeabi-v7a" }
|
|
run_task = "copy-lib"
|
|
|
|
[tasks.post-android-i686]
|
|
private = true
|
|
env = { ANDROID_TARGET = "i686-linux-android", JNI_LIB_DIR = "x86" }
|
|
run_task = "copy-lib"
|
|
|
|
|
|
[tasks.post-android-x86_64]
|
|
private = true
|
|
env = { ANDROID_TARGET = "x86_64-linux-android", JNI_LIB_DIR = "x86_64" }
|
|
run_task = "copy-lib"
|
|
|
|
[tasks.post-android]
|
|
dependencies = ["restore-crate-type"]
|
|
|
|
[tasks.setup-crate-type-android]
|
|
private = true
|
|
env = { TARGET_OS = "android" }
|
|
run_task = "setup-crate-type"
|
|
|
|
[tasks.setup-crate-type-ios]
|
|
private = true
|
|
env = { TARGET_OS = "ios" }
|
|
run_task = "setup-crate-type"
|
|
|
|
[tasks.setup-crate-type]
|
|
private = true
|
|
script_runner = "@duckscript"
|
|
script = [
|
|
"""
|
|
toml = readfile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/native/${CARGO_MAKE_CRATE_CURRENT_WORKSPACE_MEMBER}/Cargo.toml
|
|
crate_type = set ""
|
|
os = get_env TARGET_OS
|
|
is_android = eq ${os} "android"
|
|
is_ios = eq ${os} "ios"
|
|
if ${is_android}
|
|
crate_type = set "cdylib"
|
|
elseif ${is_ios}
|
|
crate_type = set "staticlib"
|
|
else
|
|
crate_type = set "rlib"
|
|
end
|
|
val = replace ${toml} "rlib" ${crate_type}
|
|
result = writefile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/native/${CARGO_MAKE_CRATE_CURRENT_WORKSPACE_MEMBER}/Cargo.toml ${val}
|
|
assert ${result}
|
|
""",
|
|
]
|
|
|
|
[tasks.restore-crate-type]
|
|
private = true
|
|
script_runner = "@duckscript"
|
|
script = [
|
|
"""
|
|
toml = readfile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/native/${CARGO_MAKE_CRATE_CURRENT_WORKSPACE_MEMBER}/Cargo.toml
|
|
crate_type = set ""
|
|
os = get_env TARGET_OS
|
|
is_android = eq ${os} "android"
|
|
is_ios = eq ${os} "ios"
|
|
if ${is_android}
|
|
crate_type = set "cdylib"
|
|
elseif ${is_ios}
|
|
crate_type = set "staticlib"
|
|
else
|
|
crate_type = set "rlib"
|
|
end
|
|
val = replace ${toml} ${crate_type} "rlib"
|
|
result = writefile ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/native/${CARGO_MAKE_CRATE_CURRENT_WORKSPACE_MEMBER}/Cargo.toml ${val}
|
|
assert ${result}
|
|
""",
|
|
]
|
|
|
|
[tasks.desktop-build-release]
|
|
private = true
|
|
command = "cargo"
|
|
args = [
|
|
"build",
|
|
"--release",
|
|
"--features=dart_ffi"
|
|
]
|
|
|
|
[tasks.mac-build-release]
|
|
private = true
|
|
command = "cargo"
|
|
args = [
|
|
"build",
|
|
"--target=x86_64-apple-darwin",
|
|
"--release",
|
|
"--features=dart_ffi"
|
|
]
|
|
|
|
[tasks.m1-build-release]
|
|
private = true
|
|
command = "cargo"
|
|
args = [
|
|
"build",
|
|
"--target=aarch64-apple-darwin",
|
|
"--release",
|
|
"--features=dart_ffi"
|
|
]
|
|
|
|
[tasks.flatpak]
|
|
dependencies = [
|
|
"setup-crate-type-android",
|
|
"desktop-build-release",
|
|
"restore-crate-type"
|
|
]
|
|
|
|
[tasks.macos]
|
|
dependencies = [
|
|
"setup-crate-type-android",
|
|
"mac-build-release",
|
|
"m1-build-release",
|
|
"restore-crate-type",
|
|
"post-macos"
|
|
]
|
|
|
|
[tasks.post-macos]
|
|
script_runner = "@duckscript"
|
|
condition = { platforms = ["mac"] }
|
|
script = [
|
|
"mkdir ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/universal/release",
|
|
"""
|
|
exec /usr/bin/lipo ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/x86_64-apple-darwin/release/libwarp_api_ffi.dylib \
|
|
${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/aarch64-apple-darwin/release/libwarp_api_ffi.dylib \
|
|
-output ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/universal/release/libwarp_api_ffi.dylib -create
|
|
""",
|
|
"""
|
|
cp ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/native/${CARGO_MAKE_CRATE_CURRENT_WORKSPACE_MEMBER}/binding.h \
|
|
${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/packages/warp_api_ffi/ios/Classes/binding.h
|
|
""",
|
|
]
|