diff --git a/eng/common/core-templates/job/source-build.yml b/eng/common/core-templates/job/source-build.yml index c4713c8b6ed..d47f09d58fd 100644 --- a/eng/common/core-templates/job/source-build.yml +++ b/eng/common/core-templates/job/source-build.yml @@ -26,6 +26,8 @@ parameters: # Specifies the build script to invoke to perform the build in the repo. The default # './build.sh' should work for typical Arcade repositories, but this is customizable for # difficult situations. + # buildArguments: '' + # Specifies additional build arguments to pass to the build script. # jobProperties: {} # A list of job properties to inject at the top level, for potential extensibility beyond # container and pool. diff --git a/eng/common/core-templates/job/source-index-stage1.yml b/eng/common/core-templates/job/source-index-stage1.yml index 205fb5b3a39..8b833332b3e 100644 --- a/eng/common/core-templates/job/source-index-stage1.yml +++ b/eng/common/core-templates/job/source-index-stage1.yml @@ -1,7 +1,7 @@ parameters: runAsPublic: false - sourceIndexUploadPackageVersion: 2.0.0-20240522.1 - sourceIndexProcessBinlogPackageVersion: 1.0.1-20240522.1 + sourceIndexUploadPackageVersion: 2.0.0-20250425.2 + sourceIndexProcessBinlogPackageVersion: 1.0.1-20250425.2 sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci" preSteps: [] diff --git a/eng/common/core-templates/steps/source-build.yml b/eng/common/core-templates/steps/source-build.yml index 2915d29bb7f..37133b55b75 100644 --- a/eng/common/core-templates/steps/source-build.yml +++ b/eng/common/core-templates/steps/source-build.yml @@ -79,6 +79,7 @@ steps: ${{ coalesce(parameters.platform.buildScript, './build.sh') }} --ci \ --configuration $buildConfig \ --restore --build --pack $publishArgs -bl \ + ${{ parameters.platform.buildArguments }} \ $officialBuildArgs \ $internalRuntimeDownloadArgs \ $internalRestoreArgs \ diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/AfterSourceBuild.proj b/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/AfterSourceBuild.proj index 6a1fd449dc3..fea978709a5 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/AfterSourceBuild.proj +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/AfterSourceBuild.proj @@ -7,6 +7,7 @@ $(NuGetPackageRoot)microsoft.dotnet.sourcebuild.tasks\$(MicrosoftDotNetSourceBuildTasksVersion)\build\ + true @@ -62,6 +63,7 @@ true diff --git a/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/SourceBuildArcadeTools.targets b/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/SourceBuildArcadeTools.targets index ed8e7dfe820..fedd7157a5b 100644 --- a/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/SourceBuildArcadeTools.targets +++ b/src/Microsoft.DotNet.Arcade.Sdk/tools/SourceBuild/SourceBuildArcadeTools.targets @@ -11,6 +11,10 @@ + + true + + @@ -45,11 +50,12 @@ - If building in DotNetBuild mode and we're in the inner repo and this is a source-only build --> + '$(DotNetBuildRepo)' == 'true'" /> diff --git a/src/Microsoft.DotNet.NuGetRepack/tasks/src/NuGetVersionUpdater.cs b/src/Microsoft.DotNet.NuGetRepack/tasks/src/NuGetVersionUpdater.cs index e2dc7c007f4..bd92f54d76d 100644 --- a/src/Microsoft.DotNet.NuGetRepack/tasks/src/NuGetVersionUpdater.cs +++ b/src/Microsoft.DotNet.NuGetRepack/tasks/src/NuGetVersionUpdater.cs @@ -240,7 +240,7 @@ private static void LoadPackages(IEnumerable packagePaths, Dictionary packages, throw new InvalidDataException($"Unexpected dependency version range: '{id}, {versionRangeAttribute.Value}'"); } + var dependencyVersion = versionRange.MinVersion ?? versionRange.MaxVersion; + var oldVersion = ToNuGetVersion(dependentPackage.OldVersion); + + if (dependencyVersion != oldVersion) + { + // The dependency version being referenced was not from + // this build so it does not need to be updated. + continue; + } + var newVersion = ToNuGetVersion(dependentPackage.NewVersion); var newRange = exactVersions ? @@ -356,7 +366,7 @@ private static void SavePackages(Dictionary packages, strin package.SpecificationXml.Save(package.SpecificationStream); package.Package.Close(); - + string finalPath = Path.Combine(outDirectory, package.Id + "." + package.NewVersion + ".nupkg"); try diff --git a/src/Microsoft.DotNet.NuGetRepack/tests/Microsoft.DotNet.NuGetRepack.Tests.csproj b/src/Microsoft.DotNet.NuGetRepack/tests/Microsoft.DotNet.NuGetRepack.Tests.csproj index 3eb2b0b7530..c202f2e3d6a 100644 --- a/src/Microsoft.DotNet.NuGetRepack/tests/Microsoft.DotNet.NuGetRepack.Tests.csproj +++ b/src/Microsoft.DotNet.NuGetRepack/tests/Microsoft.DotNet.NuGetRepack.Tests.csproj @@ -29,6 +29,9 @@ TestPackageF.1.0.0-beta.12345.1.nupkg + + TestPackageG.1.0.0-beta-12345-01.nupkg + TestPackageA.1.0.0-beta-final.nupkg @@ -47,6 +50,9 @@ TestPackageF.1.0.0-beta.final.nupkg + + TestPackageG.1.0.0-beta-final.nupkg + TestPackageA.1.0.0.nupkg @@ -65,6 +71,9 @@ TestPackageF.1.0.0.nupkg + + TestPackageG.1.0.0.nupkg + Signed.1.2.3.nupkg diff --git a/src/Microsoft.DotNet.NuGetRepack/tests/ReplacePackagePartsTests.cs b/src/Microsoft.DotNet.NuGetRepack/tests/ReplacePackagePartsTests.cs index c03085f75c2..028607aa751 100644 --- a/src/Microsoft.DotNet.NuGetRepack/tests/ReplacePackagePartsTests.cs +++ b/src/Microsoft.DotNet.NuGetRepack/tests/ReplacePackagePartsTests.cs @@ -12,7 +12,7 @@ namespace Microsoft.DotNet.Tools.Tests { public class ReplacePackagePartsTests { - [Fact(Skip = "https://github.com/dotnet/arcade/issues/3794")] + [Fact()] public static void ReplaceFile() { var dir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); diff --git a/src/Microsoft.DotNet.NuGetRepack/tests/Resources/TestPackageG.1.0.0-beta-12345-01.nupkg b/src/Microsoft.DotNet.NuGetRepack/tests/Resources/TestPackageG.1.0.0-beta-12345-01.nupkg new file mode 100644 index 00000000000..6b91e8ff943 Binary files /dev/null and b/src/Microsoft.DotNet.NuGetRepack/tests/Resources/TestPackageG.1.0.0-beta-12345-01.nupkg differ diff --git a/src/Microsoft.DotNet.NuGetRepack/tests/Resources/TestPackageG.1.0.0-beta-final.nupkg b/src/Microsoft.DotNet.NuGetRepack/tests/Resources/TestPackageG.1.0.0-beta-final.nupkg new file mode 100644 index 00000000000..058ec8927ea Binary files /dev/null and b/src/Microsoft.DotNet.NuGetRepack/tests/Resources/TestPackageG.1.0.0-beta-final.nupkg differ diff --git a/src/Microsoft.DotNet.NuGetRepack/tests/Resources/TestPackageG.1.0.0.nupkg b/src/Microsoft.DotNet.NuGetRepack/tests/Resources/TestPackageG.1.0.0.nupkg new file mode 100644 index 00000000000..9649e2aad78 Binary files /dev/null and b/src/Microsoft.DotNet.NuGetRepack/tests/Resources/TestPackageG.1.0.0.nupkg differ diff --git a/src/Microsoft.DotNet.NuGetRepack/tests/Resources/TestPackageG.nuspec b/src/Microsoft.DotNet.NuGetRepack/tests/Resources/TestPackageG.nuspec new file mode 100644 index 00000000000..cda5c56f403 --- /dev/null +++ b/src/Microsoft.DotNet.NuGetRepack/tests/Resources/TestPackageG.nuspec @@ -0,0 +1,23 @@ + + + + TestPackageG + 1.0.0-beta-12345-01 + Microsoft + Microsoft + false + G + + + + + + + + + + + + + + diff --git a/src/Microsoft.DotNet.NuGetRepack/tests/TestHelpers/TestResources.cs b/src/Microsoft.DotNet.NuGetRepack/tests/TestHelpers/TestResources.cs index 82ef8e8fe9d..5f6aa2d08da 100644 --- a/src/Microsoft.DotNet.NuGetRepack/tests/TestHelpers/TestResources.cs +++ b/src/Microsoft.DotNet.NuGetRepack/tests/TestHelpers/TestResources.cs @@ -30,6 +30,10 @@ public static class ReleasePackages private static byte[] s_F; public static byte[] TestPackageF => ResourceLoader.GetOrCreateResource(ref s_F, NameF); public const string NameF = nameof(TestPackageF) + "." + Version + ".nupkg"; + + private static byte[] s_G; + public static byte[] TestPackageG => ResourceLoader.GetOrCreateResource(ref s_G, NameG); + public const string NameG = nameof(TestPackageG) + "." + Version + ".nupkg"; } public static class PreReleasePackages @@ -60,6 +64,10 @@ public static class PreReleasePackages private static byte[] s_F; public static byte[] TestPackageF => ResourceLoader.GetOrCreateResource(ref s_F, NameF); public const string NameF = nameof(TestPackageF) + "." + SemVer2 + ".nupkg"; + + private static byte[] s_G; + public static byte[] TestPackageG => ResourceLoader.GetOrCreateResource(ref s_G, NameG); + public const string NameG = nameof(TestPackageG) + "." + SemVer1 + ".nupkg"; } public static class DailyBuildPackages @@ -90,6 +98,10 @@ public static class DailyBuildPackages private static byte[] s_F; public static byte[] TestPackageF => ResourceLoader.GetOrCreateResource(ref s_F, NameF); public const string NameF = nameof(TestPackageF) + "." + SemVer2 + ".nupkg"; + + private static byte[] s_G; + public static byte[] TestPackageG => ResourceLoader.GetOrCreateResource(ref s_G, NameG); + public const string NameG = nameof(TestPackageG) + "." + SemVer1 + ".nupkg"; } public static class MiscPackages diff --git a/src/Microsoft.DotNet.NuGetRepack/tests/VersionUpdaterTests.cs b/src/Microsoft.DotNet.NuGetRepack/tests/VersionUpdaterTests.cs index 900c55775a1..d4d76da2883 100644 --- a/src/Microsoft.DotNet.NuGetRepack/tests/VersionUpdaterTests.cs +++ b/src/Microsoft.DotNet.NuGetRepack/tests/VersionUpdaterTests.cs @@ -52,46 +52,51 @@ private static void AssertPackagesEqual(byte[] expected, byte[] actual) // change to match the platform that is executing. The reference packages that we use to validate // the SemVer tests were built on Windows which makes these test only valid for Windows. // - // This can be removed when https://github.com/dotnet/corefx/issues/39931 is fixed. - [WindowsOnlyFact(Skip = "https://github.com/dotnet/arcade/issues/3794")] + // This can be removed when https://github.com/dotnet/corefx/issues/39931 is fixed. + [WindowsOnlyFact()] public void TestPackagesSemVer1() { var dir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); Directory.CreateDirectory(dir); - string a_daily, b_daily, c_daily, d_daily; + string a_daily, b_daily, c_daily, d_daily, g_daily; File.WriteAllBytes(a_daily = Path.Combine(dir, TestResources.DailyBuildPackages.NameA), TestResources.DailyBuildPackages.TestPackageA); File.WriteAllBytes(b_daily = Path.Combine(dir, TestResources.DailyBuildPackages.NameB), TestResources.DailyBuildPackages.TestPackageB); File.WriteAllBytes(c_daily = Path.Combine(dir, TestResources.DailyBuildPackages.NameC), TestResources.DailyBuildPackages.TestPackageC); File.WriteAllBytes(d_daily = Path.Combine(dir, TestResources.DailyBuildPackages.NameD), TestResources.DailyBuildPackages.TestPackageD); + File.WriteAllBytes(g_daily = Path.Combine(dir, TestResources.DailyBuildPackages.NameG), TestResources.DailyBuildPackages.TestPackageG); var a_pre = Path.Combine(dir, TestResources.PreReleasePackages.NameA); var b_pre = Path.Combine(dir, TestResources.PreReleasePackages.NameB); var c_pre = Path.Combine(dir, TestResources.PreReleasePackages.NameC); var d_pre = Path.Combine(dir, TestResources.PreReleasePackages.NameD); + var g_pre = Path.Combine(dir, TestResources.PreReleasePackages.NameG); var a_rel = Path.Combine(dir, TestResources.ReleasePackages.NameA); var b_rel = Path.Combine(dir, TestResources.ReleasePackages.NameB); var c_rel = Path.Combine(dir, TestResources.ReleasePackages.NameC); var d_rel = Path.Combine(dir, TestResources.ReleasePackages.NameD); + var g_rel = Path.Combine(dir, TestResources.ReleasePackages.NameG); - NuGetVersionUpdater.Run(new[] { a_daily, b_daily, c_daily, d_daily }, dir, VersionTranslation.Release, exactVersions: false); - NuGetVersionUpdater.Run(new[] { a_daily, b_daily, c_daily, d_daily }, dir, VersionTranslation.PreRelease, exactVersions: false); + NuGetVersionUpdater.Run(new[] { a_daily, b_daily, c_daily, d_daily, g_daily }, dir, VersionTranslation.Release, exactVersions: false); + NuGetVersionUpdater.Run(new[] { a_daily, b_daily, c_daily, d_daily, g_daily }, dir, VersionTranslation.PreRelease, exactVersions: false); AssertPackagesEqual(TestResources.ReleasePackages.TestPackageA, File.ReadAllBytes(a_rel)); AssertPackagesEqual(TestResources.ReleasePackages.TestPackageB, File.ReadAllBytes(b_rel)); AssertPackagesEqual(TestResources.ReleasePackages.TestPackageC, File.ReadAllBytes(c_rel)); AssertPackagesEqual(TestResources.ReleasePackages.TestPackageD, File.ReadAllBytes(d_rel)); + AssertPackagesEqual(TestResources.ReleasePackages.TestPackageG, File.ReadAllBytes(g_rel)); AssertPackagesEqual(TestResources.PreReleasePackages.TestPackageA, File.ReadAllBytes(a_pre)); AssertPackagesEqual(TestResources.PreReleasePackages.TestPackageB, File.ReadAllBytes(b_pre)); AssertPackagesEqual(TestResources.PreReleasePackages.TestPackageC, File.ReadAllBytes(c_pre)); AssertPackagesEqual(TestResources.PreReleasePackages.TestPackageD, File.ReadAllBytes(d_pre)); + AssertPackagesEqual(TestResources.PreReleasePackages.TestPackageG, File.ReadAllBytes(g_pre)); Directory.Delete(dir, recursive: true); } - [WindowsOnlyFact(Skip = "https://github.com/dotnet/arcade/issues/3794")] + [WindowsOnlyFact()] public void TestPackagesSemVer2() { var dir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); @@ -119,7 +124,7 @@ public void TestPackagesSemVer2() Directory.Delete(dir, recursive: true); } - [WindowsOnlyFact(Skip = "https://github.com/dotnet/arcade/issues/3794")] + [WindowsOnlyFact()] public void TestValidation() { var dir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); @@ -158,7 +163,7 @@ public void TestValidation() Directory.Delete(dir, recursive: true); } - [WindowsOnlyFact(Skip = "https://github.com/dotnet/arcade/issues/3794")] + [WindowsOnlyFact()] public void TestDotnetToolValidation() { var dir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());