Skip to content

Apache Lucene open-source search software

Experiments with the new apis.

Dawid Weiss68cf86ba35f1
diff --git a/gradle/documentation/render-javadoc.gradle b/gradle/documentation/render-javadoc.gradle
index d0e756a13c3..f592b97edf1 100644
--- a/gradle/documentation/render-javadoc.gradle
+++ b/gradle/documentation/render-javadoc.gradle
@@ -445,8 +445,8 @@ class RenderJavadocTask extends DefaultTask {
def javadocCmd = {
if (executable == null) {
- JavaInstallationRegistry registry = project.extensions.getByType(JavaInstallationRegistry)
- JavaInstallation currentJvm = registry.installationForCurrentVirtualMachine.get()
+ //JavaInstallationRegistry registry = project.extensions.getByType(JavaInstallationRegistry)
+ //JavaInstallation currentJvm = registry.installationForCurrentVirtualMachine.get()
return currentJvm.jdk.get().javadocExecutable.asFile
} else {
return project.file(executable)
diff --git a/gradle/testing/alternative-jdk-support.gradle b/gradle/testing/alternative-jdk-support.gradle
index 2b252afe3f0..b6b603ef45c 100644
--- a/gradle/testing/alternative-jdk-support.gradle
+++ b/gradle/testing/alternative-jdk-support.gradle
@@ -1,3 +1,8 @@
+import org.gradle.internal.jvm.Jvm
+import org.gradle.internal.jvm.inspection.JvmMetadataDetector
+import org.gradle.jvm.toolchain.internal.JavaInstallationRegistry
+import org.gradle.jvm.toolchain.internal.JavaToolchainQueryService
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -18,6 +23,47 @@
// This adds support for compiling and testing against a different Java runtime.
// This is the only way to build against JVMs not yet supported by Gradle itself.
+// Set up root project's property.
+rootProject.ext.runtimeJava = null
+rootProject.ext.runtimeJavaVersion = null
+
+def home = Jvm.current().javaHome
+def otherHome = file("c:\\Tools\\java\\jdk13")
+def spec = new org.gradle.jvm.toolchain.internal.SpecificInstallationToolchainSpec(objects, otherHome)
+
+JavaInstallationRegistry installationRegistry = project.services.get(JavaInstallationRegistry)
+JvmMetadataDetector jvmDetector = project.services.get(JvmMetadataDetector)
+JavaToolchainService toolchainService = project.extensions.getByType(JavaToolchainService)
+
+installationRegistry.listInstallations().each {inst ->
+ println "# " + inst.source + " " + inst.location
+ println " " + jvmDetector.getMetadata(inst.location).languageVersion
+}
+
+JavaVersion runtimeVersion = Jvm.current().javaVersion
+
+configure(project(":lucene:core"), {
+ plugins.withType(JavaPlugin) {
+ java {
+ toolchain {
+ languageVersion = JavaLanguageVersion.of(11)
+ }
+ }
+
+ task foo {
+ doFirst {
+ logger.lifecycle("runtime.version: " + runtimeVersion)
+ logger.lifecycle("toolchain: " + java.toolchain.displayName + " " + project.path)
+ logger.lifecycle("compiler: " + toolchainService.launcherFor(java.toolchain).get().executablePath)
+ logger.lifecycle("compiler2: " +
+ toolchainService.launcherFor(spec).get().executablePath)
+ }
+ }
+ }
+})
+
+
+/*
JavaInstallationRegistry registry = extensions.getByType(JavaInstallationRegistry)
JavaInstallation currentJvm = registry.installationForCurrentVirtualMachine.get()
@@ -75,3 +121,4 @@ if (!currentJvm.javaExecutable.equals(altJvm.javaExecutable)) {
}
}
}
+*/
\ No newline at end of file
diff --git a/lucene/misc/native/build.gradle b/lucene/misc/native/build.gradle
index 2e75a653908..a443c3d47d4 100644
--- a/lucene/misc/native/build.gradle
+++ b/lucene/misc/native/build.gradle
@@ -41,7 +41,8 @@ library {
}
tasks.withType(CppCompile).configureEach {
- def javaHome = rootProject.ext.runtimeJava.getInstallationDirectory().getAsFile().getPath()
+ // TODO: this should use the default java toolchain, not runtime's
+ def javaHome = null // rootProject.ext.runtimeJava.getInstallationDirectory().getAsFile().getPath()
// Assume standard openjdk layout. This means only one architecture-specific include folder
// is present.