diff --git a/.github/scripts/build-and-pack-nuget.sh b/.github/scripts/build-and-pack-nuget.sh index 033dbef7..2bfc0501 100644 --- a/.github/scripts/build-and-pack-nuget.sh +++ b/.github/scripts/build-and-pack-nuget.sh @@ -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 @@ -99,8 +102,7 @@ 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 @@ -108,9 +110,24 @@ while [ -n "$REMAINING_PROJECTS" ] && [ $ITERATION -lt $MAX_ITERATIONS ]; do PACKAGE_ID="$PROJECT_NAME" fi + # Get the version - submodule projects use 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 property defined" + echo "❌ ERROR: Could not extract version from $PACKAGE_ID, skipping" + if [[ "$project" == *submodules/* ]]; then + echo " Make sure the project has a 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..." @@ -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 diff --git a/Directory.Build.props b/Directory.Build.props index 399e843a..ae833a36 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -9,10 +9,10 @@ - + PreserveNewest - + @@ -32,29 +32,5 @@ net5.0 net5.0;net5.0-windows - 5.8.2 - 5.8.2 - 5.8.0 - 5.8.2 - 5.8.0 - 5.8.0 - 0.1.0 - 5.8.0 - 5.9.0 - 0.1.0 - 5.8.0 - 5.8.1 - 5.8.1 - 0.1.0 - - 2.0.1 - 2.0.1 \ No newline at end of file diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 00000000..b4499b70 --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,50 @@ + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/perf/Directory.Build.props b/perf/Directory.Build.props index e1451d87..eb8a7b8a 100644 --- a/perf/Directory.Build.props +++ b/perf/Directory.Build.props @@ -9,6 +9,6 @@ - + \ No newline at end of file diff --git a/perf/War3Net.Drawing.Blp.Benchmarks/War3Net.Drawing.Blp.Benchmarks.csproj b/perf/War3Net.Drawing.Blp.Benchmarks/War3Net.Drawing.Blp.Benchmarks.csproj index 7b616b09..f5774b4e 100644 --- a/perf/War3Net.Drawing.Blp.Benchmarks/War3Net.Drawing.Blp.Benchmarks.csproj +++ b/perf/War3Net.Drawing.Blp.Benchmarks/War3Net.Drawing.Blp.Benchmarks.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets new file mode 100644 index 00000000..19ee7535 --- /dev/null +++ b/src/Directory.Build.targets @@ -0,0 +1,17 @@ + + + + + + + %(ThisProjectPackageVersion.Version) + + + + + + $(AssemblyVersion) + $(PackageVersion) + + + \ No newline at end of file diff --git a/src/War3Net.Build.Core/War3Net.Build.Core.csproj b/src/War3Net.Build.Core/War3Net.Build.Core.csproj index 3bb59c07..13409987 100644 --- a/src/War3Net.Build.Core/War3Net.Build.Core.csproj +++ b/src/War3Net.Build.Core/War3Net.Build.Core.csproj @@ -2,7 +2,6 @@ $(TfmGroupDotNet) - $(War3NetBuildCoreVersion) War3Net.Build @@ -18,9 +17,9 @@ - - - + + + diff --git a/src/War3Net.Build/War3Net.Build.csproj b/src/War3Net.Build/War3Net.Build.csproj index 8985b27b..130d1c76 100644 --- a/src/War3Net.Build/War3Net.Build.csproj +++ b/src/War3Net.Build/War3Net.Build.csproj @@ -2,7 +2,6 @@ $(TfmGroupDotNet) - $(War3NetBuildVersion) @@ -16,8 +15,8 @@ - - + + diff --git a/src/War3Net.CodeAnalysis.Decompilers/War3Net.CodeAnalysis.Decompilers.csproj b/src/War3Net.CodeAnalysis.Decompilers/War3Net.CodeAnalysis.Decompilers.csproj index a37733ed..bc50f0ce 100644 --- a/src/War3Net.CodeAnalysis.Decompilers/War3Net.CodeAnalysis.Decompilers.csproj +++ b/src/War3Net.CodeAnalysis.Decompilers/War3Net.CodeAnalysis.Decompilers.csproj @@ -2,7 +2,6 @@ $(TfmGroupDotNet) - $(War3NetCodeAnalysisDecompilersVersion) @@ -16,8 +15,8 @@ - - + + diff --git a/src/War3Net.CodeAnalysis.Jass/War3Net.CodeAnalysis.Jass.csproj b/src/War3Net.CodeAnalysis.Jass/War3Net.CodeAnalysis.Jass.csproj index b9190842..6395a902 100644 --- a/src/War3Net.CodeAnalysis.Jass/War3Net.CodeAnalysis.Jass.csproj +++ b/src/War3Net.CodeAnalysis.Jass/War3Net.CodeAnalysis.Jass.csproj @@ -2,7 +2,6 @@ $(TfmGroupDotNet) - $(War3NetCodeAnalysisJassVersion) @@ -16,8 +15,8 @@ - - + + diff --git a/src/War3Net.CodeAnalysis.Transpilers/War3Net.CodeAnalysis.Transpilers.csproj b/src/War3Net.CodeAnalysis.Transpilers/War3Net.CodeAnalysis.Transpilers.csproj index fa6cc06a..f884d8a2 100644 --- a/src/War3Net.CodeAnalysis.Transpilers/War3Net.CodeAnalysis.Transpilers.csproj +++ b/src/War3Net.CodeAnalysis.Transpilers/War3Net.CodeAnalysis.Transpilers.csproj @@ -2,7 +2,6 @@ $(TfmGroupDotNet) - $(War3NetCodeAnalysisTranspilersVersion) @@ -16,8 +15,8 @@ - - + + diff --git a/src/War3Net.CodeAnalysis.VJass/War3Net.CodeAnalysis.VJass.csproj b/src/War3Net.CodeAnalysis.VJass/War3Net.CodeAnalysis.VJass.csproj index 428e3ae2..8598861f 100644 --- a/src/War3Net.CodeAnalysis.VJass/War3Net.CodeAnalysis.VJass.csproj +++ b/src/War3Net.CodeAnalysis.VJass/War3Net.CodeAnalysis.VJass.csproj @@ -2,7 +2,6 @@ $(TfmGroupDotNet) - $(War3NetCodeAnalysisVJassVersion) @@ -16,8 +15,8 @@ - - + + diff --git a/src/War3Net.CodeAnalysis/War3Net.CodeAnalysis.csproj b/src/War3Net.CodeAnalysis/War3Net.CodeAnalysis.csproj index 4a884147..f45a03d1 100644 --- a/src/War3Net.CodeAnalysis/War3Net.CodeAnalysis.csproj +++ b/src/War3Net.CodeAnalysis/War3Net.CodeAnalysis.csproj @@ -2,7 +2,6 @@ $(TfmGroupDotNet) - $(War3NetCodeAnalysisVersion) @@ -11,7 +10,7 @@ - + diff --git a/src/War3Net.Common/War3Net.Common.csproj b/src/War3Net.Common/War3Net.Common.csproj index c30e831a..4b3802bd 100644 --- a/src/War3Net.Common/War3Net.Common.csproj +++ b/src/War3Net.Common/War3Net.Common.csproj @@ -2,7 +2,6 @@ $(TfmGroupDotNet) - $(War3NetCommonVersion) @@ -11,7 +10,7 @@ - + diff --git a/src/War3Net.Drawing.Blp/War3Net.Drawing.Blp.csproj b/src/War3Net.Drawing.Blp/War3Net.Drawing.Blp.csproj index 7d00c5a8..77f4da78 100644 --- a/src/War3Net.Drawing.Blp/War3Net.Drawing.Blp.csproj +++ b/src/War3Net.Drawing.Blp/War3Net.Drawing.Blp.csproj @@ -3,7 +3,6 @@ true $(TfmGroupDotNetWindows) - $(War3NetDrawingBlpVersion) @@ -16,7 +15,7 @@ - + @@ -24,7 +23,7 @@ - + diff --git a/src/War3Net.IO.Compression/War3Net.IO.Compression.csproj b/src/War3Net.IO.Compression/War3Net.IO.Compression.csproj index 0b9148b1..ba76c6c8 100644 --- a/src/War3Net.IO.Compression/War3Net.IO.Compression.csproj +++ b/src/War3Net.IO.Compression/War3Net.IO.Compression.csproj @@ -2,7 +2,6 @@ $(TfmGroupDotNet) - $(War3NetIOCompressionVersion) @@ -11,7 +10,7 @@ - + @@ -19,7 +18,7 @@ - + diff --git a/src/War3Net.IO.Mpq/War3Net.IO.Mpq.csproj b/src/War3Net.IO.Mpq/War3Net.IO.Mpq.csproj index 2f455fde..b8e0fdce 100644 --- a/src/War3Net.IO.Mpq/War3Net.IO.Mpq.csproj +++ b/src/War3Net.IO.Mpq/War3Net.IO.Mpq.csproj @@ -2,9 +2,8 @@ $(TfmGroupDotNet) - $(War3NetIOMpqVersion) - + Library for opening and creating files in MPQ format. mpq;warcraft3 @@ -15,7 +14,7 @@ - + diff --git a/src/War3Net.IO.Slk/War3Net.IO.Slk.csproj b/src/War3Net.IO.Slk/War3Net.IO.Slk.csproj index 1fd1ff49..d688b021 100644 --- a/src/War3Net.IO.Slk/War3Net.IO.Slk.csproj +++ b/src/War3Net.IO.Slk/War3Net.IO.Slk.csproj @@ -2,9 +2,8 @@ $(TfmGroupDotNet) - $(War3NetIOSlkVersion) - + Library for opening and creating files in SLK format. slk;warcraft3 @@ -15,7 +14,7 @@ - + diff --git a/src/War3Net.Modeling/War3Net.Modeling.csproj b/src/War3Net.Modeling/War3Net.Modeling.csproj index 6152c382..f0166725 100644 --- a/src/War3Net.Modeling/War3Net.Modeling.csproj +++ b/src/War3Net.Modeling/War3Net.Modeling.csproj @@ -2,9 +2,8 @@ $(TfmGroupDotNet) - $(War3NetModelingVersion) - + Library for handling Warcraft III models (.mdl and .mdx files). mdl;mdx;warcraft3 @@ -15,7 +14,7 @@ - + diff --git a/src/War3Net.Rendering/War3Net.Rendering.csproj b/src/War3Net.Rendering/War3Net.Rendering.csproj index d202b003..b4db244a 100644 --- a/src/War3Net.Rendering/War3Net.Rendering.csproj +++ b/src/War3Net.Rendering/War3Net.Rendering.csproj @@ -7,12 +7,12 @@ - - - - - - + + + + + + @@ -22,7 +22,7 @@ - + diff --git a/src/War3Net.Replay/War3Net.Replay.csproj b/src/War3Net.Replay/War3Net.Replay.csproj index bb693be8..28fb211a 100644 --- a/src/War3Net.Replay/War3Net.Replay.csproj +++ b/src/War3Net.Replay/War3Net.Replay.csproj @@ -5,8 +5,8 @@ - - + + @@ -14,7 +14,7 @@ - + diff --git a/src/War3Net.Runtime.Core/War3Net.Runtime.Core.csproj b/src/War3Net.Runtime.Core/War3Net.Runtime.Core.csproj index ae4868bf..598206b4 100644 --- a/src/War3Net.Runtime.Core/War3Net.Runtime.Core.csproj +++ b/src/War3Net.Runtime.Core/War3Net.Runtime.Core.csproj @@ -11,10 +11,10 @@ - - - - + + + + @@ -23,7 +23,7 @@ - + diff --git a/src/War3Net.Runtime/War3Net.Runtime.csproj b/src/War3Net.Runtime/War3Net.Runtime.csproj index d5a206d3..7f1e0324 100644 --- a/src/War3Net.Runtime/War3Net.Runtime.csproj +++ b/src/War3Net.Runtime/War3Net.Runtime.csproj @@ -6,7 +6,7 @@ - + diff --git a/submodules/Directory.Packages.props b/submodules/Directory.Packages.props new file mode 100644 index 00000000..8c119d54 --- /dev/null +++ b/submodules/Directory.Packages.props @@ -0,0 +1,2 @@ + + diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index 6d972627..3e682527 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -9,9 +9,9 @@ - - - + + + diff --git a/tests/War3Net.Build.Tests/War3Net.Build.Tests.csproj b/tests/War3Net.Build.Tests/War3Net.Build.Tests.csproj index aaedcb63..b0d4619f 100644 --- a/tests/War3Net.Build.Tests/War3Net.Build.Tests.csproj +++ b/tests/War3Net.Build.Tests/War3Net.Build.Tests.csproj @@ -10,8 +10,8 @@ - - + + diff --git a/tests/War3Net.CodeAnalysis.Decompilers.Tests/War3Net.CodeAnalysis.Decompilers.Tests.csproj b/tests/War3Net.CodeAnalysis.Decompilers.Tests/War3Net.CodeAnalysis.Decompilers.Tests.csproj index 76a11841..d5687730 100644 --- a/tests/War3Net.CodeAnalysis.Decompilers.Tests/War3Net.CodeAnalysis.Decompilers.Tests.csproj +++ b/tests/War3Net.CodeAnalysis.Decompilers.Tests/War3Net.CodeAnalysis.Decompilers.Tests.csproj @@ -10,8 +10,8 @@ - - + + diff --git a/tests/War3Net.CodeAnalysis.Transpilers.Tests/War3Net.CodeAnalysis.Transpilers.Tests.csproj b/tests/War3Net.CodeAnalysis.Transpilers.Tests/War3Net.CodeAnalysis.Transpilers.Tests.csproj index 654c2e4f..a0b3bdd4 100644 --- a/tests/War3Net.CodeAnalysis.Transpilers.Tests/War3Net.CodeAnalysis.Transpilers.Tests.csproj +++ b/tests/War3Net.CodeAnalysis.Transpilers.Tests/War3Net.CodeAnalysis.Transpilers.Tests.csproj @@ -9,7 +9,7 @@ - + diff --git a/tests/War3Net.CodeAnalysis.VJass.Tests/War3Net.CodeAnalysis.VJass.Tests.csproj b/tests/War3Net.CodeAnalysis.VJass.Tests/War3Net.CodeAnalysis.VJass.Tests.csproj index 02ab23a3..9e1fd838 100644 --- a/tests/War3Net.CodeAnalysis.VJass.Tests/War3Net.CodeAnalysis.VJass.Tests.csproj +++ b/tests/War3Net.CodeAnalysis.VJass.Tests/War3Net.CodeAnalysis.VJass.Tests.csproj @@ -9,7 +9,7 @@ - + diff --git a/tests/War3Net.Drawing.Blp.Tests/War3Net.Drawing.Blp.Tests.csproj b/tests/War3Net.Drawing.Blp.Tests/War3Net.Drawing.Blp.Tests.csproj index 9bdfd75f..44b00d84 100644 --- a/tests/War3Net.Drawing.Blp.Tests/War3Net.Drawing.Blp.Tests.csproj +++ b/tests/War3Net.Drawing.Blp.Tests/War3Net.Drawing.Blp.Tests.csproj @@ -6,7 +6,7 @@ - + @@ -14,7 +14,7 @@ - + diff --git a/tests/War3Net.Modeling.Tests/War3Net.Modeling.Tests.csproj b/tests/War3Net.Modeling.Tests/War3Net.Modeling.Tests.csproj index e092dbad..8985e8e0 100644 --- a/tests/War3Net.Modeling.Tests/War3Net.Modeling.Tests.csproj +++ b/tests/War3Net.Modeling.Tests/War3Net.Modeling.Tests.csproj @@ -11,8 +11,8 @@ - - + + diff --git a/tests/War3Net.Runtime.Core.Tests/War3Net.Runtime.Core.Tests.csproj b/tests/War3Net.Runtime.Core.Tests/War3Net.Runtime.Core.Tests.csproj index ef2c6245..be6db21f 100644 --- a/tests/War3Net.Runtime.Core.Tests/War3Net.Runtime.Core.Tests.csproj +++ b/tests/War3Net.Runtime.Core.Tests/War3Net.Runtime.Core.Tests.csproj @@ -13,7 +13,7 @@ - + diff --git a/tests/War3Net.TestTools.UnitTesting/War3Net.TestTools.UnitTesting.csproj b/tests/War3Net.TestTools.UnitTesting/War3Net.TestTools.UnitTesting.csproj index e3fbe427..7c515bf0 100644 --- a/tests/War3Net.TestTools.UnitTesting/War3Net.TestTools.UnitTesting.csproj +++ b/tests/War3Net.TestTools.UnitTesting/War3Net.TestTools.UnitTesting.csproj @@ -9,7 +9,7 @@ - +