Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Java.Interop needs JDK-17 support first!
  • Loading branch information
jonpryor committed May 12, 2023
1 parent 33f1e37 commit 2734074
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
branch = main
[submodule "external/Java.Interop"]
path = external/Java.Interop
url = https://github.com/xamarin/java.interop.git
branch = main
url = https://github.com/jonpryor/java.interop.git
branch = jonp-allow-jdk-17
[submodule "external/lz4"]
path = external/lz4
url = https://github.com/lz4/lz4.git
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
8 changes: 7 additions & 1 deletion build-tools/scripts/DotNet.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@
/>
</Target>
<Target Name="PrepareJavaInterop">
<ItemGroup>
<_JIPrepArg Include="&quot;-p:Jdks8Root=$(Java8SdkDirectory)&quot;" />
<_JIPrepArg Include="&quot;-p:Jdks11Root=$(JavaSdkDirectory)&quot;" />
<_JIPrepArg Include="&quot;-p:DotnetToolPath=$(DotNetPreviewTool)&quot;" />
<_JIPrepArg Include="&quot;-bl:$(_BinlogPathPrefix)-prepare-java-interop.binlog&quot;" />
</ItemGroup>
<Exec
Command="&quot;$(DotNetPreviewTool)&quot; build -t:Prepare Java.Interop.sln -c $(Configuration) -p:JdksRoot=$(JavaSdkDirectory) -p:DotnetToolPath=$(DotNetPreviewTool) -bl:$(_BinlogPathPrefix)-prepare-java-interop.binlog"
Command="&quot;$(DotNetPreviewTool)&quot; build -t:Prepare Java.Interop.sln -c $(Configuration) @(_JIPrepArg, ' ')"
WorkingDirectory="$(_Root)external\Java.Interop"
/>
</Target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ void GenerateShellConfig (Context context, StreamWriter sw)
AddReplacements (commonReplacements, hostRuntimeReplacements);

string monodroidObjDir = Path.Combine (Configurables.Paths.MonodroidSourceDir, "obj", context.Configuration);
string jdkInfoPropsPath = Path.Combine (Configurables.Paths.ExternalJavaInteropDir, "bin", $"Build{context.Configuration}", "JdkInfo.props");
string jdkInfoPropsPath = Path.Combine (Configurables.Paths.ExternalJavaInteropDir, "bin", $"Build{context.Configuration}", "JdkInfo-11.props");

sw.WriteLine ("# This is a bash(1) script");
sw.WriteLine ();
sw.WriteLine ($"CMAKE=\"{context.Properties.GetRequiredValue(KnownProperties.CMakePath)}\"");
sw.WriteLine ($"JDK_INCLUDE_PATH=\"$(grep JdkIncludePath {jdkInfoPropsPath} | cut -d '\"' -f 2 | tr '\\n' ' ')\"");
sw.WriteLine ($"JDK_INCLUDE_PATH=\"$(grep Jdk11IncludePath {jdkInfoPropsPath} | cut -d '\"' -f 2 | tr '\\n' ' ')\"");
sw.WriteLine ($"MONO_SOURCE_PATH=\"{Configurables.Paths.MonoSourceFullPath}\"");
sw.WriteLine ($"MONODROID_OBJ_DIR=\"{monodroidObjDir}\"");
sw.WriteLine ($"MONODROID_SOURCE_DIR=\"{Configurables.Paths.MonodroidSourceDir}\"");
Expand Down Expand Up @@ -341,7 +341,7 @@ void GenerateMonodroidTargets (Context context, StreamWriter sw)

var hostRuntimeReplacements = new Dictionary<string, string> (StringComparer.Ordinal) {
{ "@CmakeHostFlags@", "%(_HostRuntime.CmakeFlags)" },
{ "@JdkIncludePath@", "@(JdkIncludePath->'%(Identity)', ' ')" },
{ "@JdkIncludePath@", "@(Jdk11IncludePath->'%(Identity)', ' ')" },
{ "@OUTPUT_DIRECTORY@", "" },
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static partial class Defaults
public static readonly string BinutilsVersion = Configurables.BinutilsVersion;
public static readonly char[] PropertyListSeparator = new [] { ':' };

public static readonly string JdkFolder = "jdk-11";
public static readonly string JdkFolder = "jdk-17";

public static readonly Version MicrosoftOpenJDK11Version = new Version (Configurables.MicrosoftOpenJDK11Version);
public static readonly Version MicrosoftOpenJDK11Release = new Version (Configurables.MicrosoftOpenJDK11Release);
Expand Down Expand Up @@ -307,7 +307,7 @@ public static partial class Paths
public static string OpenJDK8InstallDir => GetCachedPath (ref openJDK8InstallDir, () => Path.Combine (ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainDirectory), "jdk-1.8"));
public static string OpenJDK8CacheDir => GetCachedPath (ref openJDK8CacheDir, () => ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainCacheDirectory));

