forked from unicode-org/icu4x
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.toml
130 lines (113 loc) · 4.02 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# This file is part of ICU4X. For terms of use, please see the file
# called LICENSE at the top level of the ICU4X source tree
# (online at: https://github.com/unicode-org/icu4x/blob/master/LICENSE ).
[config]
default_to_workspace = false
load_cargo_aliases = true
### INDIVIDUAL TEST AND LINT TASKS ###
# Note: If a task is purely a cargo alias, define it in .cargo/config.toml
[tasks.build-all-features]
description = "Build all permutations of all features"
category = "ICU4X Development"
install_crate = { crate_name = "cargo-all-features", binary = "cargo-build-all-features", test_arg = ["--help"] }
install_crate_args = ["--version", "^1.4"]
command = "cargo"
args = ["build-all-features"]
[tasks.license-header-check]
description = "Ensure all the source files have license headers"
category = "ICU4X Development"
script_runner = "@duckscript"
script = '''
exit_on_error true
glob_pattern_array = array "./**/*.rs" "./**/*.yml" "./**/*.toml"
for pattern in ${glob_pattern_array}
handle = glob_array ${pattern}
for path in ${handle}
if not starts_with ${path} "target" # skip paths in target dir
text = readfile ${path}
result_hash = starts_with ${text} "# This file is part of ICU4X. For terms of use, please see the file"
result_slash = starts_with ${text} "// This file is part of ICU4X. For terms of use, please see the file"
not_result_hash = not ${result_hash}
not_result_slash = not ${result_slash}
if ${not_result_hash} and ${not_result_slash}
echo "License header missing in ${path}"
trigger_error "License header missing in ${path}"
end
end
end
echo "License headers found in files matching ${pattern}"
end
echo "License header check complete"
'''
### META TASKS ###
[tasks.quick]
description = "Run quick version of all lints and tests"
category = "ICU4X Development"
dependencies = [
"test-all",
"fmt-check",
"clippy-all",
"license-header-check",
]
[tasks.ci]
description = "Run all lints and tests"
category = "ICU4X Development"
dependencies = [
"quick",
"test-docs",
"build-all-features",
]
### WASM TASKS ###
[tasks.wasm-build]
description = "Build all examples as WASM into the target directory"
category = "ICU4X WASM"
install_crate = { rustup_component_name = "rust-src" }
toolchain = "nightly"
command = "cargo"
args = ["wasm-build", "--examples"]
[tasks.wasm-dir]
description = "Make the WASM package directory"
category = "ICU4X WASM"
command = "mkdir"
args = ["-p", "wasmpkg"]
[tasks.wasm-wasm]
description = "Copy the WASM files from target into wasmpkg"
category = "ICU4X WASM"
command = "cp"
args = ["-a", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/wasm32-unknown-unknown/release/examples/.", "wasmpkg/"]
dependencies = ["wasm-build", "wasm-dir"]
[tasks.wasm-wat]
description = "Create WebAssembly Text files from the WASM files"
category = "ICU4X WASM"
command = "find"
args = ["wasmpkg/", "-name", "*.wasm", "-exec", "wasm2wat", "{}", "-o", "{}.wat", ";"]
dependencies = ["wasm-wasm"]
install_script = ["which wasm2wat || npm install -g wabt"]
[tasks.wasm-opt]
description = "Create optimized WASM files from the WASM files"
category = "ICU4X WASM"
command = "find"
args = ["wasmpkg/", "-name", "*.wasm", "-exec", "wasm-opt", "{}", "-o", "{}.opt", ";"]
dependencies = ["wasm-wasm"]
install_script = ["which wasm-opt || npm install -g wasm-opt"]
[tasks.wasm-twiggy-dominators]
description = "Create Twiggy Dominator files from the WASM files"
category = "ICU4X WASM"
command = "find"
args = ["wasmpkg/", "-name", "*.wasm", "-exec", "twiggy", "dominators", "{}", "-o", "{}.txt", ";"]
dependencies = ["wasm-wasm"]
install_crate = "twiggy"
[tasks.wasm]
description = "All-in-one command to build examples and supplements to wasmpkg"
category = "ICU4X WASM"
dependencies = [
"wasm-wasm",
"wasm-wat",
"wasm-opt",
"wasm-twiggy-dominators",
]
[tasks.wasm-clean]
description = "Clean up WASM build artifacts"
category = "ICU4X WASM"
command = "rm"
args = ["-rf", "wasmpkg"]