Skip to content

Commit

Permalink
Merge main.
Browse files Browse the repository at this point in the history
  • Loading branch information
wasabii committed Oct 30, 2024
2 parents 84f0382 + d45bebd commit ae654eb
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 44 deletions.
3 changes: 1 addition & 2 deletions IKVM.deps.targets
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project>

<ItemGroup>
<PackageReference Include="IKVM.ByteCode" Version="9.1.3" />
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" GeneratePathProperty="true" />
<PackageReference Include="System.Reflection.Metadata" Version="8.0.0" GeneratePathProperty="true" />
<PackageReference Include="System.Text.Json" Version="8.0.5" GeneratePathProperty="true" />
<PackageReference Include="IKVM.ByteCode" Version="9.2.2" />
</ItemGroup>

<Choose>
Expand All @@ -14,7 +14,6 @@
<Reference Include="System.IO.Compression" />
<Reference Include="System.Security" />
<PackageReference Include="System.Buffers" Version="4.5.1" />
<PackageReference Include="System.IO.Pipelines" Version="8.0.0" />
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<PackageReference Include="Castle.Core" Version="5.1.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Mono.Unix" Version="7.1.0-final.1.21458.1" />
<PackageReference Include="System.IO.Pipelines" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/IKVM.MSBuild.Tasks/IkvmReferenceItemPrepare.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class IkvmReferenceItemPrepare : IkvmAsyncTask
/// </summary>
/// <param name="items"></param>
/// <returns></returns>
static IList<IkvmReferenceItem> Sort(IList<IkvmReferenceItem> items)
static IList<IkvmReferenceItem> Sort(IReadOnlyList<IkvmReferenceItem> items)
{
// construct a map of nodes to their indegrees
var m = items.ToDictionary(i => i, i => 0);
Expand Down Expand Up @@ -473,7 +473,7 @@ static JarFileUtil.ModuleInfo TryGetAssemblyNameFromPath(IkvmReferenceItem item,
}
catch (Exception e)
{
throw new IkvmTaskMessageException(e, Resources.SR.Error_IkvmInvalidArchive, item, path);
throw new IkvmTaskMessageException(e, "Error.IkvmInvalidArchive", item, path);
}

return null;
Expand All @@ -495,9 +495,9 @@ internal async Task<string> CalculateIkvmIdentityAsync(IkvmReferenceItem item, C
return id;

if (string.IsNullOrWhiteSpace(item.AssemblyName))
throw new IkvmTaskMessageException(Resources.SR.Error_IkvmInvalidAssemblyName, item, item.AssemblyName);
throw new IkvmTaskMessageException("Error.IkvmInvalidAssemblyName", item, item.AssemblyName);
if (string.IsNullOrWhiteSpace(item.AssemblyVersion))
throw new IkvmTaskMessageException(Resources.SR.Error_IkvmInvalidAssemblyVersion, item, item.AssemblyVersion);
throw new IkvmTaskMessageException("Error.IkvmInvalidAssemblyVersion", item, item.AssemblyVersion);

var manifest = new StringWriter();
manifest.WriteLine("ToolVersion={0}", ToolVersion);
Expand Down
12 changes: 1 addition & 11 deletions src/IKVM.Runtime/ClassFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1262,22 +1262,12 @@ private static bool HasExceptionHandlerInRegion(Method.ExceptionTableEntry[] ent
return false;
}

/// <summary>
/// Dispses of the instance.
/// </summary>
/// <inheritdoc />
public void Dispose()
{
clazz.Dispose();
}

/// <summary>
/// Finalizes the instance.
/// </summary>
~ClassFile()
{
Dispose();
}

}

}
61 changes: 34 additions & 27 deletions src/IKVM.Tools.Importer/ImportContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -941,43 +941,50 @@ static byte[] ReadFromZip(ZipArchiveEntry ze)

static bool EmitStubWarning(RuntimeContext context, StaticCompiler compiler, ImportState options, IDiagnosticHandler diagnostics, byte[] buf)
{
IKVM.Runtime.ClassFile cf;
IKVM.Runtime.ClassFile cf = null;

try
{
cf = new IKVM.Runtime.ClassFile(context, diagnostics, IKVM.ByteCode.Decoding.ClassFile.Read(buf), "<unknown>", ClassFileParseOptions.None, null);
}
catch (ClassFormatError)
{
return false;
}
catch (ByteCodeException)
{
return false;
}
try
{
cf = new IKVM.Runtime.ClassFile(context, diagnostics, IKVM.ByteCode.Decoding.ClassFile.Read(buf), "<unknown>", ClassFileParseOptions.None, null);
}
catch (ClassFormatError)
{
return false;
}
catch (ByteCodeException)
{
return false;
}

if (cf.IKVMAssemblyAttribute == null)
{
return false;
}
if (cf.IKVMAssemblyAttribute == null)
{
return false;
}

if (cf.IKVMAssemblyAttribute.StartsWith("[["))
{
var r = new Regex(@"\[([^\[\]]+)\]");
var mc = r.Matches(cf.IKVMAssemblyAttribute);
foreach (Match m in mc)
if (cf.IKVMAssemblyAttribute.StartsWith("[["))
{
options.legacyStubReferences[m.Groups[1].Value] = null;
diagnostics.StubsAreDeprecated(m.Groups[1].Value);
var r = new Regex(@"\[([^\[\]]+)\]");
var mc = r.Matches(cf.IKVMAssemblyAttribute);
foreach (Match m in mc)
{
options.legacyStubReferences[m.Groups[1].Value] = null;
diagnostics.StubsAreDeprecated(m.Groups[1].Value);
}
}
else
{
options.legacyStubReferences[cf.IKVMAssemblyAttribute] = null;
diagnostics.StubsAreDeprecated(cf.IKVMAssemblyAttribute);
}

return true;
}
else
finally
{
options.legacyStubReferences[cf.IKVMAssemblyAttribute] = null;
diagnostics.StubsAreDeprecated(cf.IKVMAssemblyAttribute);
cf?.Dispose();
}

return true;
}

static bool IsExcludedOrStubLegacy(RuntimeContext context, StaticCompiler compiler, ImportState options, IDiagnosticHandler diagnostics, ZipArchiveEntry ze, byte[] data)
Expand Down
1 change: 1 addition & 0 deletions src/IKVM.Util/IKVM.Util.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
<PackageReference Include="IKVM.ByteCode" Version="9.1.3" />
<PackageReference Include="IKVM.ByteCode" Version="9.2.2" />
</ItemGroup>

</Project>

0 comments on commit ae654eb

Please sign in to comment.