11@ echo off
2- set _7zFast = " %programfiles% \7-Zip-Zstandard\7z.exe"
3- set _7zBuilt = " %~dp0 Tools\7z.exe"
4- set _7z = " %programfiles% \7-Zip\7z.exe"
52set _pluginName = Hi3Helper.Plugin.HBR
6- set _noPacked = true
3+ set _isRemoveSymbol = true
74
85set currentPath = %~dp0
96set projectPath = %currentPath%%_pluginName%
107set indexerPath = %currentPath% Indexer
118set projectPublishPath = %projectPath% \publish
129set indexerPublishPath = %indexerPath% \Compiled
13- set indexerToolPath = %indexerPublishPath% \ Indexer.exe
10+ set indexerToolPath = %currentPath% Indexer.exe
1411set thread = %NUMBER_OF_PROCESSORS%
1512set args1 = %1
1613
@@ -24,85 +21,62 @@ if "%speedChoice%" == "" (
2421 echo 1. Size ^ (same as -O1 optimization with debug info and stack trace stripped^ )
2522 echo 2. Speed ^ (same as -O2 optimization with debug info and stack trace stripped^ )
2623 echo 3. Debug ^ (no optimization^ )
27- echo 4. Size-NoPacked ^ (same as -O1 optimization with debug info and stack trace stripped, not packed ^ )
28- echo 5. Speed-NoPacked ^ (same as -O2 optimization with debug info and stack trace stripped, not packed ^ )
29- echo 6. Debug-NoPacked ^ (no optimization, not packed ^ )
24+ echo 4. Size-ReflectionFree ^ (same as 1. Size but more lightweight with some features removed ^ )
25+ echo 5. Speed-ReflectionFree ^ (same as 2. Speed but more lightweight with some features removed ^ )
26+ echo 6. Debug-ReflectionFree ^ (same as 3. Debug but more lightweight with some features removed ^ )
3027 echo .
31- set /p speedChoice = Size^(1^)/Speed^ (2^ )/Debug^ (3^ )/Size-NoPacked^ (4^ )/Speed-NoPacked^ (5^ )/Debug-NoPacked^ (6^ )^ >
28+ echo Note:
29+ echo ReflectionFree builds is EXPERIMENTAL and might results to unexpected behaviour!
30+ echo Some reflection-dependant feature ^ (for example: Game Installation auto-detection^ ) might not work.
31+ echo .
32+ set /p speedChoice = Choice^?^>
3233)
3334
3435if " %speedChoice% " == " 1" (
3536 echo Compiling with Size preferred optimization
3637 set publishProfile = ReleasePublish-O1
3738 set configuration = Release
38- set _noPacked = false
3939 goto :StartCompilation
4040) else if " %speedChoice% " == " 2" (
4141 echo Compiling with Speed preferred optimization
4242 set publishProfile = ReleasePublish-O2
4343 set configuration = Release
44- set _noPacked = false
4544 goto :StartCompilation
4645) else if " %speedChoice% " == " 3" (
4746 echo Compiling with No Optimization ^ (Debug^ )
4847 set publishProfile = DebugPublish
4948 set configuration = Debug
50- set _noPacked = false
49+ set _isRemoveSymbol = false
5150 goto :StartCompilation
5251) else if " %speedChoice% " == " 4" (
53- echo Compiling with Size preferred optimization, Not Packed
54- set publishProfile = ReleasePublish -O1
55- set configuration = Release
52+ echo Compiling with Size preferred optimization + Reflection-Free Mode
53+ set publishProfile = ReleaseNoReflectionPublish -O1
54+ set configuration = ReleaseNoReflection
5655 goto :StartCompilation
5756) else if " %speedChoice% " == " 5" (
58- echo Compiling with Speed preferred optimization, Not Packed
59- set publishProfile = ReleasePublish -O2
60- set configuration = Release
57+ echo Compiling with Speed preferred optimization + Reflection-Free Mode
58+ set publishProfile = ReleaseNoReflectionPublish -O2
59+ set configuration = ReleaseNoReflection
6160 goto :StartCompilation
6261) else if " %speedChoice% " == " 6" (
63- echo Compiling with No Optimization ^ (Debug^ ), Not Packed
64- set publishProfile = DebugPublish
65- set configuration = Debug
62+ echo Compiling with No Optimization ^ (Debug^ ) + Reflection-Free Mode
63+ set publishProfile = DebugNoReflectionPublish
64+ set configuration = DebugNoReflection
65+ set _isRemoveSymbol = false
6666 goto :StartCompilation
6767)
6868
6969cls
70- echo Input is not valid! Available choices: 1, 2 or 3
70+ echo Input is not valid! Available choices: 1, 2, 3, 4, 5 or 6
7171set publishProfile =
7272set args1 =
7373goto :CompileSpeedPreference
7474
7575:StartCompilation
76- if /I not " %_noPacked% " == " true" (
77- :SevenZipCheck
78- if exist %_7zFast% (
79- set sevenzip = %_7zFast%
80- echo Using 7-zip-Fast from Program Files!: %_7zFast%
81- ) else if exist %_7z% (
82- set sevenzip = %_7z%
83- echo Using 7-zip from Program Files!: %_7z%
84- ) else (
85- cls
86- echo 7-Zip ^ (x64^ ) does not exist!
87- echo Path: %_7z%
88- echo Please download it from here: https://www.7-zip.org/
89- pause | echo Press any key to retry...
90- goto :SevenZipCheck
91- )
92- )
9376set outputBaseDirPath = %projectPublishPath% \%configuration%
94- set outputDirPath = %outputBaseDirPath% \ %_pluginName%
77+ set outputDirPath = %outputBaseDirPath%
9578%~d0
9679
97- :StartIndexerCompilation
98- if /I not exist " %indexerToolPath% " (
99- mkdir " %indexerPublishPath% " || goto :Error
100- cd " %indexerPath% "
101- dotnet restore --runtime win-x64 ..\Hi3Helper.Plugin.HBR.sln || goto :Error
102- dotnet clean --configuration Release --runtime win-x64 ..\Hi3Helper.Plugin.HBR.sln || goto :Error
103- dotnet publish --configuration Release --runtime win-x64 /p:PublishProfile=ReleasePublish -o " %indexerPublishPath% " || goto :Error
104- )
105-
10680:StartPluginCompilation
10781if /I exist " %projectPublishPath% " (
10882 rmdir /S /Q " %projectPublishPath% " || goto :Error
@@ -114,20 +88,13 @@ dotnet clean --configuration %configuration% --runtime win-x64 ..\Hi3Helper.Plug
11488dotnet publish --configuration %configuration% --runtime win-x64 /p:PublishProfile=%publishProfile% -o " %outputDirPath% " || goto :Error
11589
11690:RemovePDBIfNotDebug
117- if not " %speedChoice %" == " 3 " (
91+ if " %_isRemoveSymbol %" == " true " (
11892 del " %outputDirPath% \*.pdb" || goto :Error
11993)
12094
12195:StartIndexing
12296%indexerToolPath% %outputDirPath% || goto :Error
12397
124- :StartPacking
125- if /I not " %_noPacked% " == " true" (
126- cd %outputBaseDirPath%
127- %sevenzip% a -t7z -m0=lzma2 -mx=9 -aoa -mmt=%thread% -mfb=273 -md=128m -ms=on " %_pluginName% .7z" . || goto :Error
128- rmdir /S /Q %_pluginName%
129- )
130-
13198goto :CompileSuccess
13299
133100:Error
0 commit comments