mirror of
https://github.com/sagiegurari/duckscript
synced 2024-10-14 03:42:32 +00:00
113 lines
3 KiB
Makefile
113 lines
3 KiB
Makefile
|
|
||
|
[env]
|
||
|
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = "true"
|
||
|
CARGO_MAKE_DUCKSCRIPT_PROJECT_NAME = "duckscript"
|
||
|
|
||
|
[env.sdk]
|
||
|
CARGO_MAKE_WORKSPACE_INCLUDE_MEMBERS = "duckscript_sdk;duckscript_cli"
|
||
|
|
||
|
[config]
|
||
|
additional_profiles = [
|
||
|
"ci-coverage-tasks",
|
||
|
"ci-all-build-tasks",
|
||
|
"publish-pre-cleanup"
|
||
|
]
|
||
|
|
||
|
[tasks.generate-sdk-docs]
|
||
|
workspace = false
|
||
|
command = "cargo"
|
||
|
args = [ "run", "--", "./sdkdocs.ds", ]
|
||
|
|
||
|
[tasks.generate-readme]
|
||
|
script = [
|
||
|
'''
|
||
|
echo "generating readme file"
|
||
|
rm -f ./README.md
|
||
|
cat ./docs/_includes/README.md ./docs/_includes/nav.md ./docs/_includes/content.md >> README.md
|
||
|
sed -i 's,https://github.com/sagiegurari/duckscript/blob/master/.github,.github,g' ./README.md
|
||
|
'''
|
||
|
]
|
||
|
|
||
|
[tasks.workspace-docs]
|
||
|
dependencies = [
|
||
|
"generate-sdk-docs",
|
||
|
"generate-readme"
|
||
|
]
|
||
|
|
||
|
[tasks.install_local]
|
||
|
workspace = false
|
||
|
cwd = "./duckscript_cli"
|
||
|
command = "cargo"
|
||
|
args = [ "install", "--force", "--path", "." ]
|
||
|
|
||
|
[tasks.zip-release-ci-flow]
|
||
|
description = "Compiles the binary in release mode and zips it up"
|
||
|
category = "CI"
|
||
|
workspace = false
|
||
|
condition = { env_set = ["TARGET"] }
|
||
|
dependencies = [
|
||
|
"clean",
|
||
|
"setup-build-env",
|
||
|
"build-release-for-target",
|
||
|
"zip-release-binary-for-target"
|
||
|
]
|
||
|
|
||
|
[tasks.build-release-for-target]
|
||
|
description = "Makes a release build for a given target"
|
||
|
condition = { env_set = [ "TARGET" ] }
|
||
|
command = "cargo"
|
||
|
args = [
|
||
|
"build",
|
||
|
"--release",
|
||
|
"--all-features",
|
||
|
"--target",
|
||
|
"${TARGET}"
|
||
|
]
|
||
|
|
||
|
[tasks.zip-release-binary-for-target]
|
||
|
description = "Zips up the release binary, README, and license(s)"
|
||
|
category = "Publish"
|
||
|
condition = { env_set = [ "TARGET" ] }
|
||
|
env = { "OUTPUT_NAME" = "${CARGO_MAKE_DUCKSCRIPT_PROJECT_NAME}-${TARGET}"}
|
||
|
script_runner = "@shell"
|
||
|
script = [
|
||
|
"mkdir ${OUTPUT_NAME}",
|
||
|
"cp target/$TARGET/release/${CARGO_MAKE_DUCKSCRIPT_PROJECT_NAME} ${OUTPUT_NAME}/",
|
||
|
"cp README.md LICENSE* ${OUTPUT_NAME}/",
|
||
|
"zip -r ${OUTPUT_NAME}.zip ${OUTPUT_NAME}",
|
||
|
]
|
||
|
|
||
|
[tasks.zip-release-binary-for-target.windows]
|
||
|
script = [
|
||
|
"mkdir ${OUTPUT_NAME}",
|
||
|
"dir target",
|
||
|
"powershell copy-item -path target/${TARGET}/release/${CARGO_MAKE_DUCKSCRIPT_PROJECT_NAME}.exe -destination ${OUTPUT_NAME}",
|
||
|
"powershell copy-item -path README.md -destination ${OUTPUT_NAME}",
|
||
|
"powershell copy-item -path LICENSE -destination ${OUTPUT_NAME}",
|
||
|
"dir ${OUTPUT_NAME}",
|
||
|
"powershell Compress-Archive -Path ${OUTPUT_NAME}/* -DestinationPath ${OUTPUT_NAME}.zip",
|
||
|
]
|
||
|
|
||
|
[tasks.setup-build-env]
|
||
|
description = "Sets up any non-rust dependencies in the build environment"
|
||
|
linux_alias = "setup-musl"
|
||
|
mac_alias = "empty"
|
||
|
windows_alias = "empty"
|
||
|
|
||
|
[tasks.setup-musl]
|
||
|
description = "Sets up a musl build environment"
|
||
|
windows_alias = "empty"
|
||
|
mac_alias = "empty"
|
||
|
condition = { env_set = [ "TARGET" ], env_true = [ "CARGO_MAKE_CI" ] }
|
||
|
env = { "OPENSSL_DIR" = "${HOME}/openssl-musl", "OPENSSL_VERSION" = "1.0.2l" }
|
||
|
script = [
|
||
|
'''
|
||
|
rustup target add "$TARGET"
|
||
|
curl https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz | tar xzf -
|
||
|
cd openssl-$OPENSSL_VERSION
|
||
|
CC=musl-gcc ./Configure --prefix="$OPENSSL_DIR" no-dso no-ssl2 no-ssl3 linux-x86_64 -fPIC
|
||
|
make -j"$(nproc)"
|
||
|
make install
|
||
|
'''
|
||
|
]
|