Finished refactoring build process, Added final GUID to MSI, Finished separating build scripts
Update .gitignore, check-and-fix-path.bat, and 9 more files...
This commit is contained in:
+2
-3
@@ -10,9 +10,6 @@ bin/
|
||||
obj/
|
||||
|
||||
NibblePoker.Packaging.ListComPort/Trash/
|
||||
NibblePoker.Packaging.ListComPort/*.wixobj
|
||||
NibblePoker.Packaging.ListComPort/*.wixpdb
|
||||
NibblePoker.Packaging.ListComPort/*.bat
|
||||
NibblePoker.Packaging.ListComPort/AppX/
|
||||
|
||||
Packages/
|
||||
@@ -25,5 +22,7 @@ Packages/
|
||||
*.crt
|
||||
*.pem
|
||||
*.msi
|
||||
*.wixobj
|
||||
*.wixpdb
|
||||
|
||||
notes.txt
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
@echo off
|
||||
|
||||
:: Keeping the starting CWD in memory and going into the script's directory.
|
||||
pushd %~dp0
|
||||
cd /D "%~dp0"
|
||||
|
||||
:: Calling the common script
|
||||
call .\commons.bat
|
||||
|
||||
:: Checking the PATH environment variable.
|
||||
call :verify-path
|
||||
|
||||
set NP_REDO_PATH_CHECK=false
|
||||
set NP_PATH_OK=true
|
||||
|
||||
if %NP_PATH_DOTNET% neq true (
|
||||
echo %NP_ESC%[31mFATAL ERROR:%NP_ESC%[0m The .NET SDK couldn't be found !
|
||||
echo. You can download it from Microsoft here:
|
||||
echo. https://dotnet.microsoft.com/en-us/download
|
||||
set NP_PATH_OK=false
|
||||
goto end-path
|
||||
)
|
||||
|
||||
set NP_IS_WIX_VALID=true
|
||||
if %NP_PATH_WIXLIGHT% neq true set NP_IS_WIX_VALID=false
|
||||
if %NP_PATH_WIXCANDLE% neq true set NP_IS_WIX_VALID=false
|
||||
if %NP_IS_WIX_VALID% neq true (
|
||||
echo %NP_ESC%[33mWARNING:%NP_ESC%[0m Unable to find the complete Wix Toolset in your %%PATH%% !
|
||||
echo. We will attempt to use the predefined one present at the top of "make.bat"...
|
||||
echo.
|
||||
set "PATH=%PATH%;%PATH_WIX%"
|
||||
set NP_REDO_PATH_CHECK=true
|
||||
)
|
||||
|
||||
if %NP_PATH_7ZIP% neq true (
|
||||
echo %NP_ESC%[33mWARNING:%NP_ESC%[0m Unable to find the 7-Zip in your %%PATH%% !
|
||||
echo. We will attempt to use the predefined one present at the top of "make.bat"...
|
||||
set "PATH=%PATH%;%PATH_7ZIP%"
|
||||
set NP_REDO_PATH_CHECK=true
|
||||
)
|
||||
|
||||
if %NP_REDO_PATH_CHECK% neq true (
|
||||
goto end-path
|
||||
)
|
||||
|
||||
:: Redoing the %PATH% check...
|
||||
call :verify-path
|
||||
|
||||
set NP_IS_WIX_VALID=true
|
||||
if %NP_PATH_WIXLIGHT% neq true set NP_IS_WIX_VALID=false
|
||||
if %NP_PATH_WIXCANDLE% neq true set NP_IS_WIX_VALID=false
|
||||
if %NP_IS_WIX_VALID% neq true (
|
||||
echo %NP_ESC%[31mFATAL ERROR:%NP_ESC%[0m Unable to find the complete Wix Toolset in your %%PATH%% !
|
||||
echo. You need to download Wix Toolset 3.14+ from one of these links:
|
||||
echo. https://wixtoolset.org/releases/
|
||||
echo. https://wixtoolset.org/releases/development/
|
||||
echo.
|
||||
set NP_PATH_OK=false
|
||||
goto end-path
|
||||
)
|
||||
|
||||
if %NP_PATH_7ZIP% neq true (
|
||||
echo %NP_ESC%[31mFATAL ERROR:%NP_ESC%[0m Unable to find the 7-Zip in your %%PATH%% !
|
||||
echo. You need to download it from their website:
|
||||
echo. https://www.7-zip.org/
|
||||
echo.
|
||||
set NP_PATH_OK=false
|
||||
goto end-path
|
||||
)
|
||||
|
||||
goto end-path
|
||||
|
||||
|
||||
:verify-path
|
||||
echo Checking %%PATH%% for required programs...
|
||||
|
||||
set NP_PATH_DOTNET=false
|
||||
set NP_PATH_WIXLIGHT=false
|
||||
set NP_PATH_WIXCANDLE=false
|
||||
set NP_PATH_7ZIP=false
|
||||
|
||||
where /q dotnet
|
||||
if ERRORLEVEL 1 (
|
||||
echo. * .NET SDK/Runtime: %NP_ESC%[31mNOT FOUND !%NP_ESC%[0m
|
||||
) else (
|
||||
echo. * .NET SDK/Runtime: %NP_ESC%[32mFOUND !%NP_ESC%[0m
|
||||
set NP_PATH_DOTNET=true
|
||||
)
|
||||
|
||||
where /q candle
|
||||
if ERRORLEVEL 1 (
|
||||
echo. * Wix Toolset Candle: %NP_ESC%[31mNOT FOUND !%NP_ESC%[0m
|
||||
) else (
|
||||
echo. * Wix Toolset Candle: %NP_ESC%[32mFOUND !%NP_ESC%[0m
|
||||
set NP_PATH_WIXCANDLE=true
|
||||
)
|
||||
|
||||
where /q light
|
||||
if ERRORLEVEL 1 (
|
||||
echo. * Wix Toolset Light: %NP_ESC%[31mNOT FOUND !%NP_ESC%[0m
|
||||
) else (
|
||||
echo. * Wix Toolset Light: %NP_ESC%[32mFOUND !%NP_ESC%[0m
|
||||
set NP_PATH_WIXLIGHT=true
|
||||
)
|
||||
|
||||
where /q 7z
|
||||
if ERRORLEVEL 1 (
|
||||
echo. * 7-Zip Archiver: %NP_ESC%[31mNOT FOUND !%NP_ESC%[0m
|
||||
) else (
|
||||
echo. * 7-Zip Archiver: %NP_ESC%[32mFOUND !%NP_ESC%[0m
|
||||
set NP_PATH_7ZIP=true
|
||||
)
|
||||
|
||||
echo.
|
||||
|
||||
exit /b
|
||||
|
||||
|
||||
:end-path
|
||||
:: Going back to the original directory
|
||||
popd
|
||||
@@ -1,9 +1,13 @@
|
||||
@echo off
|
||||
|
||||
:: Setting some naming constants
|
||||
:: Setting some naming constants.
|
||||
set NP_LSCOM_VERSION=3.0.0
|
||||
|
||||
:: Defining the %NP_ESC% variable for later use.
|
||||
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
|
||||
set NP_ESC=%%b
|
||||
)
|
||||
|
||||
:: User-configurable %PATH% entries.
|
||||
set PATH_WIX=C:\Program Files (x86)\WiX Toolset v3.14\bin\
|
||||
set PATH_7ZIP=C:\Program Files\7-Zip\7z.exe
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
pushd %~dp0
|
||||
cd /D "%~dp0"
|
||||
|
||||
:: Calling the common script
|
||||
:: Calling the common script.
|
||||
call .\commons.bat
|
||||
|
||||
:: Moving to the project's root
|
||||
:: Moving to the project's root.
|
||||
cd .\..\..
|
||||
|
||||
:: Cleaning
|
||||
:: Cleaning.
|
||||
echo Removing any old binaries and any intermediate files...
|
||||
rmdir /Q /S NibblePoker.Application.ListComPort\bin 2>nul
|
||||
rmdir /Q /S NibblePoker.Application.ListComPort\obj 2>nul
|
||||
@@ -20,7 +20,7 @@ rmdir /Q /S Builds 2>nul
|
||||
mkdir Builds
|
||||
echo.
|
||||
|
||||
:: Compiling
|
||||
:: Compiling.
|
||||
echo Building "Any" target...
|
||||
dotnet publish "./NibblePoker.Application.ListComPort/NibblePoker.Application.ListComPort.csproj" --nologo -o "./Builds/any/"
|
||||
echo.
|
||||
@@ -39,5 +39,5 @@ dotnet publish "./NibblePoker.Application.ListComPort/NibblePoker.Application.Li
|
||||
dotnet publish "./NibblePoker.Application.ListComPort/NibblePoker.Application.ListComPort.csproj" --nologo -r win-arm64 -c Release -o "./Builds/arm64_single_sc_trim_comp" --self-contained true -p:PublishReadyToRun=true -p:PublishTrimmed=true -p:PublishSingleFile=true -p:EnableCompressionInSingleFile=true
|
||||
echo.
|
||||
|
||||
:: Going back to the original directory
|
||||
:: Going back to the original directory.
|
||||
popd
|
||||
|
||||
@@ -4,22 +4,24 @@
|
||||
pushd %~dp0
|
||||
cd /D "%~dp0"
|
||||
|
||||
:: Calling the common script
|
||||
:: Calling the common script.
|
||||
call .\commons.bat
|
||||
|
||||
:: Moving to the "NibblePoker.Packaging.ListComPort\Wix" folder.
|
||||
cd .\..\Wix
|
||||
|
||||
:: Cleaning
|
||||
:: Cleaning.
|
||||
echo Removing old MSI-related files...
|
||||
del *.msi >nul 2>&1
|
||||
del *.wixobj >nul 2>&1
|
||||
del *.wixpdb >nul 2>&1
|
||||
echo.
|
||||
|
||||
:: Packaging into MSI
|
||||
:: Packaging into MSI.
|
||||
echo Creating x64 MSI package...
|
||||
set WixTargetPlatform=x64
|
||||
set NP_MSI_OK=false
|
||||
|
||||
candle -nologo ListComPort.wxs -out ListComPort_x64.wixobj -ext WixUIExtension
|
||||
if ERRORLEVEL 1 (
|
||||
echo.
|
||||
@@ -52,5 +54,9 @@ if ERRORLEVEL 1 (
|
||||
goto end-msi-error
|
||||
)
|
||||
|
||||
:: Going back to the original directory
|
||||
set NP_MSI_OK=true
|
||||
|
||||
|
||||
:end-msi-error
|
||||
:: Going back to the original directory.
|
||||
popd
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
@echo off
|
||||
|
||||
:: Keeping the starting CWD in memory and going into the script's directory.
|
||||
pushd %~dp0
|
||||
cd /D "%~dp0"
|
||||
|
||||
:: Calling the common script.
|
||||
call .\commons.bat
|
||||
|
||||
:: Moving to the project's root.
|
||||
cd .\..\..
|
||||
|
||||
:: Creating the packages.
|
||||
echo Removing old final distributable packages...
|
||||
rmdir /Q /S Packages 2>nul
|
||||
echo.
|
||||
|
||||
echo Preparing folders...
|
||||
mkdir Packages
|
||||
mkdir Packages\any
|
||||
mkdir Packages\x86_DotNet6
|
||||
mkdir Packages\x86_SelfContained
|
||||
mkdir Packages\x64_DotNet6
|
||||
mkdir Packages\x64_SelfContained
|
||||
mkdir Packages\arm_DotNet6
|
||||
mkdir Packages\arm_SelfContained
|
||||
mkdir Packages\arm64_DotNet6
|
||||
mkdir Packages\arm64_SelfContained
|
||||
mkdir Packages\licenses_Others
|
||||
mkdir Packages\licenses_Others\Licenses
|
||||
mkdir Packages\licenses_SelfContained
|
||||
mkdir Packages\licenses_SelfContained\Licenses
|
||||
echo.
|
||||
|
||||
echo Copying final distributable files...
|
||||
xcopy /E /v NibblePoker.Packaging.ListComPort\Licenses Packages\licenses_SelfContained\Licenses
|
||||
del Packages\licenses_SelfContained\Licenses\*.rtf
|
||||
copy Packages\licenses_SelfContained\Licenses\License_NibblePoker.pdf Packages\licenses_Others\Licenses\License_NibblePoker.pdf
|
||||
|
||||
xcopy /E /v Builds\any Packages\any
|
||||
del Packages\any\*.pdb
|
||||
|
||||
copy /B /V NibblePoker.Packaging.ListComPort\Wix\ListComPort_x86.msi Packages\ListComPort_v%NP_LSCOM_VERSION%_x86.msi
|
||||
copy /B /V NibblePoker.Packaging.ListComPort\Wix\ListComPort_x64.msi Packages\ListComPort_v%NP_LSCOM_VERSION%_x64.msi
|
||||
|
||||
copy /B /V Builds\x86_single\NibblePoker.Application.ListComPort.exe Packages\x86_DotNet6\lscom.exe
|
||||
copy /B /V Builds\x86_single_sc_trim_comp\NibblePoker.Application.ListComPort.exe Packages\x86_SelfContained\lscom.exe
|
||||
|
||||
copy /B /V Builds\x64_single\NibblePoker.Application.ListComPort.exe Packages\x64_DotNet6\lscom.exe
|
||||
copy /B /V Builds\x64_single_sc_trim_comp\NibblePoker.Application.ListComPort.exe Packages\x64_SelfContained\lscom.exe
|
||||
|
||||
copy /B /V Builds\arm_single\NibblePoker.Application.ListComPort.exe Packages\arm_DotNet6\lscom.exe
|
||||
copy /B /V Builds\arm_single_sc_trim_comp\NibblePoker.Application.ListComPort.exe Packages\arm_SelfContained\lscom.exe
|
||||
|
||||
copy /B /V Builds\arm64_single\NibblePoker.Application.ListComPort.exe Packages\arm64_DotNet6\lscom.exe
|
||||
copy /B /V Builds\arm64_single_sc_trim_comp\NibblePoker.Application.ListComPort.exe Packages\arm64_SelfContained\lscom.exe
|
||||
echo.
|
||||
|
||||
echo Renaming some files...
|
||||
ren Packages\any\NibblePoker.Application.ListComPort.exe lscom.exe
|
||||
echo.
|
||||
|
||||
echo Creating final distributable packages...
|
||||
7z a -mx9 "./Packages/ListComPort_v%NP_LSCOM_VERSION%_AnyCPU.zip" ./Packages/any/* ./Packages/licenses_Others/* > nul
|
||||
7z a -mx9 "./Packages/ListComPort_v%NP_LSCOM_VERSION%_x86_Single.zip" ./Packages/x86_DotNet6/* ./Packages/licenses_Others/* > nul
|
||||
7z a -mx9 "./Packages/ListComPort_v%NP_LSCOM_VERSION%_x86_SelfContained.zip" ./Packages/x86_SelfContained/* ./Packages/licenses_SelfContained/* > nul
|
||||
7z a -mx9 "./Packages/ListComPort_v%NP_LSCOM_VERSION%_x64_Single.zip" ./Packages/x64_DotNet6/* ./Packages/licenses_Others/* > nul
|
||||
7z a -mx9 "./Packages/ListComPort_v%NP_LSCOM_VERSION%_x64_SelfContained.zip" ./Packages/x64_SelfContained/* ./Packages/licenses_SelfContained/* > nul
|
||||
7z a -mx9 "./Packages/ListComPort_v%NP_LSCOM_VERSION%_arm_Single.zip" ./Packages/arm_DotNet6/* ./Packages/licenses_Others/* > nul
|
||||
7z a -mx9 "./Packages/ListComPort_v%NP_LSCOM_VERSION%_arm_SelfContained.zip" ./Packages/arm_SelfContained/* ./Packages/licenses_SelfContained/* > nul
|
||||
7z a -mx9 "./Packages/ListComPort_v%NP_LSCOM_VERSION%_arm64_Single.zip" ./Packages/arm64_DotNet6/* ./Packages/licenses_Others/* > nul
|
||||
7z a -mx9 "./Packages/ListComPort_v%NP_LSCOM_VERSION%_arm64_SelfContained.zip" ./Packages/arm64_SelfContained/* ./Packages/licenses_SelfContained/* > nul
|
||||
|
||||
echo.
|
||||
|
||||
:: Going back to the original directory
|
||||
popd
|
||||
@@ -79,18 +79,34 @@
|
||||
</Directory>
|
||||
|
||||
<ComponentGroup Id="ProductComponentGroup">
|
||||
<Component Id="Software" Guid="2b0b66d2-fc39-485b-baee-e5b0da8142a0" Directory="INSTALLFOLDER" Feature="FeatureExecutables" Win64="$(var.Win64)">
|
||||
<Component Id="Software" Guid="04205639-cc78-42be-974f-d6767df6e3fd" Directory="INSTALLFOLDER" Feature="FeatureExecutables" Win64="$(var.Win64)">
|
||||
<File KeyPath="yes" Source="$(var.FilePathExecutable)" Name="lscom.exe" />
|
||||
</Component>
|
||||
<Component Id="Licenses" Guid="5aa34a6f-2b5c-4544-8979-a20d6c1d3f3c" Directory="LICENSESFOLDER" Feature="FeatureLicenses" Win64="$(var.Win64)">
|
||||
|
||||
<!--
|
||||
Adding the license files as separate components as per the official documentation's recommendation.
|
||||
See: https://wixtoolset.org/docs/v3/howtos/files_and_registry/add_a_file/
|
||||
-->
|
||||
<Component Id="License_DotNetCore" Guid="599cbdb2-e95a-4377-b082-31f695860c11" Directory="LICENSESFOLDER" Feature="FeatureLicenses" Win64="$(var.Win64)">
|
||||
<File Source="..\Licenses\License_DotNetCore.pdf" Name="License_DotNetCore.pdf" />
|
||||
</Component>
|
||||
<Component Id="License_MicrosoftDotNet" Guid="7107be86-a962-4573-9c06-4594764da052" Directory="LICENSESFOLDER" Feature="FeatureLicenses" Win64="$(var.Win64)">
|
||||
<File Source="..\Licenses\License_Microsoft_DotNet.pdf" Name="License_Microsoft_DotNet.pdf" />
|
||||
</Component>
|
||||
<Component Id="License_MicrosoftVisualStudio" Guid="ff28223f-47ff-4e11-85f3-50a7f4c6ebc9" Directory="LICENSESFOLDER" Feature="FeatureLicenses" Win64="$(var.Win64)">
|
||||
<File Source="..\Licenses\License_Microsoft_VisualStudio.pdf" Name="License_Microsoft_VisualStudio.pdf" />
|
||||
</Component>
|
||||
<Component Id="License_NibblePoker" Guid="b69feeb3-2e1f-4d72-b49c-b9f3331374af" Directory="LICENSESFOLDER" Feature="FeatureLicenses" Win64="$(var.Win64)">
|
||||
<File Source="..\Licenses\License_NibblePoker.pdf" Name="License_NibblePoker.pdf" />
|
||||
</Component>
|
||||
<Component Id="License_WindowsSDK" Guid="658d086b-2763-49e6-88c5-50a4d6530d3a" Directory="LICENSESFOLDER" Feature="FeatureLicenses" Win64="$(var.Win64)">
|
||||
<File Source="..\Licenses\License_WindowsSDK.pdf" Name="License_WindowsSDK.pdf" />
|
||||
</Component>
|
||||
<Component Id="License_PrivacyMicrosoft" Guid="341c0cef-a71e-4ee4-b52e-f878fd4029fc" Directory="LICENSESFOLDER" Feature="FeatureLicenses" Win64="$(var.Win64)">
|
||||
<File Source="..\Licenses\PrivacyNotice_Microsoft_2022-09.pdf" Name="PrivacyNotice_Microsoft_2022-09.pdf" />
|
||||
</Component>
|
||||
<Component Id="Registry" Guid="73b5468a-97b3-4469-a95d-70330ed229e6" Directory="INSTALLFOLDER" Feature="FeatureRegistryPath" Win64="$(var.Win64)">
|
||||
|
||||
<Component Id="Registry" Guid="fa1f61bf-22a3-4768-ac84-6198a3f527eb" Directory="INSTALLFOLDER" Feature="FeatureRegistryPath" Win64="$(var.Win64)">
|
||||
<Environment Id="UpdatePath" Name="PATH" Part="last" Action="set" Permanent="yes" System="yes" Value="[INSTALLFOLDER]" />
|
||||
<CreateFolder Directory="INSTALLFOLDER" />
|
||||
</Component>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Include>
|
||||
<!-- Shared variables -->
|
||||
<?define ProductManufacturer = "Herwin Bozet" ?>
|
||||
<?define PackageDescription = "ListComPort (lscom)" ?> <!-- Also reffered to as 'Subject' ! -->
|
||||
<?define PackageDescription = "ListComPort (lscom)" ?> <!-- Also referred to as 'Subject' ! -->
|
||||
<?define PackageComments = "This installer database contains the logic and data required to install ListComPort." ?>
|
||||
|
||||
<!-- TODO: Add contact, support and help fields ! -->
|
||||
@@ -12,7 +12,7 @@
|
||||
<?define Win64 = "yes" ?>
|
||||
|
||||
<?define ProductName = "ListComPort (x64)" ?>
|
||||
<?define ProductUpgradeCode = "1AB189BA-5B13-4448-A916-4E25B814D2AA" ?>
|
||||
<?define ProductUpgradeCode = "4ca89060-e293-4a37-8b9c-18fa3218598a" ?>
|
||||
|
||||
<?define PackagePlatform = "x64" ?>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<?define Win64 = "no" ?>
|
||||
|
||||
<?define ProductName = "ListComPort (x86)" ?>
|
||||
<?define ProductUpgradeCode = "1F633E9D-7F55-449D-8BC9-56F9E72342E8" ?>
|
||||
<?define ProductUpgradeCode = "33a888dd-c978-4fd2-947c-87a65ee98912" ?>
|
||||
|
||||
<?define PackagePlatform = "x86" ?>
|
||||
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
<!--
|
||||
Custom string for the license agreement.
|
||||
-->
|
||||
<String Id="LicenseAgreementDlgLicenseAcceptedCheckBox">I accept the terms in these License Agreements and Privacy Statement</String>
|
||||
<String Id="LicenseAgreementDlgLicenseAcceptedCheckBox">I accept all the terms in these License Agreements and Privacy Statement</String>
|
||||
</WixLocalization>
|
||||
|
||||
@@ -4,316 +4,41 @@
|
||||
pushd %~dp0
|
||||
cd /D "%~dp0"
|
||||
|
||||
:: User-configurable %PATH% entries.
|
||||
set PATH_MAKEAPPX=C:\Program Files (x86)\Windows Kits\10\App Certification Kit\
|
||||
set PATH_WIX=C:\Program Files (x86)\WiX Toolset v3.14\bin\
|
||||
set PATH_7ZIP=C:\Program Files\7-Zip\7z.exe
|
||||
:: Calling the common script.
|
||||
call .\NibblePoker.Packaging.ListComPort\Scripts\commons.bat
|
||||
|
||||
:: Setting some naming constants
|
||||
set NP_LSCOM_VERSION=3.0.0
|
||||
:: Checking the excutables in the PATH.
|
||||
call .\NibblePoker.Packaging.ListComPort\Scripts\check-and-fix-path.bat
|
||||
|
||||
:: Defining the %NP_ESC% variable for later use.
|
||||
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
|
||||
set NP_ESC=%%b
|
||||
if %NP_PATH_OK% neq true (
|
||||
echo %NP_ESC%[31mFATAL ERROR:%NP_ESC%[0m Unable to continue without the required programs in the %%PATH%% !
|
||||
goto end-failure
|
||||
)
|
||||
|
||||
:: Making a copy of the original %PATH% variable
|
||||
set PATH_ORIGINAL=%PATH%
|
||||
:: Compiling the various builds.
|
||||
call .\NibblePoker.Packaging.ListComPort\Scripts\compile.bat
|
||||
|
||||
:: Checking the PATH environment variable.
|
||||
call :verify-path
|
||||
:: Making the MSI files.
|
||||
call .\NibblePoker.Packaging.ListComPort\Scripts\make-msi.bat
|
||||
|
||||
set NP_REDO_PATH_CHECK=false
|
||||
|
||||
if %NP_PATH_DOTNET% neq true (
|
||||
echo %NP_ESC%[31mFATAL ERROR:%NP_ESC%[0m The .NET SDK couldn't be found !
|
||||
echo. You can download it from Microsoft here:
|
||||
echo. https://dotnet.microsoft.com/en-us/download
|
||||
goto end
|
||||
if %NP_MSI_OK% neq true (
|
||||
echo %NP_ESC%[31mFATAL ERROR:%NP_ESC%[0m Unable to continue the building process without the MSI files !
|
||||
goto end-failure
|
||||
)
|
||||
|
||||
set NP_IS_WIX_VALID=true
|
||||
if %NP_PATH_WIXLIGHT% neq true set NP_IS_WIX_VALID=false
|
||||
if %NP_PATH_WIXCANDLE% neq true set NP_IS_WIX_VALID=false
|
||||
if %NP_IS_WIX_VALID% neq true (
|
||||
echo %NP_ESC%[33mWARNING:%NP_ESC%[0m Unable to find the complete Wix Toolset in your %%PATH%% !
|
||||
echo. We will attempt to use the predefined one present at the top of "make.bat"...
|
||||
echo.
|
||||
set "PATH=%PATH%;%PATH_WIX%"
|
||||
set NP_REDO_PATH_CHECK=true
|
||||
)
|
||||
|
||||
if %NP_PATH_7ZIP% neq true (
|
||||
echo %NP_ESC%[33mWARNING:%NP_ESC%[0m Unable to find the 7-Zip in your %%PATH%% !
|
||||
echo. We will attempt to use the predefined one present at the top of "make.bat"...
|
||||
set "PATH=%PATH%;%PATH_7ZIP%"
|
||||
set NP_REDO_PATH_CHECK=true
|
||||
)
|
||||
|
||||
:: TODO: MakeAppx !
|
||||
|
||||
if %NP_REDO_PATH_CHECK% neq true (
|
||||
goto build-start
|
||||
)
|
||||
|
||||
:: Redoing the %PATH% check...
|
||||
call :verify-path
|
||||
|
||||
set NP_IS_WIX_VALID=true
|
||||
if %NP_PATH_WIXLIGHT% neq true set NP_IS_WIX_VALID=false
|
||||
if %NP_PATH_WIXCANDLE% neq true set NP_IS_WIX_VALID=false
|
||||
if %NP_IS_WIX_VALID% neq true (
|
||||
echo %NP_ESC%[31mFATAL ERROR:%NP_ESC%[0m Unable to find the complete Wix Toolset in your %%PATH%% !
|
||||
echo. You need to download Wix Toolset 3.14+ from one of these links:
|
||||
echo. https://wixtoolset.org/releases/
|
||||
echo. https://wixtoolset.org/releases/development/
|
||||
echo.
|
||||
goto end
|
||||
)
|
||||
|
||||
if %NP_PATH_7ZIP% neq true (
|
||||
echo %NP_ESC%[31mFATAL ERROR:%NP_ESC%[0m Unable to find the 7-Zip in your %%PATH%% !
|
||||
echo. You need to download it from their website:
|
||||
echo. https://www.7-zip.org/
|
||||
echo.
|
||||
goto end
|
||||
)
|
||||
|
||||
|
||||
:build-start
|
||||
echo Removing any old binaries and any intermidate files...
|
||||
rmdir /Q /S NibblePoker.Application.ListComPort\bin 2>nul
|
||||
rmdir /Q /S NibblePoker.Application.ListComPort\obj 2>nul
|
||||
rmdir /Q /S NibblePoker.Library.ComPortHelpers\bin 2>nul
|
||||
rmdir /Q /S NibblePoker.Library.ComPortHelpers\obj 2>nul
|
||||
rmdir /Q /S Builds 2>nul
|
||||
mkdir Builds
|
||||
echo.
|
||||
|
||||
echo Building "Any" target...
|
||||
dotnet publish "./NibblePoker.Application.ListComPort/NibblePoker.Application.ListComPort.csproj" --nologo -o "./Builds/any/"
|
||||
echo.
|
||||
|
||||
echo Building "Single" targets...
|
||||
dotnet publish "./NibblePoker.Application.ListComPort/NibblePoker.Application.ListComPort.csproj" --nologo -r win-x86 -c Release -o "./Builds/x86_single" --no-self-contained -p:PublishSingleFile=true -p:PublishReadyToRun=true
|
||||
dotnet publish "./NibblePoker.Application.ListComPort/NibblePoker.Application.ListComPort.csproj" --nologo -r win-x64 -c Release -o "./Builds/x64_single" --no-self-contained -p:PublishSingleFile=true -p:PublishReadyToRun=true
|
||||
dotnet publish "./NibblePoker.Application.ListComPort/NibblePoker.Application.ListComPort.csproj" --nologo -r win-arm -c Release -o "./Builds/arm_single" --no-self-contained -p:PublishSingleFile=true -p:PublishReadyToRun=true
|
||||
dotnet publish "./NibblePoker.Application.ListComPort/NibblePoker.Application.ListComPort.csproj" --nologo -r win-arm64 -c Release -o "./Builds/arm64_single" --no-self-contained -p:PublishSingleFile=true -p:PublishReadyToRun=true
|
||||
echo.
|
||||
|
||||
echo Building "Optimized Single" targets...
|
||||
dotnet publish "./NibblePoker.Application.ListComPort/NibblePoker.Application.ListComPort.csproj" --nologo -r win-x86 -c Release -o "./Builds/x86_single_sc_trim_comp" --self-contained true -p:PublishReadyToRun=true -p:PublishTrimmed=true -p:PublishSingleFile=true -p:EnableCompressionInSingleFile=true
|
||||
dotnet publish "./NibblePoker.Application.ListComPort/NibblePoker.Application.ListComPort.csproj" --nologo -r win-x64 -c Release -o "./Builds/x64_single_sc_trim_comp" --self-contained true -p:PublishReadyToRun=true -p:PublishTrimmed=true -p:PublishSingleFile=true -p:EnableCompressionInSingleFile=true
|
||||
dotnet publish "./NibblePoker.Application.ListComPort/NibblePoker.Application.ListComPort.csproj" --nologo -r win-arm -c Release -o "./Builds/arm_single_sc_trim_comp" --self-contained true -p:PublishReadyToRun=true -p:PublishTrimmed=true -p:PublishSingleFile=true -p:EnableCompressionInSingleFile=true
|
||||
dotnet publish "./NibblePoker.Application.ListComPort/NibblePoker.Application.ListComPort.csproj" --nologo -r win-arm64 -c Release -o "./Builds/arm64_single_sc_trim_comp" --self-contained true -p:PublishReadyToRun=true -p:PublishTrimmed=true -p:PublishSingleFile=true -p:EnableCompressionInSingleFile=true
|
||||
echo.
|
||||
|
||||
goto msi-start
|
||||
|
||||
:: Unused
|
||||
::set %MakeAppx% = "C:\Program Files (x86)\Windows Kits\10\App Certification Kit\makeappx.exe"
|
||||
::%MakeAppx% --help
|
||||
|
||||
|
||||
:msi-start
|
||||
cd NibblePoker.Packaging.ListComPort
|
||||
|
||||
echo Removing old MSI-related files...
|
||||
del *.msi >nul 2>&1
|
||||
del *.wixobj >nul 2>&1
|
||||
del *.wixpdb >nul 2>&1
|
||||
echo.
|
||||
|
||||
echo Creating x64 MSI package...
|
||||
set WixTargetPlatform=x64
|
||||
candle -nologo ListComPort.wxs -out ListComPort_x64.wixobj -ext WixUIExtension
|
||||
if ERRORLEVEL 1 (
|
||||
echo.
|
||||
echo %NP_ESC%[31mFATAL ERROR:%NP_ESC%[0m Failed to preprocess and compile the .wix file !
|
||||
echo.
|
||||
goto end-msi-error
|
||||
)
|
||||
light ListComPort_x64.wixobj -loc en-us.wxl -out ListComPort_x64.msi -ext WixUIExtension -cultures:en-us
|
||||
if ERRORLEVEL 1 (
|
||||
echo.
|
||||
echo %NP_ESC%[31mFATAL ERROR:%NP_ESC%[0m Failed to link and create the final MSI package !
|
||||
echo.
|
||||
goto end-msi-error
|
||||
)
|
||||
|
||||
echo Creating x86 MSI package...
|
||||
set WixTargetPlatform=x86
|
||||
candle -nologo ListComPort.wxs -out ListComPort_x86.wixobj -ext WixUIExtension
|
||||
if ERRORLEVEL 1 (
|
||||
echo.
|
||||
echo %NP_ESC%[31mFATAL ERROR:%NP_ESC%[0m Failed to preprocess and compile the .wix file !
|
||||
echo.
|
||||
goto end-msi-error
|
||||
)
|
||||
light ListComPort_x86.wixobj -loc en-us.wxl -out ListComPort_x86.msi -ext WixUIExtension -cultures:en-us
|
||||
if ERRORLEVEL 1 (
|
||||
echo.
|
||||
echo %NP_ESC%[31mFATAL ERROR:%NP_ESC%[0m Failed to link and create the final MSI package !
|
||||
echo.
|
||||
goto end-msi-error
|
||||
)
|
||||
|
||||
cd ..
|
||||
|
||||
:: TODO: Packages
|
||||
|
||||
goto packages
|
||||
|
||||
|
||||
:end-msi-error
|
||||
cd ..
|
||||
|
||||
goto end
|
||||
|
||||
|
||||
:packages
|
||||
echo Removing old final distributable packages...
|
||||
rmdir /Q /S Packages 2>nul
|
||||
echo.
|
||||
|
||||
echo Preparing folders...
|
||||
mkdir Packages
|
||||
mkdir Packages\any
|
||||
mkdir Packages\x86_DotNet6
|
||||
mkdir Packages\x86_SelfContained
|
||||
mkdir Packages\x64_DotNet6
|
||||
mkdir Packages\x64_SelfContained
|
||||
mkdir Packages\arm_DotNet6
|
||||
mkdir Packages\arm_SelfContained
|
||||
mkdir Packages\arm64_DotNet6
|
||||
mkdir Packages\arm64_SelfContained
|
||||
mkdir Packages\licenses_Others
|
||||
mkdir Packages\licenses_Others\Licenses
|
||||
mkdir Packages\licenses_SelfContained
|
||||
mkdir Packages\licenses_SelfContained\Licenses
|
||||
echo.
|
||||
|
||||
echo Copying final distributable files...
|
||||
xcopy /E /v NibblePoker.Packaging.ListComPort\Licenses Packages\licenses_SelfContained\Licenses
|
||||
del Packages\licenses_SelfContained\Licenses\*.rtf
|
||||
copy Packages\licenses_SelfContained\Licenses\License_NibblePoker.pdf Packages\licenses_Others\Licenses\License_NibblePoker.pdf
|
||||
|
||||
xcopy /E /v Builds\any Packages\any
|
||||
del Packages\any\*.pdb
|
||||
|
||||
copy /B /V NibblePoker.Packaging.ListComPort\ListComPort_x86.msi Packages\ListComPort_v%NP_LSCOM_VERSION%_x86.msi
|
||||
copy /B /V NibblePoker.Packaging.ListComPort\ListComPort_x64.msi Packages\ListComPort_v%NP_LSCOM_VERSION%_x64.msi
|
||||
|
||||
copy /B /V Builds\x86_single\NibblePoker.Application.ListComPort.exe Packages\x86_DotNet6\lscom.exe
|
||||
copy /B /V Builds\x86_single_sc_trim_comp\NibblePoker.Application.ListComPort.exe Packages\x86_SelfContained\lscom.exe
|
||||
|
||||
copy /B /V Builds\x64_single\NibblePoker.Application.ListComPort.exe Packages\x64_DotNet6\lscom.exe
|
||||
copy /B /V Builds\x64_single_sc_trim_comp\NibblePoker.Application.ListComPort.exe Packages\x64_SelfContained\lscom.exe
|
||||
|
||||
copy /B /V Builds\arm_single\NibblePoker.Application.ListComPort.exe Packages\arm_DotNet6\lscom.exe
|
||||
copy /B /V Builds\arm_single_sc_trim_comp\NibblePoker.Application.ListComPort.exe Packages\arm_SelfContained\lscom.exe
|
||||
|
||||
copy /B /V Builds\arm64_single\NibblePoker.Application.ListComPort.exe Packages\arm64_DotNet6\lscom.exe
|
||||
copy /B /V Builds\arm64_single_sc_trim_comp\NibblePoker.Application.ListComPort.exe Packages\arm64_SelfContained\lscom.exe
|
||||
echo.
|
||||
|
||||
echo Renaming some files...
|
||||
ren Packages\any\NibblePoker.Application.ListComPort.exe lscom.exe
|
||||
echo.
|
||||
|
||||
echo Creating final distributable packages...
|
||||
7z a -mx9 "./Packages/ListComPort_v%NP_LSCOM_VERSION%_AnyCPU.zip" ./Packages/any/* ./Packages/licenses_Others/* > nul
|
||||
7z a -mx9 "./Packages/ListComPort_v%NP_LSCOM_VERSION%_x86_Single.zip" ./Packages/x86_DotNet6/* ./Packages/licenses_Others/* > nul
|
||||
7z a -mx9 "./Packages/ListComPort_v%NP_LSCOM_VERSION%_x86_SelfContained.zip" ./Packages/x86_SelfContained/* ./Packages/licenses_SelfContained/* > nul
|
||||
7z a -mx9 "./Packages/ListComPort_v%NP_LSCOM_VERSION%_x64_Single.zip" ./Packages/x64_DotNet6/* ./Packages/licenses_Others/* > nul
|
||||
7z a -mx9 "./Packages/ListComPort_v%NP_LSCOM_VERSION%_x64_SelfContained.zip" ./Packages/x64_SelfContained/* ./Packages/licenses_SelfContained/* > nul
|
||||
7z a -mx9 "./Packages/ListComPort_v%NP_LSCOM_VERSION%_arm_Single.zip" ./Packages/arm_DotNet6/* ./Packages/licenses_Others/* > nul
|
||||
7z a -mx9 "./Packages/ListComPort_v%NP_LSCOM_VERSION%_arm_SelfContained.zip" ./Packages/arm_SelfContained/* ./Packages/licenses_SelfContained/* > nul
|
||||
7z a -mx9 "./Packages/ListComPort_v%NP_LSCOM_VERSION%_arm64_Single.zip" ./Packages/arm64_DotNet6/* ./Packages/licenses_Others/* > nul
|
||||
7z a -mx9 "./Packages/ListComPort_v%NP_LSCOM_VERSION%_arm64_SelfContained.zip" ./Packages/arm64_SelfContained/* ./Packages/licenses_SelfContained/* > nul
|
||||
|
||||
echo.
|
||||
:: Making the final packages.
|
||||
call .\NibblePoker.Packaging.ListComPort\Scripts\package.bat
|
||||
|
||||
goto end-success
|
||||
|
||||
|
||||
:verify-path
|
||||
echo Checking %%PATH%% for required programs...
|
||||
|
||||
set NP_PATH_DOTNET=false
|
||||
set NP_PATH_MAKEAPPX=false
|
||||
set NP_PATH_WIXLIGHT=false
|
||||
set NP_PATH_WIXCANDLE=false
|
||||
set NP_PATH_7ZIP=false
|
||||
|
||||
where /q dotnet
|
||||
if ERRORLEVEL 1 (
|
||||
echo. * .NET SDK/Runtime: %NP_ESC%[31mNOT FOUND !%NP_ESC%[0m
|
||||
) else (
|
||||
echo. * .NET SDK/Runtime: %NP_ESC%[32mFOUND !%NP_ESC%[0m
|
||||
set NP_PATH_DOTNET=true
|
||||
)
|
||||
|
||||
where /q makeappx
|
||||
if ERRORLEVEL 1 (
|
||||
echo. * Microsoft MakeAppx: %NP_ESC%[31mNOT FOUND !%NP_ESC%[0m
|
||||
) else (
|
||||
echo. * Microsoft MakeAppx: %NP_ESC%[32mFOUND !%NP_ESC%[0m
|
||||
set NP_PATH_MAKEAPPX=true
|
||||
)
|
||||
|
||||
where /q candle
|
||||
if ERRORLEVEL 1 (
|
||||
echo. * Wix Toolset Candle: %NP_ESC%[31mNOT FOUND !%NP_ESC%[0m
|
||||
) else (
|
||||
echo. * Wix Toolset Candle: %NP_ESC%[32mFOUND !%NP_ESC%[0m
|
||||
set NP_PATH_WIXCANDLE=true
|
||||
)
|
||||
|
||||
where /q light
|
||||
if ERRORLEVEL 1 (
|
||||
echo. * Wix Toolset Light: %NP_ESC%[31mNOT FOUND !%NP_ESC%[0m
|
||||
) else (
|
||||
echo. * Wix Toolset Light: %NP_ESC%[32mFOUND !%NP_ESC%[0m
|
||||
set NP_PATH_WIXLIGHT=true
|
||||
)
|
||||
|
||||
where /q 7z
|
||||
if ERRORLEVEL 1 (
|
||||
echo. * 7-Zip Archiver: %NP_ESC%[31mNOT FOUND !%NP_ESC%[0m
|
||||
) else (
|
||||
echo. * 7-Zip Archiver: %NP_ESC%[32mFOUND !%NP_ESC%[0m
|
||||
set NP_PATH_7ZIP=true
|
||||
)
|
||||
|
||||
echo.
|
||||
|
||||
exit /b
|
||||
|
||||
|
||||
:end-success
|
||||
echo %NP_ESC%[32mThe building process has finished successfully !%NP_ESC%[0m
|
||||
goto end
|
||||
goto end-failure
|
||||
|
||||
|
||||
:end
|
||||
set PATH=%PATH_ORIGINAL%
|
||||
|
||||
set PATH_MAKEAPPX=
|
||||
set PATH_WIX=
|
||||
set PATH_7ZIP=
|
||||
set PATH_ORIGINAL=
|
||||
set NP_ESC=
|
||||
set NP_PATH_DOTNET=
|
||||
set NP_PATH_MAKEAPPX=
|
||||
set NP_PATH_WIXCANDLE=
|
||||
set NP_PATH_WIXLIGHT=
|
||||
set NP_PATH_7ZIP=
|
||||
set NP_IS_WIX_VALID=
|
||||
set NP_REDO_PATH_CHECK=
|
||||
set WixTargetPlatform=
|
||||
set NP_LSCOM_VERSION=
|
||||
|
||||
:end-failure
|
||||
:: Going back to the original directory
|
||||
popd
|
||||
|
||||
:: Ringing the terminal's bell
|
||||
|
||||
Reference in New Issue
Block a user