Skip to content

Commit

Permalink
Reworked as a SpaceWarp.Template project with better build process
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-bures committed Dec 20, 2023
1 parent d7f4545 commit 319bac0
Show file tree
Hide file tree
Showing 212 changed files with 484 additions and 711 deletions.
38 changes: 16 additions & 22 deletions .github/workflows/build_spacewarp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,31 @@ on:
branches: [ "main", "dev" ]

jobs:
build:
build-debug:
runs-on: ubuntu-latest

strategy:
matrix:
run_args: ["" , "-r"]


steps:
- name: Check Out Repository
uses: actions/checkout@v3

- name: Build the solution
run: dotnet build "SpaceWarp.sln" -c ${{ matrix.run_args }}

build-release:
runs-on: ubuntu-latest

steps:
- name: Check Out Repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.9

- name: Run Python Script
run: sudo python builder.py ${{ matrix.run_args }}
# I'm sure running it in sudo will cause NO issues what so ever.
- name: Build the solution
run: dotnet build "SpaceWarp.sln" -c ${{ matrix.run_args }}

- name: Find Zip
id: find-zip
run: |
if [ "${{ matrix.run_args }}" == "-r" ]; then
echo "zip=$(ls -1 build/SpaceWarp-Release*.zip | head -n 1)" >> $GITHUB_ENV
echo "artifact_name=SpaceWarpRelease" >> $GITHUB_ENV
else
echo "zip=$(ls -1 build/SpaceWarp-Debug*.zip | head -n 1)" >> $GITHUB_ENV
echo "artifact_name=SpaceWarpDebug" >> $GITHUB_ENV
fi
# Least cursed Sinon code.
echo "zip=$(ls -1 dist/SpaceWarp-*.zip | head -n 1)" >> $GITHUB_ENV
echo "artifact_name=SpaceWarpRelease" >> $GITHUB_ENV
- name: Upload Artifact
uses: actions/upload-artifact@v3
Expand Down
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,10 @@ MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/

# Build script folder
build/
# Build folders
/build
/dist
/nuget

# Idea folder
.idea
91 changes: 52 additions & 39 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,51 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<SpaceWarpVersion>1.6.0</SpaceWarpVersion>
<PropertyGroup Label="Framework and language configuration">
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace>SpaceWarp</RootNamespace>
<LangVersion>11</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
<!-- Disabled warning for publicizer attribute until the NuGet exists for KSP2,
and for missing documentation comments for public types and members -->
<NoWarn>$(NoWarn),CS0436,CS1591</NoWarn>
<LangVersion>latest</LangVersion>
<ImplicitUsings>true</ImplicitUsings>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<!--
Allows use of some newer C# language features that have compiler gates normally.
Do not modify the included types without checking that they don't require runtime support that doesn't exist.
-->
<PropertyGroup Label="Game folder configuration">
<!-- Set this to the path to your KSP 2 folder if you don't have the KSP2DIR environmental variable set -->
<KSP2DIR Condition="'$(KSP2DIR)' == ''">C:/Program Files (x86)/Steam/steamapps/common/Kerbal Space Program 2</KSP2DIR>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="PolySharp" Version="1.12.1" PrivateAssets="all"/>
</ItemGroup>
<PropertyGroup>
<PolySharpIncludeGeneratedTypes>
System.Index;
System.Range;
System.Diagnostics.CodeAnalysis.NotNullWhenAttribute;
System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute;
</PolySharpIncludeGeneratedTypes>
<PropertyGroup Label="Build and namespace configuration">
<SolutionDir Condition="'$(SolutionDir)'==''">$(MSBuildThisFileDirectory)</SolutionDir>
<PluginBinPath>$(SolutionDir)build/bin/plugin/$(Configuration)</PluginBinPath>
<PluginObjPath>$(SolutionDir)build/obj/plugin/$(Configuration)</PluginObjPath>
<ModulesBinPath>$(SolutionDir)build/bin/modules/$(Configuration)</ModulesBinPath>
<ModulesObjPath>$(SolutionDir)build/obj/modules/$(Configuration)</ModulesObjPath>
<PatcherBinPath>$(SolutionDir)build/bin/patcher/$(Configuration)</PatcherBinPath>
<PatcherObjPath>$(SolutionDir)build/obj/patcher/$(Configuration)</PatcherObjPath>
<BaseOutputPath>$(ModulesBinPath)/$(MSBuildProjectName)</BaseOutputPath>
<BaseIntermediateOutputPath>$(ModulesObjPath)/$(MSBuildProjectName)</BaseIntermediateOutputPath>
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
<RootNamespace>$(AssemblyName)</RootNamespace>
<Configurations>Debug;Release;Deploy;DeployAndRun</Configurations>
<Platforms>AnyCPU</Platforms>
<NoWarn>$(NoWarn);CS0436</NoWarn>
</PropertyGroup>

<!-- <ItemGroup Label="Dependencies for build targets">-->
<!-- <PackageReference Include="JsonPeek" Version="1.2.0" PrivateAssets="all"/>-->
<!-- </ItemGroup>-->
<PropertyGroup Label="Package source configuration">
<RestoreAdditionalProjectSources>
https://nuget.spacewarp.org/v3/index.json
</RestoreAdditionalProjectSources>
</PropertyGroup>