public static string OpenJDK11InstallDir => GetCachedPath (ref openJDK11InstallDir, () => Path.Combine (ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainDirectory), "jdk-11"));
public static string OpenJDK11InstallDir => GetCachedPath (ref openJDK11InstallDir, () => Path.Combine (ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainDirectory), Defaults.JdkFolder));
public static string OpenJDK11CacheDir => GetCachedPath (ref openJDK11CacheDir, () => ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainCacheDirectory));
// bundle
public static string BCLTestsArchiveName = "bcl-tests.zip";
Expand Down
2 changes: 1 addition & 1 deletion external/Java.Interop
Submodule Java.Interop updated 28 files
+3 −3 Configuration.Override.props.in
+3 −3 Directory.Build.props
+2 −2 Documentation/BuildConfiguration.md
+9 −2 build-tools/Java.Interop.BootstrapTasks/Java.Interop.BootstrapTasks/JdkInfo.cs
+1 −1 build-tools/gradle/gradle/wrapper/gradle-wrapper.properties
+4 −2 build-tools/scripts/Prepare.targets
+1 −0 src/Java.Base/Java.Base.csproj
+1 −0 src/Java.Base/Java.Base.targets
+14 −0 src/Java.Base/Java.Lang/Class.cs
+16 −0 src/Java.Base/Java.Lang/Double.cs
+16 −0 src/Java.Base/Java.Lang/Float.cs
+16 −0 src/Java.Base/Java.Lang/Integer.cs
+16 −0 src/Java.Base/Java.Lang/Long.cs
+20 −0 src/Java.Base/Java.Lang/String.cs
+19 −0 src/Java.Base/Transforms/Metadata.xml
+2 −2 src/Java.Interop/Java.Interop.targets
+1 −1 src/java-interop/java-interop.targets
+2 −2 tests/Java.Base-Tests/Java.Base-Tests.targets
+2 −2 tests/Java.Interop-PerformanceTests/Java.Interop-PerformanceTests.targets
+2 −2 tests/Java.Interop-Tests/Java.Interop-Tests.targets
+2 −2 tests/Java.Interop.Export-Tests/Java.Interop.Export-Tests.csproj
+1 −1 tests/NativeTiming/NativeTiming.targets
+2 −2 tests/TestJVM/TestJVM.cs
+2 −2 tests/Xamarin.Android.Tools.Bytecode-Tests/ConfiguredJdkInfo.cs
+2 −2 tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.targets
+3 −2 tools/java-source-utils/build.gradle
+1 −1 tools/java-source-utils/java-source-utils.targets
+0 −2 tools/java-source-utils/src/test/java/com/microsoft/android/JavaSourceUtilsOptionsTest.java
1 change: 1 addition & 0 deletions external/Java.Interop.override.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<XamarinAndroidToolsDirectory>$(MSBuildThisFileDirectory)xamarin-android-tools</XamarinAndroidToolsDirectory>
<Jdks11MaxVersion>17.99.0</Jdks11MaxVersion>
</PropertyGroup>

</Project>
8 changes: 4 additions & 4 deletions src/manifestmerger/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repositories {

dependencies {
// https://mvnrepository.com/artifact/com.android.tools.build/manifest-merger
compile group: 'com.android.tools.build', name: 'manifest-merger', version: '30.3.1'
implementation 'com.android.tools.build:manifest-merger:30.3.1'
}

sourceSets {
Expand All @@ -36,10 +36,10 @@ jar {
attributes 'Main-Class': 'com.xamarin.manifestmerger.Main'
}
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
} {
// Exclude native jnidispatch content to simplify installer signing and notarization
exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA', 'com/sun/jna/**/*jnidispatch*'
}
archiveName 'manifestmerger.jar'
}
archiveFileName.set('manifestmerger.jar')
}
5 changes: 4 additions & 1 deletion src/monodroid/monodroid.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\external\Java.Interop\bin\Build$(Configuration)\JdkInfo.props" Condition="Exists('..\..\external\Java.Interop\bin\Build$(Configuration)\JdkInfo.props')"/>
<Import
Project="..\..\external\Java.Interop\bin\Build$(Configuration)\JdkInfo-11.props"
Condition="Exists('..\..\external\Java.Interop\bin\Build$(Configuration)\JdkInfo-11.props')"
/>
<Import Project="..\..\bin\Build$(Configuration)\cmake-config.props" Condition="Exists('..\..\bin\Build$(Configuration)\cmake-config.props')" />
<Import Project="monodroid.projitems" />
<UsingTask AssemblyFile="$(BootstrapTasksAssembly)" TaskName="Xamarin.Android.Tools.BootstrapTasks.GenerateMonoDroidIncludes" />
Expand Down
8 changes: 4 additions & 4 deletions src/r8/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repositories {
}

dependencies {
compile group: 'com.android.tools', name: 'r8', version: '8.0.40'
implementation 'com.android.tools:r8:8.0.40'
}

jar {
Expand All @@ -24,7 +24,7 @@ jar {
attributes 'Main-Class': 'com.android.tools.r8.R8'
}
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
archiveName 'r8.jar'
}
archiveFileName.set('r8.jar')
}

0 comments on commit 2734074

Please sign in to comment.