Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
env:
DOTNET_VERSION: 9.0
PROJECT: StarMap.Launcher/StarMap.Launcher.csproj
PROJECT: StarMap/StarMap.csproj
NUGET_SOURCE: "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"

steps:
Expand Down
46 changes: 9 additions & 37 deletions .github/workflows/rc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ on:

env:
DOTNET_VERSION: 10.0
STANDALONE_PROJECT: StarMap.Loader/StarMap.Loader.csproj
LAUNCHER_PROJECT: StarMap.Launcher/StarMap.Launcher.csproj
PROJECT: StarMap/StarMap.csproj
API_PROJECT: StarMap.API/StarMap.API.csproj
STANDALONE_OUTPUT_PATH: ./publish/standalone
LAUNCHER_OUTPUT_PATH: ./publish/launcher
OUTPUT_PATH: ./publish
NUGET_SOURCE: "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
EXCLUDE: "*.pdb *.xml"
Expand Down Expand Up @@ -75,35 +72,18 @@ jobs:
--store-password-in-clear-text \
--name github "${{ env.NUGET_SOURCE }}"

- name: Build launcher
- name: Build
run: |
dotnet publish ${{ env.LAUNCHER_PROJECT }} \
dotnet publish ${{ env.PROJECT }} \
-c Release \
-o ${{ env.LAUNCHER_OUTPUT_PATH }} \
-o ${{ env.OUTPUT_PATH }} \
-r win-x64 \
--self-contained false \
/p:PackageVersion=${{ steps.version.outputs.hash_version }} \
/p:Version=${{ steps.version.outputs.new_version }} \
/p:AssemblyVersion=${{ steps.version.outputs.new_version }} \
/p:FileVersion=${{ steps.version.outputs.new_version }}

- name: Build standalone
run: |
dotnet publish ${{ env.STANDALONE_PROJECT }} \
-c Release \
-o ${{ env.STANDALONE_OUTPUT_PATH }} \
-r win-x64 \
--self-contained false \
/p:PackageVersion=${{ steps.version.outputs.hash_version }} \
/p:Version=${{ steps.version.outputs.new_version }} \
/p:AssemblyVersion=${{ steps.version.outputs.new_version }} \
/p:FileVersion=${{ steps.version.outputs.new_version }}

- name: Rename executables
run: |
mv ${{ env.LAUNCHER_OUTPUT_PATH }}/StarMap.Launcher.exe ${{ env.LAUNCHER_OUTPUT_PATH }}/StarMap.exe
mv ${{ env.STANDALONE_OUTPUT_PATH }}/StarMap.Loader.exe ${{ env.STANDALONE_OUTPUT_PATH }}/StarMap.exe

- name: Write version file
run: echo "${{ steps.version.outputs.hash_version }}" > version.txt

Expand All @@ -112,8 +92,7 @@ jobs:
with:
name: rc-build
path: |
${{ env.LAUNCHER_OUTPUT_PATH }}
${{ env.STANDALONE_OUTPUT_PATH }}
${{ env.OUTPUT_PATH }}
version.txt
retention-days: 1

Expand Down Expand Up @@ -176,16 +155,10 @@ jobs:
sudo apt-get update -y
sudo apt-get install -y zip

- name: Package launcher ZIP
run: |
cd ./build_artifacts/${{ env.LAUNCHER_OUTPUT_PATH }}
zip -r $GITHUB_WORKSPACE/StarMapLauncher-RC.zip . -x ${{ env.EXCLUDE }}
cd -

- name: Package standalone ZIP
- name: Package ZIP
run: |
cd ./build_artifacts/${{ env.STANDALONE_OUTPUT_PATH }}
zip -r $GITHUB_WORKSPACE/StarMapStandalone-RC.zip . -x ${{ env.EXCLUDE }}
cd ./build_artifacts/${{ env.OUTPUT_PATH }}
zip -r $GITHUB_WORKSPACE/StarMap-RC.zip . -x ${{ env.EXCLUDE }}
cd -

- name: Update RC GitHub release
Expand All @@ -195,8 +168,7 @@ jobs:
name: Release Candidate
prerelease: true
files: |
StarMapLauncher-RC.zip
StarMapStandalone-RC.zip
StarMap-RC.zip
./build_artifacts/version.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44 changes: 8 additions & 36 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ on:

