Skip to content

Commit ea7a8a8

Browse files
committed
Fix compile script
Also embed Indexer.exe for CI/CD support
1 parent b767682 commit ea7a8a8

File tree

10 files changed

+162
-65
lines changed

10 files changed

+162
-65
lines changed

CompileAOTAndShip.bat

Lines changed: 24 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
@echo off
2-
set _7zFast="%programfiles%\7-Zip-Zstandard\7z.exe"
3-
set _7zBuilt="%~dp0Tools\7z.exe"
4-
set _7z="%programfiles%\7-Zip\7z.exe"
52
set _pluginName=Hi3Helper.Plugin.HBR
6-
set _noPacked=true
3+
set _isRemoveSymbol=true
74

85
set currentPath=%~dp0
96
set projectPath=%currentPath%%_pluginName%
107
set indexerPath=%currentPath%Indexer
118
set projectPublishPath=%projectPath%\publish
129
set indexerPublishPath=%indexerPath%\Compiled
13-
set indexerToolPath=%indexerPublishPath%\Indexer.exe
10+
set indexerToolPath=%currentPath%Indexer.exe
1411
set thread=%NUMBER_OF_PROCESSORS%
1512
set 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

3435
if "%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

6969
cls
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
7171
set publishProfile=
7272
set args1=
7373
goto :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-
)
9376
set 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
10781
if /I exist "%projectPublishPath%" (
10882
rmdir /S /Q "%projectPublishPath%" || goto :Error
@@ -114,20 +88,13 @@ dotnet clean --configuration %configuration% --runtime win-x64 ..\Hi3Helper.Plug
11488
dotnet 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-
13198
goto :CompileSuccess
13299

133100
:Error

Hi3Helper.Plugin.HBR/Exports.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace Hi3Helper.Plugin.HBR;
1515
public partial class Seraphim : SharedStatic<Seraphim> // 2025-08-18: We use generic version of SharedStatic<T> to add support for game launch API.
1616
// Though, the devs can still use the old SharedStatic without any compatibility issue.
1717
{
18-
static Seraphim() => Load<HBRPlugin>(!RuntimeFeature.IsDynamicCodeCompiled ? new Core.Management.GameVersion(0, 8, 2, 0) : default); // Loads the IPlugin instance as HBRPlugin.
18+
static Seraphim() => Load<HBRPlugin>(!RuntimeFeature.IsDynamicCodeCompiled ? new Core.Management.GameVersion(0, 8, 3, 0) : default); // Loads the IPlugin instance as HBRPlugin.
1919

2020
[UnmanagedCallersOnly(EntryPoint = "TryGetApiExport", CallConvs = [typeof(CallConvCdecl)])]
2121
public static unsafe int TryGetApiExport(char* exportName, void** delegateP) =>

Hi3Helper.Plugin.HBR/Hi3Helper.Plugin.HBR.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<Company>Collapse Launcher Team</Company>
1919
<Authors>$(Company). neon-nyan, Cry0, bagusnl, shatyuka, gablm.</Authors>
2020
<Copyright>Copyright 2022-2025 $(Company)</Copyright>
21-
<Version>0.8.2</Version>
21+
<Version>0.8.3</Version>
2222
<ApplicationIcon>icon.ico</ApplicationIcon>
2323
<Configurations>Debug;Release;DebugNoReflection;ReleaseNoReflection</Configurations>
2424
</PropertyGroup>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
3+
<Project>
4+
<PropertyGroup>
5+
<Configuration>DebugNoReflection</Configuration>
6+
<Platform>x64</Platform>
7+
<PublishDir>publish/Debug</PublishDir>
8+
<PublishProtocol>FileSystem</PublishProtocol>
9+
<_TargetId>Folder</_TargetId>
10+
<TargetFramework>net10.0</TargetFramework>
11+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
12+
<SelfContained>true</SelfContained>
13+
<PublishSingleFile>false</PublishSingleFile>
14+
<PublishReadyToRun>false</PublishReadyToRun>
15+
<PublishTrimmed>true</PublishTrimmed>
16+
<PublishAot>true</PublishAot>
17+
<DebugType>portable</DebugType>
18+
19+
<!-- Compilation -->
20+
<Deterministic>true</Deterministic>
21+
<IlcDisableReflection>true</IlcDisableReflection>
22+
</PropertyGroup>
23+
</Project>

Hi3Helper.Plugin.HBR/Properties/PublishProfiles/DebugPublish.pubxml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
33
<Project>
44
<PropertyGroup>
5-
<Configuration>DebugNoReflection</Configuration>
5+
<Configuration>Debug</Configuration>
66
<Platform>x64</Platform>
77
<PublishDir>publish/Debug</PublishDir>
88
<PublishProtocol>FileSystem</PublishProtocol>
@@ -18,6 +18,7 @@
1818

1919
<!-- Compilation -->
2020
<Deterministic>true</Deterministic>
21-
<IlcDisableReflection>true</IlcDisableReflection>
21+
<IlcDisableReflection>false</IlcDisableReflection>
22+
<IlcScanReflection>false</IlcScanReflection>
2223
</PropertyGroup>
2324
</Project>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
3+
<Project>
4+
<PropertyGroup>
5+
<Configuration>ReleaseNoReflection</Configuration>
6+
<Platform>x64</Platform>
7+
<PublishDir>publish/Release</PublishDir>
8+
<PublishProtocol>FileSystem</PublishProtocol>
9+
<_TargetId>Folder</_TargetId>
10+
<TargetFramework>net10.0</TargetFramework>
11+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
12+
<SelfContained>true</SelfContained>
13+
<PublishSingleFile>false</PublishSingleFile>
14+
<PublishReadyToRun>false</PublishReadyToRun>
15+
<PublishTrimmed>true</PublishTrimmed>
16+
<PublishAot>true</PublishAot>
17+
<DebugType>portable</DebugType>
18+
19+
<!-- Compilation and Optimization -->
20+
<Optimize>true</Optimize>
21+
<Deterministic>true</Deterministic>
22+
<IlcOptimizationPreference>Size</IlcOptimizationPreference>
23+
<IlcDisableReflection>true</IlcDisableReflection>
24+
<OptimizationPreference>Size</OptimizationPreference>
25+
<UseSizeOptimizedLinq>true</UseSizeOptimizedLinq>
26+
<IlcTrimMetadata>true</IlcTrimMetadata>
27+
<TrimMetadata>true</TrimMetadata>
28+
<IlcFoldIdenticalMethodBodies>true</IlcFoldIdenticalMethodBodies>
29+
<FoldIdenticalMethodBodies>true</FoldIdenticalMethodBodies>
30+
<IlcScanReflection>false</IlcScanReflection>
31+
<UseWindowsThreadPool>true</UseWindowsThreadPool>
32+
33+
<!-- Debugging and Metadata -->
34+
<IlcGenerateMstatFile>true</IlcGenerateMstatFile>
35+
<IlcGenerateDgmlFile>true</IlcGenerateDgmlFile>
36+
37+
<!-- Security and Resource Management -->
38+
<EnableUnsafeBinaryFormatterSerialization>false</EnableUnsafeBinaryFormatterSerialization>
39+
<EnableUnsafeUTF7Encoding>false</EnableUnsafeUTF7Encoding>
40+
<EventSourceSupport>false</EventSourceSupport>
41+
<HttpActivityPropagationSupport>false</HttpActivityPropagationSupport>
42+
<MetricsSupport>false</MetricsSupport>
43+
<UseSystemResourceKeys>true</UseSystemResourceKeys>
44+
<XmlResolverIsNetworkingEnabledByDefault>false</XmlResolverIsNetworkingEnabledByDefault>
45+
<InvariantGlobalization>true</InvariantGlobalization>
46+
<MetadataUpdaterSupport>false</MetadataUpdaterSupport>
47+
<StackTraceSupport>false</StackTraceSupport>
48+
<TrimmerRemoveAssemblies>true</TrimmerRemoveAssemblies>
49+
50+
<!-- Runtime Patch -->
51+
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
52+
</PropertyGroup>
53+
</Project>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
3+
<Project>
4+
<PropertyGroup>
5+
<Configuration>ReleaseNoReflection</Configuration>
6+
<Platform>x64</Platform>
7+
<PublishDir>publish/Release</PublishDir>
8+
<PublishProtocol>FileSystem</PublishProtocol>
9+
<_TargetId>Folder</_TargetId>
10+
<TargetFramework>net10.0</TargetFramework>
11+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
12+
<SelfContained>true</SelfContained>
13+
<PublishSingleFile>false</PublishSingleFile>
14+
<PublishReadyToRun>false</PublishReadyToRun>
15+
<PublishTrimmed>true</PublishTrimmed>
16+
<PublishAot>true</PublishAot>
17+
<DebugType>portable</DebugType>
18+
19+
<!-- Compilation and Optimization -->
20+
<Optimize>true</Optimize>
21+
<Deterministic>true</Deterministic>
22+
<IlcOptimizationPreference>Speed</IlcOptimizationPreference>
23+
<IlcDisableReflection>true</IlcDisableReflection>
24+
<OptimizationPreference>Speed</OptimizationPreference>
25+
<UseSizeOptimizedLinq>false</UseSizeOptimizedLinq>
26+
<IlcTrimMetadata>true</IlcTrimMetadata>
27+
<TrimMetadata>true</TrimMetadata>
28+
<IlcFoldIdenticalMethodBodies>true</IlcFoldIdenticalMethodBodies>
29+
<FoldIdenticalMethodBodies>true</FoldIdenticalMethodBodies>
30+
<IlcScanReflection>false</IlcScanReflection>
31+
<UseWindowsThreadPool>true</UseWindowsThreadPool>
32+
33+
<!-- Debugging and Metadata -->
34+
<IlcGenerateMstatFile>true</IlcGenerateMstatFile>
35+
<IlcGenerateDgmlFile>true</IlcGenerateDgmlFile>
36+
37+
<!-- Security and Resource Management -->
38+
<EnableUnsafeBinaryFormatterSerialization>false</EnableUnsafeBinaryFormatterSerialization>
39+
<EnableUnsafeUTF7Encoding>false</EnableUnsafeUTF7Encoding>
40+
<EventSourceSupport>false</EventSourceSupport>
41+
<HttpActivityPropagationSupport>false</HttpActivityPropagationSupport>
42+
<MetricsSupport>false</MetricsSupport>
43+
<UseSystemResourceKeys>true</UseSystemResourceKeys>
44+
<XmlResolverIsNetworkingEnabledByDefault>false</XmlResolverIsNetworkingEnabledByDefault>
45+
<InvariantGlobalization>true</InvariantGlobalization>
46+
<MetadataUpdaterSupport>false</MetadataUpdaterSupport>
47+
<StackTraceSupport>false</StackTraceSupport>
48+
<TrimmerRemoveAssemblies>true</TrimmerRemoveAssemblies>
49+
50+
<!-- Runtime Patch -->
51+
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
52+
</PropertyGroup>
53+
</Project>

Hi3Helper.Plugin.HBR/Properties/PublishProfiles/ReleasePublish-O1.pubxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
33
<Project>
44
<PropertyGroup>
5-
<Configuration>ReleaseNoReflection</Configuration>
5+
<Configuration>Release</Configuration>
66
<Platform>x64</Platform>
77
<PublishDir>publish/Release</PublishDir>
88
<PublishProtocol>FileSystem</PublishProtocol>
@@ -20,7 +20,7 @@
2020
<Optimize>true</Optimize>
2121
<Deterministic>true</Deterministic>
2222
<IlcOptimizationPreference>Size</IlcOptimizationPreference>
23-
<IlcDisableReflection>true</IlcDisableReflection>
23+
<IlcDisableReflection>false</IlcDisableReflection>
2424
<OptimizationPreference>Size</OptimizationPreference>
2525
<UseSizeOptimizedLinq>true</UseSizeOptimizedLinq>
2626
<IlcTrimMetadata>true</IlcTrimMetadata>

Hi3Helper.Plugin.HBR/Properties/PublishProfiles/ReleasePublish-O2.pubxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
33
<Project>
44
<PropertyGroup>
5-
<Configuration>ReleaseNoReflection</Configuration>
5+
<Configuration>Release</Configuration>
66
<Platform>x64</Platform>
77
<PublishDir>publish/Release</PublishDir>
88
<PublishProtocol>FileSystem</PublishProtocol>
@@ -20,7 +20,7 @@
2020
<Optimize>true</Optimize>
2121
<Deterministic>true</Deterministic>
2222
<IlcOptimizationPreference>Speed</IlcOptimizationPreference>
23-
<IlcDisableReflection>true</IlcDisableReflection>
23+
<IlcDisableReflection>false</IlcDisableReflection>
2424
<OptimizationPreference>Speed</OptimizationPreference>
2525
<UseSizeOptimizedLinq>false</UseSizeOptimizedLinq>
2626
<IlcTrimMetadata>true</IlcTrimMetadata>

Indexer.exe

3.13 MB
Binary file not shown.

0 commit comments

Comments
 (0)