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
32 changes: 28 additions & 4 deletions .github/scripts/build-and-pack-nuget.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ set -e
SKIP_VERSION_CHECK=false
[[ "$1" == "--skip-version-check" ]] && SKIP_VERSION_CHECK=true

# Track version extraction failures
VERSION_EXTRACTION_FAILURES=0

# Create artifacts directory for local NuGet feed
mkdir -p ./artifacts

Expand Down Expand Up @@ -99,18 +102,32 @@ while [ -n "$REMAINING_PROJECTS" ] && [ $ITERATION -lt $MAX_ITERATIONS ]; do
echo "Building $PROJECT_NAME (version check skipped)..."
SHOULD_BUILD=true
else
# Get the version and PackageId from the project file by evaluating MSBuild properties
VERSION=$(dotnet msbuild "$project" -getProperty:Version -p:Configuration=Release 2>/dev/null | tail -1)
# Get the PackageId from the project file by evaluating the MSBuild property
PACKAGE_ID=$(dotnet msbuild "$project" -getProperty:PackageId -p:Configuration=Release 2>/dev/null | tail -1)

# If PackageId is not set, fall back to project name
if [ -z "$PACKAGE_ID" ]; then
PACKAGE_ID="$PROJECT_NAME"
fi

# Get the version - submodule projects use <Version> property, main projects use CPM
if [[ "$project" == *submodules/* ]]; then
# Submodule projects have their own Version property
VERSION=$(dotnet msbuild "$project" -getProperty:Version -p:Configuration=Release -nologo 2>/dev/null | grep -v "^$" | tail -1)
else
# Main projects use CPM - the version is set by the SetProjectVersionsFromCentralPackageManagement target
# We suppress stderr as GetAssemblyVersion task may not be found but PackageVersion is still set correctly
VERSION=$(dotnet msbuild "$project" -t:SetProjectVersionsFromCentralPackageManagement -getProperty:PackageVersion -p:Configuration=Release -nologo 2>/dev/null | grep -v "^$" | tail -1)
fi

if [ -z "$VERSION" ]; then
echo "❌ ERROR: Could not extract version from $PROJECT_NAME, skipping"
echo " Make sure the project has a <Version> property defined"
echo "❌ ERROR: Could not extract version from $PACKAGE_ID, skipping"
if [[ "$project" == *submodules/* ]]; then
echo " Make sure the project has a <Version> property defined"
else
echo " Make sure the project has a version defined in Directory.Packages.props"
fi
VERSION_EXTRACTION_FAILURES=$((VERSION_EXTRACTION_FAILURES + 1))
SHOULD_BUILD=false
else
echo "Checking if $PACKAGE_ID $VERSION exists on NuGet.org..."
Expand Down Expand Up @@ -168,6 +185,13 @@ echo ""
echo "=== Build Summary ==="
echo "Successfully created $PACKAGE_COUNT package(s)"

# Exit with error if any version extractions failed
if [ $VERSION_EXTRACTION_FAILURES -gt 0 ]; then
echo ""
echo "❌ ERROR: Failed to extract version for $VERSION_EXTRACTION_FAILURES project(s)"
exit 1
fi

# Only create zip and check for updates when NOT skipping version check
if [ "$SKIP_VERSION_CHECK" = false ]; then
if [ $PACKAGE_COUNT -eq 0 ]; then
Expand Down
30 changes: 3 additions & 27 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<ItemGroup Condition="'$(Configuration)'=='Debug'">
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435">
<PackageReference Include="StyleCop.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand All @@ -9,10 +9,10 @@
<SourceRoot Include="$(MSBuildThisFileDirectory)/"/>
</ItemGroup>
<ItemGroup Condition="'$(PACK)'!='true'">
<Content Include="$(MSBuildThisFileDirectory)LICENSE">
<Content Include="$(MSBuildThisFileDirectory)LICENSE" Visible="false">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Visible="false" />
</ItemGroup>
<ItemGroup>
<None Remove="README.md" />
Expand All @@ -32,29 +32,5 @@
<PropertyGroup>
<TfmGroupDotNet>net5.0</TfmGroupDotNet>
<TfmGroupDotNetWindows>net5.0;net5.0-windows</TfmGroupDotNetWindows>
<War3NetBuildVersion>5.8.2</War3NetBuildVersion>
<War3NetBuildCoreVersion>5.8.2</War3NetBuildCoreVersion>
<War3NetCodeAnalysisVersion>5.8.0</War3NetCodeAnalysisVersion>
<War3NetCodeAnalysisDecompilersVersion>5.8.2</War3NetCodeAnalysisDecompilersVersion>
<War3NetCodeAnalysisJassVersion>5.8.0</War3NetCodeAnalysisJassVersion>
<War3NetCodeAnalysisTranspilersVersion>5.8.0</War3NetCodeAnalysisTranspilersVersion>
<War3NetCodeAnalysisVJassVersion>0.1.0</War3NetCodeAnalysisVJassVersion>
<War3NetCommonVersion>5.8.0</War3NetCommonVersion>
<War3NetDrawingBlpVersion>5.9.0</War3NetDrawingBlpVersion>
<War3NetIOCascVersion>0.1.0</War3NetIOCascVersion>
<War3NetIOCompressionVersion>5.8.0</War3NetIOCompressionVersion>
<War3NetIOMpqVersion>5.8.1</War3NetIOMpqVersion>
<War3NetIOSlkVersion>5.8.1</War3NetIOSlkVersion>
<War3NetModelingVersion>0.1.0</War3NetModelingVersion>
<!--
<War3NetRenderingVersion></War3NetRenderingVersion>
<War3NetReplayVersion></War3NetReplayVersion>
<War3NetRuntimeVersion></War3NetRuntimeVersion>
<War3NetRuntimeApiBlizzardVersion></War3NetRuntimeApiBlizzardVersion>
<War3NetRuntimeApiCommonVersion></War3NetRuntimeApiCommonVersion>
<War3NetRuntimeCoreVersion></War3NetRuntimeCoreVersion>
-->
<War3NetCSharpLuaVersion>2.0.1</War3NetCSharpLuaVersion>
<War3NetCSharpLuaCoreSystemVersion>2.0.1</War3NetCSharpLuaCoreSystemVersion>
</PropertyGroup>
</Project>
50 changes: 50 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.13.2" />
<PackageVersion Include="DotNetZip" Version="1.16.0" />
<PackageVersion Include="JpegLibrary" Version="0.3.30" />
<PackageVersion Include="MessagePack" Version="2.2.60" />
<PackageVersion Include="MessagePackAnalyzer" Version="2.2.60" />
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageVersion Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageVersion Include="MSTest.TestFramework" Version="2.2.10" />
<PackageVersion Include="NAudio" Version="1.10.0" />
<PackageVersion Include="NLua" Version="1.4.32" />
<PackageVersion Include="OptimizedPriorityQueue" Version="5.0.0" />
<PackageVersion Include="Pfim" Version="0.11.1" />
<PackageVersion Include="Pidgin" Version="3.1.0" />
<PackageVersion Include="Portable.BouncyCastle" Version="1.9.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageVersion Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageVersion Include="SixLabors.ImageSharp" Version="3.1.11" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.435" />
<PackageVersion Include="System.Drawing.Common" Version="6.0.0" />
<PackageVersion Include="System.Text.Json" Version="8.0.4" />
<PackageVersion Include="Veldrid" Version="4.8.0" />
<PackageVersion Include="Veldrid.ImGui" Version="5.72.0" />
<PackageVersion Include="Veldrid.SPIRV" Version="1.0.13" />
<PackageVersion Include="Veldrid.StartupUtilities" Version="4.8.0" />
<PackageVersion Include="Veldrid.Utilities" Version="4.8.0" />
<PackageVersion Include="War3Api.Object" Version="1.31.1-rc.11" />
<PackageVersion Include="War3Net.Build" Version="5.8.2" />
<PackageVersion Include="War3Net.Build.Core" Version="5.8.2" />
<PackageVersion Include="War3Net.CodeAnalysis" Version="5.8.0" />
<PackageVersion Include="War3Net.CodeAnalysis.Decompilers" Version="5.8.2" />
<PackageVersion Include="War3Net.CodeAnalysis.Jass" Version="5.8.0" />
<PackageVersion Include="War3Net.CodeAnalysis.Transpilers" Version="5.8.0" />
<PackageVersion Include="War3Net.CodeAnalysis.VJass" Version="0.1.0" />
<PackageVersion Include="War3Net.Common" Version="5.8.0" />
<PackageVersion Include="War3Net.CSharpLua" Version="2.0.1" />
<PackageVersion Include="War3Net.CSharpLua.CoreSystem" Version="2.0.1" />
<PackageVersion Include="War3Net.Drawing.Blp" Version="5.9.0" />
<PackageVersion Include="War3Net.IO.Casc" Version="0.1.0" />
<PackageVersion Include="War3Net.IO.Compression" Version="5.8.0" />
<PackageVersion Include="War3Net.IO.Mpq" Version="5.8.1" />
<PackageVersion Include="War3Net.IO.Slk" Version="5.8.1" />
<PackageVersion Include="War3Net.Modeling" Version="0.1.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion perf/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
<PackageReference Include="BenchmarkDotNet" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</ItemGroup>

<ItemGroup Condition="'$(Configuration)'=='Release'">
<PackageReference Include="War3Net.Drawing.Blp" Version="$(War3NetDrawingBlpVersion)" />
<PackageReference Include="War3Net.Drawing.Blp" />
</ItemGroup>

</Project>
17 changes: 17 additions & 0 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project>
<Target Name="SetProjectVersionsFromCentralPackageManagement" Condition="'$(ManagePackageVersionsCentrally)' == 'true'" BeforeTargets="BeforeBuild">
<ItemGroup>
<ThisProjectPackageVersion Include="@(PackageVersion)" Condition="'%(PackageVersion.Identity)' == $(PackageId)" />
</ItemGroup>
<PropertyGroup>
<PackageVersion>%(ThisProjectPackageVersion.Version)</PackageVersion>
</PropertyGroup>
<GetAssemblyVersion Condition="'$(AssemblyVersion)' == '' And '$(PackageVersion)' != '' And '$(GenerateAssemblyInfo)' != 'false'" NuGetVersion="$(PackageVersion)">
<Output TaskParameter="AssemblyVersion" PropertyName="AssemblyVersion" />
</GetAssemblyVersion>
<PropertyGroup Condition="'$(GenerateAssemblyInfo)' != 'false'">
<FileVersion Condition="'$(FileVersion)' == ''">$(AssemblyVersion)</FileVersion>
<InformationalVersion Condition="'$(InformationalVersion)' == ''">$(PackageVersion)</InformationalVersion>
</PropertyGroup>
</Target>
</Project>
7 changes: 3 additions & 4 deletions src/War3Net.Build.Core/War3Net.Build.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<TargetFrameworks>$(TfmGroupDotNet)</TargetFrameworks>
<Version>$(War3NetBuildCoreVersion)</Version>
<RootNamespace>War3Net.Build</RootNamespace>
</PropertyGroup>

Expand All @@ -18,9 +17,9 @@
</ItemGroup>

<ItemGroup Condition="'$(Configuration)'=='Release'">
<PackageReference Include="War3Net.CodeAnalysis.Jass" Version="$(War3NetCodeAnalysisJassVersion)" />
<PackageReference Include="War3Net.IO.Mpq" Version="$(War3NetIOMpqVersion)" />
<PackageReference Include="War3Net.IO.Slk" Version="$(War3NetIOSlkVersion)" />
<PackageReference Include="War3Net.CodeAnalysis.Jass" />
<PackageReference Include="War3Net.IO.Mpq" />
<PackageReference Include="War3Net.IO.Slk" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 2 additions & 3 deletions src/War3Net.Build/War3Net.Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<TargetFrameworks>$(TfmGroupDotNet)</TargetFrameworks>
<Version>$(War3NetBuildVersion)</Version>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -16,8 +15,8 @@
</ItemGroup>

<ItemGroup Condition="'$(Configuration)'=='Release'">
<PackageReference Include="War3Net.Build.Core" Version="$(War3NetBuildCoreVersion)" />
<PackageReference Include="War3Net.CodeAnalysis.Transpilers" Version="$(War3NetCodeAnalysisTranspilersVersion)" />
<PackageReference Include="War3Net.Build.Core" />
<PackageReference Include="War3Net.CodeAnalysis.Transpilers" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<TargetFrameworks>$(TfmGroupDotNet)</TargetFrameworks>
<Version>$(War3NetCodeAnalysisDecompilersVersion)</Version>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -16,8 +15,8 @@
</ItemGroup>

<ItemGroup Condition="'$(Configuration)'=='Release'">
<PackageReference Include="War3Net.Build.Core" Version="$(War3NetBuildCoreVersion)" />
<PackageReference Include="War3Net.CodeAnalysis.Jass" Version="$(War3NetCodeAnalysisJassVersion)" />
<PackageReference Include="War3Net.Build.Core" />
<PackageReference Include="War3Net.CodeAnalysis.Jass" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<TargetFrameworks>$(TfmGroupDotNet)</TargetFrameworks>
<Version>$(War3NetCodeAnalysisJassVersion)</Version>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -16,8 +15,8 @@
</ItemGroup>

<ItemGroup Condition="'$(Configuration)'=='Release'">
<PackageReference Include="War3Net.CodeAnalysis" Version="$(War3NetCodeAnalysisVersion)" />
<PackageReference Include="War3Net.Common" Version="$(War3NetCommonVersion)" />
<PackageReference Include="War3Net.CodeAnalysis" />
<PackageReference Include="War3Net.Common" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<TargetFrameworks>$(TfmGroupDotNet)</TargetFrameworks>
<Version>$(War3NetCodeAnalysisTranspilersVersion)</Version>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -16,8 +15,8 @@
</ItemGroup>

<ItemGroup Condition="'$(Configuration)'=='Release'">
<PackageReference Include="War3Net.CodeAnalysis.Jass" Version="$(War3NetCodeAnalysisJassVersion)" />
<PackageReference Include="War3Net.CSharpLua" Version="$(War3NetCSharpLuaVersion)" />
<PackageReference Include="War3Net.CodeAnalysis.Jass" />
<PackageReference Include="War3Net.CSharpLua" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<TargetFrameworks>$(TfmGroupDotNet)</TargetFrameworks>
<Version>$(War3NetCodeAnalysisVJassVersion)</Version>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -16,8 +15,8 @@
</ItemGroup>

<ItemGroup Condition="'$(Configuration)'=='Release'">
<PackageReference Include="War3Net.CodeAnalysis" Version="$(War3NetCodeAnalysisVersion)" />
<PackageReference Include="War3Net.Common" Version="$(War3NetCommonVersion)" />
<PackageReference Include="War3Net.CodeAnalysis" />
<PackageReference Include="War3Net.Common" />
</ItemGroup>

</Project>
3 changes: 1 addition & 2 deletions src/War3Net.CodeAnalysis/War3Net.CodeAnalysis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<TargetFrameworks>$(TfmGroupDotNet)</TargetFrameworks>
<Version>$(War3NetCodeAnalysisVersion)</Version>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -11,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Pidgin" Version="3.1.0" />
<PackageReference Include="Pidgin" />
</ItemGroup>

</Project>
3 changes: 1 addition & 2 deletions src/War3Net.Common/War3Net.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<TargetFrameworks>$(TfmGroupDotNet)</TargetFrameworks>
<Version>$(War3NetCommonVersion)</Version>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -11,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="System.Drawing.Common" />
</ItemGroup>

</Project>
5 changes: 2 additions & 3 deletions src/War3Net.Drawing.Blp/War3Net.Drawing.Blp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<PropertyGroup>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<TargetFrameworks>$(TfmGroupDotNetWindows)</TargetFrameworks>
<Version>$(War3NetDrawingBlpVersion)</Version>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -16,15 +15,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="JpegLibrary" Version="0.3.30" />
<PackageReference Include="JpegLibrary" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)'=='Debug'">
<ProjectReference Include="..\War3Net.Common\War3Net.Common.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(Configuration)'=='Release'">
<PackageReference Include="War3Net.Common" Version="$(War3NetCommonVersion)" />
<PackageReference Include="War3Net.Common" />
</ItemGroup>

</Project>
Loading
Loading