-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish.sh
More file actions
97 lines (75 loc) · 2.77 KB
/
publish.sh
File metadata and controls
97 lines (75 loc) · 2.77 KB
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
#!/bin/bash
publish_dotnet_app() {
local project_path="$1"
local old_name="$2"
local new_name="$3"
shift 3
local publish_args=("$@")
echo "Publishing $new_name..."
local output_dir="./publish_output"
if [ -d "$output_dir" ]; then
rm -rf "$output_dir"
fi
dotnet publish "$project_path" -c Release -r linux-x64 "${publish_args[@]}" --output "$output_dir" --nologo
if [ -f "$output_dir/$old_name" ]; then
mv "$output_dir/$old_name" "./$new_name"
chmod +x "./$new_name"
echo "Successfully published $new_name!"
else
echo "Error: Expected binary $old_name not found in $output_dir!"
fi
}
publish_go_app() {
local project_path="$1"
local output_name="$2"
echo "Publishing $output_name..."
if [ -f "$output_name" ]; then
rm -f "$output_name"
fi
if [ ! -d "$project_path" ]; then
echo "Error: Go project path $project_path does not exist!"
return 1
fi
pushd "$project_path" > /dev/null
go build -o "../$output_name" .
popd > /dev/null
if [ -f "$output_name" ]; then
chmod +x "$output_name"
echo "Successfully published $output_name!"
else
echo "Error: Go binary $output_name not found!"
fi
}
publish_rust_app() {
local project_path="$1"
local binary_name="$2"
local output_name="$3"
echo "Publishing $output_name..."
if [ -f "$output_name" ]; then
rm -f "$output_name"
fi
if [ ! -d "$project_path" ]; then
echo "Error: Rust project path $project_path does not exist!"
return 1
fi
pushd "$project_path" > /dev/null
cargo build --release
cp ./target/release/$binary_name ../$output_name
popd > /dev/null
if [ -f "$output_name" ]; then
chmod +x "$output_name"
echo "Successfully published $output_name!"
else
echo "Error: Rust binary $output_name not found!"
fi
}
publish_dotnet_app "./DotNetWorkload" "DotNetWorkload" "DotNetWorkloadJitApp" "--self-contained" "true" "/p:PublishSingleFile=true"
publish_dotnet_app "./DotNetLight" "DotNetLight" "DotNetLightJitApp" "--self-contained" "true" "/p:PublishSingleFile=true"
publish_dotnet_app "./DotNetWorkload" "DotNetWorkload" "DotNetWorkloadAotApp" "/p:PublishAot=true"
publish_dotnet_app "./DotNetLight" "DotNetLight" "DotNetLightAotApp" "/p:PublishAot=true"
publish_go_app "./GolangWorkload" "GolangWorkloadApp"
publish_go_app "./GolangLight" "GolangLightApp"
publish_rust_app "./RustWorkload" "RustWorkload" "RustWorkloadApp"
publish_rust_app "./RustLight" "RustLight" "RustLightApp"
publish_dotnet_app "./PerformanceProfiler" "PerformanceProfiler" "PerformanceProfilerApp" "--self-contained" "true" "/p:PublishSingleFile=true"
echo "All builds completed successfully!"