Skip to content

Commit

Permalink
Support building packages with testing mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
hamster620 committed Jul 8, 2023
1 parent 1e33c51 commit c0d1af0
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 6 deletions.
3 changes: 2 additions & 1 deletion BuildLinuxPackages.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set CONFIG=Release
set FRAMEWORK=net7.0
set SELF_CONTAINED=true
set TRIM_ASSEMBLIES=true
set TESTING_MODE_BUILD=false
set ERRORLEVEL=0

echo ********** Start building %APP_NAME% **********
Expand Down Expand Up @@ -71,7 +72,7 @@ REM Build packages
)

REM Build project
dotnet publish %APP_NAME% -c %CONFIG% -r %%r --self-contained %SELF_CONTAINED% -p:PublishTrimmed=%TRIM_ASSEMBLIES%
dotnet publish %APP_NAME% -c %CONFIG% -r %%r --self-contained %SELF_CONTAINED% -p:PublishTrimmed=%TRIM_ASSEMBLIES% -p:TestingModeBuild=%TESTING_MODE_BUILD%
if %ERRORLEVEL% neq 0 (
echo Failed to build project: %ERRORLEVEL%
del /Q Packages\Packaging.txt
Expand Down
3 changes: 2 additions & 1 deletion BuildLinuxPackages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ APP_NAME="ULogViewer"
RID_LIST=("linux-x64" "linux-arm64")
CONFIG="Release"
TRIM_ASSEMBLIES="true"
TESTING_MODE_BUILD="false"
echo "********** Start building $APP_NAME **********"

# Get application version
Expand Down Expand Up @@ -45,7 +46,7 @@ for i in "${!RID_LIST[@]}"; do
fi

# build
dotnet publish $APP_NAME -c $CONFIG -r $RID --self-contained true -p:PublishTrimmed=$TRIM_ASSEMBLIES
dotnet publish $APP_NAME -c $CONFIG -r $RID --self-contained true -p:PublishTrimmed=$TRIM_ASSEMBLIES -p:TestingModeBuild=$TESTING_MODE_BUILD
if [ "$?" != "0" ]; then
exit
fi
Expand Down
5 changes: 3 additions & 2 deletions BuildMacOSPackages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ RID_LIST=("osx.11.0-arm64" "osx-x64")
PUB_PLATFORM_LIST=("osx-arm64" "osx-x64")
CONFIG="Release"
TRIM_ASSEMBLIES="true"
TESTING_MODE_BUILD="false"
ICON_VERSION="2"
CERT_NAME="" # Name of certification to sign the application

Expand Down Expand Up @@ -43,7 +44,7 @@ for i in "${!RID_LIST[@]}"; do
fi

# build
dotnet msbuild $APP_NAME -t:BundleApp -property:Configuration=$CONFIG -p:SelfContained=true -p:PublishSingleFile=false -p:PublishTrimmed=$TRIM_ASSEMBLIES -p:RuntimeIdentifier=$RID
dotnet msbuild $APP_NAME -t:BundleApp -property:Configuration=$CONFIG -p:SelfContained=true -p:PublishSingleFile=false -p:PublishTrimmed=$TRIM_ASSEMBLIES -p:RuntimeIdentifier=$RID -p:TestingModeBuild=$TESTING_MODE_BUILD
if [ "$?" != "0" ]; then
exit
fi
Expand All @@ -58,7 +59,7 @@ for i in "${!RID_LIST[@]}"; do
exit
fi

# copy .app directory to output directoty
# copy .app directory to output directory
mv ./$APP_NAME/bin/$CONFIG/net7.0/$RID/publish/$APP_NAME.app ./Packages/$VERSION/$PUB_PLATFORM/$APP_NAME.app
if [ "$?" != "0" ]; then
exit
Expand Down
3 changes: 2 additions & 1 deletion BuildWindowsPackages.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set CONFIG=Release-Windows
set FRAMEWORK=net7.0
set SELF_CONTAINED=true
set TRIM_ASSEMBLIES=true
set TESTING_MODE_BUILD=false
set ERRORLEVEL=0

echo ********** Start building %APP_NAME% **********
Expand Down Expand Up @@ -59,7 +60,7 @@ REM Build packages
)

REM Build project
dotnet publish %APP_NAME% -c %CONFIG% -r %%r --self-contained %SELF_CONTAINED% -p:PublishTrimmed=%TRIM_ASSEMBLIES%
dotnet publish %APP_NAME% -c %CONFIG% -r %%r --self-contained %SELF_CONTAINED% -p:PublishTrimmed=%TRIM_ASSEMBLIES% -p:TestingModeBuild=%TESTING_MODE_BUILD%
if %ERRORLEVEL% neq 0 (
echo Failed to build project: %ERRORLEVEL%
del /Q Packages\Packaging.txt
Expand Down
2 changes: 1 addition & 1 deletion ULogViewer/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ protected override bool OnSelectEnteringDebugMode()
// Select whether to enter testing mode or not.
protected override bool OnSelectEnteringTestingMode()
{
#if DEBUG
#if DEBUG || TESTING_MODE_BUILD
return true;
#else
return base.OnSelectEnteringTestingMode();
Expand Down
4 changes: 4 additions & 0 deletions ULogViewer/ULogViewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(TestingModeBuild)'=='True'">
<DefineConstants>TESTING_MODE_BUILD</DefineConstants>
</PropertyGroup>

<PropertyGroup>
<CFBundleName>ULogViewer</CFBundleName>
<CFBundleExecutable>ULogViewer</CFBundleExecutable>
Expand Down

0 comments on commit c0d1af0

Please sign in to comment.