LUCENE-9978: Integrate Luke with the binary release package.

This commit is contained in:
Dawid Weiss 2021-10-24 13:01:35 +02:00
parent 39d388330c
commit 627ef4d469
6 changed files with 66 additions and 49 deletions

View File

@ -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")) {
jars
jarsTestFramework
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.

View File

@ -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/:
The following sub-folders are included in the binary Lucene distribution:
* `core/lucene-core-XX.jar`:
The compiled core Lucene library.
* `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`

View File

@ -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
ENDLOCAL

View File

@ -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.luke

View File

@ -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) {

View File

@ -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() {}
}