Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions tools/jnimarshalmethod-gen/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class App : MarshalByRefObject
{

internal const string Name = "jnimarshalmethod-gen";
static DirectoryAssemblyResolver resolver = new DirectoryAssemblyResolver (logger: (l, v) => { Console.WriteLine (v); }, loadDebugSymbols: true, loadReaderParameters: new ReaderParameters () { ReadSymbols = true });
static DirectoryAssemblyResolver resolver = new DirectoryAssemblyResolver (logger: (l, v) => { Console.WriteLine (v); }, loadDebugSymbols: true, loadReaderParameters: new ReaderParameters () { ReadSymbols = true, InMemory = true });
static Dictionary<string, TypeBuilder> definedTypes = new Dictionary<string, TypeBuilder> ();
static Dictionary<string, TypeDefinition> typeMap = new Dictionary<string, TypeDefinition> ();
static public bool Debug;
Expand Down Expand Up @@ -145,11 +145,13 @@ void ProcessAssemblies (List<string> assemblies)

var readWriteParameters = new ReaderParameters {
AssemblyResolver = resolver,
InMemory = true,
ReadSymbols = true,
ReadWrite = true,
};
var readWriteParametersNoSymbols = new ReaderParameters {
AssemblyResolver = resolver,
InMemory = true,
ReadSymbols = false,
ReadWrite = true,
};
Expand Down Expand Up @@ -347,7 +349,7 @@ void CreateMarshalMethodAssembly (string path)
ColorWriteLine ($"Marshal method assembly '{assemblyName}' created", ConsoleColor.Cyan);

var dstAssembly = resolver.GetAssembly (destPath);
var mover = new TypeMover (dstAssembly, ad, definedTypes, resolver);
var mover = new TypeMover (dstAssembly, ad, path, definedTypes, resolver);
mover.Move ();

if (!keepTemporary)
Expand Down
6 changes: 4 additions & 2 deletions tools/jnimarshalmethod-gen/TypeMover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ public class TypeMover
{
AssemblyDefinition Source { get; }
AssemblyDefinition Destination { get; }
string DestinationPath { get; }
Dictionary<string, System.Reflection.Emit.TypeBuilder> Types { get; }

MethodReference consoleWriteLine;

public TypeMover (AssemblyDefinition source, AssemblyDefinition destination, Dictionary<string, System.Reflection.Emit.TypeBuilder> types, DirectoryAssemblyResolver resolver)
public TypeMover (AssemblyDefinition source, AssemblyDefinition destination, string destinationPath, Dictionary<string, System.Reflection.Emit.TypeBuilder> types, DirectoryAssemblyResolver resolver)
{
Source = source;
Destination = destination;
DestinationPath = destinationPath;
Types = types;

if (App.Debug) {
Expand Down Expand Up @@ -49,7 +51,7 @@ public void Move ()
return;
}

Destination.Write (new WriterParameters () { WriteSymbols = Destination.MainModule.HasSymbols });
Destination.Write (DestinationPath, new WriterParameters () { WriteSymbols = Destination.MainModule.HasSymbols });

if (App.Verbose)
App.ColorWriteLine ($"Wrote updated {Destination.MainModule.FileName} assembly", ConsoleColor.Cyan);
Expand Down