env:
DOTNET_VERSION: 10.0
STANDALONE_PROJECT: StarMap.Loader/StarMap.Loader.csproj
LAUNCHER_PROJECT: StarMap.Launcher/StarMap.Launcher.csproj
PROJECT: StarMap/StarMap.csproj
API_PROJECT: StarMap.API/StarMap.API.csproj
STANDALONE_OUTPUT_PATH: ./publish/standalone
LAUNCHER_OUTPUT_PATH: ./publish/launcher
OUTPUT_PATH: ./publish
NUGET_SOURCE: "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
EXCLUDE: "*.pdb *.xml"
Expand Down Expand Up @@ -86,42 +83,24 @@ jobs:
--store-password-in-clear-text \
--name github "${{ env.NUGET_SOURCE }}"

- name: Build launcher
run: |
dotnet publish ${{ env.LAUNCHER_PROJECT }} \
-c Release \
-o ${{ env.LAUNCHER_OUTPUT_PATH }} \
-r win-x64 \
--self-contained false \
/p:PackageVersion=${{ steps.version.outputs.new_version }} \
/p:Version=${{ steps.version.outputs.new_version }} \
/p:AssemblyVersion=${{ steps.version.outputs.new_version }} \
/p:FileVersion=${{ steps.version.outputs.new_version }}

- name: Build standalone
run: |
dotnet publish ${{ env.STANDALONE_PROJECT }} \
dotnet publish ${{ env.PROJECT }} \
-c Release \
-o ${{ env.STANDALONE_OUTPUT_PATH }} \
-o ${{ env.OUTPUT_PATH }} \
-r win-x64 \
--self-contained false \
/p:PackageVersion=${{ steps.version.outputs.new_version }} \
/p:Version=${{ steps.version.outputs.new_version }} \
/p:AssemblyVersion=${{ steps.version.outputs.new_version }} \
/p:FileVersion=${{ steps.version.outputs.new_version }}

- name: Rename executables
run: |
mv ${{ env.LAUNCHER_OUTPUT_PATH }}/StarMap.Launcher.exe ${{ env.LAUNCHER_OUTPUT_PATH }}/StarMap.exe
mv ${{ env.STANDALONE_OUTPUT_PATH }}/StarMap.Loader.exe ${{ env.STANDALONE_OUTPUT_PATH }}/StarMap.exe

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: publish
path: |
${{ env.LAUNCHER_OUTPUT_PATH }}
${{ env.STANDALONE_OUTPUT_PATH }}
${{ env.OUTPUT_PATH }}
version.txt
retention-days: 1

Expand Down Expand Up @@ -216,16 +195,10 @@ jobs:
sudo apt-get update -y
sudo apt-get install -y zip

- name: Package launcher ZIP
run: |
cd ./build_artifacts/${{ env.LAUNCHER_OUTPUT_PATH }}
zip -r $GITHUB_WORKSPACE/StarMapLauncher-${{ needs.build.outputs.new_version }}.zip . -x ${{ env.EXCLUDE }}
cd -

- name: Package standalone ZIP
- name: Package ZIP
run: |
cd ./build_artifacts/${{ env.STANDALONE_OUTPUT_PATH }}
zip -r $GITHUB_WORKSPACE/StarMapStandalone-${{ needs.build.outputs.new_version }}.zip . -x ${{ env.EXCLUDE }}
cd ./build_artifacts/${{ env.OUTPUT_PATH }}
zip -r $GITHUB_WORKSPACE/StarMap-${{ needs.build.outputs.new_version }}.zip . -x ${{ env.EXCLUDE }}
cd -

- name: Create GitHub Release
Expand All @@ -237,8 +210,7 @@ jobs:
Automated release for version ${{ needs.build.outputs.new_version }}
Triggered by PR #${{ github.event.pull_request.number }}
files: |
StarMapLauncher-${{ needs.build.outputs.new_version }}.zip
StarMapStandalone-${{ needs.build.outputs.new_version }}.zip
StarMap-${{ needs.build.outputs.new_version }}.zip

build-release-installer:
runs-on: windows-latest
Expand Down
29 changes: 19 additions & 10 deletions StarMap.API/StarMap.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,31 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>1591</NoWarn>
<NoWarn>1591;CS1734</NoWarn>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Configurations>Debug;Release;SourceNuget</Configurations>
</PropertyGroup>

