cargo-make 0.15.2

Rust task runner and build tool.

[env]
RUST_TEST_THREADS = "1"

[tasks.outdated]
#do not break build due to child outdated dependencies also used as root dependencies
force = true

[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/cargo-make/blob/master/.github,.github,g' ./README.md
sed -i "s,{{ site.version }},${CARGO_MAKE_CRATE_VERSION},g" ./README.md
'''
]

[tasks.post-docs]
linux_alias = "generate-readme"

[tasks.zip-release-ci-flow]
description = "Compiles the binary in release mode and zips it up"
category = "CI"
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_CRATE_NAME}-v${CARGO_MAKE_CRATE_VERSION}-${TARGET}"}
script_runner = "@shell"
script = [
  "mkdir ${OUTPUT_NAME}",
  "cp target/$TARGET/release/${CARGO_MAKE_CRATE_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}",
  "powershell copy-item -path target/release/${CARGO_MAKE_CRATE_NAME}.exe -destination ${OUTPUT_NAME}",
  "powershell copy-item -path README.md -destination ${OUTPUT_NAME}",
  "powershell copy-item -path cp LICENSE -destination ${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 = { "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
'''
]