-
-
Notifications
You must be signed in to change notification settings - Fork 130
/
Makefile.toml
83 lines (70 loc) · 2.11 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
[tasks.openapi-delete]
cwd = "openapi"
command = "rm"
args = ["-rf", "spec3.sdk.json", "out"]
[tasks.openapi-delete-out]
cwd = "openapi"
command = "rm"
args = ["-rf", "out"]
# verifies if all the apis are exported, and reports which are missing
[tasks.verify]
script = '''
#!/usr/bin/env bash
for filename in src/resources/generated/*.rs ; do
BASE=$(basename $filename '.rs')
if ! grep -Fq "pub mod $BASE;" src/resources/generated.rs ; then
echo $BASE missing module
fi
if ! grep -Fq "$BASE::*," src/resources.rs ; then
echo $BASE missing export
fi
done
'''
[tasks.duplicates]
script = '''
rg -N --no-filename -i '^pub (struct|enum) ([A-Z][a-zA-z0-9]+).*?$' src/resources/generated -g '!placeholders.rs' -r '$2'\
| sort\
| uniq -cd
'''
[tasks.openapi-generate-no-fetch]
cwd = "openapi"
command = "cargo"
args = ["run", "spec3.sdk.json"]
dependencies = ["openapi-delete-out"]
[tasks.openapi-generate]
cwd = "openapi"
command = "cargo"
args = ["run", "spec3.sdk.json", "--fetch", "current"]
dependencies = ["openapi-delete-out"]
[tasks.openapi-generate-latest]
cwd = "openapi"
command = "cargo"
args = ["run", "spec3.sdk.json", "--fetch", "latest"]
dependencies = ["openapi-delete-out"]
[tasks.openapi-copy]
cwd = "openapi"
command = "rsync"
# --delete so that generated files don't stick around when not
# generated anymore, see https://github.com/arlyon/async-stripe/issues/229
args = ["-a", "--delete-during", "out/", "../src/resources/generated"]
[tasks.fmt]
command = "cargo"
toolchain = "nightly"
install_crate = "rustfmt"
# we set this to true because missing files currently cause rustfmt to fail
# which impacts our weekly CI job
ignore_errors = true
args = ["fmt"]
[tasks.check]
command = "cargo"
toolchain = "nightly"
install_crate = "rustfmt"
args = ["fmt", "--", "--check"]
[tasks.openapi-install]
dependencies = ["openapi-generate", "openapi-copy", "fmt"]
[tasks.openapi-install-latest]
dependencies = ["openapi-generate-latest", "openapi-copy", "fmt"]
[tasks.openapi-install-no-fetch]
dependencies = ["openapi-generate-no-fetch", "openapi-copy", "fmt"]
[config]
default_to_workspace = false