Skip to content

Commit 44a36b1

Browse files
authored
Fix build by not triming (#469)
* Fix build by not triming * Fix build by not triming * Fix build by not triming * Fix build by not triming * Fix build by not triming * Fix build by not triming * Fix build by not triming * Fix build by not triming
1 parent 08adebd commit 44a36b1

File tree

4 files changed

+39
-36
lines changed

4 files changed

+39
-36
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.16.36
1+
1.16.37

build.cmd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set SCRIPT_DIR=%~dp0
55
set SCRIPT_DIR=%SCRIPT_DIR:~0,-1%
66
set BUILD_CONFIGURATION=
77
set BUILD_FLAGS=-p:PublishTrimmed=true
8+
set BUILD_FLAGS=
89
set BUILD_VERSION=
910
set VC_SOLUTION_DIR=%SCRIPT_DIR%\src\VirtualClient
1011

@@ -16,7 +17,7 @@ for %%a in (%*) do (
1617

1718
rem Pass in the --notrim flag to opt out of trimming the project
1819
rem assemblies during build.
19-
if /i "%%a" == "--notrim" set BUILD_FLAGS=
20+
if /i "%%a" == "--trim" set BUILD_FLAGS=-p:PublishTrimmed=true
2021
)
2122

2223
rem The default build version is defined in the repo VERSION file.

build.sh

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,27 @@
11
#!/bin/bash
22

33
EXIT_CODE=0
4-
BUILD_CONFIGURATION=""
5-
BUILD_FLAGS="-p:PublishTrimmed=true"
4+
BUILD_CONFIGURATION="Release"
5+
BUILD_FLAGS=""
66
BUILD_VERSION=""
77
SCRIPT_DIR="$(dirname $(readlink -f "${BASH_SOURCE}"))"
88

99
Usage() {
1010
echo ""
11-
echo "Builds the source code in the repo."
11+
echo "Builds the source code in the repo. "
12+
echo ""
13+
echo "Options:"
14+
echo "---------------------"
15+
echo "--trim - Enables trimming for publish output."
1216
echo ""
1317
echo "Usage:"
1418
echo "---------------------"
15-
echo "build.sh"
19+
echo "build.sh [--trim]"
1620
echo ""
1721
echo "Examples"
1822
echo "---------------------"
19-
echo "# Use defaults"
20-
echo "user@system:~/repo$ chmod +x *.sh"
21-
echo "user@system:~/repo$ ./build.sh"
22-
echo ""
23-
echo "# Set specific version and configuration"
24-
echo "user@system:~/repo$ export VCBuildVersion=\"1.16.25\""
25-
echo "user@system:~/repo$ export VCBuildConfiguration=\"Debug\""
26-
echo "user@system:~/repo$ chmod +x *.sh"
2723
echo "user@system:~/repo$ ./build.sh"
24+
echo "user@system:~/repo$ ./build.sh --trim"
2825
echo ""
2926
Finish
3027
}
@@ -45,23 +42,23 @@ Finish() {
4542
exit $EXIT_CODE
4643
}
4744

48-
for ((i=1; i<=$#; i++)); do
49-
arg="${!i}"
50-
51-
if [ "$arg" == "/?" ] || [ "$arg" == "-?" ] || [ "$arg" == "--help" ]; then
52-
Usage
53-
fi
45+
# Parse arguments
46+
while [[ $# -gt 0 ]]; do
47+
case "${1,,}" in
48+
"/?"|"-?"|"--help")
49+
Usage
50+
;;
51+
"--trim")
52+
BUILD_FLAGS="-p:PublishTrimmed=true"
53+
;;
54+
*)
55+
echo "Unknown option: $1"
56+
Usage
57+
;;
58+
esac
59+
shift
5460
done
5561

56-
# The default build version is defined in the repo VERSION file.
57-
BUILD_VERSION=$(cat "$SCRIPT_DIR/VERSION")
58-
59-
# The default build version can be overridden by the 'VCBuildVersion'
60-
# environment variable
61-
if [[ -v "VCBuildVersion" && -n "$VCBuildVersion" ]]; then
62-
BUILD_VERSION=$VCBuildVersion
63-
fi
64-
6562
# The default build configuration is 'Release'.
6663
BUILD_CONFIGURATION="Release"
6764

@@ -71,6 +68,14 @@ if [[ -v "VCBuildConfiguration" && -n "$VCBuildConfiguration" ]]; then
7168
BUILD_CONFIGURATION=$VCBuildConfiguration
7269
fi
7370

71+
# The default build version is defined in the repo VERSION file.
72+
BUILD_VERSION=$(cat "$SCRIPT_DIR/VERSION" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
73+
74+
# The default build version can be overridden by the 'VCBuildVersion' environment variable
75+
if [[ -v "VCBuildVersion" && -n "$VCBuildVersion" ]]; then
76+
BUILD_VERSION=$VCBuildVersion
77+
fi
78+
7479
echo ""
7580
echo "**********************************************************************"
7681
echo "Build Version : $BUILD_VERSION"
@@ -79,6 +84,7 @@ echo "Configuration : $BUILD_CONFIGURATION"
7984
echo "Flags : $BUILD_FLAGS"
8085
echo "**********************************************************************"
8186

87+
8288
echo ""
8389
echo "[Build Solution]"
8490
echo "----------------------------------------------------------------------"
@@ -102,7 +108,7 @@ if [ $result -ne 0 ]; then
102108
fi
103109

104110
echo ""
105-
echo "Build Virtual Client: linux-arm64]"
111+
echo "[Build Virtual Client: linux-arm64]"
106112
echo "----------------------------------------------------------------------"
107113
dotnet publish "$SCRIPT_DIR/src/VirtualClient/VirtualClient.Main/VirtualClient.Main.csproj" -r linux-arm64 -c $BUILD_CONFIGURATION --self-contained \
108114
-p:AssemblyVersion=$BUILD_VERSION $BUILD_FLAGS
@@ -113,7 +119,7 @@ if [ $result -ne 0 ]; then
113119
fi
114120

115121
echo ""
116-
echo "Build Virtual Client: win-x64]"
122+
echo "[Build Virtual Client: win-x64]"
117123
echo "----------------------------------------------------------------------"
118124
dotnet publish "$SCRIPT_DIR/src/VirtualClient/VirtualClient.Main/VirtualClient.Main.csproj" -r win-x64 -c $BUILD_CONFIGURATION --self-contained \
119125
-p:AssemblyVersion=$BUILD_VERSION $BUILD_FLAGS
@@ -134,4 +140,4 @@ if [ $result -ne 0 ]; then
134140
Error
135141
fi
136142

137-
End
143+
End

src/VirtualClient/VirtualClient.Core.UnitTests/VirtualClient.Core.UnitTests.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@
4848
</Content>
4949
</ItemGroup>
5050

51-
<ItemGroup>
52-
<Content Include="S:\microsoft\virtualclient2\src\VirtualClient\TestResources\Results_CtsTraffic.csv" Link="Results_CtsTraffic.csv" />
53-
</ItemGroup>
54-
5551
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Module.props))\Module.props" />
5652

5753
</Project>

0 commit comments

Comments
 (0)