forked from sagiegurari/cargo-make
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.toml
executable file
·88 lines (79 loc) · 2.63 KB
/
Makefile.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
[env]
RUST_TEST_THREADS = "1"
CARGO_MAKE_TEST_COVERAGE_BINARY_FILTER = "cli-[a-z0-9]*$\\|makers-[a-z0-9]*$\\|${CARGO_MAKE_TEST_COVERAGE_DEFAULT_BINARY_FILTER}"
[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}",
"dir target",
"powershell copy-item -path target/${TARGET}/release/${CARGO_MAKE_CRATE_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 = { "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
'''
]