From 50ea284b84487bf6894bdf34f74f8b79e26749a1 Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Thu, 11 Jul 2024 19:31:42 -0500 Subject: [PATCH 01/14] Big cleanup of property, itemgroup and target names. --- src/IKVM.Image/IKVM.Image.csproj | 12 +- src/IKVM.Image/IKVM.Image.runtime.targets | 12 +- src/IKVM.Java/IKVM.Java.runtime.jdk.targets | 367 ++++++++++-------- src/IKVM.Java/IKVM.Java.runtime.nashorn.props | 6 +- .../IKVM.Java.runtime.nashorn.targets | 14 + src/IKVM.Java/IKVM.Java.runtime.targets | 50 +-- src/libosxapp/libosxapp.clangproj | 22 +- targets/openjdk.buildtools.targets | 62 +-- 8 files changed, 298 insertions(+), 247 deletions(-) create mode 100644 src/IKVM.Java/IKVM.Java.runtime.nashorn.targets diff --git a/src/IKVM.Image/IKVM.Image.csproj b/src/IKVM.Image/IKVM.Image.csproj index 48e8bd329..a9b47afdf 100644 --- a/src/IKVM.Image/IKVM.Image.csproj +++ b/src/IKVM.Image/IKVM.Image.csproj @@ -67,13 +67,13 @@ - + - + @@ -87,13 +87,13 @@ $(IntermediateOutputPath)currency.data - + - + @@ -112,13 +112,13 @@ $(IntermediateOutputPath)cacerts - + - + diff --git a/src/IKVM.Image/IKVM.Image.runtime.targets b/src/IKVM.Image/IKVM.Image.runtime.targets index 6b020c980..d632f7f79 100644 --- a/src/IKVM.Image/IKVM.Image.runtime.targets +++ b/src/IKVM.Image/IKVM.Image.runtime.targets @@ -100,13 +100,13 @@ $(IntermediateOutputPath)fontconfig.bfc - + - - + + @@ -129,13 +129,13 @@ $(IntermediateOutputPath)java.security - + - - + + diff --git a/src/IKVM.Java/IKVM.Java.runtime.jdk.targets b/src/IKVM.Java/IKVM.Java.runtime.jdk.targets index f1747e62f..2a5b27b9c 100644 --- a/src/IKVM.Java/IKVM.Java.runtime.jdk.targets +++ b/src/IKVM.Java/IKVM.Java.runtime.jdk.targets @@ -104,6 +104,7 @@ + $(IntermediateOutputPath)jdk_chardat\ $(OpenJdkDir)jdk\make\data\characterdata\ $(OpenJdkDir)jdk\make\data\unicodedata\ @@ -116,7 +117,7 @@ - + @@ -130,7 +131,7 @@ <_SpecialCasingArg>$(_SpecialCasingArg.Replace('\', '\\')) <_PropListArg>$(UnicodeDataDir)PropList.txt <_PropListArg>$(_PropListArg.Replace('\', '\\')) - <_OutputArg>$(IntermediateOutputPath)genchardat\java\lang\%(CharacterDataItem.Identity).java.tmp + <_OutputArg>$(CharacterDataOutputPath)java\lang\%(CharacterDataItem.Identity).java.tmp <_OutputArg>$(_OutputArg.Replace('\', '\\')) @@ -151,15 +152,15 @@ <_GenerateCharacterArgs Include="%(CharacterDataItem.Arg3)" /> - + - - + + - - - + + + @@ -168,15 +169,15 @@ - - + + - - + + - - + + @@ -188,7 +189,11 @@ - + + $(IntermediateOutputPath)jdk_chardec\ + + + @@ -221,14 +226,14 @@ <_GenerateCharsetDecoderArgs Include="-Dotypes-per-itype="chars-per-byte"" /> <_GenerateCharsetDecoderArgs Include="-DoutSequence="Unicode character"" /> <_GenerateCharsetDecoderTmpl Include="$(OpenJdkDir)jdk\src\share\classes\java\nio\charset\Charset-X-Coder.java.template" /> - <_GenerateCharsetDecoderTemp Include="$(IntermediateOutputPath)genchardec\java\nio\charset\CharsetDecoder.java.tmp" /> - <_GenerateCharsetDecoderFile Include="$(IntermediateOutputPath)genchardec\java\nio\charset\CharsetDecoder.java" /> + <_GenerateCharsetDecoderTemp Include="$(CharsetDecoderOutputPath)java\nio\charset\CharsetDecoder.java.tmp" /> + <_GenerateCharsetDecoderFile Include="$(CharsetDecoderOutputPath)java\nio\charset\CharsetDecoder.java" /> - - - - + + + + @@ -238,7 +243,11 @@ - + + $(IntermediateOutputPath)jdk_charenc\ + + + @@ -270,14 +279,14 @@ <_GenerateCharsetEncoderArgs Include="-Dotypes-per-itype="bytes-per-char"" /> <_GenerateCharsetEncoderArgs Include="-DoutSequence="byte sequence in the given charset"" /> <_GenerateCharsetEncoderTmpl Include="$(OpenJdkDir)jdk\src\share\classes\java\nio\charset\Charset-X-Coder.java.template" /> - <_GenerateCharsetEncoderTemp Include="$(IntermediateOutputPath)gencharenc\java\nio\charset\CharsetEncoder.java.tmp" /> - <_GenerateCharsetEncoderFile Include="$(IntermediateOutputPath)gencharenc\java\nio\charset\CharsetEncoder.java" /> + <_GenerateCharsetEncoderTemp Include="$(CharsetEncoderOutputPath)java\nio\charset\CharsetEncoder.java.tmp" /> + <_GenerateCharsetEncoderFile Include="$(CharsetEncoderOutputPath)java\nio\charset\CharsetEncoder.java" /> - - - - + + + + @@ -296,47 +305,48 @@ - $(OpenJdkDir)jdk\make\data\charsetmapping\ - $(OpenJdkDir)jdk\make\src\classes\build\tools\charsetmapping\ + $(IntermediateOutputPath)\jdk_charmap\ + $(OpenJdkDir)jdk\make\data\charsetmapping\ + $(OpenJdkDir)jdk\make\src\classes\build\tools\charsetmapping\ - - + + - - - - - - + + + + + + - + - <_GenerateCharsetMappingArgs Include="%(GenerateCharsetMappingItem.Source)" /> - <_GenerateCharsetMappingArgs Include="$(IntermediateOutputPath)gencharmap_%(GenerateCharsetMappingItem.Identity)\%(GenerateCharsetMappingItem.Destination)" /> - <_GenerateCharsetMappingArgs Include="%(GenerateCharsetMappingItem.Identity)" /> - <_GenerateCharsetMappingArgs Include="%(GenerateCharsetMappingItem.Copyright)" Condition=" '%(GenerateCharsetMappingItem.Copyright)' != '' " /> + <_GenerateCharsetMappingArgs Include="%(CharsetMappingItem.Source)" /> + <_GenerateCharsetMappingArgs Include="$(CharsetMappingOutputPath)%(CharsetMappingItem.Identity)\%(CharsetMappingItem.Destination)" /> + <_GenerateCharsetMappingArgs Include="%(CharsetMappingItem.Identity)" /> + <_GenerateCharsetMappingArgs Include="%(CharsetMappingItem.Copyright)" Condition=" '%(CharsetMappingItem.Copyright)' != '' " /> - - - - - - + + + + + + <_GenerateCharsetMappingsItems Remove="@(_GenerateCharsetMappingsItems)" /> - <_GenerateCharsetMappingsItems Include="$(IntermediateOutputPath)gencharmap_%(GenerateCharsetMappingItem.Identity)\**\*" /> - + <_GenerateCharsetMappingsItems Include="$(CharsetMappingOutputPath)%(CharsetMappingItem.Identity)\**\*" /> + @@ -569,40 +579,45 @@ public class WriteStandardCharsets : Task - + + $(IntermediateOutputPath)jdk_stdchar\ + $(IntermediateOutputPath)jdk_stdchar_tmp\ + + + - + + + + - - - + + + - + + + AliasesClassFile="$(StandardCharsetsTempPath)Aliases.java" + ClassesClassFile="$(StandardCharsetsTempPath)Classes.java" + CacheClassFile="$(StandardCharsetsTempPath)Cache.java" /> + - - - - - - + @@ -614,20 +629,24 @@ public class WriteStandardCharsets : Task - + + $(IntermediateOutputPath)jdk_html32dtd\ + + + <_DtdHome Include="$(OpenJdkDir)jdk\make\data\dtdbuilder" /> - <_BdtdTemp Include="$(IntermediateOutputPath)genhtml32dtd\javax\swing\text\html\parser\html32.bdtd.tmp" /> - <_Bdtd Include="$(IntermediateOutputPath)genhtml32dtd\javax\swing\text\html\parser\html32.bdtd" /> + <_BdtdTemp Include="$(Html32DTDOutputPath)javax\swing\text\html\parser\html32.bdtd.tmp" /> + <_Bdtd Include="$(Html32DTDOutputPath)javax\swing\text\html\parser\html32.bdtd" /> - - - + + + @@ -660,7 +679,7 @@ public class WriteStandardCharsets : Task - + @@ -680,6 +699,10 @@ public class WriteStandardCharsets : Task --> + + $(IntermediateOutputPath)jdk_buffers\ + + @@ -1024,12 +1047,12 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN - + - + <_Src Remove="@(_Src)" /> @@ -1037,23 +1060,23 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN <_Bin Remove="@(_Bin)" /> <_Bin Include="$(OpenJdkDir)jdk\src\share\classes\java\nio\%(_GenBufferCommand.Template)-bin.java.template" /> <_Tmp Remove="@(_Tmp)" /> - <_Tmp Include="$(IntermediateOutputPath)genbuf\java\nio\%(_GenBufferCommand.Identity).java.tmp" /> + <_Tmp Include="$(BufferOutputPath)java\nio\%(_GenBufferCommand.Identity).java.tmp" /> <_Dst Remove="@(_Dst)" /> - <_Dst Include="$(IntermediateOutputPath)genbuf\java\nio\%(_GenBufferCommand.Identity).java" /> + <_Dst Include="$(BufferOutputPath)java\nio\%(_GenBufferCommand.Identity).java" /> - + - - + + - - - - - - + + + + + + @@ -1074,28 +1097,29 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN 21.0.1 + $(IntermediateOutputPath)jdk_cldr\ - - - - + + + + - + - - - - + + + + - - + + @@ -1106,6 +1130,10 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN + + $(IntermediateOutputPath)jdk_icons\ + + @@ -1134,28 +1162,28 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN - + - + <_Src Remove="@(_Src)" /> <_Src Include="%(AwtIcons.Identity)" /> <_Tmp Remove="@(_Tmp)" /> - <_Tmp Include="$(IntermediateOutputPath)genico\sun\awt\%(AwtIcons.ClassName).java.tmp" /> + <_Tmp Include="$(IconsOutputPath)sun\awt\%(AwtIcons.ClassName).java.tmp" /> <_Dst Remove="@(_Dst)" /> - <_Dst Include="$(IntermediateOutputPath)genico\sun\awt\%(AwtIcons.ClassName).java" /> + <_Dst Include="$(IconsOutputPath)sun\awt\%(AwtIcons.ClassName).java" /> - + - + @@ -1175,26 +1203,26 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN + $(IntermediateOutputPath)jdk_nimbus\ $(OpenJdkDir)jdk\src\share\classes\javax\swing\plaf\nimbus $(OpenJdkDir)jdk\src\share\classes\javax\swing\plaf\nimbus\skin.laf - + - - - - + + + + - - - + + @@ -1206,14 +1234,14 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN - $(IntermediateOutputPath)genx11_tmp\ - $(IntermediateOutputPath)genx11\sun\awt\X11\ + $(IntermediateOutputPath)jdk_x11wrappers\ + $(IntermediateOutputPath)jdk_x11wrappers_tmp\ $(OpenJdkDir)jdk\src\solaris\classes\sun\awt\X11\generator\xlibtypes.txt $(OpenJdkDir)jdk\src\solaris\classes\sun\awt\X11\generator\sizes.32 $(OpenJdkDir)jdk\src\solaris\classes\sun\awt\X11\generator\sizes.64 - + @@ -1221,28 +1249,27 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN <_X11WrapperSizePath Remove="@(_X11WrapperTempPath)" /> <_X11WrapperSizePath Include="$(X11WrapperTempPath)sizes" /> - <_X11WrapperDestPath Remove="@(_X11WrapperDestPath)" /> - <_X11WrapperDestPath Include="$(X11WrapperDestPath)" /> + <_X11WrapperOutputPath Remove="@(_X11WrapperOutputPath)" /> + <_X11WrapperOutputPath Include="$(X11WrapperOutputPath)" /> <_XLibTypes Remove="@(_XLibTypes)" /> <_XLibTypes Include="$(XLibTypes)" /> - + - + - - + + + - - - - + + @@ -1254,24 +1281,25 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN - $(OpenJdkDir)jdk\make\data\unicodedata\UnicodeData.txt - $(IntermediateOutputPath)uniName.dat + $(OpenJdkDir)jdk\make\data\unicodedata\UnicodeData.txt + $(IntermediateOutputPath)jdk_uniname\uniName.dat - + - - - - + + + + + - - - + + + @@ -1283,21 +1311,22 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN - $(OpenJdkDir)jdk\make\data\lsrdata\language-subtag-registry.txt - $(IntermediateOutputPath)LocaleEquivalentMaps.java + $(OpenJdkDir)jdk\make\data\lsrdata\language-subtag-registry.txt + $(IntermediateOutputPath)jdk_lsrequivmaps\LocaleEquivalentMaps.java - + - - + + + - - + + @@ -1309,8 +1338,7 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN - $(IntermediateOutputPath)break_iterator\classes\ - $(IntermediateOutputPath)break_iterator\gendata\ + $(IntermediateOutputPath)jdk_breakiterator\ sun\text\resources @@ -1319,16 +1347,16 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN - - - - - - - - - - + + + + + + + + + + @@ -1336,27 +1364,28 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN - - - + + + + - + - - - + + + - - - + + + @@ -1367,14 +1396,14 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN GenerateBreakIteratorClasses; - GenerateBreakIteratorData; + GenerateBreakIteratorResources; $(GenerateDependsOn); $(OpenJdkDir)jdk\src\share\classes\sun\util\CoreResourceBundleControl-XLocales.java.template - $(IntermediateOutputPath)CoreResourceBundleControl.java + $(IntermediateOutputPath)jdk_crbc\CoreResourceBundleControl.java @@ -1416,7 +1445,8 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN foreach (var locale in LocaleList) l.Add(o.ContainsKey(locale.ItemSpec) ? "Locale." + o[locale.ItemSpec] : "new Locale(\"" + string.Join("\", \"", locale.ItemSpec.Split('_')) + "\")"); - + + Directory.CreateDirectory(Path.GetDirectoryName(OutputFile)); using var src = File.OpenText(SourceFile); using var dst = new StreamWriter(File.Open(OutputFile, FileMode.Create)); @@ -1451,7 +1481,7 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN $(OpenJdkDir)jdk\src\share\classes\sun\util\locale\provider\LocaleDataMetaInfo-XLocales.java.template - $(IntermediateOutputPath)LocaleDataMetaInfo.java + $(IntermediateOutputPath)jdk_locales\LocaleDataMetaInfo.java @@ -1499,6 +1529,7 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN } } + Directory.CreateDirectory(Path.GetDirectoryName(OutputFile)); using var src = File.OpenText(SourceFile); using var dst = new StreamWriter(File.Open(OutputFile, FileMode.Create)); diff --git a/src/IKVM.Java/IKVM.Java.runtime.nashorn.props b/src/IKVM.Java/IKVM.Java.runtime.nashorn.props index 27591c1f4..4756d3e0b 100644 --- a/src/IKVM.Java/IKVM.Java.runtime.nashorn.props +++ b/src/IKVM.Java/IKVM.Java.runtime.nashorn.props @@ -12,12 +12,12 @@ - + - - + + diff --git a/src/IKVM.Java/IKVM.Java.runtime.nashorn.targets b/src/IKVM.Java/IKVM.Java.runtime.nashorn.targets new file mode 100644 index 000000000..b06b9d145 --- /dev/null +++ b/src/IKVM.Java/IKVM.Java.runtime.nashorn.targets @@ -0,0 +1,14 @@ + + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + + diff --git a/src/IKVM.Java/IKVM.Java.runtime.targets b/src/IKVM.Java/IKVM.Java.runtime.targets index ae88d3087..21e520856 100644 --- a/src/IKVM.Java/IKVM.Java.runtime.targets +++ b/src/IKVM.Java/IKVM.Java.runtime.targets @@ -40,11 +40,15 @@ - OpenJdkBuildTools; + BuildJdkBuildTools; $(GenerateDependsOn); + + $(IntermediateOutputPath)genprop\ + + @@ -70,14 +74,14 @@ - + - <_Dest>$(IntermediateOutputPath)genprop\%(PackagePath)\%(ClassName).java + <_Dest>$(ResourceBundleOutputPath)%(PackagePath)\%(ClassName).java <_Args Remove="@(_Args)" /> @@ -86,15 +90,15 @@ - - - - + + + + - - - + + + @@ -129,14 +133,14 @@ - + - <_Dest>$(IntermediateOutputPath)genprop\%(PackagePath)\%(ResourceName).properties + <_Dest>$(ResourceBundleOutputPath)%(PackagePath)\%(ResourceName).properties <_Args Remove="@(_Args)" /> @@ -145,14 +149,15 @@ - - - + + + + - - - + + + @@ -200,12 +205,12 @@ - - + + - - + + @@ -338,5 +343,6 @@ File.WriteAllBytes(Path, Encoding.UTF8.GetBytes(Text)); + diff --git a/src/libosxapp/libosxapp.clangproj b/src/libosxapp/libosxapp.clangproj index 9241d4e5c..e8dd16c41 100644 --- a/src/libosxapp/libosxapp.clangproj +++ b/src/libosxapp/libosxapp.clangproj @@ -55,28 +55,28 @@ - <_GenIcon Include="$(OpenJdkDir)jdk\src\macosx\native\sun\osxapp\resource\icons\JavaApp.icns" Destination="$(IntermediateOutputPath)\gensrc\AWTIconData.h" /> + - - + + - + <_Src Remove="@(_Src)" /> - <_Src Include="%(_GenIcon.Identity)" /> + <_Src Include="%(OSXIcon.Identity)" /> <_Tmp Remove="@(_Tmp)" /> - <_Tmp Include="%(_GenIcon.Destination).tmp" /> + <_Tmp Include="%(OSXIcon.Destination).tmp" /> <_Dst Remove="@(_Dst)" /> - <_Dst Include="%(_GenIcon.Destination)" /> + <_Dst Include="%(OSXIcon.Destination)" /> - - + + - + @@ -85,7 +85,7 @@ - + GenerateOSXIcons; diff --git a/targets/openjdk.buildtools.targets b/targets/openjdk.buildtools.targets index 77509feb1..3a75d320d 100644 --- a/targets/openjdk.buildtools.targets +++ b/targets/openjdk.buildtools.targets @@ -11,33 +11,33 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - + - $([System.IO.Path]::GetFullPath('$(JAVA_HOME)\lib\tools.jar')) + $([System.IO.Path]::GetFullPath('$(JAVA_HOME)\lib\tools.jar')) - - + + - $(IntermediateOutputPath)btclasses.javac.rsp - $(IntermediateOutputPath)btclasses\ - $(IntermediateOutputPath)$(MSBuildProjectName).OpenJdkBuildTools.stamp + $(IntermediateOutputPath)jdk_btclasses\ + $(IntermediateOutputPath)jdk_btclasses.javac.rsp + $(IntermediateOutputPath)jdk_btclasses.stamp - - - - + + + + - - - + + + - <_OpenJdkBuildToolsJavaCompilerClasspath Include="$(OpenJdkToolsJarPath)" /> + <_OpenJdkBuildToolsJavaCompilerClasspath Include="$(JavaToolsJarPath)" /> @@ -54,34 +54,34 @@ <_OpenJdkBuildToolsJavaCompilerArgs Include="1.8" /> <_OpenJdkBuildToolsJavaCompilerArgs Include="-nowarn" /> <_OpenJdkBuildToolsJavaCompilerArgs Include="-d" /> - <_OpenJdkBuildToolsJavaCompilerArgs Include="$(OpenJdkBuildToolsOutputPath)" /> - <_OpenJdkBuildToolsJavaCompilerArgs Include="@(OpenJdkBuildToolsSource->'%(FullPath)')" /> + <_OpenJdkBuildToolsJavaCompilerArgs Include="$(JdkBuildToolsOutputPath)" /> + <_OpenJdkBuildToolsJavaCompilerArgs Include="@(JdkBuildToolsSource->'%(FullPath)')" /> - + - + - + - - - - - - - + + + + + + + - - - - + + + + From e2db47e505f51c853ce3346c85f2fef25fc6c489 Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Thu, 11 Jul 2024 22:03:54 -0500 Subject: [PATCH 02/14] So, here's how this works. We build using target and source 7. We then build nasgen. We then run nasgen against the built classes. This emits some more classes (and potentially replacements). Then we copy the original classes ontop of those where missing. This provides the combination of both original and nasgen'd. --- src/IKVM.Java/IKVM.Java.runtime.jdk.targets | 2 +- src/IKVM.Java/IKVM.Java.runtime.nashorn.props | 4 - .../IKVM.Java.runtime.nashorn.targets | 156 ++++++++++++++++++ 3 files changed, 157 insertions(+), 5 deletions(-) diff --git a/src/IKVM.Java/IKVM.Java.runtime.jdk.targets b/src/IKVM.Java/IKVM.Java.runtime.jdk.targets index 2a5b27b9c..1dd268370 100644 --- a/src/IKVM.Java/IKVM.Java.runtime.jdk.targets +++ b/src/IKVM.Java/IKVM.Java.runtime.jdk.targets @@ -1370,7 +1370,7 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN - + diff --git a/src/IKVM.Java/IKVM.Java.runtime.nashorn.props b/src/IKVM.Java/IKVM.Java.runtime.nashorn.props index 4756d3e0b..750ac8189 100644 --- a/src/IKVM.Java/IKVM.Java.runtime.nashorn.props +++ b/src/IKVM.Java/IKVM.Java.runtime.nashorn.props @@ -11,10 +11,6 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - - - - diff --git a/src/IKVM.Java/IKVM.Java.runtime.nashorn.targets b/src/IKVM.Java/IKVM.Java.runtime.nashorn.targets index b06b9d145..71596156a 100644 --- a/src/IKVM.Java/IKVM.Java.runtime.nashorn.targets +++ b/src/IKVM.Java/IKVM.Java.runtime.nashorn.targets @@ -11,4 +11,160 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + $(IntermediateOutputPath)nashorn_tmp\ + $(IntermediateOutputPath)nashorn_tmp.javac.rsp + $(NashornTempPath)stamp + $(IntermediateOutputPath)nashorn_classes\ + $(NashornOutputPath)stamp + + + + + + + + + <_NashornTempJavaCompilerClasspath Include="$([System.IO.Path]::GetFullPath('$(ClassOutputPath)'))" /> + <_NashornTempJavaCompilerClasspath Include="$([System.IO.Path]::GetFullPath('$(NashornOutputPath)'))" /> + + + <_NashornTempJavaCompilerClasspathArg>@(_NashornTempJavaCompilerClasspath, '$([System.IO.Path]::PathSeparator)') + <_NashornTempJavaCompilerClasspathArg>$(_NashornTempJavaCompilerClasspathArg.Replace('\', '\\')) + + + + <_NashornTempJavaCompilerArgs Include="-cp" /> + <_NashornTempJavaCompilerArgs Include=""$([MSBuild]::Escape('$(_NashornTempJavaCompilerClasspathArg)'))"" /> + <_NashornTempJavaCompilerArgs Include="-g" /> + <_NashornTempJavaCompilerArgs Include="-source" /> + <_NashornTempJavaCompilerArgs Include="7" /> + <_NashornTempJavaCompilerArgs Include="-target" /> + <_NashornTempJavaCompilerArgs Include="7" /> + <_NashornTempJavaCompilerArgs Include="-nowarn" /> + <_NashornTempJavaCompilerArgs Include="-d" /> + <_NashornTempJavaCompilerArgs Include="$(NashornTempPath)" /> + <_NashornTempJavaCompilerArgs Include="@(NashornSource->'%(FullPath)')" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(IntermediateOutputPath)nashorn_nasgen\ + $(IntermediateOutputPath)nashorn_nasgen.javac.rsp + $(NasgenOutputPath)stamp + + + + + + + + + <_NasgenJavaCompilerClasspath Include="$([System.IO.Path]::GetFullPath('$(ClassOutputPath)'))" /> + <_NasgenJavaCompilerClasspath Include="$([System.IO.Path]::GetFullPath('$(NashornOutputPath)'))" /> + + + <_NasgenJavaCompilerClasspathArg>@(_NasgenJavaCompilerClasspath, '$([System.IO.Path]::PathSeparator)') + <_NasgenJavaCompilerClasspathArg>$(_NasgenJavaCompilerClasspathArg.Replace('\', '\\')) + + + + <_NasgenJavaCompilerArgs Include="-bootclasspath" /> + <_NasgenJavaCompilerArgs Include=""$([MSBuild]::Escape('$(_NasgenJavaCompilerClasspathArg)'))"" /> + <_NasgenJavaCompilerArgs Include="-g" /> + <_NasgenJavaCompilerArgs Include="-source" /> + <_NasgenJavaCompilerArgs Include="7" /> + <_NasgenJavaCompilerArgs Include="-target" /> + <_NasgenJavaCompilerArgs Include="7" /> + <_NasgenJavaCompilerArgs Include="-nowarn" /> + <_NasgenJavaCompilerArgs Include="-d" /> + <_NasgenJavaCompilerArgs Include="$(NasgenOutputPath)" /> + <_NasgenJavaCompilerArgs Include="@(NasgenSource->'%(FullPath)')" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_NasgenClasspath Include="$([System.IO.Path]::GetFullPath('$(NasgenOutputPath)'))" /> + <_NasgenClasspath Include="$([System.IO.Path]::GetFullPath('$(NashornTempPath)'))" /> + + + + <_NasgenClasspathArg>@(_NasgenClasspath, '$([System.IO.Path]::PathSeparator)') + <_NasgenClasspathArg>$(_NasgenClasspathArg.Replace('\', '\\')) + + + + + + + + + + + + + + + + + + + RunNasgen; + $(CoreCompileDependsOn); + + + From 53d8b2603aa4063fac506233c213fce09b8afc66 Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Thu, 11 Jul 2024 23:36:08 -0500 Subject: [PATCH 03/14] Build Nashorn against JDK. --- src/IKVM.Java/IKVM.Java.runtime.nashorn.targets | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/IKVM.Java/IKVM.Java.runtime.nashorn.targets b/src/IKVM.Java/IKVM.Java.runtime.nashorn.targets index 71596156a..ace8b9b79 100644 --- a/src/IKVM.Java/IKVM.Java.runtime.nashorn.targets +++ b/src/IKVM.Java/IKVM.Java.runtime.nashorn.targets @@ -23,10 +23,9 @@ - + <_NashornTempJavaCompilerClasspath Include="$([System.IO.Path]::GetFullPath('$(ClassOutputPath)'))" /> - <_NashornTempJavaCompilerClasspath Include="$([System.IO.Path]::GetFullPath('$(NashornOutputPath)'))" /> <_NashornTempJavaCompilerClasspathArg>@(_NashornTempJavaCompilerClasspath, '$([System.IO.Path]::PathSeparator)') From 81896721aca7f86c322429bbe3117303083fce26 Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Thu, 11 Jul 2024 23:44:39 -0500 Subject: [PATCH 04/14] dep --- src/IKVM.Java/IKVM.Java.runtime.nashorn.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/IKVM.Java/IKVM.Java.runtime.nashorn.targets b/src/IKVM.Java/IKVM.Java.runtime.nashorn.targets index ace8b9b79..1c93e1a0c 100644 --- a/src/IKVM.Java/IKVM.Java.runtime.nashorn.targets +++ b/src/IKVM.Java/IKVM.Java.runtime.nashorn.targets @@ -52,7 +52,7 @@ - + From af483edb93165f81a86633d462a68371dee13c00 Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Fri, 12 Jul 2024 08:05:16 -0500 Subject: [PATCH 05/14] Escape slashes. --- src/IKVM.Java/IKVM.Java.runtime.jdk.targets | 26 +++++++++++++++------ 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/IKVM.Java/IKVM.Java.runtime.jdk.targets b/src/IKVM.Java/IKVM.Java.runtime.jdk.targets index 1dd268370..49b87e2c1 100644 --- a/src/IKVM.Java/IKVM.Java.runtime.jdk.targets +++ b/src/IKVM.Java/IKVM.Java.runtime.jdk.targets @@ -1339,7 +1339,7 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN $(IntermediateOutputPath)jdk_breakiterator\ - sun\text\resources + sun/text/resources @@ -1364,9 +1364,14 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN + + <_BreakIteratorOutputPath Remove="@(_BreakIteratorOutputPath)" /> + <_BreakIteratorOutputPath Include="$(BreakIteratorOutputPath)" /> + + - - + + @@ -1379,13 +1384,20 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN + + <_BreakIteratorClasspath Remove="@(_BreakIteratorClasspath)" /> + <_BreakIteratorClasspath Include="$(BreakIteratorOutputPath)" /> + <_BreakIteratorOutputArg Remove="@(_BreakIteratorOutputArg)" /> + <_BreakIteratorOutputArg Include="$(BreakIteratorOutputPath)$(BreakIteratorPackage)" /> + + - - + + - - + + From a6a63728da595dc71a6ac21ac451e9ba730845da Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Fri, 12 Jul 2024 09:37:23 -0500 Subject: [PATCH 06/14] Rename --- src/IKVM.Java/IKVM.Java.runtime.jdk.targets | 27 ++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/IKVM.Java/IKVM.Java.runtime.jdk.targets b/src/IKVM.Java/IKVM.Java.runtime.jdk.targets index 49b87e2c1..48e88c17b 100644 --- a/src/IKVM.Java/IKVM.Java.runtime.jdk.targets +++ b/src/IKVM.Java/IKVM.Java.runtime.jdk.targets @@ -46,10 +46,10 @@ $(IntermediateOutputPath)rmistubs\ - <_BuildRmiStubsCoreStampFile>$(RmiStubsOutputPath)stamp + $(RmiStubsOutputPath)stamp - + <_RmiCompilerClasspath Include="@(Classpath);$(ClassOutputPath)" /> <_RmiCompilerArgs Include="@(RmiCompilerArgs)" /> @@ -59,14 +59,21 @@ <_RmiCompilerArgs Include="-d" /> <_RmiCompilerArgs Include="$(RmiStubsOutputPath)" /> + <_RmiCompilerArgs>@(_RmiCompilerArgs, ' ') + - + + + + + + @@ -79,13 +86,11 @@ - - - + - + @@ -591,7 +596,7 @@ public class WriteStandardCharsets : Task - + @@ -1390,11 +1395,11 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN <_BreakIteratorOutputArg Remove="@(_BreakIteratorOutputArg)" /> <_BreakIteratorOutputArg Include="$(BreakIteratorOutputPath)$(BreakIteratorPackage)" /> - + - + @@ -1477,7 +1482,7 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN SourceFile="$(CoreResourceBundleControlSrc)" OutputFile="$(CoreResourceBundleControlDst)" LocaleList="@(CoreResourceBundleControlNonExistLocales)" /> - + From 7269d8fa18a3a2d66afe4e90e874b61b86646aec Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Sat, 13 Jul 2024 14:38:34 -0500 Subject: [PATCH 07/14] Add some extra tests for nashorn. --- src/IKVM.Tests/IKVM.Tests.csproj | 2 +- .../Java/javax/script/BooleanAccessTests.cs | 46 ++ .../Java/javax/script/NashornAccessTests.cs | 36 -- src/IKVM.Tests/Java/javax/script/Person.cs | 42 ++ .../Java/javax/script/SharedObject.cs | 521 ++++++++++++++++++ 5 files changed, 610 insertions(+), 37 deletions(-) create mode 100644 src/IKVM.Tests/Java/javax/script/BooleanAccessTests.cs delete mode 100644 src/IKVM.Tests/Java/javax/script/NashornAccessTests.cs create mode 100644 src/IKVM.Tests/Java/javax/script/Person.cs create mode 100644 src/IKVM.Tests/Java/javax/script/SharedObject.cs diff --git a/src/IKVM.Tests/IKVM.Tests.csproj b/src/IKVM.Tests/IKVM.Tests.csproj index 43f73295b..630fb1a30 100644 --- a/src/IKVM.Tests/IKVM.Tests.csproj +++ b/src/IKVM.Tests/IKVM.Tests.csproj @@ -8,7 +8,7 @@ true true false - 11 + 12 $(MSBuildProjectDirectory)\IKVM.Tests.runsettings diff --git a/src/IKVM.Tests/Java/javax/script/BooleanAccessTests.cs b/src/IKVM.Tests/Java/javax/script/BooleanAccessTests.cs new file mode 100644 index 000000000..3f716e843 --- /dev/null +++ b/src/IKVM.Tests/Java/javax/script/BooleanAccessTests.cs @@ -0,0 +1,46 @@ +using FluentAssertions; + +using javax.script; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.Tests.Java.javax.script +{ + + [TestClass] + public class BooleanAccessTests + { + + static ScriptEngine e; + static SharedObject o; + + [TestInitialize] + public void Initialize() + { + var m = new ScriptEngineManager(); + e = m.getEngineByName("nashorn"); + o = new SharedObject(); + e.put("o", o); + e.eval("var SharedObject = Packages.cli.IKVM.Tests.Java.javax.script.SharedObject;"); + } + + [TestCleanup] + public void Cleanup() + { + e = null; + o = null; + } + + [TestMethod] + public void AccessFieldBoolean() + { + e.eval("var p_boolean = o.publicBoolean;"); + o.publicBoolean.Should().Be(((global::java.lang.Boolean)e.get("p_boolean")).booleanValue()); + e.eval("typeof p_boolean;").Should().Be("boolean"); + e.eval("o.publicBoolean = false;"); + o.publicBoolean.Should().Be(false); + } + + } + +} diff --git a/src/IKVM.Tests/Java/javax/script/NashornAccessTests.cs b/src/IKVM.Tests/Java/javax/script/NashornAccessTests.cs deleted file mode 100644 index edf0f2406..000000000 --- a/src/IKVM.Tests/Java/javax/script/NashornAccessTests.cs +++ /dev/null @@ -1,36 +0,0 @@ -using FluentAssertions; - -using javax.script; - -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace IKVM.Tests.Java.javax.script -{ - - [TestClass] - public class NashornAccessTests - { - - class SharedObject - { - - public string publicString = "PublicString"; - - } - - static ScriptEngine e; - static SharedObject o; - - [TestInitialize] - public void Initialize() - { - var m = new ScriptEngineManager(); - e = m.getEngineByName("nashorn"); - o = new SharedObject(); - e.put("o", o); - e.eval("var SharedObject = Packages.cli.IKVM.Tests.Java.javax.script.NashornAccessTests$SharedObject;"); - } - - } - -} diff --git a/src/IKVM.Tests/Java/javax/script/Person.cs b/src/IKVM.Tests/Java/javax/script/Person.cs new file mode 100644 index 000000000..c683780c3 --- /dev/null +++ b/src/IKVM.Tests/Java/javax/script/Person.cs @@ -0,0 +1,42 @@ +namespace IKVM.Tests.Java.javax.script +{ + + public class Person + { + + public int id = 0; + + public Person() + { + + } + + public Person(int code) + { + this.id = code; + } + + public override bool Equals(object obj) + { + if (obj != null && obj is Person) + { + Person o = (Person)obj; + return this.id == o.id; + } + + return false; + } + + public override int GetHashCode() + { + return id; + } + + public override string ToString() + { + return "Person(" + id + ")"; + } + + } + +} diff --git a/src/IKVM.Tests/Java/javax/script/SharedObject.cs b/src/IKVM.Tests/Java/javax/script/SharedObject.cs new file mode 100644 index 000000000..3ad8011ad --- /dev/null +++ b/src/IKVM.Tests/Java/javax/script/SharedObject.cs @@ -0,0 +1,521 @@ +using System; + +using javax.script; + +namespace IKVM.Tests.Java.javax.script +{ + + public class SharedObject + { + + // Public fields + public string publicString = "PublicString"; + public string[] publicStringArray = ["ArrayString[0]", "ArrayString[1]", "ArrayString[2]", "ArrayString[3]"]; + public Person publicObject = new Person(256); + public Person[] publicObjectArray = [new Person(4), new Person(-422), new Person(14)]; + public bool publicBoolean = true; + public bool[] publicBooleanArray = [true, false, false, true]; + public global::java.lang.Boolean publicBooleanBox = new global::java.lang.Boolean(true); + public long publicLong = 933333333333333333L; + public long[] publicLongArray = [99012333333333L, -124355555L, 89777777777L]; + public global::java.lang.Long publicLongBox = new global::java.lang.Long(9333333333L); + public int publicInt = 2076543123; + public int[] publicIntArray = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]; + public global::java.lang.Integer publicIntBox = new global::java.lang.Integer(20765123); + public byte publicByte = unchecked((byte)-128); + public byte[] publicByteArray = [1, 2, 4, 8, 16, 32, 64, 127, unchecked((byte)-128)]; + public global::java.lang.Byte publicByteBox = new global::java.lang.Byte(127); + public short publicShort = 32000; + public short[] publicShortArray = [3240, 8900, -16789, 1, 12]; + public global::java.lang.Short publicShortBox = new global::java.lang.Short(global::java.lang.Short.MIN_VALUE); + public float publicFloat = 0.7f; + public float[] publicFloatArray = [-32.01f, 89.3f, -1.3e8f, 3.1f]; + public global::java.lang.Float publicFloatBox = new global::java.lang.Float(1.377e4f); + public double publicDouble = 1.34e20; + public double[] publicDoubleArray = [0.75e80, 8e-43, 1.000077, 0.123e10]; + public global::java.lang.Double publicDoubleBox = new global::java.lang.Double(1.4e-19); + public char publicChar = 'A'; + public char[] publicCharArray = "Hello Nashorn".ToCharArray(); + public global::java.lang.Character publicCharBox = new global::java.lang.Character('B'); + + // Public static fields + public static string publicStaticString = "PublicStaticString"; + public static string[] publicStaticStringArray = ["StaticArrayString[0]", "StaticArrayString[1]", "StaticArrayString[2]", "StaticArrayString[3]"]; + public static Person publicStaticObject = new Person(512); + public static Person[] publicStaticObjectArray = { new Person(40), new Person(-22), new Person(18) }; + public static bool publicStaticBoolean = true; + public static bool[] publicStaticBooleanArray = { false, false, false, true }; + public static global::java.lang.Boolean publicStaticBooleanBox = new global::java.lang.Boolean(true); + public static long publicStaticLong = 13333333333333333L; + public static long[] publicStaticLongArray = { 19012333333333L, -224355555L, 39777777777L }; + public static global::java.lang.Long publicStaticLongBox = new global::java.lang.Long(9333333334L); + public static int publicStaticInt = 207654323; + public static int[] publicStaticIntArray = { 5, 8, 13, 21, 34 }; + public static global::java.lang.Integer publicStaticIntBox = new global::java.lang.Integer(2075123); + public static byte publicStaticByte = unchecked((byte)-12); + public static byte[] publicStaticByteArray = { 16, 32, 64, 127, unchecked((byte)-128) }; + public static global::java.lang.Byte publicStaticByteBox = new global::java.lang.Byte(17); + public static short publicStaticShort = 320; + public static short[] publicStaticShortArray = { 1240, 900, -1789, 100, 12 }; + public static global::java.lang.Short publicStaticShortBox = new global::java.lang.Short(-16777); + public static float publicStaticFloat = 7.7e8f; + public static float[] publicStaticFloatArray = { -131.01f, 189.3f, -31.3e8f, 3.7f }; + public static global::java.lang.Float publicStaticFloatBox = new global::java.lang.Float(1.37e4f); + public static double publicStaticDouble = 1.341e20; + public static double[] publicStaticDoubleArray = { 0.75e80, 0.123e10, 8e-43, 1.000077 }; + public static global::java.lang.Double publicStaticDoubleBox = new global::java.lang.Double(1.41e-12); + public static char publicStaticChar = 'C'; + public static char[] publicStaticCharArray = "Nashorn".ToCharArray(); + public static global::java.lang.Character publicStaticCharBox = new global::java.lang.Character('D'); + + // Public final fields + public readonly string publicFinalString = "PublicFinalString"; + public readonly string[] publicFinalStringArray = ["FinalArrayString[0]", "FinalArrayString[1]", "FinalArrayString[2]", "FinalArrayString[3]"]; + public readonly Person publicFinalObject = new Person(1024); + public readonly Person[] publicFinalObjectArray = [new Person(-900), new Person(1000), new Person(180)]; + public readonly bool publicFinalBoolean = true; + public readonly bool[] publicFinalBooleanArray = [false, false, true, false]; + public readonly global::java.lang.Boolean publicFinalBooleanBox = new global::java.lang.Boolean(true); + public readonly long publicFinalLong = 13353333333333333L; + public readonly long[] publicFinalLongArray = [1901733333333L, -2247355555L, 3977377777L]; + public readonly global::java.lang.Long publicFinalLongBox = new global::java.lang.Long(9377333334L); + public readonly int publicFinalInt = 20712023; + public readonly int[] publicFinalIntArray = [50, 80, 130, 210, 340]; + public readonly global::java.lang.Integer publicFinalIntBox = new global::java.lang.Integer(207512301); + public readonly byte publicFinalByte = unchecked((byte)-7); + public readonly byte[] publicFinalByteArray = [1, 3, 6, 17, unchecked((byte)-128)]; + public readonly global::java.lang.Byte publicFinalByteBox = new global::java.lang.Byte(19); + public readonly short publicFinalShort = 31220; + public readonly short[] publicFinalShortArray = [12240, 9200, -17289, 1200, 12]; + public readonly global::java.lang.Short publicFinalShortBox = new global::java.lang.Short(-26777); + public readonly float publicFinalFloat = 7.72e8f; + public readonly float[] publicFinalFloatArray = [-131.012f, 189.32f, -31.32e8f, 3.72f]; + public readonly global::java.lang.Float publicFinalFloatBox = new global::java.lang.Float(1.372e4f); + public readonly double publicFinalDouble = 1.3412e20; + public readonly double[] publicFinalDoubleArray = [0.725e80, 0.12e10, 8e-3, 1.00077]; + public readonly global::java.lang.Double publicFinalDoubleBox = new global::java.lang.Double(1.412e-12); + public readonly char publicFinalChar = 'E'; + public readonly char[] publicFinalCharArray = "Nashorn hello".ToCharArray(); + public readonly global::java.lang.Character publicFinalCharBox = new global::java.lang.Character('F'); + + // Public static final fields + public static readonly string publicStaticFinalString = "PublicStaticFinalString"; + public static readonly string[] publicStaticFinalStringArray = ["StaticFinalArrayString[0]", "StaticFinalArrayString[1]", "StaticFinalArrayString[2]", "StaticFinalArrayString[3]"]; + public static readonly Person publicStaticFinalObject = new Person(2048); + public static readonly Person[] publicStaticFinalObjectArray = [new Person(-9), new Person(110), new Person(global::java.lang.Integer.MAX_VALUE)]; + public static readonly bool publicStaticFinalBoolean = true; + public static readonly bool[] publicStaticFinalBooleanArray = [false, true, false, false]; + public static readonly global::java.lang.Boolean publicStaticFinalBooleanBox = new global::java.lang.Boolean(true); + public static readonly long publicStaticFinalLong = 8333333333333L; + public static readonly long[] publicStaticFinalLongArray = [19017383333L, -2247358L, 39773787L]; + public static readonly global::java.lang.Long publicStaticFinalLongBox = new global::java.lang.Long(9377388334L); + public static readonly int publicStaticFinalInt = 207182023; + public static readonly int[] publicStaticFinalIntArray = [1308, 210, 340]; + public static readonly global::java.lang.Integer publicStaticFinalIntBox = new global::java.lang.Integer(2078301); + public static readonly byte publicStaticFinalByte = unchecked((byte)-70); + public static readonly byte[] publicStaticFinalByteArray = [17, unchecked((byte)-128), 81]; + public static readonly global::java.lang.Byte publicStaticFinalByteBox = new global::java.lang.Byte(91); + public static readonly short publicStaticFinalShort = 8888; + public static readonly short[] publicStaticFinalShortArray = [8240, 9280, -1289, 120, 812]; + public static readonly global::java.lang.Short publicStaticFinalShortBox = new global::java.lang.Short(-26); + public static readonly float publicStaticFinalFloat = 0.72e8f; + public static readonly float[] publicStaticFinalFloatArray = [-8131.012f, 9.32f, -138.32e8f, 0.72f]; + public static readonly global::java.lang.Float publicStaticFinalFloatBox = new global::java.lang.Float(1.2e4f); + public static readonly double publicStaticFinalDouble = 1.8e12; + public static readonly double[] publicStaticFinalDoubleArray = [8.725e80, 0.82e10, 18e-3, 1.08077]; + public static readonly global::java.lang.Double publicStaticFinalDoubleBox = new global::java.lang.Double(1.5612e-13); + public static readonly char publicStaticFinalChar = 'K'; + public static readonly char[] publicStaticFinalCharArray = "StaticString".ToCharArray(); + public static readonly global::java.lang.Character publicStaticFinalCharBox = new global::java.lang.Character('L'); + + // Special vars + public volatile bool volatileBoolean = true; + + [NonSerialized] + public bool transientBoolean = true; + + // For methods testing + public bool isAccessed = false; + public volatile bool isFinished = false; + + private ScriptEngine engine; + + public ScriptEngine getEngine() + { + return engine; + } + + public void setEngine(ScriptEngine engine) + { + this.engine = engine; + } + + public void voidMethod() + { + isAccessed = true; + } + + public bool booleanMethod(bool arg) + { + return !arg; + } + + public global::java.lang.Boolean booleanBoxingMethod(global::java.lang.Boolean arg) + { + return new global::java.lang.Boolean(!arg.booleanValue()); + } + + public bool[] booleanArrayMethod(bool[] arg) + { + bool[] res = new bool[arg.Length]; + for (int i = 0; i < arg.Length; i++) + { + res[i] = !arg[i]; + } + return res; + } + + public int intMethod(int arg) + { + return arg + arg; + } + + public global::java.lang.Integer intBoxingMethod(global::java.lang.Integer arg) + { + return new global::java.lang.Integer(arg.intValue() + arg.intValue()); + } + + public int[] intArrayMethod(int[] arg) + { + int[] res = new int[arg.Length]; + for (int i = 0; i < arg.Length; i++) + { + res[i] = arg[i] * 2; + } + return res; + } + + public long longMethod(long arg) + { + return arg + arg; + } + + public global::java.lang.Long longBoxingMethod(global::java.lang.Long arg) + { + return new global::java.lang.Long(arg.longValue() + arg.longValue()); + } + + public long[] longArrayMethod(long[] arg) + { + long[] res = new long[arg.Length]; + for (int i = 0; i < arg.Length; i++) + { + res[i] = arg[i] * 2; + } + return res; + } + + public byte byteMethod(byte arg) + { + return (byte)(arg + arg); + } + + public global::java.lang.Byte byteBoxingMethod(global::java.lang.Byte arg) + { + return new global::java.lang.Byte((byte)(arg.byteValue() + arg.byteValue())); + } + + public byte[] byteArrayMethod(byte[] arg) + { + byte[] res = new byte[arg.Length]; + for (int i = 0; i < arg.Length; i++) + { + res[i] = (byte)(arg[i] * 2); + } + return res; + } + + public char charMethod(char arg) + { + return global::java.lang.Character.toUpperCase(arg); + } + + public global::java.lang.Character charBoxingMethod(global::java.lang.Character arg) + { + return new global::java.lang.Character(global::java.lang.Character.toUpperCase(arg.charValue())); + } + + public char[] charArrayMethod(char[] arg) + { + char[] res = new char[arg.Length]; + for (int i = 0; i < arg.Length; i++) + { + res[i] = global::java.lang.Character.toUpperCase(arg[i]); + } + return res; + } + + public short shortMethod(short arg) + { + return (short)(arg + arg); + } + + public global::java.lang.Short shortBoxingMethod(global::java.lang.Short arg) + { + return new global::java.lang.Short((short)(arg.shortValue() + arg.shortValue())); + } + + public short[] shortArrayMethod(short[] arg) + { + short[] res = new short[arg.Length]; + for (int i = 0; i < arg.Length; i++) + { + res[i] = (short)(arg[i] * 2); + } + return res; + } + + public float floatMethod(float arg) + { + return arg + arg; + } + + public global::java.lang.Float floatBoxingMethod(global::java.lang.Float arg) + { + return new global::java.lang.Float(arg.floatValue() + arg.floatValue()); + } + + public float[] floatArrayMethod(float[] arg) + { + float[] res = new float[arg.Length]; + for (int i = 0; i < arg.Length; i++) + { + res[i] = arg[i] * 2; + } + return res; + } + + public double doubleMethod(double arg) + { + return arg + arg; + } + + public global::java.lang.Double doubleBoxingMethod(global::java.lang.Double arg) + { + return new global::java.lang.Double(arg.doubleValue() + arg.doubleValue()); + } + + public double[] doubleArrayMethod(double[] arg) + { + double[] res = new double[arg.Length]; + for (int i = 0; i < arg.Length; i++) + { + res[i] = arg[i] * 2; + } + return res; + } + + public string stringMethod(string str) + { + return str + str; + } + + public string[] stringArrayMethod(string[] arr) + { + int l = arr.Length; + string[] res = new string[l]; + for (int i = 0; i < l; i++) + { + res[i] = arr[l - i - 1]; + } + return res; + } + + public Person[] objectArrayMethod(Person[] arr) + { + Person[] res = new Person[arr.Length]; + for (int i = 0; i < arr.Length; i++) + { + res[i] = new Person(i + 100); + } + return res; + } + + public Person objectMethod(Person t) + { + t.id *= 2; + return t; + } + + public int twoParamMethod(long l, double d) + { + return (int)(l + d); + } + + public int threeParamMethod(short s, long l, char c) + { + return (int)(s + l + c); + } + + public Person[] twoObjectParamMethod(Person arg1, Person arg2) + { + return new Person[] { arg2, arg1 }; + } + + public Person[] threeObjectParamMethod(Person arg1, Person arg2, Person arg3) + { + return new Person[] { arg3, arg2, arg1 }; + } + + public Person[] eightObjectParamMethod(Person arg1, Person arg2, Person arg3, Person arg4, Person arg5, Person arg6, Person arg7, Person arg8) + { + return new Person[] { arg8, arg7, arg6, arg5, arg4, arg3, arg2, arg1 }; + } + + public Person[] nineObjectParamMethod(Person arg1, Person arg2, Person arg3, Person arg4, Person arg5, Person arg6, Person arg7, Person arg8, Person arg9) + { + return new Person[] { arg9, arg8, arg7, arg6, arg5, arg4, arg3, arg2, arg1 }; + } + + public Person[] methodObjectEllipsis(params Person[] args) + { + int l = args.Length; + Person[] res = new Person[l]; + for (int i = 0; i < l; i++) + { + res[i] = args[l - i - 1]; + } + return res; + } + + public Person[] methodPrimitiveEllipsis(params int[] args) + { + int l = args.Length; + Person[] res = new Person[l]; + for (int i = 0; i < l; i++) + { + res[i] = new Person(args[i]); + } + return res; + } + + public object[] methodMixedEllipsis(params object[] args) + { + return args; + } + + public object[] methodObjectWithEllipsis(string arg, params int[] args) + { + object[] res = new object[args.Length + 1]; + res[0] = arg; + for (int i = 0; i < args.Length; i++) + { + res[i + 1] = args[i]; + } + return res; + } + + public object[] methodPrimitiveWithEllipsis(int arg, params long[] args) + { + object[] res = new object[args.Length + 1]; + res[0] = arg; + for (int i = 0; i < args.Length; i++) + { + res[i + 1] = args[i]; + } + return res; + } + + public object[] methodMixedWithEllipsis(string arg1, int arg2, params object[] args) + { + object[] res = new object[args.Length + 2]; + res[0] = arg1; + res[1] = arg2; + global::java.lang.System.arraycopy(args, 0, res, 2, args.Length); + return res; + } + + public void methodStartsThread() + { + isFinished = false; + + global::java.lang.Thread t = new global::java.lang.Thread(new IKVM.Java.Extensions.java.lang.DelegateRunnable(() => + { + try + { + global::java.lang.Thread.sleep(1000); + isFinished = true; + } + catch (global::java.lang.InterruptedException e) + { + e.printStackTrace(); + } + })); + + t.start(); + } + + public string overloadedMethodDoubleVSint(int arg) + { + return "int"; + } + + public string overloadedMethodDoubleVSint(double arg) + { + return "double"; + } + + public int overloadedMethod(int arg) + { + return arg * 2; + } + + public int overloadedMethod(string arg) + { + return arg.Length; + } + + public int overloadedMethod(bool arg) + { + return (arg) ? 1 : 0; + } + + public int overloadedMethod(Person arg) + { + return arg.id * 2; + } + + public int firstLevelMethodInt(int arg) + { + return (int)((Invocable)engine).invokeFunction("secondLevelMethodInt", arg); + } + + public int thirdLevelMethodInt(int arg) + { + return arg * 5; + } + + public int firstLevelMethodInteger(global::java.lang.Integer arg) + { + return (int)((Invocable)engine).invokeFunction("secondLevelMethodInteger", arg); + } + + public int thirdLevelMethodInteger(global::java.lang.Integer arg) + { + return arg.intValue() * 10; + } + + public Person firstLevelMethodObject(Person p) + { + return (Person)((Invocable)engine).invokeFunction("secondLevelMethodObject", p); + } + + public Person thirdLevelMethodObject(Person p) + { + p.id *= 10; + return p; + } + + } + +} \ No newline at end of file From 91c3f3242bb3c43da7089bb8b1060eec2179e815 Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Sat, 13 Jul 2024 14:39:15 -0500 Subject: [PATCH 08/14] Trigger TargetsTriggeredByCompilation in _CoreCompile so it only runs when needed. Use JetBrains RefAssembler thing to turn IKVM.Java ref into real ref. Remove BreakIterator stuff. --- IKVM.deps.targets | 2 +- IKVM.refs.targets | 4 +- .../IKVM.Java.runtime.linux.csproj | 2 +- .../IKVM.Java.runtime.osx.csproj | 2 +- src/IKVM.Java/IKVM.Java.csproj | 18 + src/IKVM.Java/IKVM.Java.runtime.jdk.props | 490 +++++++++--------- .../targets/IKVM.Java.Core.NoTasks.targets | 2 + .../targets/IKVM.Java.Core.Tasks.targets | 2 + .../targets/IKVM.Java.Core.targets | 2 +- 9 files changed, 274 insertions(+), 250 deletions(-) diff --git a/IKVM.deps.targets b/IKVM.deps.targets index 90d32e6c3..1f8b2cd8b 100644 --- a/IKVM.deps.targets +++ b/IKVM.deps.targets @@ -12,7 +12,7 @@ - + diff --git a/IKVM.refs.targets b/IKVM.refs.targets index b7f57fc24..31fbb71fa 100644 --- a/IKVM.refs.targets +++ b/IKVM.refs.targets @@ -33,14 +33,14 @@ IkvmJavaItem win - + false False all IkvmJavaItem linux - + false False all diff --git a/src/IKVM.Java.runtime.linux/IKVM.Java.runtime.linux.csproj b/src/IKVM.Java.runtime.linux/IKVM.Java.runtime.linux.csproj index 04840cb4c..de4dc3acd 100644 --- a/src/IKVM.Java.runtime.linux/IKVM.Java.runtime.linux.csproj +++ b/src/IKVM.Java.runtime.linux/IKVM.Java.runtime.linux.csproj @@ -2,7 +2,7 @@ - net472;net6.0;net8.0 + net6.0;net8.0 IKVM.Java.runtime.linux linux diff --git a/src/IKVM.Java.runtime.osx/IKVM.Java.runtime.osx.csproj b/src/IKVM.Java.runtime.osx/IKVM.Java.runtime.osx.csproj index 34c26082b..caa18872f 100644 --- a/src/IKVM.Java.runtime.osx/IKVM.Java.runtime.osx.csproj +++ b/src/IKVM.Java.runtime.osx/IKVM.Java.runtime.osx.csproj @@ -2,7 +2,7 @@ - net472;net6.0;net8.0 + net6.0;net8.0 IKVM.Java.runtime.osx osx diff --git a/src/IKVM.Java/IKVM.Java.csproj b/src/IKVM.Java/IKVM.Java.csproj index 3f4fba07c..c983c0141 100644 --- a/src/IKVM.Java/IKVM.Java.csproj +++ b/src/IKVM.Java/IKVM.Java.csproj @@ -5,9 +5,27 @@ net472;net6.0;net8.0 IKVM.Java ref + none + + + + + all + all + true + + + + + $(TargetsTriggeredByCompilation);ConvertRefAssembly + + + + + diff --git a/src/IKVM.Java/IKVM.Java.runtime.jdk.props b/src/IKVM.Java/IKVM.Java.runtime.jdk.props index c992522c4..fcc957803 100644 --- a/src/IKVM.Java/IKVM.Java.runtime.jdk.props +++ b/src/IKVM.Java/IKVM.Java.runtime.jdk.props @@ -12,263 +12,265 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + @@ -341,14 +343,14 @@ - - - - - - - - + + + + + + + + diff --git a/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets b/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets index 8ef5d2891..d652bfdc7 100644 --- a/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets +++ b/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets @@ -336,6 +336,8 @@ Value = b.ToString(); + + diff --git a/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.Tasks.targets b/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.Tasks.targets index 3c91ca25f..f0106ab7b 100644 --- a/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.Tasks.targets +++ b/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.Tasks.targets @@ -149,6 +149,8 @@ + + \ No newline at end of file diff --git a/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.targets b/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.targets index 4ecd78d8f..9a80c4533 100644 --- a/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.targets +++ b/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.targets @@ -204,7 +204,7 @@ Files = files.ToArray(); - + From a826651fa34bc39a841fc101f06b76192596c931 Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Sun, 14 Jul 2024 09:06:25 -0500 Subject: [PATCH 09/14] Use new target. --- src/IKVM.Java/IKVM.Java.csproj | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/IKVM.Java/IKVM.Java.csproj b/src/IKVM.Java/IKVM.Java.csproj index 9acef14b0..95d8b6512 100644 --- a/src/IKVM.Java/IKVM.Java.csproj +++ b/src/IKVM.Java/IKVM.Java.csproj @@ -40,9 +40,4 @@ - - - - - From cceae27713b6cbc7f305ce74d099b8557c099200 Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Sun, 14 Jul 2024 09:08:25 -0500 Subject: [PATCH 10/14] Use new target. --- src/IKVM.Java/IKVM.Java.csproj | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/IKVM.Java/IKVM.Java.csproj b/src/IKVM.Java/IKVM.Java.csproj index 95d8b6512..4a566f1bd 100644 --- a/src/IKVM.Java/IKVM.Java.csproj +++ b/src/IKVM.Java/IKVM.Java.csproj @@ -5,18 +5,6 @@ net472;net6.0;net8.0 IKVM.Java ref - none - - - - - all - all - true - - - - false none $(TargetsTriggeredByCompilation);ConvertRefAssembly From adcd3ac45a5bac42ab70937c8104fce9d556e5b5 Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Sun, 14 Jul 2024 19:57:48 -0500 Subject: [PATCH 11/14] Disable TaskHostFactory on Core. Unsure if this is the cause of our issues. --- src/IKVM.MSBuild/buildTransitive/IKVM.MSBuild.Tasks.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/IKVM.MSBuild/buildTransitive/IKVM.MSBuild.Tasks.targets b/src/IKVM.MSBuild/buildTransitive/IKVM.MSBuild.Tasks.targets index de9b02d22..7ef638cf4 100644 --- a/src/IKVM.MSBuild/buildTransitive/IKVM.MSBuild.Tasks.targets +++ b/src/IKVM.MSBuild/buildTransitive/IKVM.MSBuild.Tasks.targets @@ -7,7 +7,7 @@ $([System.Runtime.InteropServices.RuntimeInformation]:: FrameworkDescription.ToString()) net6.0 net472 - TaskHostFactory + TaskHostFactory $(MSBuildThisFileDirectory)..\tasks\$(IkvmMSBuildTaskFolder)\IKVM.MSBuild.Tasks.dll @(IkvmCompilerToolPath->WithMetadataValue('TargetFramework', '$(IkvmToolFramework)')->WithMetadataValue('RuntimeIdentifier', '$(IkvmToolRuntime)')) From a6c48f7b1fa8388c5606b4d968795616f81519e0 Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Sun, 14 Jul 2024 19:58:23 -0500 Subject: [PATCH 12/14] Set NUGET_PACKAGES env variable to empty. --- src/IKVM.NET.Sdk.Tests/ProjectTests.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/IKVM.NET.Sdk.Tests/ProjectTests.cs b/src/IKVM.NET.Sdk.Tests/ProjectTests.cs index 4be669bb5..92c349780 100644 --- a/src/IKVM.NET.Sdk.Tests/ProjectTests.cs +++ b/src/IKVM.NET.Sdk.Tests/ProjectTests.cs @@ -108,6 +108,7 @@ public static void Init(TestContext context) var analyzer = manager.GetProject(Path.Combine(TestRoot, "Exe", "ProjectExe.msbuildproj")); analyzer.AddBuildLogger(new TargetLogger(context)); analyzer.AddBinaryLogger(Path.Combine(WorkRoot, "msbuild.binlog")); + analyzer.SetEnvironmentVariable("NUGET_PACKAGES", ""); analyzer.SetGlobalProperty("ImportDirectoryBuildProps", "false"); analyzer.SetGlobalProperty("ImportDirectoryBuildTargets", "false"); analyzer.SetGlobalProperty("IkvmCacheDir", IkvmCachePath + Path.DirectorySeparatorChar); @@ -231,6 +232,7 @@ public void CanBuildTestProject(EnvironmentPreference env, string tfm, string ri var analyzer = manager.GetProject(Path.Combine(@"Project", "Exe", "ProjectExe.msbuildproj")); analyzer.AddBuildLogger(new TargetLogger(TestContext)); analyzer.AddBinaryLogger(Path.Combine(WorkRoot, $"{env}-{tfm}-{rid}-msbuild.binlog")); + analyzer.SetEnvironmentVariable("NUGET_PACKAGES", ""); analyzer.SetGlobalProperty("ImportDirectoryBuildProps", "false"); analyzer.SetGlobalProperty("ImportDirectoryBuildTargets", "false"); analyzer.SetGlobalProperty("IkvmCacheDir", IkvmCachePath + Path.DirectorySeparatorChar); From 37ae076ce6deec54cf69b0f906885243394c2ded Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Sun, 14 Jul 2024 20:02:40 -0500 Subject: [PATCH 13/14] Fix missing output files for X11 gen. --- src/IKVM.Java/IKVM.Java.runtime.jdk.targets | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/IKVM.Java/IKVM.Java.runtime.jdk.targets b/src/IKVM.Java/IKVM.Java.runtime.jdk.targets index 48e88c17b..17d541999 100644 --- a/src/IKVM.Java/IKVM.Java.runtime.jdk.targets +++ b/src/IKVM.Java/IKVM.Java.runtime.jdk.targets @@ -1244,9 +1244,10 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN $(OpenJdkDir)jdk\src\solaris\classes\sun\awt\X11\generator\xlibtypes.txt $(OpenJdkDir)jdk\src\solaris\classes\sun\awt\X11\generator\sizes.32 $(OpenJdkDir)jdk\src\solaris\classes\sun\awt\X11\generator\sizes.64 + $(X11WrapperOutputPath)stamp - + @@ -1269,7 +1270,7 @@ File.WriteAllLines(Path, File.ReadAllLines(Path).TakeWhile(i => i.Contains("#BIN - + From a2994d48ac2123c93137d87d244d0557d55d3684 Mon Sep 17 00:00:00 2001 From: Jerome Haltom Date: Mon, 15 Jul 2024 10:47:19 -0500 Subject: [PATCH 14/14] Move version.properties to proper sub dir. Add missing service file. --- src/IKVM.Java/IKVM.Java.runtime.nashorn.props | 5 +++-- .../nashorn/internal/runtime/resources}/.gitignore | 0 .../internal/runtime/resources}/version.properties.tt | 0 3 files changed, 3 insertions(+), 2 deletions(-) rename src/IKVM.Java/local/{nashorn => jdk/nashorn/internal/runtime/resources}/.gitignore (100%) rename src/IKVM.Java/local/{nashorn => jdk/nashorn/internal/runtime/resources}/version.properties.tt (100%) diff --git a/src/IKVM.Java/IKVM.Java.runtime.nashorn.props b/src/IKVM.Java/IKVM.Java.runtime.nashorn.props index 750ac8189..01fbd2806 100644 --- a/src/IKVM.Java/IKVM.Java.runtime.nashorn.props +++ b/src/IKVM.Java/IKVM.Java.runtime.nashorn.props @@ -14,11 +14,12 @@ + - - + + diff --git a/src/IKVM.Java/local/nashorn/.gitignore b/src/IKVM.Java/local/jdk/nashorn/internal/runtime/resources/.gitignore similarity index 100% rename from src/IKVM.Java/local/nashorn/.gitignore rename to src/IKVM.Java/local/jdk/nashorn/internal/runtime/resources/.gitignore diff --git a/src/IKVM.Java/local/nashorn/version.properties.tt b/src/IKVM.Java/local/jdk/nashorn/internal/runtime/resources/version.properties.tt similarity index 100% rename from src/IKVM.Java/local/nashorn/version.properties.tt rename to src/IKVM.Java/local/jdk/nashorn/internal/runtime/resources/version.properties.tt