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
47 changes: 23 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,18 @@ defaults:

jobs:
build:
# Pinned: Mono's repository only has packages built for Ubuntu 20.04 (focal), known to install
# on 24.04. ubuntu-latest moved to 26.04, which also dropped apt-key.
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
timeout-minutes: 20
# Mono and the .NET SDK come with the job container (https://github.com/sarbian/KSP_CI), so
# no packages are installed here. Pinned by digest: the 26.04 tag is pushed again on each change
# of the image, so a release builds with the image this file names. To update:
# docker buildx imagetools inspect ghcr.io/sarbian/ksp-ci:26.04 (the index Digest)
container:
image: ghcr.io/sarbian/ksp-ci:26.04@sha256:8d6ab6ddd9c79f029b51a9edb57bc0f081492fe426581630dc0253f405f2a590
options: --user 1001:1001 # the image's unprivileged runner user, as on GitHub's hosted runners
env:
DOTNET_NOLOGO: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
permissions:
contents: read
pull-requests: write # comment the build on the PR
Expand All @@ -59,23 +67,10 @@ jobs:
with:
ref: ${{ inputs.ref }}

# The project is a legacy (non-SDK) net471 csproj built with Mono's own MSBuild, exactly
# like the old Jenkins job did (its "mono-msbuild" tool). Ubuntu's own mono-complete package
# only ships the deprecated xbuild, not msbuild, so we pull Mono from the official repo.
# The signing key goes in its own keyring, named by the source (signed-by), as apt-key is
# gone from newer Ubuntu releases.
- name: Install Mono
- name: Tool versions
run: |
sudo apt-get install -y -qq gnupg ca-certificates curl
sudo install -d -m 0755 /etc/apt/keyrings
curl -fsSL --retry 5 --retry-all-errors --retry-delay 5 \
"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF" \
| sudo gpg --batch --yes --dearmor -o /etc/apt/keyrings/mono-official-stable.gpg
echo "deb [signed-by=/etc/apt/keyrings/mono-official-stable.gpg] https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt-get update -qq
sudo apt-get install -y -qq mono-devel nuget
mono --version | head -1
msbuild --version | tail -1
dotnet --version

# Compile-only KSP/Unity reference assemblies (method bodies stripped), just enough to
# resolve the bare <Reference Include="Assembly-CSharp"/> etc. in the csproj files.
Expand Down Expand Up @@ -115,16 +110,20 @@ jobs:
sed -i -E "s/(AssemblyVersion\(\")[^\"]*(\"\))/\1${VERSION}\2/" "$file"
grep -qF "AssemblyVersion(\"$VERSION\")" "$file"

# SDK-style net471 projects: the restore also brings the .NET Framework reference assemblies
# (Microsoft.NETFramework.ReferenceAssemblies.net471, see Directory.Build.targets)
- name: Restore
run: nuget restore ModuleManager.sln -Verbosity quiet
run: dotnet restore ModuleManager.sln

# ReferencePath resolves the bare KSP/Unity references (see Directory.Build.targets);
# CopyBuild=false skips the copy into a KSP install (copy_build.sh)
- name: Build
run: >
msbuild ModuleManager.sln
/p:Configuration=Release
/p:ReferencePath=/tmp/ksp/KSP_x64_Data/Managed
/p:PostBuildEvent=
/nologo /v:minimal
dotnet msbuild ModuleManager.sln
-p:Configuration=Release
-p:ReferencePath=/tmp/ksp/KSP_x64_Data/Managed
-p:CopyBuild=false
-nologo -v:minimal

- name: Package
env:
Expand Down
23 changes: 23 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project>