<ItemGroup Label="Dependencies for build targets">
<PackageReference Include="JsonPeek" Version="1.2.0" PrivateAssets="all"/>
</ItemGroup>

<!-- &lt;!&ndash; Define the main target &ndash;&gt;-->
<!-- <Target Label="Reading properties from swinfo.json" Name="ReadPropertiesFromJson" BeforeTargets="PreBuildEvent">-->
<!-- <JsonPeek ContentPath="$(SolutionDir)/SpaceWarpBuildTemplate/swinfo.json" Query="$">-->
<!-- <Output TaskParameter="Result" ItemName="Swinfo"/>-->
<!-- </JsonPeek>-->
<!-- <JsonPeek ContentPath="$(SolutionDir)/SpaceWarpBuildTemplate/swinfo.json" Query="$.dependencies">-->
<!-- <Output TaskParameter="Result" ItemName="Dependencies"/>-->
<!-- </JsonPeek>-->
<!-- Define the main target -->
<Target Label="Reading properties from swinfo.json" Name="ReadPropertiesFromJson" BeforeTargets="PreBuildEvent;AddGeneratedFile">
<JsonPeek ContentPath="$(SolutionDir)/plugin_template/BepInEx/plugins/SpaceWarp/swinfo.json" Query="$">
<Output TaskParameter="Result" ItemName="Swinfo"/>
</JsonPeek>

<!-- &lt;!&ndash; Extract properties from the JSON &ndash;&gt;-->
<!-- <PropertyGroup>-->
<!-- <SpaceWarpVersion>@(Swinfo -> '%(version)')</SpaceWarpVersion>-->
<!-- </PropertyGroup>-->
<!-- </Target>-->
<!-- Extract properties from the JSON -->
<PropertyGroup>
<ModId>@(Swinfo -> '%(mod_id)')</ModId>
<Version>@(Swinfo -> '%(version)')</Version>
<Version Condition="$(Version.Contains('-'))">$(Version.Substring(0, $(Version.IndexOf('-'))))</Version>
<Product>@(Swinfo -> '%(name)')</Product>
<Authors>@(Swinfo -> '%(author)')</Authors>
<Description>@(Swinfo -> '%(description)')</Description>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>@(Swinfo -> '%(source)')</RepositoryUrl>
<BepInExPluginGuid>$(ModId)</BepInExPluginGuid>
<BepInExPluginName>$(Product)</BepInExPluginName>
<BepInExPluginVersion>$(Version)</BepInExPluginVersion>
</PropertyGroup>
</Target>
</Project>
8 changes: 0 additions & 8 deletions Directory.Build.targets

This file was deleted.

3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 X606
Copyright (c) 2023 Space Warp Team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

6 changes: 0 additions & 6 deletions NuGet.config

This file was deleted.

22 changes: 11 additions & 11 deletions SpaceWarp.nuspec → Package.nuspec
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>SpaceWarp</id>
<version>1.6.0</version>
<authors>SpaceWarp contributors</authors>
<id>$id$</id>
<version>$version$</version>
<authors>$authors$</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<licenseUrl>https://raw.githubusercontent.com/SpaceWarp/SpaceWarp/main/LICENSE</licenseUrl>
<description>A C# modding API for KSP2</description>
<tags>spacewarp ksp2 modding</tags>
<icon>icon.png</icon>
<licenseUrl>https://raw.githubusercontent.com/SpaceWarpDev/SpaceWarp/main/LICENSE</licenseUrl>
<description>$description$</description>
<tags>ksp2 mod library api spacewarp</tags>
<projectUrl>https://spacewarp.org</projectUrl>
<repository type="git" url="https://github.com/SpaceWarpDev/SpaceWarp" />
<repository type="$repositoryType$" url="$repositoryUrl$" />
<readme>README.md</readme>
<icon>icon.png</icon>
<dependencies>
<group targetFramework=".NETStandard2.1" />
</dependencies>
</metadata>
<files>
<file src=".github\README.md" target="README.md" />
<file src="images\icon.png" target="icon.png" />
<file src="LICENSE" target="LICENSE" />
<file src="build\nuget_temp\*.dll" target="lib/netstandard2.1/" />
<file src="build\nuget_temp\*.xml" target="lib/netstandard2.1/" />
<file src="images\icon.png" target="icon.png" />
<file src="temp_nuget\*.dll" target="lib/netstandard2.1/" />
<file src="temp_nuget\*.xml" target="lib/netstandard2.1/" />
</files>
</package>
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Space Warp
Space Warp is an API for KSP 2 mod developers.
41 changes: 0 additions & 41 deletions SpaceWarp.Core/SpaceWarp.Core.csproj

This file was deleted.

11 changes: 0 additions & 11 deletions SpaceWarp.Game/SpaceWarp.Game.csproj

This file was deleted.

5 changes: 0 additions & 5 deletions SpaceWarp.Messaging/SpaceWarp.Messaging.csproj

This file was deleted.

11 changes: 0 additions & 11 deletions SpaceWarp.Sound/SpaceWarp.Sound.csproj

This file was deleted.

21 changes: 0 additions & 21 deletions SpaceWarp.UI/SpaceWarp.UI.csproj

This file was deleted.

10 changes: 0 additions & 10 deletions SpaceWarp.VersionChecking/SpaceWarp.VersionChecking.csproj

This file was deleted.

Loading

0 comments on commit 319bac0

Please sign in to comment.