diff --git a/dev-tools/scripts/buildAndPushRelease.py b/dev-tools/scripts/buildAndPushRelease.py index b96ec30dd25..e47edd80bd7 100755 --- a/dev-tools/scripts/buildAndPushRelease.py +++ b/dev-tools/scripts/buildAndPushRelease.py @@ -84,15 +84,8 @@ def getGitRev(): status = os.popen('git status').read().strip() if 'nothing to commit, working directory clean' not in status and 'nothing to commit, working tree clean' not in status: raise RuntimeError('git clone is dirty:\n\n%s' % status) - branch = os.popen('git rev-parse --abbrev-ref HEAD').read().strip() - command = 'git log origin/%s..' % branch - p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - stdout, stderr = p.communicate() - if len(stdout.strip()) > 0: - raise RuntimeError('There are unpushed commits - "%s" output is:\n\n%s' % (command, stdout.decode('utf-8'))) - if len(stderr.strip()) > 0: - raise RuntimeError('Command "%s" failed:\n\n%s' % (command, stderr.decode('utf-8'))) - + if 'Your branch is ahead of' in status: + raise RuntimeError('Your local branch is ahead of the remote? git status says:\n%s' % status) print(' git clone is clean') else: print(' Ignoring dirty git clone due to dev-mode') diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.py index 24aee7089b6..999a15303b4 100755 --- a/dev-tools/scripts/smokeTestRelease.py +++ b/dev-tools/scripts/smokeTestRelease.py @@ -574,7 +574,6 @@ def verifyUnpacked(java, artifact, unpackPath, gitRevision, version, testArgs): # raise RuntimeError('lucene: file "%s" is missing from artifact %s' % (fileName, artifact)) # in_root_folder.remove(fileName) - # TODO: clean this up to not be a list of modules that we must maintain expected_folders = ['analysis', 'backward-codecs', 'benchmark', 'classification', 'codecs', 'core', 'demo', 'expressions', 'facet', 'grouping', 'highlighter', 'join', 'luke', 'memory', 'misc', 'monitor', 'queries', 'queryparser', 'replicator', @@ -589,8 +588,7 @@ def verifyUnpacked(java, artifact, unpackPath, gitRevision, version, testArgs): if len(in_lucene_folder) > 0: raise RuntimeError('lucene: unexpected files/dirs in artifact %s lucene/ folder: %s' % (artifact, in_lucene_folder)) else: - is_in_list(in_root_folder, expected_folders) - is_in_list(in_root_folder, ['docs']) + is_in_list(in_root_folder, ['bin', 'docs', 'licenses', 'modules', 'modules-test-framework', 'modules-thirdparty']) if len(in_root_folder) > 0: raise RuntimeError('lucene: unexpected files/dirs in artifact %s: %s' % (artifact, in_root_folder)) @@ -648,21 +646,26 @@ def testDemo(run_java, isSrc, version, jdk): print(' test demo with %s...' % jdk) sep = ';' if cygwin else ':' if isSrc: + # For source release, use the classpath for each module. classPath = ['lucene/core/build/libs/lucene-core-%s.jar' % version, 'lucene/demo/build/libs/lucene-demo-%s.jar' % version, 'lucene/analysis/common/build/libs/lucene-analyzers-common-%s.jar' % version, 'lucene/queryparser/build/libs/lucene-queryparser-%s.jar' % version] cp = sep.join(classPath) docsDir = 'lucene/core/src' + checkIndexCmd = 'java -ea -cp "%s" org.apache.lucene.index.CheckIndex index' % cp + indexFilesCmd = 'java -cp "%s" -Dsmoketester=true org.apache.lucene.demo.IndexFiles -index index -docs %s' % (cp, docsDir) + searchFilesCmd = 'java -cp "%s" org.apache.lucene.demo.SearchFiles -index index -query lucene' % cp else: - classPath = ['core/lucene-core-%s.jar' % version, - 'demo/lucene-demo-%s.jar' % version, - 'analysis/common/lucene-analyzers-common-%s.jar' % version, - 'queryparser/lucene-queryparser-%s.jar' % version] - cp = sep.join(classPath) + # For binary release, set up classpath as modules. + cp = "--module-path modules" docsDir = 'docs' - run_java('java -cp "%s" -Dsmoketester=true org.apache.lucene.demo.IndexFiles -index index -docs %s' % (cp, docsDir), 'index.log') - run_java('java -cp "%s" org.apache.lucene.demo.SearchFiles -index index -query lucene' % cp, 'search.log') + checkIndexCmd = 'java -ea %s --module lucene.core/org.apache.lucene.index.CheckIndex index' % cp + indexFilesCmd = 'java -Dsmoketester=true %s --module lucene.demo/org.apache.lucene.demo.IndexFiles -index index -docs %s' % (cp, docsDir) + searchFilesCmd = 'java %s --module lucene.demo/org.apache.lucene.demo.SearchFiles -index index -query lucene' % cp + + run_java(indexFilesCmd, 'index.log') + run_java(searchFilesCmd, 'search.log') reMatchingDocs = re.compile('(\d+) total matching documents') m = reMatchingDocs.search(open('search.log', encoding='UTF-8').read()) if m is None: @@ -672,8 +675,9 @@ def testDemo(run_java, isSrc, version, jdk): if numHits < 100: raise RuntimeError('lucene demo\'s SearchFiles found too few results: %s' % numHits) print(' got %d hits for query "lucene"' % numHits) + print(' checkindex with %s...' % jdk) - run_java('java -ea -cp "%s" org.apache.lucene.index.CheckIndex index' % cp, 'checkindex.log') + run_java(checkIndexCmd, 'checkindex.log') s = open('checkindex.log').read() m = re.search(r'^\s+version=(.*?)$', s, re.MULTILINE) if m is None: diff --git a/gradle/validation/jar-checks.gradle b/gradle/validation/jar-checks.gradle index 27bd4873575..9741656d2b0 100644 --- a/gradle/validation/jar-checks.gradle +++ b/gradle/validation/jar-checks.gradle @@ -45,6 +45,7 @@ def licenseTypes = [ "MIT" : [name: "Massachusetts Institute of Tech. License", noticeOptional: true], "MPL" : [name: "Mozilla Public License", noticeOptional: true /* NOT SURE on the required notice */], "PD" : [name: "Public Domain", noticeOptional: true], + "PDDL" : [name: "Public Domain Dedication and License", noticeOptional: true], "SUN" : [name: "Sun Open Source License", noticeOptional: true], "COMPOUND": [name: "Compound license (details in NOTICE file)."], ] @@ -311,7 +312,7 @@ configure(project(":lucene")) { // Used by Luke. "elegant-icon-font-*", // glove knn dictionary. - "pddl-10.txt", + "glove-LICENSE-PDDL.txt", ] } diff --git a/lucene/demo/src/java/org/apache/lucene/demo/knn/package-info.java b/lucene/demo/src/java/org/apache/lucene/demo/knn/package-info.java index 86206bab011..0b7f4176d5c 100644 --- a/lucene/demo/src/java/org/apache/lucene/demo/knn/package-info.java +++ b/lucene/demo/src/java/org/apache/lucene/demo/knn/package-info.java @@ -18,9 +18,8 @@ /** * KnnVector example code. * - *
The vector dictionary used in the demo is taken from the GloVe project hosted at - * https://nlp.stanford.edu/projects/glove, whose data is in the public domain, as described by - * http://opendatacommons.org/licenses/pddl/1.0, available in the Lucene distribution as - * lucene/licenses/pddl-10.txt. + *
The vector dictionary used in the demo is taken from the GloVe project, whose data is in the public domain. */ package org.apache.lucene.demo.knn; diff --git a/lucene/distribution/binary-artifacts.gradle b/lucene/distribution/binary-artifacts.gradle deleted file mode 100644 index 15d83cd8dd3..00000000000 --- a/lucene/distribution/binary-artifacts.gradle +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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. - */ - -// Configure binary distribution content defaults for each subproject. - -configure(rootProject.ext.mavenProjects) { - plugins.withType(JavaPlugin) { - ext { - binaryArtifactsDir = file("${buildDir}/binaryArtifacts") - } - - configurations { - // All of the module's "binary" artifacts that should go to the release. - binaryArtifacts - - // Legacy binary distribution contains Lucene artifacts (JARs) and their dependencies - // under 'lib/'. We have to go through some hoops to split the artifact from all of its - // transitive dependencies and separate their output location. - transitiveDependencies { - // All of runtime elements - extendsFrom runtimeElements - // Exclude cross-module dependencies - exclude group: "org.apache.lucene" - // Exclude the following from all projects, if they appear. - exclude group: "commons-logging" - exclude group: "org.slf4j" - } - } - - task assembleBinaryArtifacts(type: Sync) { - from(tasks.findByName("jar")) - - from(projectDir, { - include "README.*" - }) - - from(configurations.transitiveDependencies, { - into "lib/" - }) - - into binaryArtifactsDir - } - - artifacts { - binaryArtifacts binaryArtifactsDir, { - builtBy assembleBinaryArtifacts - } - } - } -} - - -// Add launch scripts for Luke. -configure(project(":lucene:luke")) { - tasks.matching { it.name == "assembleBinaryArtifacts" }.all { - from("${projectDir}/bin", { - }) - } -} diff --git a/lucene/distribution/binary-release.gradle b/lucene/distribution/binary-release.gradle index 31bb7e21b86..c06bb1a8777 100644 --- a/lucene/distribution/binary-release.gradle +++ b/lucene/distribution/binary-release.gradle @@ -15,41 +15,52 @@ * limitations under the License. */ - // Configure Lucene's binary release. This is a bit convoluted so is placed // in a separate script. configure(project(":lucene:distribution")) { def packageBaseName = "${buildDir}/packages/lucene-${version}" - // All the maven-published projects are part of the binary distribution. - def includeInBinaries = rootProject.ext.mavenProjects - - // Legacy binary distribution contains Lucene artifacts (JARs) and their dependencies - // under 'lib/'. We have to go through some hoops to split the artifact from all of its - // transitive dependencies and separate their output location. - def moduleArtifactConfigurations = [] - for (Project module : includeInBinaries) { - def binaryArtifactsConfiguration = configurations.create("binary-artifacts" + module.path.replace(':', '-')) - - dependencies { DependencyHandler handler -> - handler.add(binaryArtifactsConfiguration.name, project(path: module.path, configuration: "binaryArtifacts")) - } - - moduleArtifactConfigurations += [ - "module": module, - "binaryArtifactsConfiguration": binaryArtifactsConfiguration - ] - } - - - // Prepare site documentation dependency for inclusion. + // Prepare site documentation dependency for inclusion. configurations { docs + + jars + jarsTestFramework + jarsThirdParty } - dependencies { + dependencies { DependencyHandler handler -> docs project(path: ':lucene:documentation', configuration: 'site') + + // Maven-published submodule JARs are part of the binary distribution + // (with a few exceptions explicitly filtered below). + // We don't copy their transitive dependencies. + def binaryModules = rootProject.ext.mavenProjects.findAll { p -> !(p in [ + // Placed in a separate folder (module layer conflicts). + project(":lucene:test-framework"), + ]) } + for (Project module : binaryModules) { + jars(module, { + transitive = false + }) + } + + // The test framework has split packages and breaks the module system layer so + // it's in a separate folder. + 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 + }) + } } @@ -67,8 +78,9 @@ configure(project(":lucene:distribution")) { copy.setMode(0755) } - // Attach binary release exclusive files. + // Attach binary release - only files. from(file("src/binary-release"), { + filteringCharset = 'UTF-8' }) // Cherry-pick certain files from the root. @@ -83,7 +95,6 @@ configure(project(":lucene:distribution")) { include "JRE_VERSION_MIGRATION.md" include "MIGRATE.md" include "SYSTEM_REQUIREMENTS.md" - include "licenses/*" }) @@ -92,14 +103,18 @@ configure(project(":lucene:distribution")) { into 'docs' }) - // Each module's binary artifacts and their dependencies. - moduleArtifactConfigurations.each { - def toPath = it.module.path.replaceFirst("^:lucene:", "").replace(':', '/') + // Binary modules (Lucene). + from(configurations.jars, { + into 'modules' + }) + from(configurations.jarsTestFramework, { + into 'modules-test-framework' + }) - from(it.binaryArtifactsConfiguration, { - into toPath - }) - } + // Binary modules (with dependencies). Don't duplicate project artifacts. + from((configurations.jarsThirdParty - configurations.jars), { + into 'modules-thirdparty' + }) // Internal archive folder for all files. into "lucene-${rootProject.version}/" diff --git a/lucene/distribution/build.gradle b/lucene/distribution/build.gradle index 2778720e020..1cd0ba21dcc 100644 --- a/lucene/distribution/build.gradle +++ b/lucene/distribution/build.gradle @@ -37,7 +37,6 @@ ext { apply from: buildscript.sourceFile.toPath().resolveSibling("source-release.gradle") // Prepare the "binary" distribution artifact. -apply from: buildscript.sourceFile.toPath().resolveSibling("binary-artifacts.gradle") apply from: buildscript.sourceFile.toPath().resolveSibling("binary-release.gradle") // Configure maven artifact collection to a local build folder (required to collect artifacts for the release). diff --git a/lucene/distribution/src/binary-release/README.md b/lucene/distribution/src/binary-release/README.md index 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/: +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` diff --git a/lucene/luke/bin/luke.bat b/lucene/distribution/src/binary-release/bin/luke.cmd similarity index 64% rename from lucene/luke/bin/luke.bat rename to lucene/distribution/src/binary-release/bin/luke.cmd index 2f3fc9757b8..26f75776bc1 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 --add-modules org.apache.logging.log4j --module lucene.luke +ENDLOCAL diff --git a/lucene/luke/bin/luke.sh b/lucene/distribution/src/binary-release/bin/luke.sh old mode 100755 new mode 100644 similarity index 58% rename from lucene/luke/bin/luke.sh rename to lucene/distribution/src/binary-release/bin/luke.sh index 814eefb7536..9d870885437 --- 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 --add-modules org.apache.logging.log4j --module lucene.luke diff --git a/lucene/licenses/pddl-10.txt b/lucene/licenses/glove-LICENSE-PDDL.txt similarity index 98% rename from lucene/licenses/pddl-10.txt rename to lucene/licenses/glove-LICENSE-PDDL.txt index 679f7e5a2e1..c390d3f382c 100644 --- a/lucene/licenses/pddl-10.txt +++ b/lucene/licenses/glove-LICENSE-PDDL.txt @@ -1,208 +1,211 @@ -Public Domain Dedication and License (PDDL) - - -Preamble - - -The Open Data Commons – Public Domain Dedication and Licence is a document intended to allow you to freely share, modify, and use this work for any purpose and without any restrictions. This licence is intended for use on databases or their contents (“data”), either together or individually. - - -Many databases are covered by copyright. Some jurisdictions, mainly in Europe, have specific special rights that cover databases called the “sui generis” database right. Both of these sets of rights, as well as other legal rights used to protect databases and data, can create uncertainty or practical difficulty for those wishing to share databases and their underlying data but retain a limited amount of rights under a “some rights reserved” approach to licensing as outlined in the Science Commons Protocol for Implementing Open Access Data. As a result, this waiver and licence tries to the fullest extent possible to eliminate or fully license any rights that cover this database and data. Any Community Norms or similar statements of use of the database or data do not form a part of this document, and do not act as a contract for access or other terms of use for the database or data. - - -The position of the recipient of the work - - -Because this document places the database and its contents in or as close as possible within the public domain, there are no restrictions or requirements placed on the recipient by this document. Recipients may use this work commercially, use technical protection measures, combine this data or database with other databases or data, and share their changes and additions or keep them secret. It is not a requirement that recipients provide further users with a copy of this licence or attribute the original creator of the data or database as a source. The goal is to eliminate restrictions held by the original creator of the data and database on the use of it by others. - - -The position of the dedicator of the work - - -Copyright law, as with most other law under the banner of “intellectual property”, is inherently national law. This means that there exists several differences in how copyright and other IP rights can be relinquished, waived or licensed in the many legal jurisdictions of the world. This is despite much harmonisation of minimum levels of protection. The internet and other communication technologies span these many disparate legal jurisdictions and thus pose special difficulties for a document relinquishing and waiving intellectual property rights, including copyright and database rights, for use by the global community. Because of this feature of intellectual property law, this document first relinquishes the rights and waives the relevant rights and claims. It then goes on to license these same rights for jurisdictions or areas of law that may make it difficult to relinquish or waive rights or claims. - - -The purpose of this document is to enable rightsholders to place their work into the public domain. Unlike licences for free and open source software, free cultural works, or open content licences, rightsholders will not be able to “dual license” their work by releasing the same work under different licences. This is because they have allowed anyone to use the work in whatever way they choose. Rightsholders therefore can’t re-license it under copyright or database rights on different terms because they have nothing left to license. Doing so creates truly accessible data to build rich applications and advance the progress of science and the arts. - - -This document can cover either or both of the database and its contents (the data). Because databases can have a wide variety of content – not just factual data – rightsholders should use the Open Data Commons – Public Domain Dedication & Licence for an entire database and its contents only if everything can be placed under the terms of this document. Because even factual data can sometimes have intellectual property rights, rightsholders should use this licence to cover both the database and its factual data when making material available under this document; even if it is likely that the data would not be covered by copyright or database rights. - - -Rightsholders can also use this document to cover any copyright or database rights claims over only a database, and leave the contents to be covered by other licences or documents. They can do this because this document refers to the “Work”, which can be either – or both – the database and its contents. As a result, rightsholders need to clearly state what they are dedicating under this document when they dedicate it. - - -Just like any licence or other document dealing with intellectual property, rightsholders should be aware that one can only license what one owns. Please ensure that the rights have been cleared to make this material available under this document. - - -This document permanently and irrevocably makes the Work available to the public for any use of any kind, and it should not be used unless the rightsholder is prepared for this to happen. - - -Part I: Introduction - - -The Rightsholder (the Person holding rights or claims over the Work) agrees as follows: - - -1.0 Definitions of Capitalised Words - - -“Copyright” – Includes rights under copyright and under neighbouring rights and similarly related sets of rights under the law of the relevant jurisdiction under Section 6.4. - - -“Data” – The contents of the Database, which includes the information, independent works, or other material collected into the Database offered under the terms of this Document. - - -“Database” – A collection of Data arranged in a systematic or methodical way and individually accessible by electronic or other means offered under the terms of this Document. - - -“Database Right” – Means rights over Data resulting from the Chapter III (“sui generis”) rights in the Database Directive (Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases) and any future updates as well as any similar rights available in the relevant jurisdiction under Section 6.4. - - -“Document” – means this relinquishment and waiver of rights and claims and back up licence agreement. - - -“Person” – Means a natural or legal person or a body of persons corporate or incorporate. - - -“Use” – As a verb, means doing any act that is restricted by Copyright or Database Rights whether in the original medium or any other; and includes modifying the Work as may be technically necessary to use it in a different mode or format. This includes the right to sublicense the Work. - - -“Work” – Means either or both of the Database and Data offered under the terms of this Document. - - -“You” – the Person acquiring rights under the licence elements of this Document. - - -Words in the singular include the plural and vice versa. - - -2.0 What this document covers - - -2.1. Legal effect of this Document. This Document is: - - - a. A dedication to the public domain and waiver of Copyright and Database Rights over the Work; and - - - b. A licence of Copyright and Database Rights over the Work in jurisdictions that do not allow for relinquishment or waiver. - - -2.2. Legal rights covered. - - - a. Copyright. Any copyright or neighbouring rights in the Work. Copyright law varies between jurisdictions, but is likely to cover: the Database model or schema, which is the structure, arrangement, and organisation of the Database, and can also include the Database tables and table indexes; the data entry and output sheets; and the Field names of Data stored in the Database. Copyright may also cover the Data depending on the jurisdiction and type of Data; and - - - b. Database Rights. Database Rights only extend to the extraction and re-utilisation of the whole or a substantial part of the Data. Database Rights can apply even when there is no copyright over the Database. Database Rights can also apply when the Data is removed from the Database and is selected and arranged in a way that would not infringe any applicable copyright. - - -2.2 Rights not covered. - - - a. This Document does not apply to computer programs used in the making or operation of the Database; - - - b. This Document does not cover any patents over the Data or the Database. Please see Section 4.2 later in this Document for further details; and - - - c. This Document does not cover any trade marks associated with the Database. Please see Section 4.3 later in this Document for further details. - - -Users of this Database are cautioned that they may have to clear other rights or consult other licences. - - -2.3 Facts are free. The Rightsholder takes the position that factual information is not covered by Copyright. This Document however covers the Work in jurisdictions that may protect the factual information in the Work by Copyright, and to cover any information protected by Copyright that is contained in the Work. - - -Part II: Dedication to the public domain - - -3.0 Dedication, waiver, and licence of Copyright and Database Rights - - -3.1 Dedication of Copyright and Database Rights to the public domain. The Rightsholder by using this Document, dedicates the Work to the public domain for the benefit of the public and relinquishes all rights in Copyright and Database Rights over the Work. - - -a. The Rightsholder realises that once these rights are relinquished, that the Rightsholder has no further rights in Copyright and Database Rights over the Work, and that the Work is free and open for others to Use. - - -b. The Rightsholder intends for their relinquishment to cover all present and future rights in the Work under Copyright and Database Rights, whether they are vested or contingent rights, and that this relinquishment of rights covers all their heirs and successors. - - -The above relinquishment of rights applies worldwide and includes media and formats now known or created in the future. - - -3.2 Waiver of rights and claims in Copyright and Database Rights when Section 3.1 dedication inapplicable. If the dedication in Section 3.1 does not apply in the relevant jurisdiction under Section 6.4, the Rightsholder waives any rights and claims that the Rightsholder may have or acquire in the future over the Work in: - - -a. Copyright; and - - -b. Database Rights. - - -To the extent possible in the relevant jurisdiction, the above waiver of rights and claims applies worldwide and includes media and formats now known or created in the future. The Rightsholder agrees not to assert the above rights and waives the right to enforce them over the Work. - - -3.3 Licence of Copyright and Database Rights when Sections 3.1 and 3.2 inapplicable. If the dedication and waiver in Sections 3.1 and 3.2 does not apply in the relevant jurisdiction under Section 6.4, the Rightsholder and You agree as follows: - - -a. The Licensor grants to You a worldwide, royalty-free, non-exclusive, licence to Use the Work for the duration of any applicable Copyright and Database Rights. These rights explicitly include commercial use, and do not exclude any field of endeavour. To the extent possible in the relevant jurisdiction, these rights may be exercised in all media and formats whether now known or created in the future. - - -3.4 Moral rights. This section covers moral rights, including the right to be identified as the author of the Work or to object to treatment that would otherwise prejudice the author’s honour and reputation, or any other derogatory treatment: - - -a. For jurisdictions allowing waiver of moral rights, Licensor waives all moral rights that Licensor may have in the Work to the fullest extent possible by the law of the relevant jurisdiction under Section 6.4; - - -b. If waiver of moral rights under Section 3.4 a in the relevant jurisdiction is not possible, Licensor agrees not to assert any moral rights over the Work and waives all claims in moral rights to the fullest extent possible by the law of the relevant jurisdiction under Section 6.4; and - - -c. For jurisdictions not allowing waiver or an agreement not to assert moral rights under Section 3.4 a and b, the author may retain their moral rights over the copyrighted aspects of the Work. - - -Please note that some jurisdictions do not allow for the waiver of moral rights, and so moral rights may still subsist over the work in some jurisdictions. - - -4.0 Relationship to other rights - - -4.1 No other contractual conditions. The Rightsholder makes this Work available to You without any other contractual obligations, either express or implied. Any Community Norms statement associated with the Work is not a contract and does not form part of this Document. - - -4.2 Relationship to patents. This Document does not grant You a licence for any patents that the Rightsholder may own. Users of this Database are cautioned that they may have to clear other rights or consult other licences. - - -4.3 Relationship to trade marks. This Document does not grant You a licence for any trade marks that the Rightsholder may own or that the Rightsholder may use to cover the Work. Users of this Database are cautioned that they may have to clear other rights or consult other licences. - - -Part III: General provisions - - -5.0 Warranties, disclaimer, and limitation of liability - - -5.1 The Work is provided by the Rightsholder “as is” and without any warranty of any kind, either express or implied, whether of title, of accuracy or completeness, of the presence of absence of errors, of fitness for purpose, or otherwise. Some jurisdictions do not allow the exclusion of implied warranties, so this exclusion may not apply to You. - - -5.2 Subject to any liability that may not be excluded or limited by law, the Rightsholder is not liable for, and expressly excludes, all liability for loss or damage however and whenever caused to anyone by any use under this Document, whether by You or by anyone else, and whether caused by any fault on the part of the Rightsholder or not. This exclusion of liability includes, but is not limited to, any special, incidental, consequential, punitive, or exemplary damages. This exclusion applies even if the Rightsholder has been advised of the possibility of such damages. - - -5.3 If liability may not be excluded by law, it is limited to actual and direct financial loss to the extent it is caused by proved negligence on the part of the Rightsholder. - - -6.0 General - - -6.1 If any provision of this Document is held to be invalid or unenforceable, that must not affect the validity or enforceability of the remainder of the terms of this Document. - - -6.2 This Document is the entire agreement between the parties with respect to the Work covered here. It replaces any earlier understandings, agreements or representations with respect to the Work not specified here. - - -6.3 This Document does not affect any rights that You or anyone else may independently have under any applicable law to make any use of this Work, including (for jurisdictions where this Document is a licence) fair dealing, fair use, database exceptions, or any other legally recognised limitation or exception to infringement of copyright or other applicable laws. - - +This license applies to knn-token-vectors resource in Lucene demo. +https://nlp.stanford.edu/projects/glove + +Public Domain Dedication and License (PDDL) + + +Preamble + + +The Open Data Commons – Public Domain Dedication and Licence is a document intended to allow you to freely share, modify, and use this work for any purpose and without any restrictions. This licence is intended for use on databases or their contents (“data”), either together or individually. + + +Many databases are covered by copyright. Some jurisdictions, mainly in Europe, have specific special rights that cover databases called the “sui generis” database right. Both of these sets of rights, as well as other legal rights used to protect databases and data, can create uncertainty or practical difficulty for those wishing to share databases and their underlying data but retain a limited amount of rights under a “some rights reserved” approach to licensing as outlined in the Science Commons Protocol for Implementing Open Access Data. As a result, this waiver and licence tries to the fullest extent possible to eliminate or fully license any rights that cover this database and data. Any Community Norms or similar statements of use of the database or data do not form a part of this document, and do not act as a contract for access or other terms of use for the database or data. + + +The position of the recipient of the work + + +Because this document places the database and its contents in or as close as possible within the public domain, there are no restrictions or requirements placed on the recipient by this document. Recipients may use this work commercially, use technical protection measures, combine this data or database with other databases or data, and share their changes and additions or keep them secret. It is not a requirement that recipients provide further users with a copy of this licence or attribute the original creator of the data or database as a source. The goal is to eliminate restrictions held by the original creator of the data and database on the use of it by others. + + +The position of the dedicator of the work + + +Copyright law, as with most other law under the banner of “intellectual property”, is inherently national law. This means that there exists several differences in how copyright and other IP rights can be relinquished, waived or licensed in the many legal jurisdictions of the world. This is despite much harmonisation of minimum levels of protection. The internet and other communication technologies span these many disparate legal jurisdictions and thus pose special difficulties for a document relinquishing and waiving intellectual property rights, including copyright and database rights, for use by the global community. Because of this feature of intellectual property law, this document first relinquishes the rights and waives the relevant rights and claims. It then goes on to license these same rights for jurisdictions or areas of law that may make it difficult to relinquish or waive rights or claims. + + +The purpose of this document is to enable rightsholders to place their work into the public domain. Unlike licences for free and open source software, free cultural works, or open content licences, rightsholders will not be able to “dual license” their work by releasing the same work under different licences. This is because they have allowed anyone to use the work in whatever way they choose. Rightsholders therefore can’t re-license it under copyright or database rights on different terms because they have nothing left to license. Doing so creates truly accessible data to build rich applications and advance the progress of science and the arts. + + +This document can cover either or both of the database and its contents (the data). Because databases can have a wide variety of content – not just factual data – rightsholders should use the Open Data Commons – Public Domain Dedication & Licence for an entire database and its contents only if everything can be placed under the terms of this document. Because even factual data can sometimes have intellectual property rights, rightsholders should use this licence to cover both the database and its factual data when making material available under this document; even if it is likely that the data would not be covered by copyright or database rights. + + +Rightsholders can also use this document to cover any copyright or database rights claims over only a database, and leave the contents to be covered by other licences or documents. They can do this because this document refers to the “Work”, which can be either – or both – the database and its contents. As a result, rightsholders need to clearly state what they are dedicating under this document when they dedicate it. + + +Just like any licence or other document dealing with intellectual property, rightsholders should be aware that one can only license what one owns. Please ensure that the rights have been cleared to make this material available under this document. + + +This document permanently and irrevocably makes the Work available to the public for any use of any kind, and it should not be used unless the rightsholder is prepared for this to happen. + + +Part I: Introduction + + +The Rightsholder (the Person holding rights or claims over the Work) agrees as follows: + + +1.0 Definitions of Capitalised Words + + +“Copyright” – Includes rights under copyright and under neighbouring rights and similarly related sets of rights under the law of the relevant jurisdiction under Section 6.4. + + +“Data” – The contents of the Database, which includes the information, independent works, or other material collected into the Database offered under the terms of this Document. + + +“Database” – A collection of Data arranged in a systematic or methodical way and individually accessible by electronic or other means offered under the terms of this Document. + + +“Database Right” – Means rights over Data resulting from the Chapter III (“sui generis”) rights in the Database Directive (Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases) and any future updates as well as any similar rights available in the relevant jurisdiction under Section 6.4. + + +“Document” – means this relinquishment and waiver of rights and claims and back up licence agreement. + + +“Person” – Means a natural or legal person or a body of persons corporate or incorporate. + + +“Use” – As a verb, means doing any act that is restricted by Copyright or Database Rights whether in the original medium or any other; and includes modifying the Work as may be technically necessary to use it in a different mode or format. This includes the right to sublicense the Work. + + +“Work” – Means either or both of the Database and Data offered under the terms of this Document. + + +“You” – the Person acquiring rights under the licence elements of this Document. + + +Words in the singular include the plural and vice versa. + + +2.0 What this document covers + + +2.1. Legal effect of this Document. This Document is: + + + a. A dedication to the public domain and waiver of Copyright and Database Rights over the Work; and + + + b. A licence of Copyright and Database Rights over the Work in jurisdictions that do not allow for relinquishment or waiver. + + +2.2. Legal rights covered. + + + a. Copyright. Any copyright or neighbouring rights in the Work. Copyright law varies between jurisdictions, but is likely to cover: the Database model or schema, which is the structure, arrangement, and organisation of the Database, and can also include the Database tables and table indexes; the data entry and output sheets; and the Field names of Data stored in the Database. Copyright may also cover the Data depending on the jurisdiction and type of Data; and + + + b. Database Rights. Database Rights only extend to the extraction and re-utilisation of the whole or a substantial part of the Data. Database Rights can apply even when there is no copyright over the Database. Database Rights can also apply when the Data is removed from the Database and is selected and arranged in a way that would not infringe any applicable copyright. + + +2.2 Rights not covered. + + + a. This Document does not apply to computer programs used in the making or operation of the Database; + + + b. This Document does not cover any patents over the Data or the Database. Please see Section 4.2 later in this Document for further details; and + + + c. This Document does not cover any trade marks associated with the Database. Please see Section 4.3 later in this Document for further details. + + +Users of this Database are cautioned that they may have to clear other rights or consult other licences. + + +2.3 Facts are free. The Rightsholder takes the position that factual information is not covered by Copyright. This Document however covers the Work in jurisdictions that may protect the factual information in the Work by Copyright, and to cover any information protected by Copyright that is contained in the Work. + + +Part II: Dedication to the public domain + + +3.0 Dedication, waiver, and licence of Copyright and Database Rights + + +3.1 Dedication of Copyright and Database Rights to the public domain. The Rightsholder by using this Document, dedicates the Work to the public domain for the benefit of the public and relinquishes all rights in Copyright and Database Rights over the Work. + + +a. The Rightsholder realises that once these rights are relinquished, that the Rightsholder has no further rights in Copyright and Database Rights over the Work, and that the Work is free and open for others to Use. + + +b. The Rightsholder intends for their relinquishment to cover all present and future rights in the Work under Copyright and Database Rights, whether they are vested or contingent rights, and that this relinquishment of rights covers all their heirs and successors. + + +The above relinquishment of rights applies worldwide and includes media and formats now known or created in the future. + + +3.2 Waiver of rights and claims in Copyright and Database Rights when Section 3.1 dedication inapplicable. If the dedication in Section 3.1 does not apply in the relevant jurisdiction under Section 6.4, the Rightsholder waives any rights and claims that the Rightsholder may have or acquire in the future over the Work in: + + +a. Copyright; and + + +b. Database Rights. + + +To the extent possible in the relevant jurisdiction, the above waiver of rights and claims applies worldwide and includes media and formats now known or created in the future. The Rightsholder agrees not to assert the above rights and waives the right to enforce them over the Work. + + +3.3 Licence of Copyright and Database Rights when Sections 3.1 and 3.2 inapplicable. If the dedication and waiver in Sections 3.1 and 3.2 does not apply in the relevant jurisdiction under Section 6.4, the Rightsholder and You agree as follows: + + +a. The Licensor grants to You a worldwide, royalty-free, non-exclusive, licence to Use the Work for the duration of any applicable Copyright and Database Rights. These rights explicitly include commercial use, and do not exclude any field of endeavour. To the extent possible in the relevant jurisdiction, these rights may be exercised in all media and formats whether now known or created in the future. + + +3.4 Moral rights. This section covers moral rights, including the right to be identified as the author of the Work or to object to treatment that would otherwise prejudice the author’s honour and reputation, or any other derogatory treatment: + + +a. For jurisdictions allowing waiver of moral rights, Licensor waives all moral rights that Licensor may have in the Work to the fullest extent possible by the law of the relevant jurisdiction under Section 6.4; + + +b. If waiver of moral rights under Section 3.4 a in the relevant jurisdiction is not possible, Licensor agrees not to assert any moral rights over the Work and waives all claims in moral rights to the fullest extent possible by the law of the relevant jurisdiction under Section 6.4; and + + +c. For jurisdictions not allowing waiver or an agreement not to assert moral rights under Section 3.4 a and b, the author may retain their moral rights over the copyrighted aspects of the Work. + + +Please note that some jurisdictions do not allow for the waiver of moral rights, and so moral rights may still subsist over the work in some jurisdictions. + + +4.0 Relationship to other rights + + +4.1 No other contractual conditions. The Rightsholder makes this Work available to You without any other contractual obligations, either express or implied. Any Community Norms statement associated with the Work is not a contract and does not form part of this Document. + + +4.2 Relationship to patents. This Document does not grant You a licence for any patents that the Rightsholder may own. Users of this Database are cautioned that they may have to clear other rights or consult other licences. + + +4.3 Relationship to trade marks. This Document does not grant You a licence for any trade marks that the Rightsholder may own or that the Rightsholder may use to cover the Work. Users of this Database are cautioned that they may have to clear other rights or consult other licences. + + +Part III: General provisions + + +5.0 Warranties, disclaimer, and limitation of liability + + +5.1 The Work is provided by the Rightsholder “as is” and without any warranty of any kind, either express or implied, whether of title, of accuracy or completeness, of the presence of absence of errors, of fitness for purpose, or otherwise. Some jurisdictions do not allow the exclusion of implied warranties, so this exclusion may not apply to You. + + +5.2 Subject to any liability that may not be excluded or limited by law, the Rightsholder is not liable for, and expressly excludes, all liability for loss or damage however and whenever caused to anyone by any use under this Document, whether by You or by anyone else, and whether caused by any fault on the part of the Rightsholder or not. This exclusion of liability includes, but is not limited to, any special, incidental, consequential, punitive, or exemplary damages. This exclusion applies even if the Rightsholder has been advised of the possibility of such damages. + + +5.3 If liability may not be excluded by law, it is limited to actual and direct financial loss to the extent it is caused by proved negligence on the part of the Rightsholder. + + +6.0 General + + +6.1 If any provision of this Document is held to be invalid or unenforceable, that must not affect the validity or enforceability of the remainder of the terms of this Document. + + +6.2 This Document is the entire agreement between the parties with respect to the Work covered here. It replaces any earlier understandings, agreements or representations with respect to the Work not specified here. + + +6.3 This Document does not affect any rights that You or anyone else may independently have under any applicable law to make any use of this Work, including (for jurisdictions where this Document is a licence) fair dealing, fair use, database exceptions, or any other legally recognised limitation or exception to infringement of copyright or other applicable laws. + + 6.4 This Document takes effect in the relevant jurisdiction in which the Document terms are sought to be enforced. If the rights waived or granted under applicable law in the relevant jurisdiction includes additional rights not waived or granted under this Document, these additional rights are included in this Document in order to meet the intent of this Document. \ No newline at end of file diff --git a/lucene/luke/build.gradle b/lucene/luke/build.gradle index 5f6e1635375..23c843a39ab 100644 --- a/lucene/luke/build.gradle +++ b/lucene/luke/build.gradle @@ -57,12 +57,12 @@ 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 { - } +// Process UTF8 property files to unicode escapes. +tasks.withType(ProcessResources).configureEach { task -> + task.filesMatching("**/messages*.properties", { + filteringCharset = 'UTF-8' + filter(EscapeUnicode) + }) } // Configure "stand-alone" JAR with proper dependency classpath links. diff --git a/lucene/luke/src/distribution/README.md b/lucene/luke/src/distribution/README.md index b0672ae2bca..c23dba02875 100644 --- a/lucene/luke/src/distribution/README.md +++ b/lucene/luke/src/distribution/README.md @@ -20,6 +20,14 @@ This is Luke, Apache Lucene low-level index inspection and repair utility. Luke requires Java ${required.java.version}. You can start it with: +``` java -jar ${luke.cmd} +``` + +or, using Java modules: + +``` +java --module-path . --add-modules org.apache.logging.log4j --module lucene.luke +``` Happy index hacking! 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.java index f8fd192eb77..453ef388b08 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 @@ -17,13 +17,8 @@ package org.apache.lucene.luke.app.desktop.util; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; import java.text.MessageFormat; import java.util.Locale; -import java.util.PropertyResourceBundle; import java.util.ResourceBundle; /** Utilities for accessing message resources. */ @@ -41,24 +36,8 @@ public class MessageUtils { return new MessageFormat(pattern, Locale.ENGLISH).format(args); } - // https://stackoverflow.com/questions/4659929/how-to-use-utf-8-in-resource-properties-with-resourcebundle - private static ResourceBundle.Control UTF8_RESOURCEBUNDLE_CONTROL = - new ResourceBundle.Control() { - @Override - public ResourceBundle newBundle( - String baseName, Locale locale, String format, ClassLoader loader, boolean reload) - throws IllegalAccessException, InstantiationException, IOException { - String bundleName = toBundleName(baseName, locale); - String resourceName = toResourceName(bundleName, "properties"); - try (InputStream is = loader.getResourceAsStream(resourceName)) { - return new PropertyResourceBundle(new InputStreamReader(is, StandardCharsets.UTF_8)); - } - } - }; - private static ResourceBundle bundle = - ResourceBundle.getBundle( - MESSAGE_BUNDLE_BASENAME, Locale.ENGLISH, UTF8_RESOURCEBUNDLE_CONTROL); + ResourceBundle.getBundle(MESSAGE_BUNDLE_BASENAME, Locale.ENGLISH); private MessageUtils() {} } diff --git a/lucene/luke/src/resources/org/apache/lucene/luke/app/desktop/messages/messages.properties b/lucene/luke/src/resources/org/apache/lucene/luke/app/desktop/messages/messages.properties index 30b43cf18b7..e8143297121 100644 --- a/lucene/luke/src/resources/org/apache/lucene/luke/app/desktop/messages/messages.properties +++ b/lucene/luke/src/resources/org/apache/lucene/luke/app/desktop/messages/messages.properties @@ -15,6 +15,9 @@ # limitations under the License. # +# This file must use UTF8 encoding. UTF8 is replaced with unicode +# escapes at build time. + # Common label.status=Status: label.help=Help