Skip to content

Commit 3dd4b9c

Browse files
committed
Improve script update_default_manifest
1 parent a85e3ca commit 3dd4b9c

1 file changed

Lines changed: 53 additions & 17 deletions

File tree

bin/update_default_manifest

Lines changed: 53 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,65 @@
11
#!/bin/bash -eu
22

3-
if [[ $(basename $(pwd)) == "bin" ]]; then
3+
if [[ $(basename "$(pwd)") == "bin" ]]; then
44
cd ..
55
fi
66

7+
repo_root=$(pwd)
8+
9+
julia_major=$(julia --startup-file=no -e 'print("$(VERSION.major).$(VERSION.minor)")')
10+
manifest_name="Manifest-v${julia_major}.toml"
11+
default_manifest="${manifest_name}.default"
12+
projects=("." "examples" "test")
13+
14+
delete_manifests() {
15+
local project_dir=$1
16+
rm -f "$project_dir/$manifest_name" "$project_dir/Manifest.toml"
17+
}
18+
19+
rename_manifest() {
20+
local project_dir=$1
21+
if [[ -f "$project_dir/Manifest.toml" ]]; then
22+
mv "$project_dir/Manifest.toml" "$project_dir/$manifest_name"
23+
fi
24+
}
25+
26+
copy_default_manifest() {
27+
local project_dir=$1
28+
if [[ -f "$project_dir/$manifest_name" ]]; then
29+
cp "$project_dir/$manifest_name" "$project_dir/$default_manifest"
30+
fi
31+
}
32+
33+
require_manifest() {
34+
local project_dir=$1
35+
if [[ ! -f "$project_dir/$manifest_name" ]]; then
36+
echo "Expected $project_dir/$manifest_name to exist, but it was not created."
37+
exit 1
38+
fi
39+
}
40+
41+
for project_dir in "${projects[@]}"; do
42+
delete_manifests "$project_dir"
43+
done
44+
745
cd bin
846
./create_sys_image --update
47+
cd "$repo_root"
948

10-
julia_version=$(julia --version | awk '{print($3)}')
11-
julia_major=${julia_version:0:3}
12-
if [[ $julia_major == "1.1" ]]; then
13-
julia_major=${julia_version:0:4}
49+
if [[ $julia_major == "1.12" ]]; then
50+
julia --startup-file=no --project -e 'using Pkg; Pkg.update()'
51+
julia --startup-file=no --project=examples -e 'using Pkg; Pkg.update()'
52+
julia --startup-file=no --project=test -e 'using Pkg; Pkg.update()'
1453
fi
1554

55+
for project_dir in "${projects[@]}"; do
56+
rename_manifest "$project_dir"
57+
require_manifest "$project_dir"
58+
copy_default_manifest "$project_dir"
59+
done
60+
1661
# TODO run tests
1762

18-
cd ..
19-
if [[ $julia_major == "1.10" ]]; then
20-
cp Manifest-v1.10.toml Manifest-v1.10.toml.default
21-
rm -rf ~/.julia/compiled/v1.10/KiteControllers/
22-
echo "Updated Manifest-v1.10.toml.default !"
23-
echo "Make sure to run the tests before committing the new version!"
24-
else
25-
cp Manifest-v1.11.toml Manifest-v1.11.toml.default
26-
rm -rf ~/.julia/compiled/v1.11/KiteControllers/
27-
echo "Updated Manifest-v1.11.toml.default !"
28-
echo "Make sure to run the tests before committing the new version!"
29-
fi
63+
rm -rf ~/.julia/compiled/v${julia_major}/KiteControllers/
64+
echo "Updated ${default_manifest} files for Julia ${julia_major} in root, examples, and test!"
65+
echo "Make sure to run the tests before committing the new version!"

0 commit comments

Comments
 (0)