Skip to content

Commit

Permalink
Merge pull request #168 from BUTR/dev
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
Aragas authored Dec 28, 2023
2 parents 149aae1 + 46fc55f commit 8a698ac
Show file tree
Hide file tree
Showing 16 changed files with 398 additions and 392 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/check-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Setup
uses: butr/actions-common-setup@v2.1
uses: butr/actions-common-setup@v2
with:
github-token: ${{secrets.GITHUB_TOKEN}}

- name: Run VersionChecker
id: status
run: >-
dotnet build ./build/VersionChecker/VersionChecker.csproj --configuration Release;
$status = dotnet run --project ./build/VersionChecker/VersionChecker.csproj --no-build --configuration Release;
dotnet tool install -g dotnet-script;
$status = dotnet script -v e ./build/VersionChecker.csx;
echo "::set-env name=newer_version_status::$status";
shell: pwsh

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
mod_version: ${{ steps.version.outputs.mod_version }}
steps:
- name: Setup
uses: butr/actions-common-setup@v2.1
uses: butr/actions-common-setup@v2
with:
github-token: ${{secrets.GITHUB_TOKEN}}

Expand All @@ -44,7 +44,7 @@ jobs:
shell: pwsh

- name: Upload Bannerlord folder
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: bannerlord
path: ./bannerlord/
Expand All @@ -62,7 +62,7 @@ jobs:
mod_filename: Harmony
mod_version: ${{ needs.build-module.outputs.mod_version }}
mod_description: |
Works with every version past v1.0.0
Works with every version past v1.0.0 (Steam/GOG/Epic) and past v1.2.7 (Xbox).
* Added more info for Debug UI. Available via CTRL+ALT+H
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -351,3 +351,4 @@ MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/
/src/.idea/*
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 BUTR Team
Copyright (c) 2020-2024 BUTR 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 Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ The Module combines the Harmony version used and the Build Id that published the
``2.0.2.22`` indicates that Harmony ``2.0.2.0`` is used and ``22`` is the Build Id.
``2.0.0.1025`` indicates that Harmony ``2.0.0.10`` is used and ``25`` is the Build Id.

We considered using the Rimworld approach with introducing our own version system, but it won't give a clear way to detect which HarmonyX version the Module contains. It's easier for the user to report the version of the Module used than to check the assembly version/send it.
We considered using the Rimworld approach with introducing our own version system, but it won't give a clear way to detect which Harmony version the Module contains. It's easier for the user to report the version of the Module used than to check the assembly version/send it.

48 changes: 48 additions & 0 deletions build/VersionChecker.csx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#r "nuget: Newtonsoft.Json, 13.0.3"

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;

using System.Threading.Tasks;

using Newtonsoft.Json;

public class NuGetVersions
{
public required List<string> Versions { get; init; }
}

public class NexusModsLatestVersion
{
public required string Message { get; init; }
}

private static readonly string NuGet = "https://api.nuget.org/v3-flatcontainer/lib.harmony/index.json";
private static readonly string RunKit = "https://nexusmods-version-pzk4e0ejol6j.runkit.sh/?gameId=mountandblade2bannerlord&modId=2006";

Version nuGetVersion;
Version nexusModsLatestVersion;

try
{
var client = new HttpClient();
nuGetVersion = JsonConvert.DeserializeObject<NuGetVersions>(await client.GetStringAsync(NuGet)).Versions.Select(Version.Parse).MaxBy(x => x);
nexusModsLatestVersion = Version.Parse(JsonConvert.DeserializeObject<NexusModsLatestVersion>(await client.GetStringAsync(RunKit)).Message);
}
catch (Exception e)
{
Console.WriteLine(1);
//Console.WriteLine(e);
return;
}

if (nexusModsLatestVersion == nuGetVersion)
Console.WriteLine(2);

if (nexusModsLatestVersion > nuGetVersion)
Console.WriteLine(3);

if (nexusModsLatestVersion < nuGetVersion)
Console.WriteLine(0);
57 changes: 0 additions & 57 deletions build/VersionChecker/Program.cs

This file was deleted.

13 changes: 0 additions & 13 deletions build/VersionChecker/VersionChecker.csproj

This file was deleted.

11 changes: 6 additions & 5 deletions build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
<!--Harmony Version-->
<HarmonyExtensionsVersion>3.2.0.77</HarmonyExtensionsVersion>
<HarmonyVersion>2.3.0.0</HarmonyVersion>
<HarmonyAnalyzerVersion>1.0.1.44</HarmonyAnalyzerVersion>
<BuildResourcesVersion>1.1.0.102</BuildResourcesVersion>
<HarmonyAnalyzerVersion>1.0.1.50</HarmonyAnalyzerVersion>
<BuildResourcesVersion>1.1.0.104</BuildResourcesVersion>
<BUTRAnalyzerVersion>1.0.1.12</BUTRAnalyzerVersion>
<BUTRSharedVersion>3.0.0.136</BUTRSharedVersion>
<BUTRModuleManagerVersion>5.0.209</BUTRModuleManagerVersion>
<BUTRSharedVersion>3.0.0.138</BUTRSharedVersion>
<BUTRModuleManagerVersion>5.0.221</BUTRModuleManagerVersion>
<!--Current Bannerlord Version-->
<GameVersion>1.0.0</GameVersion>
<GameVersionWithPrefix>v$(GameVersion)</GameVersionWithPrefix>
<!--Bannerlord's Root Folder. Leave empty if you want it to be tried to be autoresolved.-->
<GameFolder Condition="$(Configuration) == 'Stable_Debug' OR $(Configuration) == 'Stable_Release'">$(BANNERLORD_STABLE_DIR)</GameFolder>
<GameFolder Condition="$(Configuration) == 'Beta_Debug' OR $(Configuration) == 'Beta_Release'">$(BANNERLORD_BETA_DIR)</GameFolder>
Expand Down Expand Up @@ -50,7 +51,7 @@
</PropertyGroup>
<!--SorceLink-->
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>
<!--CI Builds-->
<ItemGroup Condition="$(TargetFramework) == 'net472' AND $(OS) != 'Windows_NT'">
Expand Down
12 changes: 1 addition & 11 deletions src/Bannerlord.Harmony.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{E6508F3E-117D-4D23-A09A-FF327F5EB547}"
ProjectSection(SolutionItems) = preProject
..\build\common.props = ..\build\common.props
..\build\VersionChecker.csx = ..\build\VersionChecker.csx
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5958576A-D277-4419-A640-9D05524C28E8}"
Expand All @@ -18,8 +19,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
..\.github\workflows\publish.yml = ..\.github\workflows\publish.yml
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VersionChecker", "..\build\VersionCHecker\VersionChecker.csproj", "{7CD86F86-0C46-4695-953B-5634AF718E5B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{088AC302-5E01-4094-A7CB-6D3036D4CC62}"
ProjectSection(SolutionItems) = preProject
..\.editorconfig = ..\.editorconfig
Expand All @@ -44,21 +43,12 @@ Global
{8F7DF9CA-28B6-43DD-AD0D-12E916E8CEED}.Stable_Release|x64.Build.0 = Stable_Release|x64
{8F7DF9CA-28B6-43DD-AD0D-12E916E8CEED}.Beta_Debug|x64.ActiveCfg = Beta_Debug|x64
{8F7DF9CA-28B6-43DD-AD0D-12E916E8CEED}.Beta_Debug|x64.Build.0 = Beta_Debug|x64
{7CD86F86-0C46-4695-953B-5634AF718E5B}.Beta_Release|x64.ActiveCfg = Release|Any CPU
{7CD86F86-0C46-4695-953B-5634AF718E5B}.Beta_Release|x64.Build.0 = Release|Any CPU
{7CD86F86-0C46-4695-953B-5634AF718E5B}.Stable_Debug|x64.ActiveCfg = Debug|Any CPU
{7CD86F86-0C46-4695-953B-5634AF718E5B}.Stable_Debug|x64.Build.0 = Debug|Any CPU
{7CD86F86-0C46-4695-953B-5634AF718E5B}.Stable_Release|x64.ActiveCfg = Release|Any CPU
{7CD86F86-0C46-4695-953B-5634AF718E5B}.Stable_Release|x64.Build.0 = Release|Any CPU
{7CD86F86-0C46-4695-953B-5634AF718E5B}.Beta_Debug|x64.ActiveCfg = Debug|Any CPU
{7CD86F86-0C46-4695-953B-5634AF718E5B}.Beta_Debug|x64.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{8F7DF9CA-28B6-43DD-AD0D-12E916E8CEED} = {5958576A-D277-4419-A640-9D05524C28E8}
{7CD86F86-0C46-4695-953B-5634AF718E5B} = {E6508F3E-117D-4D23-A09A-FF327F5EB547}
{E6508F3E-117D-4D23-A09A-FF327F5EB547} = {088AC302-5E01-4094-A7CB-6D3036D4CC62}
{5958576A-D277-4419-A640-9D05524C28E8} = {088AC302-5E01-4094-A7CB-6D3036D4CC62}
{9DDD383F-8BE9-43A7-8353-A603EA47DF03} = {088AC302-5E01-4094-A7CB-6D3036D4CC62}
Expand Down
10 changes: 5 additions & 5 deletions src/Bannerlord.Harmony/Bannerlord.Harmony.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks>
<LangVersion>9.0</LangVersion>
<TargetFrameworks>net472;net6</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<Platforms>x64</Platforms>
<BuildForWindows>false</BuildForWindows>
Expand All @@ -15,7 +15,7 @@
<PropertyGroup Condition="$(TargetFramework) == 'net472'">
<BuildForWindows>true</BuildForWindows>
</PropertyGroup>
<PropertyGroup Condition="$(TargetFramework) == 'netcoreapp3.1'">
<PropertyGroup Condition="$(TargetFramework) == 'net6'">
<BuildForWindowsStore>true</BuildForWindowsStore>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
Expand All @@ -25,7 +25,7 @@
<ItemGroup Condition="$(TargetFramework) == 'net472'">
<Reference Include="System.Windows.Forms" PrivateAssets="all" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework) == 'netcoreapp3.1'">
<ItemGroup Condition="$(TargetFramework) == 'net6'">
<FrameworkReference Include="Microsoft.WindowsDesktop.App" PrivateAssets="all" />
</ItemGroup>
<!--Windows Forms-->
Expand All @@ -39,7 +39,7 @@

<ItemGroup>
<PackageReference Include="Lib.Harmony" Version="$(HarmonyVersion)-prerelease.2" />
<PackageReference Include="MonoMod.Core" Version="1.0.0" />
<PackageReference Include="MonoMod.Core" Version="1.1.0-prerelease.1" />

<PackageReference Include="Bannerlord.BuildResources" Version="$(BuildResourcesVersion)" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
<PackageReference Include="Bannerlord.BUTR.Analyzers" Version="$(BUTRAnalyzerVersion)" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
Expand Down
Loading

0 comments on commit 8a698ac

Please sign in to comment.