зеркало из https://github.com/mono/ikvm-fork.git
*** empty log message ***
This commit is contained in:
Родитель
103a252fb4
Коммит
69e51f767d
|
@ -441,6 +441,8 @@ namespace NativeCode.java
|
||||||
m.Invoke(properties, new string[] { "user.home", home });
|
m.Invoke(properties, new string[] { "user.home", home });
|
||||||
m.Invoke(properties, new string[] { "user.dir", Environment.CurrentDirectory });
|
m.Invoke(properties, new string[] { "user.dir", Environment.CurrentDirectory });
|
||||||
m.Invoke(properties, new string[] { "awt.toolkit", "ikvm.awt.NetToolkit, awt, Version=1.0, Culture=neutral, PublicKeyToken=null" });
|
m.Invoke(properties, new string[] { "awt.toolkit", "ikvm.awt.NetToolkit, awt, Version=1.0, Culture=neutral, PublicKeyToken=null" });
|
||||||
|
// HACK we assume that the type of the properties object is the classpath assembly
|
||||||
|
m.Invoke(properties, new string[] { "gnu.classpath.home.url", "ikvmres:" + properties.GetType().Assembly.FullName + ":lib" });
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string nativeGetLibname(string pathname, string libname)
|
public static string nativeGetLibname(string pathname, string libname)
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="classpath.dll" depends="classes">
|
<target name="classpath.dll" depends="classes">
|
||||||
<exec program="${nant.project.basedir}/../bin/ikvmc.exe" commandline="-nojni -out:classpath.dll -target:library -recurse:./*.class -recurse:${Classpath.dir}/*.class mscorlib.jar System.jar System.Xml.jar" />
|
<exec program="${nant.project.basedir}/../bin/ikvmc.exe" commandline="-nojni -out:classpath.dll -target:library -recurse:./*.class -recurse:${Classpath.dir}/*.class mscorlib.jar System.jar System.Xml.jar -resource:lib/security/classpath.security=classpath.security" />
|
||||||
<copy file="classpath.dll" tofile="../bin/classpath.dll.new" />
|
<copy file="classpath.dll" tofile="../bin/classpath.dll.new" />
|
||||||
<exec program="peverify" commandline="../bin/classpath.dll.new" />
|
<exec program="peverify" commandline="../bin/classpath.dll.new" />
|
||||||
<copy file="classpath.dll" todir="../bin" />
|
<copy file="classpath.dll" todir="../bin" />
|
||||||
|
|
|
@ -46,8 +46,16 @@ class IkvmresURLConnection extends URLConnection
|
||||||
{
|
{
|
||||||
String assembly = url.getHost();
|
String assembly = url.getHost();
|
||||||
String resource = url.getFile();
|
String resource = url.getFile();
|
||||||
// TODO error handling
|
Assembly asm = Assembly.Load(assembly);
|
||||||
FieldInfo fi = Assembly.Load(assembly).GetLoadedModules()[0].GetField(resource);
|
if(asm == null)
|
||||||
|
{
|
||||||
|
throw new IOException("assembly " + assembly + " not found");
|
||||||
|
}
|
||||||
|
FieldInfo fi = asm.GetLoadedModules()[0].GetField(resource);
|
||||||
|
if(fi == null)
|
||||||
|
{
|
||||||
|
throw new IOException("resource " + resource + " not found in assembly " + assembly);
|
||||||
|
}
|
||||||
byte[] b = new byte[system.runtime.interopservices.Marshal.SizeOf(fi.get_FieldType())];
|
byte[] b = new byte[system.runtime.interopservices.Marshal.SizeOf(fi.get_FieldType())];
|
||||||
InitArray(b, fi);
|
InitArray(b, fi);
|
||||||
inputStream = new ByteArrayInputStream(b);
|
inputStream = new ByteArrayInputStream(b);
|
||||||
|
@ -91,13 +99,13 @@ public class Handler extends URLStreamHandler
|
||||||
protected void parseURL(URL url, String url_string, int start, int end)
|
protected void parseURL(URL url, String url_string, int start, int end)
|
||||||
{
|
{
|
||||||
int colon = url_string.indexOf(':', start);
|
int colon = url_string.indexOf(':', start);
|
||||||
String file = url_string.substring(start, colon);
|
String assembly = url_string.substring(start, colon);
|
||||||
String assembly = url_string.substring(colon + 1);
|
String file = url_string.substring(colon + 1);
|
||||||
setURL(url, "ikvmres", assembly, 0, file, null);
|
setURL(url, "ikvmres", assembly, 0, file, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String toExternalForm(URL url)
|
protected String toExternalForm(URL url)
|
||||||
{
|
{
|
||||||
return "ikvmres:" + url.getFile() + ":" + url.getHost();
|
return "ikvmres:" + url.getHost() + ":" + url.getFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,7 @@ final class VMClassLoader
|
||||||
Assembly assembly = findResourceAssembly(name);
|
Assembly assembly = findResourceAssembly(name);
|
||||||
if(assembly != null)
|
if(assembly != null)
|
||||||
{
|
{
|
||||||
return new URL("ikvmres:" + name + ":" + assembly.get_FullName());
|
return new URL("ikvmres:" + assembly.get_FullName() + ":" + name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(java.net.MalformedURLException x)
|
catch(java.net.MalformedURLException x)
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
# classpath.security
|
|
||||||
# Copyright (C) 2002 Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This file is part of GNU Classpath.
|
|
||||||
#
|
|
||||||
# GNU Classpath is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# GNU Classpath is distributed in the hope that it will be useful, but
|
|
||||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
# General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with GNU Classpath; see the file COPYING. If not, write to the
|
|
||||||
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
||||||
# 02111-1307 USA.
|
|
||||||
#
|
|
||||||
# Linking this library statically or dynamically with other modules is
|
|
||||||
# making a combined work based on this library. Thus, the terms and
|
|
||||||
# conditions of the GNU General Public License cover the whole
|
|
||||||
# combination.
|
|
||||||
#
|
|
||||||
# As a special exception, the copyright holders of this library give you
|
|
||||||
# permission to link this library with independent modules to produce an
|
|
||||||
# executable, regardless of the license terms of these independent
|
|
||||||
# modules, and to copy and distribute the resulting executable under
|
|
||||||
# terms of your choice, provided that you also meet, for each linked
|
|
||||||
# independent module, the terms and conditions of the license of that
|
|
||||||
# module. An independent module is a module which is not derived from
|
|
||||||
# or based on this library. If you modify this library, you may extend
|
|
||||||
# this exception to your version of the library, but you are not
|
|
||||||
# obligated to do so. If you do not wish to do so, delete this
|
|
||||||
# exception statement from your version.
|
|
||||||
|
|
||||||
|
|
||||||
security.provider.1=gnu.java.security.provider.Gnu
|
|
|
@ -1,39 +0,0 @@
|
||||||
# classpath.security
|
|
||||||
# Copyright (C) 2002 Free Software Foundation, Inc.
|
|
||||||
#
|
|
||||||
# This file is part of GNU Classpath.
|
|
||||||
#
|
|
||||||
# GNU Classpath is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# GNU Classpath is distributed in the hope that it will be useful, but
|
|
||||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
# General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with GNU Classpath; see the file COPYING. If not, write to the
|
|
||||||
# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
||||||
# 02111-1307 USA.
|
|
||||||
#
|
|
||||||
# Linking this library statically or dynamically with other modules is
|
|
||||||
# making a combined work based on this library. Thus, the terms and
|
|
||||||
# conditions of the GNU General Public License cover the whole
|
|
||||||
# combination.
|
|
||||||
#
|
|
||||||
# As a special exception, the copyright holders of this library give you
|
|
||||||
# permission to link this library with independent modules to produce an
|
|
||||||
# executable, regardless of the license terms of these independent
|
|
||||||
# modules, and to copy and distribute the resulting executable under
|
|
||||||
# terms of your choice, provided that you also meet, for each linked
|
|
||||||
# independent module, the terms and conditions of the license of that
|
|
||||||
# module. An independent module is a module which is not derived from
|
|
||||||
# or based on this library. If you modify this library, you may extend
|
|
||||||
# this exception to your version of the library, but you are not
|
|
||||||
# obligated to do so. If you do not wish to do so, delete this
|
|
||||||
# exception statement from your version.
|
|
||||||
|
|
||||||
|
|
||||||
security.provider.1=gnu.java.security.provider.Gnu
|
|
|
@ -76,6 +76,7 @@ class Compiler : MarshalByRefObject
|
||||||
Console.Error.WriteLine(" -reference:<path> Reference an assembly");
|
Console.Error.WriteLine(" -reference:<path> Reference an assembly");
|
||||||
Console.Error.WriteLine(" -recurse:<filespec> Recurse directory and include matching files");
|
Console.Error.WriteLine(" -recurse:<filespec> Recurse directory and include matching files");
|
||||||
Console.Error.WriteLine(" -nojni Do not generate JNI stub for native methods");
|
Console.Error.WriteLine(" -nojni Do not generate JNI stub for native methods");
|
||||||
|
Console.Error.WriteLine(" -resource:<name>=<path> Include file as Java resource");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
ArrayList classes = new ArrayList();
|
ArrayList classes = new ArrayList();
|
||||||
|
@ -120,6 +121,23 @@ class Compiler : MarshalByRefObject
|
||||||
string spec = s.Substring(9);
|
string spec = s.Substring(9);
|
||||||
Recurse(classes, resources, new DirectoryInfo(Path.GetDirectoryName(spec)), Path.GetFileName(spec));
|
Recurse(classes, resources, new DirectoryInfo(Path.GetDirectoryName(spec)), Path.GetFileName(spec));
|
||||||
}
|
}
|
||||||
|
else if(s.StartsWith("-resource:"))
|
||||||
|
{
|
||||||
|
string[] spec = s.Substring(10).Split('=');
|
||||||
|
if(resources.ContainsKey(spec[0]))
|
||||||
|
{
|
||||||
|
Console.Error.WriteLine("Warning: skipping resource (name clash): " + spec[0]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
using(FileStream fs = new FileStream(spec[1], FileMode.Open))
|
||||||
|
{
|
||||||
|
byte[] b = new byte[fs.Length];
|
||||||
|
fs.Read(b, 0, b.Length);
|
||||||
|
resources.Add(spec[0], b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else if(s == "-nojni")
|
else if(s == "-nojni")
|
||||||
{
|
{
|
||||||
nojni = true;
|
nojni = true;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче