Skip to content

Commit 393fc32

Browse files
committed
feat!(build): add various tasks required for functional dist command
1 parent 51baed9 commit 393fc32

File tree

4 files changed

+117
-33
lines changed

4 files changed

+117
-33
lines changed

.rustfmt.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ imports_granularity = "Module"
1313
imports_layout = "HorizontalVertical"
1414
normalize_doc_attributes = true
1515
reorder_impl_items = true
16-
reorder_modules = true
16+
reorder_modules = true

TODO.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

build/common-tasks.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ echo "BREAKER: ${BREAKER}"
3131
[tasks.print_all]
3232
script_runner = "@duckscript"
3333
script = '''
34+
echo "BREAKER: ${BREAKER}"
3435
echo ""ROOT: ${ROOT}
3536
echo "PROFILE: ${PROFILE}"
3637
echo "VERSION: ${VERSION}"
@@ -99,4 +100,4 @@ dependencies = ["format"]
99100
[tasks.test_workspace]
100101
command = "cargo"
101102
args = ["test", "--workspace"]
102-
# END Workspaces
103+
# END Workspaces

build/dist-tasks.toml

Lines changed: 114 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,137 @@
1+
[tasks.print_outs]
2+
script_runner = "@duckscript"
3+
script = '''
4+
echo "BREAKER: ${BREAKER}"
5+
echo "winodows would be args: "FROM:: ${FOLDER_BIN_EXE}""
6+
echo "winodows would be args: "TO:: ${DIST_FOLDER}/${OUTPUT_BIN_NAME}.exe""
7+
echo "BREAKER: ${BREAKER}"
8+
'''
9+
110
[tasks.clear_dist_if_exist]
2-
windows.command = "del"
311
command = "rm"
4-
windows.args = ["${DIST_FOLDER}/", "-ErrorAction", "SilentlyContinue"]
5-
#windows.args = ["-Force", "-Recurse", "${DIST_FOLDER}/", "-ErrorAction", "SilentlyContinue"]
612
linux.args = ["-rf", "${DIST_FOLDER}/"]
13+
windows.command = "pwsh.exe"
14+
windows.args = [
15+
"-Command",
16+
"Remove-Item",
17+
"-Recurse",
18+
"-Force",
19+
"${DIST_FOLDER}/",
20+
"-ErrorAction",
21+
"SilentlyContinue"
22+
]
23+
ignore_errors = true # REQUIRED as - if the dir doesn't exist, SilenlyContinue does nothing really
724

825
[tasks.create_dist]
9-
windows.command = "mkdir"
1026
linux.command = "mkdir"
11-
windows.args = ["${DIST_FOLDER}/"]
1227
linux.args = ["-p", "${DIST_FOLDER}/"]
28+
windows.command = "mkdir"
29+
windows.args = ["${DIST_FOLDER}/"]
1330

1431
[tasks.create_showcase_dist]
1532
linux.command = "mkdir"
33+
linux.args = ["-p", "${DIST_FOLDER}/showcase/"]
1634
windows.command = "mkdir"
17-
args = ["-p", "${DIST_FOLDER}/showcase/"]
35+
windows.args = ["${DIST_FOLDER}/showcase/"]
1836
dependencies = ["create_dist"]
1937

2038
[tasks.copy_readme_to_dist]
2139
linux.command = "cp"
22-
windows.command = "copy"
23-
args = ["${ROOT}/README.md", "${DIST_FOLDER}/"]
40+
linux.args = ["${ROOT}/README.md", "${DIST_FOLDER}/"]
41+
windows.command = "pwsh.exe"
42+
windows.args = [
43+
"-Command",
44+
"Copy-Item",
45+
"-Path",
46+
"${ROOT}/README.md",
47+
"-Destination",
48+
"${DIST_FOLDER}",
49+
]
2450
dependencies = ["create_dist"]
2551

2652
[tasks.copy_release_to_dist]
27-
command = "cp"
28-
windows.args = ["${FOLDER_BIN_EXE}", "${DIST_FOLDER}/${OUTPUT_BIN_NAME}.exe"]
53+
linux.command = "cp"
2954
linux.args = ["${FOLDER_BIN_EXE}", "${DIST_FOLDER}/${OUTPUT_BIN_NAME}"]
30-
dependencies = ["create_dist", "build_release"]
55+
windows.command = "pwsh.exe"
56+
windows.args = [
57+
"-Command",
58+
"Copy-Item",
59+
"-Path",
60+
"${FOLDER_BIN_EXE}",
61+
"-Destination",
62+
"${DIST_FOLDER}/${OUTPUT_BIN_NAME}.exe",
63+
]
64+
dependencies = ["create_dist"]
65+
66+
[tasks.compress_dist]
67+
linux.command = "tar"
68+
linux.args = [
69+
"-czvf",
70+
"${DIST_FOLDER}.tar.gz",
71+
"${DIST_FOLDER}/",
72+
"mv",
73+
"${DIST_FOLDER}.tar.gz",
74+
"${DIST_FOLDER}/",
75+
]
76+
77+
windows.command = "pwsh.exe"
78+
windows.args = [
79+
"-Command",
80+
"Compress-Archive",
81+
"-Path",
82+
"${DIST_FOLDER}",
83+
"-DestinationPath",
84+
"${DIST_FOLDER}.zip",
85+
]
86+
dependencies = ["create_dist"]
87+
88+
[tasks.move_compressed_to_dist]
89+
linux.command = "mv"
90+
linux.args = ["${DIST_FOLDER}.tar.gz", "${DIST_FOLDER}/"]
91+
92+
windows.command = "pwsh.exe"
93+
windows.args = [
94+
"-Command",
95+
"Move-Item",
96+
"-Path",
97+
"${DIST_FOLDER}.zip",
98+
"-Destination",
99+
"${DIST_FOLDER}/"
100+
]
101+
102+
# Lets any streaming tasks finish
103+
[tasks.sleep]
104+
linux.command = "sleep"
105+
linux.args = ["1"]
106+
windows.command = "pwsh.exe"
107+
windows.args = ["-Command", "Start-Sleep", "-Seconds", "1"]
108+
109+
[tasks.gitignore_folder_contents]
110+
linux.command = "echo"
111+
linux.args = ["\"*\" >> ${DIST_FOLDER}/.gitignore"]
112+
113+
windows.command = "pwsh.exe"
114+
windows.args = [
115+
"-Command",
116+
"echo",
117+
"\"*\"",
118+
">>",
119+
"${DIST_FOLDER}/.gitignore"
120+
]
31121

32122
[tasks.build_release_dist]
123+
env.PROFILE = "release"
33124
dependencies = [
34-
# "a",
125+
"a",
126+
"clear_dist_if_exist",
35127
"create_dist",
36-
# "create_showcase_dist",
37-
# "copy_readme_to_dist",
38-
# "copy_release_to_dist",
39-
# "print_all",
40-
# "docs",
41-
]
128+
"create_showcase_dist",
129+
"copy_readme_to_dist",
130+
"copy_release_to_dist",
131+
"docs",
132+
"print_all",
133+
"gitignore_folder_contents",
134+
"compress_dist",
135+
"sleep",
136+
"move_compressed_to_dist",
137+
]

0 commit comments

Comments
 (0)