LUCENE-10234: Change module prefix to org.apache.* (#487)

This commit is contained in:
Dawid Weiss 2021-11-30 22:03:33 +01:00 committed by GitHub
parent 5d18596d3d
commit 20cb6817db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 47 additions and 10 deletions

View File

@ -1,3 +1,6 @@
import java.util.jar.JarFile
import java.util.regex.Matcher
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -47,8 +50,7 @@ subprojects {
}
}
manifest {
attributes([
def manifestAttrs = [
"Extension-Name" : implementationTitle,
"Implementation-Vendor" : "The Apache Software Foundation",
@ -64,10 +66,17 @@ subprojects {
"X-Compile-Target-JDK" : "${-> project.targetCompatibility}",
"X-Build-JDK" : "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})",
"X-Build-OS" : "${System.properties['os.name']} ${System.properties['os.arch']} ${System.properties['os.version']}",
"X-Build-OS" : "${System.properties['os.name']} ${System.properties['os.arch']} ${System.properties['os.version']}"
]
"Automatic-Module-Name" : "${-> project.path.replaceFirst(":", "").replace(':', '.').replace("-", "_")}"
])
// Only apply automatic module name to jar task.
if (task.name in ["jar"]) {
manifestAttrs["Automatic-Module-Name"] =
"${-> project.path.replaceFirst(/^:lucene/, Matcher.quoteReplacement(project.group)).replace(':', '.').replace('-', '_')}"
}
manifest {
attributes(manifestAttrs)
}
// Copy legalese into META-INF.
@ -79,3 +88,29 @@ subprojects {
}
}
}
configure(rootProject) {
tasks.register("showModuleNames", { showModuleTask ->
def allJarTasks = []
rootProject.subprojects.each { subproject ->
subproject.tasks.matching { it.name == 'jar' }.all {
allJarTasks.add it
}
}
dependsOn allJarTasks
doFirst {
allJarTasks.each { jarTask ->
File jarFile = jarTask.outputs.files.singleFile
try (def jar = new JarFile(jarFile)) {
logger.lifecycle(String.format(Locale.ROOT,
"%-50s -> %s",
jarFile.name,
jar.manifest.mainAttributes.getValue("Automatic-Module-Name")))
}
}
}
})
}

View File

@ -254,7 +254,9 @@ API Changes
Improvements
---------------------
* LUCENE-10234: Added Automatic-Module-Name to all JARs. (Dawid Weiss)
* LUCENE-10234: Added Automatic-Module-Name to all JARs. This is the first step to enable full Java
module system (JMS) support in later Lucene versions. At the moment, the automatic names should
not be considered stable. (Dawid Weiss, Uwe Schindler)
* LUCENE-10182: TestRamUsageEstimator used RamUsageTester.sizeOf throughout, making some of the
tests trivial. Now, it compares results from RamUsageEstimator with those from RamUsageTester.

View File

@ -17,5 +17,5 @@
SETLOCAL
SET MODULES=%~dp0..
start javaw --module-path "%MODULES%\modules;%MODULES%\modules-thirdparty" --add-modules org.apache.logging.log4j --module lucene.luke
start javaw --module-path "%MODULES%\modules;%MODULES%\modules-thirdparty" --add-modules org.apache.logging.log4j --module org.apache.lucene.luke
ENDLOCAL

View File

@ -17,4 +17,4 @@
MODULES=`dirname "$0"`/..
MODULES=`cd "$MODULES" && pwd`
java --module-path "$MODULES/modules:$MODULES/modules-thirdparty" --add-modules org.apache.logging.log4j --module lucene.luke
java --module-path "$MODULES/modules:$MODULES/modules-thirdparty" --add-modules org.apache.logging.log4j --module org.apache.lucene.luke

View File

@ -27,7 +27,7 @@ java -jar ${luke.cmd}
or, using Java modules:
```
java --module-path . --add-modules org.apache.logging.log4j --module lucene.luke
java --module-path . --add-modules org.apache.logging.log4j --module org.apache.lucene.luke
```
Happy index hacking!