Apache Lucene open-source search software
LUCENE-9978: Integrate Luke with the binary release package.
Dawid Weiss627ef4d46997
diff --git a/lucene/distribution/binary-release.gradle b/lucene/distribution/binary-release.gradleindex 041f8623ef5..ddfdb25595d 100644--- a/lucene/distribution/binary-release.gradle+++ b/lucene/distribution/binary-release.gradle@@ -15,6 +15,7 @@* limitations under the License.*/+import org.apache.tools.ant.filters.ExpandProperties// Configure Lucene's binary release. This is a bit convoluted so is placed// in a separate script.@@ -28,6 +29,9 @@ configure(project(":lucene:distribution")) {jarsjarsTestFramework+ jarsThirdParty++ log4j}dependencies { DependencyHandler handler ->@@ -37,13 +41,11 @@ configure(project(":lucene:distribution")) {// (with a few exceptions explicitly filtered below).// We don't copy their transitive dependencies.def binaryModules = rootProject.ext.mavenProjects.findAll { p -> !(p in [- // Will end up in a separate binary- project(":lucene:luke"),- // Placed in a separate module folder.+ // Placed in a separate folder (module layer conflicts).project(":lucene:test-framework"),]) }for (Project module : binaryModules) {- jars(project(path: module.path), {+ jars(module, {transitive = false})}@@ -53,6 +55,19 @@ configure(project(":lucene:distribution")) {jarsTestFramework(project(":lucene:test-framework"), {transitive = false})++ // The third-party JARs consist of all the transitive dependencies from these modules.+ // Not sure whether we have to include all the thirdparty JARs from across all the modules.+ for (Project module : [+ project(":lucene:luke")+ ]) {+ jarsThirdParty(module, {+ transitive = true+ })+ }++ // Just to collect the version.+ log4j "org.apache.logging.log4j:log4j-api"}@@ -70,8 +85,19 @@ configure(project(":lucene:distribution")) {copy.setMode(0755)}- // Attach binary release exclusive files.+ // Attach binary release - only files.++ // We need to substitute log4j jar name because it's a proper module (for luke)+ // and is otherwise invisible.+ dependsOn configurations.log4j+ def antPrj = new org.apache.tools.ant.Project()+ doFirst {+ antPrj.setProperty("log4j.api.jar", configurations.log4j.singleFile.name)+ }+from(file("src/binary-release"), {+ filteringCharset = 'UTF-8'+ filter(ExpandProperties, project: antPrj)})// Cherry-pick certain files from the root.@@ -86,7 +112,6 @@ configure(project(":lucene:distribution")) {include "JRE_VERSION_MIGRATION.md"include "MIGRATE.md"include "SYSTEM_REQUIREMENTS.md"-include "licenses/*"})@@ -95,12 +120,17 @@ configure(project(":lucene:distribution")) {into 'docs'})- // Binary artifacts from modules.+ // Binary modules (Lucene).from(configurations.jars, {- into 'jars'+ into 'modules'})from(configurations.jarsTestFramework, {- into 'test-framework'+ into 'modules-test-framework'+ })++ // Binary modules (with dependencies). Don't duplicate project artifacts.+ from((configurations.jarsThirdParty - configurations.jars), {+ into 'modules-thirdparty'})// Internal archive folder for all files.diff --git a/lucene/distribution/src/binary-release/README.md b/lucene/distribution/src/binary-release/README.mdindex f4efffccfc2..bb09f59b697 100644--- a/lucene/distribution/src/binary-release/README.md+++ b/lucene/distribution/src/binary-release/README.md@@ -29,10 +29,16 @@ and an API that can easily be used to add search capabilities to applications.## Files in a binary distribution-Files are organized by module, for example in core/:--* `core/lucene-core-XX.jar`:- The compiled core Lucene library.+The following sub-folders are included in the binary Lucene distribution:++* `bin/`:+ Convenience scripts to launch Lucene Luke and other index-maintenance tools.+* `modules/`:+ All binary Lucene Java modules (JARs).+* `modules-thirdparty/`+ Third-party binary modules required to run Lucene Luke.+* `licenses/`+ Third-party licenses and notice files.To review the documentation, read the main documentation page, located at:`docs/index.html`diff --git a/lucene/luke/bin/luke.bat b/lucene/distribution/src/binary-release/bin/luke.cmdsimilarity index 64%rename from lucene/luke/bin/luke.batrename to lucene/distribution/src/binary-release/bin/luke.cmdindex 2f3fc9757b8..a718460ca3c 100644--- a/lucene/luke/bin/luke.bat+++ b/lucene/distribution/src/binary-release/bin/luke.cmd@@ -14,15 +14,8 @@@rem limitations under the License.@echo off-@setlocal enabledelayedexpansion-cd /d %~dp0--set JAVA_OPTIONS=%JAVA_OPTIONS% -Xmx1024m -Xms512m -XX:MaxMetaspaceSize=256m--set CLASSPATHS=.\*;.\lib\*;..\core\*;..\codecs\*;..\backward-codecs\*;..\queries\*;..\queryparser\*;..\suggest\*;..\misc\*-for /d %%A in (..\analysis\*) do (- set "CLASSPATHS=!CLASSPATHS!;%%A\*;%%A\lib\*"-)--start javaw -cp %CLASSPATHS% %JAVA_OPTIONS% org.apache.lucene.luke.app.desktop.LukeMain+SETLOCAL+SET MODULES=%~dp0..+start javaw --module-path %MODULES%\modules;%MODULES%\modules-thirdparty -cp %MODULES%\modules-thirdparty\${log4j.api.jar} --module lucene.luke+ENDLOCALdiff --git a/lucene/luke/bin/luke.sh b/lucene/distribution/src/binary-release/bin/luke.shold mode 100755new mode 100644similarity index 58%rename from lucene/luke/bin/luke.shrename to lucene/distribution/src/binary-release/bin/luke.shindex 814eefb7536..d372b42a861--- a/lucene/luke/bin/luke.sh+++ b/lucene/distribution/src/binary-release/bin/luke.sh@@ -15,19 +15,5 @@# See the License for the specific language governing permissions and# limitations under the License.-LUKE_HOME=$(cd $(dirname $0) && pwd)-cd ${LUKE_HOME}--JAVA_OPTIONS="${JAVA_OPTIONS} -Xmx1024m -Xms512m -XX:MaxMetaspaceSize=256m"--CLASSPATHS="./*:./lib/*:../core/*:../codecs/*:../backward-codecs/*:../queries/*:../queryparser/*:../suggest/*:../misc/*"-for dir in `ls ../analysis`; do- CLASSPATHS="${CLASSPATHS}:../analysis/${dir}/*:../analysis/${dir}/lib/*"-done--LOG_DIR=${HOME}/.luke.d/- if [[ ! -d ${LOG_DIR} ]]; then- mkdir ${LOG_DIR}- fi--nohup java -cp ${CLASSPATHS} ${JAVA_OPTIONS} org.apache.lucene.luke.app.desktop.LukeMain > ${LOG_DIR}/luke_out.log 2>&1 &+MODULES=$(cd $(dirname $0) && pwd)+java --module-path $MODULES/modules;$MODULES/modules-thirdparty -cp $MODULES/modules-thirdparty/${log4j.api.jar} --module lucene.lukediff --git a/lucene/luke/build.gradle b/lucene/luke/build.gradleindex 5f6e1635375..760e8392699 100644--- a/lucene/luke/build.gradle+++ b/lucene/luke/build.gradle@@ -57,13 +57,6 @@ tasks.withType(Jar) {}}-// Configure the default JAR without any class path information-// (this may actually be wrong - perhaps we should add the-// "distribution" paths here.-jar {- manifest {- }-}// Configure "stand-alone" JAR with proper dependency classpath links.task standaloneJar(type: Jar) {diff --git a/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/util/MessageUtils.java b/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/util/MessageUtils.javaindex f8fd192eb77..2afb62b754a 100644--- a/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/util/MessageUtils.java+++ b/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/util/MessageUtils.java@@ -56,9 +56,18 @@ public class MessageUtils {}};- private static ResourceBundle bundle =- ResourceBundle.getBundle(- MESSAGE_BUNDLE_BASENAME, Locale.ENGLISH, UTF8_RESOURCEBUNDLE_CONTROL);+ private static ResourceBundle bundle;++ static {+ Class<?> self = MessageUtils.class;+ if (self.getModule().isNamed()) {+ bundle = ResourceBundle.getBundle(MESSAGE_BUNDLE_BASENAME, Locale.ENGLISH, self.getModule());+ } else {+ bundle =+ ResourceBundle.getBundle(+ MESSAGE_BUNDLE_BASENAME, Locale.ENGLISH, UTF8_RESOURCEBUNDLE_CONTROL);+ }+ }private MessageUtils() {}}