<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' == 'Debug'">
<Reference Include="..\..\Import\KSA.dll" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)' == 'Debug'">
<Reference Include="..\..\Import\KSA.dll" />
<Reference Include="..\..\Import\Brutal.*.dll" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' != 'Debug'">
<PackageReference Include="StarMap.KSA.Dummy" Version="1.0.22">
<IncludeAssets>compile; build; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup Condition="'$(Configuration)' == 'SourceNuget'">
<PackageReference Include="RocketWerkz.KSA" Version="2026.7.6.4939">
<IncludeAssets>compile; build; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' == 'Release'">
<PackageReference Include="RocketWerkz.KSA.Ref" Version="2026.7.6.4939">
<IncludeAssets>compile; build; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion StarMap.Core/ModRepository/ModLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private void PrepareMods()
{
if (!mod.Enabled)
{
Console.WriteLine($"StarMap - Nod loading mod: {mod.Id} because it is disable in manifest");
Console.WriteLine($"StarMap - Not loading mod: {mod.Id} because it is disable in manifest");
continue;
}

Expand Down
56 changes: 55 additions & 1 deletion StarMap.Core/Patches/ModLibraryPatches.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
using HarmonyLib;
using Brutal.Collections;
using HarmonyLib;
using KSA;
using StarMap.API;
using StarMap.Core.ModRepository;
using StarMap.Core.UI;
using StarMap.Core.UI.ConfirmRestart;
using System.ComponentModel.Design;
using System.Diagnostics;
using System.Reflection;

namespace StarMap.Core.Patches
{
Expand All @@ -20,5 +26,53 @@ public static void AfterLoad()
method.Invoke(@object, []);
}
}

[HarmonyPatch(nameof(ModLibrary.PrepareAll))]
[HarmonyPrefix]
public static void BeforePrepareAll()
{
static bool wereNewModsEnabled()
{
foreach (var mod in ModLibrary.Manifest.Mods)
{
if (mod.New && mod.Enabled)
return true;
}
return false;
}

if (ModLibrary.HasNewMods() && wereNewModsEnabled())
{
var confirmRestart = new ConfirmRestart();
while(confirmRestart.Show)
{
confirmRestart.OnFrame();
}

if (confirmRestart.Restart)
{
Console.WriteLine("StarMap - RESTARTING");
Console.WriteLine("======================================");

var mainModule = Process.GetCurrentProcess().MainModule;
if (mainModule is null || Path.GetDirectoryName(mainModule.FileName) is not string starMapInstallLocation)
{
Console.WriteLine("Unable to get StarMap install location for restart.");
}
else {
var startInfo = new ProcessStartInfo
{
FileName = mainModule.FileName,
Arguments = "--restarted",
WorkingDirectory = starMapInstallLocation,
};

Process.Start(startInfo);
}

Environment.Exit(0);
}
}
}
}
}
44 changes: 26 additions & 18 deletions StarMap.Core/StarMap.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;SourceNuget</Configurations>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Lib.Harmony" Version="2.4.2" />
<PackageReference Include="Samboy063.Tomlet" Version="6.1.0">
<ExcludeAssets>runtime</ExcludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Lib.Harmony" Version="2.4.2" />
<PackageReference Include="Samboy063.Tomlet" Version="6.1.0">
<ExcludeAssets>runtime</ExcludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\StarMap.API\StarMap.API.csproj" />
<ProjectReference Include="..\StarMap.Types\StarMap.Types.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\StarMap.API\StarMap.API.csproj" />
<ProjectReference Include="..\StarMap.Types\StarMap.Types.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' == 'Debug'">
<Reference Include="..\..\Import\KSA.dll" />
<Reference Include="..\..\Import\Brutal.*.dll" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' == 'SourceNuget'">
<PackageReference Include="RocketWerkz.KSA" Version="2026.7.6.4939">
<ExcludeAssets>runtime</ExcludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(Configuration)' != 'Debug'">
<PackageReference Include="StarMap.KSA.Dummy" Version="1.0.22">
<ItemGroup Condition="'$(Configuration)' == 'Release'">
<PackageReference Include="RocketWerkz.KSA.Ref" Version="2026.7.6.4939">
<ExcludeAssets>runtime</ExcludeAssets>
</PackageReference>
</ItemGroup>
Expand Down
Loading
Loading