<!--
.NET Framework 4.7.1 reference assemblies from NuGet, so the net471 projects build with the
.NET SDK on Linux and macOS (and on Windows without the 4.7.1 Developer Pack).
-->
<ItemGroup Condition=" '$(TargetFramework)' == 'net471' ">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net471" Version="1.0.3">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<!--
Honor ReferencePath as an assembly search path, so the bare <Reference Include="Assembly-CSharp"/>
etc. resolve to KSP's assemblies: CI passes -p:ReferencePath=<KSPLibs>/KSP_x64_Data/Managed, a
local build gets it from its .csproj.user. SDK-style projects do not search ReferencePath the
way the legacy targets did.
-->
<PropertyGroup Condition=" '$(ReferencePath)' != '' ">
<AssemblySearchPaths>$(AssemblySearchPaths);$(ReferencePath)</AssemblySearchPaths>
</PropertyGroup>

</Project>
246 changes: 36 additions & 210 deletions ModuleManager/ModuleManager.csproj
Original file line number Diff line number Diff line change
@@ -1,218 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{02C8E3AF-69F9-4102-AB60-DD6DE60662D3}</ProjectGuid>
<OutputType>Library</OutputType>
<TargetFramework>net471</TargetFramework>
<RootNamespace>ModuleManager</RootNamespace>
<AssemblyName>ModuleManager</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<TargetFrameworkProfile />
<ProjectGuid>{02C8E3AF-69F9-4102-AB60-DD6DE60662D3}</ProjectGuid>
<LangVersion>8.0</LangVersion>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<LangVersion>default</LangVersion>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\Release\</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<Compile Include="Cats\CatAnimator.cs" />
<Compile Include="Cats\CatManager.cs" />
<Compile Include="Cats\CatMover.cs" />
<Compile Include="Cats\CatOrbiter.cs" />
<Compile Include="Collections\ArrayEnumerator.cs" />
<Compile Include="Collections\ImmutableStack.cs" />
<Compile Include="Collections\KeyValueCache.cs" />
<Compile Include="Collections\MessageQueue.cs" />
<Compile Include="Command.cs" />
<Compile Include="CommandParser.cs" />
<Compile Include="Extensions\ByteArrayExtensions.cs" />
<Compile Include="Extensions\ConfigNodeExtensions.cs" />
<Compile Include="Extensions\IBasicLoggerExtensions.cs" />
<Compile Include="Extensions\NodeStackExtensions.cs" />
<Compile Include="Extensions\StringExtensions.cs" />
<Compile Include="Extensions\UrlConfigExtensions.cs" />
<Compile Include="Extensions\UrlDirExtensions.cs" />
<Compile Include="Extensions\UrlFileExtensions.cs" />
<Compile Include="FatalErrorHandler.cs" />
<Compile Include="FilePathRepository.cs" />
<Compile Include="Fix16.cs" />
<Compile Include="Logging\IBasicLogger.cs" />
<Compile Include="Logging\ILogMessage.cs" />
<Compile Include="Logging\LogMessage.cs" />
<Compile Include="Logging\LogSplitter.cs" />
<Compile Include="Logging\PrefixLogger.cs" />
<Compile Include="Logging\QueueLogger.cs" />
<Compile Include="Logging\QueueLogRunner.cs" />
<Compile Include="Logging\StreamLogger.cs" />
<Compile Include="Logging\UnityLogger.cs" />
<Compile Include="MMPatchLoader.cs" />
<Compile Include="MMPatchRunner.cs" />
<Compile Include="ModuleManager.cs" />
<Compile Include="ModListGenerator.cs" />
<Compile Include="PostPatchLoader.cs" />
<Compile Include="ModuleManagerTestRunner.cs" />
<Compile Include="NeedsChecker.cs" />
<Compile Include="NodeMatcher.cs" />
<Compile Include="Operator.cs" />
<Compile Include="OperatorParser.cs" />
<Compile Include="Pass.cs" />
<Compile Include="PatchApplier.cs" />
<Compile Include="PatchTypeIndex.cs" />
<Compile Include="ConfigFileHasher.cs" />
<Compile Include="ConfigNodeWriter.cs" />
<Compile Include="PatchContext.cs" />
<Compile Include="Patches\CopyPatch.cs" />
<Compile Include="Patches\DeletePatch.cs" />
<Compile Include="Patches\EditPatch.cs" />
<Compile Include="Patches\InsertPatch.cs" />
<Compile Include="Patches\IPatch.cs" />
<Compile Include="Patches\PassSpecifiers\AfterPassSpecifier.cs" />
<Compile Include="Patches\PassSpecifiers\BeforePassSpecifier.cs" />
<Compile Include="Patches\PassSpecifiers\FinalPassSpecifier.cs" />
<Compile Include="Patches\PassSpecifiers\FirstPassSpecifier.cs" />
<Compile Include="Patches\PassSpecifiers\ForPassSpecifier.cs" />
<Compile Include="Patches\PassSpecifiers\InsertPassSpecifier.cs" />
<Compile Include="Patches\PassSpecifiers\IPassSpecifier.cs" />
<Compile Include="Patches\PassSpecifiers\LegacyPassSpecifier.cs" />
<Compile Include="Patches\PassSpecifiers\LastPassSpecifier.cs" />
<Compile Include="Patches\PatchCompiler.cs" />
<Compile Include="Patches\ProtoPatch.cs" />
<Compile Include="Patches\ProtoPatchBuilder.cs" />
<Compile Include="PatchExtractor.cs" />
<Compile Include="PatchList.cs" />
<Compile Include="Progress\ProgressCounter.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs" />
<Compile Include="Progress\IPatchProgress.cs" />
<Compile Include="Progress\PatchProgress.cs" />
<Compile Include="ProtoUrlConfig.cs" />
<Compile Include="Tags\Tag.cs" />
<Compile Include="Tags\TagList.cs" />
<Compile Include="Tags\TagListParser.cs" />
<Compile Include="Threading\ITaskStatus.cs" />
<Compile Include="Threading\TaskStatus.cs" />
<Compile Include="Threading\TaskStatusWrapper.cs" />
<Compile Include="ExceptionIntercept\InterceptLogHandler.cs" />
<Compile Include="Utils\Counter.cs" />
<Compile Include="Utils\FileUtils.cs" />
<Compile Include="CustomConfigsManager.cs" />
<Compile Include="Threading\BackgroundTask.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="KSPAssets, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
</Reference>
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.ImageConversionModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.Physics2DModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.UIModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-1.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-10.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-11.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-12.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-2.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-3.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-4.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-5.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-6.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-7.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-8.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\cat-9.png" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\rainbow2.png" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>sh -c "TARGET_PATH='$(TargetPath)' TARGET_DIR='$(TargetDir)' TARGET_NAME='$(TargetName)' sh '$(ProjectDir)/copy_build.sh'"</PostBuildEvent>
</PropertyGroup>
</Project>

