2023-03-09 15:27:31 -05:00
|
|
|
/*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership.
|
|
|
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
* (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
def resources = scriptResources(buildscript)
|
|
|
|
|
2023-05-25 02:59:50 -04:00
|
|
|
configure(rootProject) {
|
|
|
|
ext {
|
|
|
|
// also change this in extractor tool: ExtractForeignAPI
|
2024-02-09 17:02:42 -05:00
|
|
|
vectorIncubatorJavaVersions = [ JavaVersion.VERSION_20, JavaVersion.VERSION_21, JavaVersion.VERSION_22 ] as Set
|
2023-05-25 02:59:50 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-09 15:27:31 -05:00
|
|
|
configure(project(":lucene:core")) {
|
|
|
|
ext {
|
2023-09-21 04:42:20 -04:00
|
|
|
apijars = layout.projectDirectory.dir("src/generated/jdk")
|
2023-06-12 15:07:04 -04:00
|
|
|
mrjarJavaVersions = [ 19, 20, 21 ]
|
2023-03-09 15:27:31 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
configurations {
|
|
|
|
apiextractor
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
apiextractor "org.ow2.asm:asm:${scriptDepVersions['asm']}"
|
|
|
|
}
|
|
|
|
|
2023-10-12 07:22:48 -04:00
|
|
|
mrjarJavaVersions.each { jdkVersion ->
|
2023-05-25 02:59:50 -04:00
|
|
|
def task = tasks.create(name: "generateJdkApiJar${jdkVersion}", type: JavaExec) {
|
|
|
|
description "Regenerate the API-only JAR file with public Panama Foreign & Vector API from JDK ${jdkVersion}"
|
2023-03-09 15:27:31 -05:00
|
|
|
group "generation"
|
|
|
|
|
|
|
|
javaLauncher = javaToolchains.launcherFor {
|
|
|
|
languageVersion = JavaLanguageVersion.of(jdkVersion)
|
|
|
|
}
|
|
|
|
|
|
|
|
onlyIf {
|
|
|
|
try {
|
|
|
|
javaLauncher.get()
|
|
|
|
return true
|
|
|
|
} catch (Exception e) {
|
2023-05-25 02:59:50 -04:00
|
|
|
logger.warn('Launcher for Java {} is not available; skipping regeneration of Panama Foreign & Vector API JAR.', jdkVersion)
|
2023-03-09 15:27:31 -05:00
|
|
|
logger.warn('Error: {}', e.cause?.message)
|
|
|
|
logger.warn("Please make sure to point env 'JAVA{}_HOME' to exactly JDK version {} or enable Gradle toolchain auto-download.", jdkVersion, jdkVersion)
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
2023-05-25 02:59:50 -04:00
|
|
|
|
2023-03-09 15:27:31 -05:00
|
|
|
classpath = configurations.apiextractor
|
2023-05-25 02:59:50 -04:00
|
|
|
mainClass = file("${resources}/ExtractJdkApis.java") as String
|
2023-05-19 12:42:55 -04:00
|
|
|
systemProperties = [
|
2023-12-12 09:00:01 -05:00
|
|
|
'user.timezone': 'UTC',
|
|
|
|
'file.encoding': 'UTF-8',
|
2023-05-19 12:42:55 -04:00
|
|
|
]
|
2023-03-09 15:27:31 -05:00
|
|
|
args = [
|
|
|
|
jdkVersion,
|
2023-09-21 04:42:20 -04:00
|
|
|
apijars.file("jdk${jdkVersion}.apijar"),
|
2023-03-09 15:27:31 -05:00
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
regenerate.dependsOn task
|
|
|
|
}
|
|
|
|
}
|