Skip to content

Commit

Permalink
Merge branch 'release/1.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
wasabii committed Feb 7, 2023
2 parents f21b23b + 2a58461 commit 1f01e1f
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 50 deletions.
10 changes: 5 additions & 5 deletions src/IKVM.Maven.Sdk.Tasks.Tests/IKVM.Maven.Sdk.Tasks.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.8.0" />
<PackageReference Include="Microsoft.CodeCoverage" Version="17.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="FluentAssertions" Version="6.9.0" />
<PackageReference Include="Microsoft.CodeCoverage" Version="17.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
<PackageReference Include="Microsoft.Build" Version="16.9.0" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="16.9.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,53 +54,60 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist
void ReadAliases(JObject json, JsonSerializer serializer, DefaultDependencyNode node)
{
var l = new java.util.ArrayList();
foreach (var i in json["aliases"].ToObject<DefaultArtifact[]>(serializer))
l.add(i);

if (json["aliases"] is JArray a)
foreach (var i in a.ToObject<DefaultArtifact[]>(serializer))
l.add(i);

node.setAliases(l);
}

void ReadChildren(JObject json, JsonSerializer serializer, DefaultDependencyNode node)
{
var l = new java.util.ArrayList();
foreach (var i in json["children"].ToObject<DefaultDependencyNode[]>(serializer))
l.add(i);

if (json["children"] is JArray a)
foreach (var i in a.ToObject<DefaultDependencyNode[]>(serializer))
l.add(i);

node.setChildren(l);
}

void ReadData(JObject json, JsonSerializer serializer, DefaultDependencyNode node)
{
if (json["data"] is not JArray a)
return;

foreach (var o in a)
if (o is JObject i)
node.setData(i["key"].ToObject<object>(serializer), i["value"].ToObject<object>(serializer));
if (json["data"] is JArray a)
foreach (var o in a)
if (o is JObject i)
node.setData(i["key"].ToObject<object>(serializer), i["value"].ToObject<object>(serializer));
}

void ReadManagedBits(JObject json, JsonSerializer serializer, DefaultDependencyNode node)
{
node.setManagedBits(json["managedBits"].Value<int>());
if (json["managedBits"] is JValue v && v.Type == JTokenType.Integer)
node.setManagedBits((int)v);
}

void ReadRepositories(JObject json, JsonSerializer serializer, DefaultDependencyNode node)
{
var l = new java.util.ArrayList();
foreach (var i in json["repositories"].ToObject<RemoteRepository[]>(serializer))
l.add(i);

if (json["repositories"] is JArray a)
foreach (var i in a.ToObject<RemoteRepository[]>(serializer))
l.add(i);

node.setRepositories(l);
}

void ReadVersion(JObject json, JsonSerializer serializer, DefaultDependencyNode node)
{
node.setVersion(json["version"].ToObject<org.eclipse.aether.version.Version>(serializer));
if (json["version"] is JToken v)
node.setVersion(v.ToObject<org.eclipse.aether.version.Version>(serializer));
}

void ReadVersionConstraint(JObject json, JsonSerializer serializer, DefaultDependencyNode node)
{
node.setVersionConstraint(json["versionConstraint"].ToObject<org.eclipse.aether.version.VersionConstraint>(serializer));
if (json["versionConstraint"] is JToken t)
node.setVersionConstraint(t.ToObject<org.eclipse.aether.version.VersionConstraint>(serializer));
}

public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
Expand Down
22 changes: 15 additions & 7 deletions src/IKVM.Maven.Sdk.Tasks/Aether/VersionConstraintJsonConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,39 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist

public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
var o = value as org.eclipse.aether.version.VersionConstraint;
if (o == null)
// type must be a VersionConstrant
if (value is not org.eclipse.aether.version.VersionConstraint o)
{
writer.WriteNull();
return;
}

// constraint can be a Version
if (o.getVersion() is org.eclipse.aether.version.Version c)
{
writer.WriteValue(c.toString());
else if (o.getRange() is org.eclipse.aether.version.VersionRange r)
return;
}

// constraint can be a VersionRange
if (o.getRange() is org.eclipse.aether.version.VersionRange r)
{
var l = r.getLowerBound();
var u = r.getUpperBound();
var s = new StringBuilder();
if (l != null)
s.Append(l.isInclusive() ? "[" : "(").Append(l.getVersion().toString());
if (l != null || r != null)
if (l != null || u != null)
s.Append(",");
if (r != null)
if (u != null)
s.Append(u.getVersion().toString()).Append(u.isInclusive() ? "]" : ")");

writer.WriteValue(s.ToString());
return;
}
else
writer.WriteNull();

// fallback
writer.WriteNull();
}

}
Expand Down
4 changes: 0 additions & 4 deletions src/IKVM.Maven.Sdk.Tasks/IKVM.Maven.Sdk.Tasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@

<ItemGroup>
<PackageReference Include="IKVM" Version="8.4.4" />
<PackageReference Include="IKVM.Core.MSBuild" Version="0.1.27">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Build" Version="16.9.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="16.9.0" PrivateAssets="All" />
<PackageReference Include="NuGet.Common" Version="6.2.1" />
Expand Down
10 changes: 5 additions & 5 deletions src/IKVM.Maven.Sdk.Tests/IKVM.Maven.Sdk.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.8.0" />
<PackageReference Include="FluentAssertions" Version="6.9.0" />
<PackageReference Include="Buildalyzer" Version="4.1.4" />
<PackageReference Include="Microsoft.CodeCoverage" Version="17.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="Microsoft.CodeCoverage" Version="17.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 0 additions & 7 deletions src/dist-nuget/dist-nuget.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="IKVM.Core.MSBuild" Version="0.1.27">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<PackageProjectReference Include="..\IKVM.Maven.Sdk\IKVM.Maven.Sdk.csproj">
<PackageTargetPath>.</PackageTargetPath>
Expand Down
7 changes: 0 additions & 7 deletions src/dist-tests/dist-tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="IKVM.Core.MSBuild" Version="0.1.27">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<TestTarget Include="IKVM.Maven.Sdk.Tasks.Tests|net48" ProjectName="IKVM.Maven.Sdk.Tasks.Tests" TargetFramework="net48" />
<TestTarget Include="IKVM.Maven.Sdk.Tasks.Tests|netcoreapp3.1" ProjectName="IKVM.Maven.Sdk.Tasks.Tests" TargetFramework="netcoreapp3.1" />
Expand Down

0 comments on commit 1f01e1f

Please sign in to comment.