<!-- KSP's assemblies, found through ReferencePath (see Directory.Build.targets). Never copied to the output. -->
<ItemGroup>
<Reference Include="Assembly-CSharp" Private="false" />
<Reference Include="KSPAssets" Private="false" />
<Reference Include="UnityEngine" Private="false" />
<Reference Include="UnityEngine.CoreModule" Private="false" />
<Reference Include="UnityEngine.ImageConversionModule" Private="false" />
<Reference Include="UnityEngine.InputLegacyModule" Private="false" />
<Reference Include="UnityEngine.Physics2DModule" Private="false" />
<Reference Include="UnityEngine.TextRenderingModule" Private="false" />
<Reference Include="UnityEngine.UI" Private="false" />
<Reference Include="UnityEngine.UIModule" Private="false" />
</ItemGroup>

<!--
Copies the build into $KSPDIR/GameData when it is set (see copy_build.sh).
CI turns it off with -p:CopyBuild=false.
-->
<Target Name="CopyBuild" AfterTargets="Build" Condition=" '$(CopyBuild)' != 'false' ">
<Exec Command="sh -c &quot;TARGET_PATH='$(TargetPath)' TARGET_DIR='$(TargetDir)' TARGET_NAME='$(TargetName)' sh '$(ProjectDir)/copy_build.sh'&quot;" />
</Target>

</Project>
4 changes: 0 additions & 4 deletions ModuleManager/packages.config

This file was deleted.

Loading
Loading