Skip to content

Commit

Permalink
Fix standalone build still including MySQL etc
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownShadow200 committed Apr 28, 2024
1 parent 9a578b5 commit 4725607
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 9 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:

# publish standalone windows binaries
- name: Publish-win64
run: dotnet publish CLI/MCGalaxyCLI_dotnet6.csproj -r win-x64 --self-contained -p:DefineConstants=MCG_STANDALONE
run: dotnet publish CLI/MCGalaxyCLI_standalone6.csproj -r win-x64 --self-contained

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
Expand All @@ -125,7 +125,7 @@ jobs:

# publish standalone linux binaries
- name: Publish-linux64
run: dotnet publish CLI/MCGalaxyCLI_dotnet6.csproj -r linux-x64 --self-contained -p:DefineConstants=MCG_STANDALONE
run: dotnet publish CLI/MCGalaxyCLI_standalone6.csproj -r linux-x64 --self-contained

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
Expand All @@ -135,7 +135,7 @@ jobs:

# publish standalone macOS binaries
- name: Publish-mac64
run: dotnet publish CLI/MCGalaxyCLI_dotnet6.csproj -r osx-x64 --self-contained -p:DefineConstants=MCG_STANDALONE
run: dotnet publish CLI/MCGalaxyCLI_standalone6.csproj -r osx-x64 --self-contained

- uses: ./.github/actions/upload_build
if: ${{ always() && steps.compile.outcome == 'success' }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ jobs:
- name: Retrieve standalone binaries
run: |
wget https://cdn.classicube.net/client/mcg/latest/mcg-win64-standalone.exe -O mcg-win64
wget https://cdn.classicube.net/client/mcg/latest/mcg-mac64-standalone -O mcg-mac64
wget https://cdn.classicube.net/client/mcg/latest/mcg-linux64-standalone -O mcg-linux64
wget https://cdn.classicube.net/client/mcg/latest/win64 -O mcg-win64
wget https://cdn.classicube.net/client/mcg/latest/mac64 -O mcg-mac64
wget https://cdn.classicube.net/client/mcg/latest/linux64 -O mcg-linux64
- name: Generate builds
id: compile
Expand Down
1 change: 0 additions & 1 deletion CLI/MCGalaxyCLI_dotnet6.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion CLI/MCGalaxyCLI_dotnet7.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion CLI/MCGalaxyCLI_dotnet8.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>

<ItemGroup>
Expand Down
13 changes: 13 additions & 0 deletions CLI/MCGalaxyCLI_standalone6.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>true</PublishTrimmed>
<DefineConstants>$(DefineConstants);MCG_STANDALONE</DefineConstants>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\MCGalaxy\MCGalaxy_standalone.csproj" />
</ItemGroup>
</Project>
2 changes: 2 additions & 0 deletions CLI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public static void Main(string[] args) {
}

static void SetCurrentDirectory() {
#if !MCG_STANDALONE
string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

Check warning on line 48 in CLI/Program.cs

View workflow job for this annotation

GitHub Actions / build-dotnet6

'System.Reflection.Assembly.Location' always returns an empty string for assemblies embedded in a single-file app. If the path to the app directory is needed, consider calling 'System.AppContext.BaseDirectory'.

Check warning on line 48 in CLI/Program.cs

View workflow job for this annotation

GitHub Actions / build-dotnet6

'System.Reflection.Assembly.Location' always returns an empty string for assemblies embedded in a single-file app. If the path to the app directory is needed, consider calling 'System.AppContext.BaseDirectory'.

Check warning on line 48 in CLI/Program.cs

View workflow job for this annotation

GitHub Actions / build-dotnet8

'System.Reflection.Assembly.Location' always returns an empty string for assemblies embedded in a single-file app. If the path to the app directory is needed, consider calling 'System.AppContext.BaseDirectory'.

Check warning on line 48 in CLI/Program.cs

View workflow job for this annotation

GitHub Actions / build-dotnet8

'System.Reflection.Assembly.Location' always returns an empty string for assemblies embedded in a single-file app. If the path to the app directory is needed, consider calling 'System.AppContext.BaseDirectory'.
try {
Environment.CurrentDirectory = path;
Expand All @@ -55,6 +56,7 @@ static void SetCurrentDirectory() {
// (since most users will not be trying to run .exe from a different folder anyways)
Console.WriteLine("Failed to set working directory to '{0}', running in current directory..", path);
}
#endif
}

static void EnableCLIMode() {
Expand Down
11 changes: 11 additions & 0 deletions MCGalaxy/MCGalaxy_standalone.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<DefineConstants>$(DefineConstants);MCG_STANDALONE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.8" />
</ItemGroup>
</Project>

0 comments on commit 4725607

Please sign in to comment.