From cc5c6cde29016351996ab83e433bcf8e23a3e2a9 Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Thu, 31 Oct 2024 10:46:27 -0500 Subject: [PATCH] Update IKVM version. --- global.json | 2 +- .../MavenReferenceItemPrepareTests.cs | 1 - .../MavenReferenceItemResolveTests.cs | 32 +++++++++++++++++++ .../IKVM.Maven.Sdk.Tasks.csproj | 2 +- src/IKVM.Maven.Sdk/IKVM.Maven.Sdk.csproj | 2 +- 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/global.json b/global.json index 9496ce5..d8b0ee2 100644 --- a/global.json +++ b/global.json @@ -4,6 +4,6 @@ "rollForward": "latestFeature" }, "msbuild-sdks": { - "IKVM.NET.Sdk": "8.10.1" + "IKVM.NET.Sdk": "8.10.3" } } diff --git a/src/IKVM.Maven.Sdk.Tasks.Tests/MavenReferenceItemPrepareTests.cs b/src/IKVM.Maven.Sdk.Tasks.Tests/MavenReferenceItemPrepareTests.cs index b0acd2e..79a3ee1 100644 --- a/src/IKVM.Maven.Sdk.Tasks.Tests/MavenReferenceItemPrepareTests.cs +++ b/src/IKVM.Maven.Sdk.Tasks.Tests/MavenReferenceItemPrepareTests.cs @@ -161,7 +161,6 @@ public void ShouldNotRemoveDuplicateDependencies() i2.GetMetadata(MavenReferenceItemMetadata.ArtifactId).Should().Be("foo"); i2.GetMetadata(MavenReferenceItemMetadata.Version).Should().Be("1.0"); i2.GetMetadata(MavenReferenceItemMetadata.Classifier).Should().Be("cls"); - } } diff --git a/src/IKVM.Maven.Sdk.Tasks.Tests/MavenReferenceItemResolveTests.cs b/src/IKVM.Maven.Sdk.Tasks.Tests/MavenReferenceItemResolveTests.cs index 71606eb..70f2e02 100644 --- a/src/IKVM.Maven.Sdk.Tasks.Tests/MavenReferenceItemResolveTests.cs +++ b/src/IKVM.Maven.Sdk.Tasks.Tests/MavenReferenceItemResolveTests.cs @@ -550,6 +550,38 @@ public void CanResolveCircularDependency() pkg2.GetMetadata("References").Split(';').Should().NotContain("maven$org.apache.commons:commons-text:1.11.0"); } + [TestMethod] + public void CanResolveCircularDependency2() + { + var cacheFile = Path.GetTempFileName(); + + var engine = new Mock(); + var errors = new List(); + engine.Setup(x => x.LogErrorEvent(It.IsAny())).Callback((BuildErrorEventArgs e) => { errors.Add(e); TestContext.WriteLine("ERROR: " + e.Message); }); + engine.Setup(x => x.LogWarningEvent(It.IsAny())).Callback((BuildWarningEventArgs e) => TestContext.WriteLine("WARNING: " + e.Message)); + engine.Setup(x => x.LogMessageEvent(It.IsAny())).Callback((BuildMessageEventArgs e) => TestContext.WriteLine(e.Message)); + var t = new MavenReferenceItemResolve(); + t.BuildEngine = engine.Object; + t.CacheFile = cacheFile; + t.Repositories = new[] { GetCentralRepositoryItem() }; + + var i1 = new TaskItem("org.openrewrite:rewrite-java-8:8.35.0"); + i1.SetMetadata(MavenReferenceItemMetadata.GroupId, "org.openrewrite"); + i1.SetMetadata(MavenReferenceItemMetadata.ArtifactId, "rewrite-java-8"); + i1.SetMetadata(MavenReferenceItemMetadata.Version, "8.35.0"); + i1.SetMetadata(MavenReferenceItemMetadata.Scope, "compile"); + t.References = new[] { i1 }; + + t.Execute().Should().BeTrue(); + errors.Should().BeEmpty(); + var pkg1 = t.ResolvedReferences.First(i => i.ItemSpec == "maven$org.apache.commons:commons-text:1.11.0"); + pkg1.GetMetadata("References").Split(';').Should().Contain("maven$org.apache.commons:commons-lang3:3.13.0"); + var pkg2 = t.ResolvedReferences.First(i => i.ItemSpec == "maven$org.apache.commons:commons-lang3:3.13.0"); + + // we break the circle so we can actually build them + pkg2.GetMetadata("References").Split(';').Should().NotContain("maven$org.apache.commons:commons-text:1.11.0"); + } + [TestMethod] public void CanResolveFromLocalRepository() { diff --git a/src/IKVM.Maven.Sdk.Tasks/IKVM.Maven.Sdk.Tasks.csproj b/src/IKVM.Maven.Sdk.Tasks/IKVM.Maven.Sdk.Tasks.csproj index e75ab52..e6e3afb 100644 --- a/src/IKVM.Maven.Sdk.Tasks/IKVM.Maven.Sdk.Tasks.csproj +++ b/src/IKVM.Maven.Sdk.Tasks/IKVM.Maven.Sdk.Tasks.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/IKVM.Maven.Sdk/IKVM.Maven.Sdk.csproj b/src/IKVM.Maven.Sdk/IKVM.Maven.Sdk.csproj index d1c8363..7779cb4 100644 --- a/src/IKVM.Maven.Sdk/IKVM.Maven.Sdk.csproj +++ b/src/IKVM.Maven.Sdk/IKVM.Maven.Sdk.csproj @@ -20,7 +20,7 @@ - +