Skip to content

Commit

Permalink
Merge branch 'hotfix/8.5.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
wasabii committed Jun 2, 2023
2 parents 72775a3 + eb8eb07 commit e48c511
Show file tree
Hide file tree
Showing 62 changed files with 1,086 additions and 773 deletions.
37 changes: 14 additions & 23 deletions .github/workflows/IKVM.yml
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ jobs:
run:
- IKVM.ByteCode.Tests
- IKVM.Tests
- IKVM.Java.Tests
- IKVM.Tools.Importer.Tests
- IKVM.Tools.Exporter.Tests
- IKVM.Tools.Tests
Expand All @@ -304,6 +305,8 @@ jobs:
exclude:
- tfm: net461
sys: linux
- run: IKVM.Tests.Java
tfm: net6.0
- run: IKVM.Tools.Exporter.Tests
tfm: net6.0
- run: IKVM.Tools.Importer.Tests
Expand Down Expand Up @@ -362,34 +365,26 @@ jobs:
if: runner.os == 'Windows'
shell: pwsh
run: |
$dir="C:\work"
$dir="C:\w"
mkdir $dir
mkdir $dir\temp
mkdir $dir\dotnet
mkdir $dir\nuget
mkdir $dir\nuget\packages
mkdir $dir\ikvm
mkdir $dir\ikvm\dist
Add-Content $env:GITHUB_ENV "`nIKVMPATH=$dir\ikvm"
Add-Content $env:GITHUB_ENV "`nTMP=$dir\temp`nTEMP=$dir\temp`nTMPDIR=$dir\temp"
Add-Content $env:GITHUB_ENV "`nDOTNET_INSTALL_DIR=$dir\dotnet"
Add-Content $env:GITHUB_ENV "`nNUGET_PACKAGES=$dir\nuget\packages"
- name: Set Paths (Linux)
if: runner.os == 'Linux'
shell: pwsh
run: |
$dir="${{ runner.temp }}/work"
$dir="${{ runner.temp }}/w"
mkdir $dir
mkdir $dir/temp
mkdir $dir/dotnet
mkdir $dir/nuget
mkdir $dir/nuget/packages
mkdir $dir/ikvm
mkdir $dir/ikvm/dist
Add-Content $env:GITHUB_ENV "`nIKVMPATH=$dir/ikvm"
Add-Content $env:GITHUB_ENV "`nTMP=$dir/temp`nTEMP=$dir/temp`nTMPDIR=$dir/temp"
Add-Content $env:GITHUB_ENV "`nDOTNET_INSTALL_DIR=$dir/dotnet"
Add-Content $env:GITHUB_ENV "`nNUGET_PACKAGES=$dir/nuget/packages"
- name: Setup .NET 3.1
uses: actions/setup-dotnet@v3
with:
Expand All @@ -409,14 +404,14 @@ jobs:
uses: actions/download-artifact@v3
with:
name: tests
path: ${{ env.IKVMPATH }}/dist
path: ${{ env.IKVMPATH }}
- name: Restore Tests
run: tar xzvf tests.tar.gz
working-directory: ${{ env.IKVMPATH }}/dist
working-directory: ${{ env.IKVMPATH }}
- name: Delete Tests
shell: pwsh
run: ri tests.tar.gz
working-directory: ${{ env.IKVMPATH }}/dist
working-directory: ${{ env.IKVMPATH }}
- name: Execute Tests
timeout-minutes: 120
shell: pwsh
Expand Down Expand Up @@ -448,13 +443,17 @@ jobs:
dotnet test -f $tfm --blame -v 2 --results-directory "TestResults" --logger:"console;verbosity=detailed" --logger:trx --collect "Code Coverage" $tests
}
}
working-directory: ${{ env.IKVMPATH }}/dist
working-directory: ${{ env.IKVMPATH }}
- name: Archive Test Results
if: always() && startsWith(env.RET, 'TestResults--')
run: tar czvf ${{ env.TMPDIR }}/TestResults.tar.gz TestResults
working-directory: ${{ env.IKVMPATH }}
- name: Upload Test Results
if: always() && startsWith(env.RET, 'TestResults--')
uses: actions/upload-artifact@v3
with:
name: ${{ env.RET }}
path: ${{ env.IKVMPATH }}/dist/TestResults
path: ${{ env.TMPDIR }}/TestResults.tar.gz
release:
name: Release
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/hotfix/')
Expand Down Expand Up @@ -538,14 +537,6 @@ jobs:
env:
GITHUB_REPOS: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push NuGet (Azure DevOps)
shell: pwsh
run: |
dotnet nuget add source $env:AZUREDEVOPS_REPOS --name az --username az --password $env:AZUREDEVOPS_TOKEN --store-password-in-clear-text
dotnet nuget push dist/nuget/*.nupkg --source az --api-key az --skip-duplicate --no-symbols
env:
AZUREDEVOPS_REPOS: https://pkgs.dev.azure.com/ikvm-revived/ikvm/_packaging/ikvm-ci/nuget/v3/index.json
AZUREDEVOPS_TOKEN: ${{ secrets.AZUREDEVOPS_PAT }}
- name: Push NuGet
if: github.ref == 'refs/heads/main' || github.event.head_commit.message == '+push'
shell: pwsh
Expand Down
1 change: 1 addition & 0 deletions IKVM.deps.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<ItemGroup>
<PackageReference Include="Mono.Unix" Version="7.1.0-final.1.21458.1" GeneratePathProperty="true" />
<PackageReference Include="Mono.Posix" Version="7.1.0-final.1.21458.1" GeneratePathProperty="true" />
<PackageReference Include="System.IO.Pipelines" Version="6.0.3" />
<PackageReference Include="System.Memory" Version="4.5.5" />
</ItemGroup>

Expand Down
12 changes: 6 additions & 6 deletions IKVM.sln
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IKVM.Tools.Importer", "src\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IKVM.Tools.Importer.Tests", "src\IKVM.Tools.Importer.Tests\IKVM.Tools.Importer.Tests.csproj", "{6C942D7C-654A-4CBE-B3A9-887A37D2FA4C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IKVM.Tests.Java", "src\IKVM.Tests.Java\IKVM.Tests.Java.msbuildproj", "{87CB99AE-16D1-4D58-BEAC-72485E02B321}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IKVM.ByteCode.Tests", "src\IKVM.ByteCode.Tests\IKVM.ByteCode.Tests.csproj", "{60E804E4-B25B-4C9A-A3E6-F83D618CFD26}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IKVM.Java.Tests", "src\IKVM.Java.Tests\IKVM.Java.Tests.msbuildproj", "{B1B3F6B2-8A32-4C49-A9D2-154CD084CD9D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -605,14 +605,14 @@ Global
{6C942D7C-654A-4CBE-B3A9-887A37D2FA4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6C942D7C-654A-4CBE-B3A9-887A37D2FA4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6C942D7C-654A-4CBE-B3A9-887A37D2FA4C}.Release|Any CPU.Build.0 = Release|Any CPU
{87CB99AE-16D1-4D58-BEAC-72485E02B321}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{87CB99AE-16D1-4D58-BEAC-72485E02B321}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87CB99AE-16D1-4D58-BEAC-72485E02B321}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87CB99AE-16D1-4D58-BEAC-72485E02B321}.Release|Any CPU.Build.0 = Release|Any CPU
{60E804E4-B25B-4C9A-A3E6-F83D618CFD26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{60E804E4-B25B-4C9A-A3E6-F83D618CFD26}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60E804E4-B25B-4C9A-A3E6-F83D618CFD26}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60E804E4-B25B-4C9A-A3E6-F83D618CFD26}.Release|Any CPU.Build.0 = Release|Any CPU
{B1B3F6B2-8A32-4C49-A9D2-154CD084CD9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B1B3F6B2-8A32-4C49-A9D2-154CD084CD9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1B3F6B2-8A32-4C49-A9D2-154CD084CD9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B1B3F6B2-8A32-4C49-A9D2-154CD084CD9D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ IKVM includes build-time support for translating Java libraries to .NET assembli
</ItemGroup>

<ItemGroup>
<IkvmReference Include="..\..\ext\helloworld-2.0.jar" />
<IkvmReference Include="..\..\ext\helloworld\helloworld-2.0.jar" />
</ItemGroup>
```

Expand All @@ -102,7 +102,7 @@ The output assembly will be generated as part of your project's build process an

```xml
<ItemGroup>
<IkvmReference Include="..\..\ext\helloworld-2.0.jar">
<IkvmReference Include="..\..\ext\helloworld\helloworld-2.0.jar">
<AssemblyName>MyAssembly</AssemblyName>
<AssemblyVersion>3.2.1.0</AssemblyVersion>
<AssemblyFileVersion>3.0.0.0</AssemblyFileVersion>
Expand Down
File renamed without changes.
File renamed without changes.
36 changes: 20 additions & 16 deletions src/IKVM.JTReg.TestAdapter.Core/JTRegTestManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,6 @@ public class JTRegTestManager

static readonly MD5 md5 = MD5.Create();

/// <summary>
/// Computes the hash of the value.
/// </summary>
/// <param name="buffer"></param>
/// <returns></returns>
static byte[] ComputeHash(byte[] buffer)
{
lock (md5)
return md5.ComputeHash(buffer);
}

/// <summary>
/// Initializes the static instance.
/// </summary>
Expand Down Expand Up @@ -82,10 +71,22 @@ static JTRegTestManager()
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
protected static string GetSourceHash(string source)
protected static string GetSourceId(string source)
{
// allows a lock around the MD5 instance
byte[] ComputeHash(byte[] buffer)
{
lock (md5)
{
var b = new byte[8];
var h = md5.ComputeHash(buffer);
Array.Copy(h, b, 8);
return b;
}
}

var b = ComputeHash(Encoding.UTF8.GetBytes(source));
var s = new StringBuilder(32);
var s = new StringBuilder(16);
for (int i = 0; i < b.Length; i++)
s.Append(b[i].ToString("x2"));
return s.ToString();
Expand Down Expand Up @@ -182,11 +183,11 @@ public void DiscoverTests(string source, IJTRegDiscoveryContext context, Cancell
return;

// output path for jtreg state
var id = GetSourceHash(source);
var id = GetSourceId(source);
var baseDir = Path.Combine(Path.GetTempPath(), BASEDIR_PREFIX + id);

// attempt to create a temporary directory as scratch space for this test
context.SendMessage(JTRegTestMessageLevel.Informational, $"JTReg: Using run directory: {baseDir}");
context.SendMessage(JTRegTestMessageLevel.Informational, $"JTReg: Using discover directory: {baseDir}");
Directory.CreateDirectory(baseDir);

// output to framework
Expand Down Expand Up @@ -293,8 +294,11 @@ internal void RunTestForSource(string source, IJTRegExecutionContext context, Li
return;

// output path for jtreg state
var id = GetSourceHash(source);
var id = GetSourceId(source);
var baseDir = Path.Combine(context.TestRunDirectory, BASEDIR_PREFIX + id);

// attempt to create a temporary directory as scratch space for this test
context.SendMessage(JTRegTestMessageLevel.Informational, $"JTReg: Using run directory: {baseDir}");
Directory.CreateDirectory(baseDir);

// output to framework
Expand Down
9 changes: 8 additions & 1 deletion src/IKVM.Java-ref/java/lang/Class.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
namespace java.lang
using System;

namespace java.lang
{

public class Class
{

public Class(Type type)
{

}

}

}
12 changes: 12 additions & 0 deletions src/IKVM.Java.Extensions/java/util/IteratorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ public static List<T> RemainingToList<T>(this Iterator iterator)
return l;
}

/// <summary>
/// Returns an enumerable that iterators over the items in an iterator.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="iterator"></param>
/// <returns></returns>
public static IEnumerable<T> RemainingToEnumerable<T>(this Iterator iterator)
{
while (iterator.hasNext())
yield return (T)iterator.next();
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
<ItemGroup>
<ProjectReference Include="..\IKVM.Image\IKVM.Image.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="java\lang\" />
</ItemGroup>

<Import Project="$(MSBuildThisFileDirectory)..\IKVM.NET.Sdk\Sdk\Sdk.targets" />
<Import Project="$(MSBuildThisFileDirectory)..\IKVM\buildTransitive\netstandard2.0\IKVM.targets" />
Expand Down
48 changes: 48 additions & 0 deletions src/IKVM.Java.Tests/java/util/concurrent/ForkJoinPoolTests.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package ikvm.tests.java.java.util.concurrent;

import java.lang.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;

@cli.Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute.Annotation()
public class ForkJoinPoolTests {

class RecursiveActionTestTask extends RecursiveAction {

private int range;
private AtomicInteger count;

public RecursiveActionTestTask(int range, AtomicInteger count) {
this.range = range;
this.count = count;
}

protected void compute() {
if (this.range > 1) {
RecursiveActionTestTask t1 = new RecursiveActionTestTask(this.range / 2, count);
t1.fork();
RecursiveActionTestTask t2 = new RecursiveActionTestTask(this.range / 2, count);
t2.fork();

t1.join();
t2.join();
} else {
count.incrementAndGet();
}
}

}

@cli.Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute.Annotation()
public void canExecuteRecursiveAction() throws Exception {
ForkJoinPool p = ForkJoinPool.commonPool();
AtomicInteger c = new AtomicInteger();
RecursiveActionTestTask t = new RecursiveActionTestTask(1024 * 1024, c);
p.invoke(t);
if (c.get() != 1024 * 1024) {
throw new Exception();
}
}

}
22 changes: 0 additions & 22 deletions src/IKVM.Java/local/ikvm/runtime/Launcher.java

This file was deleted.

Loading

0 comments on commit e48c511

Please sign in to comment.