Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-9488 Create Release Artifacts with Gradle (#1905)

Mike Drob08e38d3452d5
diff --git a/build.gradle b/build.gradle
index 9826b57cfb9..ada00210ff7 100644
--- a/build.gradle
+++ b/build.gradle
@@ -85,6 +85,7 @@ ext {
// version unification control. These are not our main dependencies.
scriptDepVersions = [
"apache-rat": "0.11",
+ "commons-codec": "1.13",
"ecj": "3.19.0",
"javacc": "7.0.4",
"jflex": "1.7.0",
@@ -121,8 +122,9 @@ apply from: file('gradle/testing/fail-on-no-tests.gradle')
apply from: file('gradle/testing/alternative-jdk-support.gradle')
apply from: file('gradle/jar-manifest.gradle')
-// Maven publishing.
+// Publishing and releasing
apply from: file('gradle/maven/defaults-maven.gradle')
+apply from: file('gradle/releasing.gradle')
// IDE support, settings and specials.
apply from: file('gradle/ide/intellij-idea.gradle')
diff --git a/dev-tools/scripts/README.md b/dev-tools/scripts/README.md
index f32aa6b312d..94e69645177 100644
--- a/dev-tools/scripts/README.md
+++ b/dev-tools/scripts/README.md
@@ -115,7 +115,7 @@ of the other tools in this folder.
usage: addVersion.py [-h] version
- Add a new version to CHANGES, to Version.java, lucene/version.properties and
+ Add a new version to CHANGES, to Version.java, build.gradle and
solrconfig.xml files
positional arguments:
diff --git a/dev-tools/scripts/addVersion.py b/dev-tools/scripts/addVersion.py
index 9fb918267dc..0fc0c5adb11 100755
--- a/dev-tools/scripts/addVersion.py
+++ b/dev-tools/scripts/addVersion.py
@@ -105,17 +105,16 @@ def add_constant(new_version, deprecate):
changed = update_file(filename, matcher, Edit())
print('done' if changed else 'uptodate')
-version_prop_re = re.compile('version\.base=(.*)')
def update_build_version(new_version):
- print(' changing version.base...', end='', flush=True)
- filename = 'lucene/version.properties'
+ print(' changing baseVersion...', end='', flush=True)
+ filename = 'build.gradle'
def edit(buffer, match, line):
if new_version.dot in line:
return None
- buffer.append('version.base=' + new_version.dot + '\n')
+ buffer.append(' baseVersion = \'' + new_version.dot + '\'\n')
return True
- changed = update_file(filename, version_prop_re, edit)
+ changed = update_file(filename, scriptutil.version_prop_re, edit)
print('done' if changed else 'uptodate')
def update_latest_constant(new_version):
@@ -178,7 +177,7 @@ def check_solr_version_tests():
print('ok')
def read_config(current_version):
- parser = argparse.ArgumentParser(description='Add a new version to CHANGES, to Version.java, lucene/version.properties and solrconfig.xml files')
+ parser = argparse.ArgumentParser(description='Add a new version to CHANGES, to Version.java, build.gradle and solrconfig.xml files')
parser.add_argument('version', type=Version.parse)
newconf = parser.parse_args()
@@ -203,7 +202,7 @@ def get_solr_init_changes():
''')
def main():
- if not os.path.exists('lucene/version.properties'):
+ if not os.path.exists('build.gradle'):
sys.exit("Tool must be run from the root of a source checkout.")
current_version = Version.parse(find_current_version())
newconf = read_config(current_version)
diff --git a/dev-tools/scripts/buildAndPushRelease.py b/dev-tools/scripts/buildAndPushRelease.py
index 1742813818e..21861cb5811 100755
--- a/dev-tools/scripts/buildAndPushRelease.py
+++ b/dev-tools/scripts/buildAndPushRelease.py
@@ -27,6 +27,8 @@ import textwrap
import urllib.request, urllib.error, urllib.parse
import xml.etree.ElementTree as ET
+import scriptutil
+
LOG = '/tmp/release.log'
def log(msg):
@@ -113,14 +115,12 @@ def prepare(root, version, gpgKeyID, gpgPassword):
open('rev.txt', mode='wb').write(rev.encode('UTF-8'))
print(' prepare-release')
- cmd = './gradlew -Dversion=%s clean' % version
- # TODO cd lucene ; ant dist-all?
- # TODO cd solr ; ant package?
+ cmd = './gradlew -Dversion.release=%s clean assembleDist' % version
if gpgKeyID is not None:
# TODO sign
# cmd += ' -Psigning.keyId=%s publishSignedPublicationToMavenLocal' % gpgKeyID
pass
- cmd += ' mavenLocal'
+ cmd += ' mavenToLocalFolder'
if gpgPassword is not None:
runAndSendGPGPassword(cmd, gpgPassword)
@@ -190,7 +190,8 @@ def pushLocal(version, root, rev, rcNum, localDir):
os.makedirs('%s/%s/lucene' % (localDir, dir))
os.makedirs('%s/%s/solr' % (localDir, dir))
print(' Lucene')
- os.chdir('%s/lucene/dist' % root)
+ lucene_dist_dir = '%s/lucene/packaging/build/distributions' % root
+ os.chdir(lucene_dist_dir)
print(' zip...')
if os.path.exists('lucene.tar.bz2'):
os.remove('lucene.tar.bz2')
@@ -198,19 +199,20 @@ def pushLocal(version, root, rev, rcNum, localDir):
os.chdir('%s/%s/lucene' % (localDir, dir))
print(' unzip...')
- run('tar xjf "%s/lucene/dist/lucene.tar.bz2"' % root)
- os.remove('%s/lucene/dist/lucene.tar.bz2' % root)
+ run('tar xjf "%s/lucene.tar.bz2"' % lucene_dist_dir)
+ os.remove('%s/lucene.tar.bz2' % lucene_dist_dir)
print(' Solr')
- os.chdir('%s/solr/package' % root)
+ solr_dist_dir = '%s/solr/packaging/build/distributions' % root
+ os.chdir(solr_dist_dir)
print(' zip...')
if os.path.exists('solr.tar.bz2'):
os.remove('solr.tar.bz2')
run('tar cjf solr.tar.bz2 *')
print(' unzip...')
os.chdir('%s/%s/solr' % (localDir, dir))
- run('tar xjf "%s/solr/package/solr.tar.bz2"' % root)
- os.remove('%s/solr/package/solr.tar.bz2' % root)
+ run('tar xjf "%s/solr.tar.bz2"' % solr_dist_dir)
+ os.remove('%s/solr.tar.bz2' % solr_dist_dir)
print(' chmod...')
os.chdir('..')
@@ -220,8 +222,7 @@ def pushLocal(version, root, rev, rcNum, localDir):
return 'file://%s/%s' % (os.path.abspath(localDir), dir)
def read_version(path):
- version_props_file = os.path.join(path, 'lucene', 'version.properties')
- return re.search(r'version\.base=(.*)', open(version_props_file).read()).group(1)
+ return scriptutil.find_current_version()
def parse_config():
epilogue = textwrap.dedent('''
diff --git a/dev-tools/scripts/releaseWizard.py b/dev-tools/scripts/releaseWizard.py
index 8a9306bf9d5..d268ad6b7be 100755
--- a/dev-tools/scripts/releaseWizard.py
+++ b/dev-tools/scripts/releaseWizard.py
@@ -150,11 +150,8 @@ def replace_templates(text):
tpl_lines.append(line)
return "\n".join(tpl_lines)
-
def getScriptVersion():
- topLevelDir = os.path.join(os.path.abspath("%s/" % script_path), os.path.pardir, os.path.pardir)
- reBaseVersion = re.compile(r'version\.base\s*=\s*(\d+\.\d+\.\d+)')
- return reBaseVersion.search(open('%s/lucene/version.properties' % topLevelDir).read()).group(1)
+ return scriptutil.find_current_version()
def get_editor():
diff --git a/dev-tools/scripts/releaseWizard.yaml b/dev-tools/scripts/releaseWizard.yaml
index 6de5ab1c75e..463b359640e 100644
--- a/dev-tools/scripts/releaseWizard.yaml
+++ b/dev-tools/scripts/releaseWizard.yaml
@@ -674,7 +674,7 @@ groups:
stdout: true
- !Command
cmd: "{{ gradle_cmd }} documentation"
- post_description: Check that both tests pass. If they fail, commit fixes for the failures before proceeding.
+ post_description: Check that the task passed. If it failed, commit fixes for the failures before proceeding.
- !Todo
id: clear_gradle_cache
title: Clear the gradle cache
@@ -1056,7 +1056,7 @@ groups:
logfile: checkout-release-tag.log
tee: true
- !Command
- cmd: "{{ gradle_cmd }} documentation -Dversion={{ release_version }}"
+ cmd: "{{ gradle_cmd }} documentation -Dversion.release={{ release_version }}"
comment: Build documentation
- !Command
cmd: svn -m "Add docs, changes and javadocs for Lucene {{ release_version }}" import {{ git_checkout_folder }}/lucene/build/docs https://svn.apache.org/repos/infra/websites/production/lucene/content/core/{{ version }}
diff --git a/dev-tools/scripts/scriptutil.py b/dev-tools/scripts/scriptutil.py
index 254f6b6958d..04983c0ea98 100644
--- a/dev-tools/scripts/scriptutil.py
+++ b/dev-tools/scripts/scriptutil.py
@@ -175,9 +175,11 @@ def attemptDownload(urlString, fileName):
if not success:
os.remove(fileName)
-version_prop_re = re.compile('version\.base=(.*)')
+version_prop_re = re.compile(r'baseVersion\s*=\s*([\'"])(.*)\1')
def find_current_version():
- return version_prop_re.search(open('lucene/version.properties').read()).group(1).strip()
+ script_path = os.path.dirname(os.path.realpath(__file__))
+ top_level_dir = os.path.join(os.path.abspath("%s/" % script_path), os.path.pardir, os.path.pardir)
+ return version_prop_re.search(open('%s/build.gradle' % top_level_dir).read()).group(2).strip()
if __name__ == '__main__':
print('This is only a support module, it cannot be run')
diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.py
index 867e4520807..8d712df4c68 100755
--- a/dev-tools/scripts/smokeTestRelease.py
+++ b/dev-tools/scripts/smokeTestRelease.py
@@ -37,7 +37,7 @@ import xml.etree.ElementTree as ET
import zipfile
from collections import defaultdict
from collections import namedtuple
-from scriptutil import download
+import scriptutil
import checkJavadocLinks
@@ -322,13 +322,13 @@ def checkSigs(project, urlString, version, tmpDir, isSigned, keysFile):
for artifact, urlString in artifacts:
print(' download %s...' % artifact)
- download(artifact, urlString, tmpDir, force_clean=FORCE_CLEAN)
+ scriptutil.download(artifact, urlString, tmpDir, force_clean=FORCE_CLEAN)
verifyDigests(artifact, urlString, tmpDir)
if isSigned:
print(' verify sig')
# Test sig (this is done with a clean brand-new GPG world)
- download(artifact + '.asc', urlString + '.asc', tmpDir, force_clean=FORCE_CLEAN)
+ scriptutil.download(artifact + '.asc', urlString + '.asc', tmpDir, force_clean=FORCE_CLEAN)
sigFile = '%s/%s.asc' % (tmpDir, artifact)
artifactFile = '%s/%s' % (tmpDir, artifact)
logFile = '%s/%s.%s.gpg.verify.log' % (tmpDir, project, artifact)
@@ -623,7 +623,7 @@ def verifyUnpacked(java, project, artifact, unpackPath, gitRevision, version, te
# TODO: clean this up to not be a list of modules that we must maintain
extras = ('analysis', 'backward-codecs', 'benchmark', 'classification', 'codecs', 'core', 'demo', 'docs', 'expressions', 'facet', 'grouping', 'highlighter', 'join', 'luke', 'memory', 'misc', 'monitor', 'queries', 'queryparser', 'replicator', 'sandbox', 'spatial-extras', 'spatial3d', 'suggest', 'test-framework', 'licenses')
if isSrc:
- extras += ('build.gradle', 'build.xml', 'common-build.xml', 'module-build.xml', 'top-level-ivy-settings.xml', 'default-nested-ivy-settings.xml', 'ivy-versions.properties', 'ivy-ignore-conflicts.properties', 'version.properties', 'tools', 'site', 'dev-docs')
+ extras += ('build.gradle', 'build.xml', 'common-build.xml', 'module-build.xml', 'top-level-ivy-settings.xml', 'default-nested-ivy-settings.xml', 'ivy-versions.properties', 'ivy-ignore-conflicts.properties', 'tools', 'site', 'dev-docs')
else:
extras = ()
@@ -941,7 +941,7 @@ def getBinaryDistFiles(project, tmpDir, version, baseURL):
if not os.path.exists('%s/%s' % (tmpDir, distribution)):
distURL = '%s/%s/%s' % (baseURL, project, distribution)
print(' download %s...' % distribution, end=' ')
- download(distribution, distURL, tmpDir, force_clean=FORCE_CLEAN)
+ scriptutil.download(distribution, distURL, tmpDir, force_clean=FORCE_CLEAN)
destDir = '%s/unpack-%s-getBinaryDistFiles' % (tmpDir, project)
if os.path.exists(destDir):
shutil.rmtree(destDir)
@@ -1170,7 +1170,7 @@ def crawl(downloadedFiles, urlString, targetDir, exclusions=set()):
crawl(downloadedFiles, subURL, path, exclusions)
else:
if not os.path.exists(path) or FORCE_CLEAN:
- download(text, subURL, targetDir, quiet=True, force_clean=FORCE_CLEAN)
+ scriptutil.download(text, subURL, targetDir, quiet=True, force_clean=FORCE_CLEAN)
downloadedFiles.append(path)
sys.stdout.write('.')
@@ -1371,22 +1371,11 @@ def confirmAllReleasesAreTestedForBackCompat(smokeVersion, unpackPath):
else:
print(' success!')
-def getScriptVersion():
- topLevelDir = '../..' # Assumption: this script is in dev-tools/scripts/ of a checkout
- m = re.compile(r'(.*)/').match(sys.argv[0]) # Get this script's directory
- if m is not None and m.group(1) != '.':
- origCwd = os.getcwd()
- os.chdir(m.group(1))
- os.chdir('../..')
- topLevelDir = os.getcwd()
- os.chdir(origCwd)
- reBaseVersion = re.compile(r'version\.base\s*=\s*(\d+\.\d+)')
- return reBaseVersion.search(open('%s/lucene/version.properties' % topLevelDir).read()).group(1)
def main():
c = parse_config()
- scriptVersion = getScriptVersion()
+ scriptVersion = scriptutil.find_current_version()
if not c.version.startswith(scriptVersion + '.'):
raise RuntimeError('smokeTestRelease.py for %s.X is incompatible with a %s release.' % (scriptVersion, c.version))
@@ -1435,7 +1424,7 @@ def smokeTest(java, baseURL, gitRevision, version, tmpDir, isSigned, local_keys,
else:
keysFileURL = "https://archive.apache.org/dist/lucene/KEYS"
print(" Downloading online KEYS file %s" % keysFileURL)
- download('KEYS', keysFileURL, tmpDir, force_clean=FORCE_CLEAN)
+ scriptutil.download('KEYS', keysFileURL, tmpDir, force_clean=FORCE_CLEAN)
keysFile = '%s/KEYS' % (tmpDir)
if is_port_in_use(8983):
diff --git a/gradle/documentation/documentation.gradle b/gradle/documentation/documentation.gradle
index eb5c46324d0..242b26a0f71 100644
--- a/gradle/documentation/documentation.gradle
+++ b/gradle/documentation/documentation.gradle
@@ -57,6 +57,10 @@ configure(subprojects.findAll { it.path == ':lucene' || it.path == ':solr' }) {
ext {
docroot = file("${buildDir}/documentation")
}
+
+ configurations {
+ docs
+ }
task documentation() {
group = 'documentation'
@@ -75,6 +79,12 @@ configure(subprojects.findAll { it.path == ':lucene' || it.path == ':solr' }) {
from('site/assets') // solr
into project.docroot
}
+
+ artifacts {
+ docs project.docroot, {
+ builtBy documentation
+ }
+ }
}
configure(project(':solr')) {
@@ -83,9 +93,26 @@ configure(project(':solr')) {
docrootOnline = file("${buildDir}/docs-online")
}
+ configurations {
+ docsOnline
+ }
+
documentation {
// for Solr we also have a page shipped with zip/tgz that just points to online web pages:
- dependsOn 'copyOnlineDocumentationAssets','createOnlineDocumentationIndex'
+ dependsOn 'documentationOnline'
+ }
+
+ task documentationOnline() {
+ group = 'documentation'
+ description = "Generate stub Solr documentation pointing to web page (that's part of Solr TGZ)"
+ dependsOn 'copyOnlineDocumentationAssets','createOnlineDocumentationIndex','copyChangesToHtmlForOnline'
+ }
+
+ task copyChangesToHtmlForOnline(type: Copy) {
+ from project.docroot
+ into project.docrootOnline
+ include 'changes/**'
+ dependsOn 'changesToHtml'
}
task copyOnlineDocumentationAssets(type: Copy) {
@@ -93,4 +120,10 @@ configure(project(':solr')) {
from('site/assets')
into project.docrootOnline
}
+
+ artifacts {
+ docsOnline project.docrootOnline, {
+ builtBy documentationOnline
+ }
+ }
}
diff --git a/gradle/documentation/markdown.gradle b/gradle/documentation/markdown.gradle
index 6e0a03bf219..254b4228e8c 100644
--- a/gradle/documentation/markdown.gradle
+++ b/gradle/documentation/markdown.gradle
@@ -65,7 +65,7 @@ configure(project(':lucene')) {
dependsOn copyDocumentationAssets,markdownToHtml
outputFile = file("${project.docroot}/index.html")
- templateFile = file('site/xsl/index.template.md')
+ templateFile = file('site/index.template.md')
def defaultCodecFile = project(':lucene:core').file('src/java/org/apache/lucene/codecs/Codec.java')
inputs.file(defaultCodecFile)
diff --git a/gradle/releasing.gradle b/gradle/releasing.gradle
new file mode 100644
index 00000000000..b05b826fa40
--- /dev/null
+++ b/gradle/releasing.gradle
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+import org.apache.commons.codec.digest.DigestUtils
+
+// We're using commons-codec for computing checksums.
+buildscript {
+ repositories {
+ mavenCentral()
+ }
+
+ dependencies {
+ classpath "commons-codec:commons-codec:${scriptDepVersions['commons-codec']}"
+ }
+}
+
+allprojects {
+ plugins.withType(DistributionPlugin) {
+ def checksum = {
+ outputs.files.each { File file ->
+ String sha512 = new DigestUtils(DigestUtils.sha512Digest).digestAsHex(file).trim()
+ new File(file.parent, file.name + ".sha512").write(sha512 + " " + file.name, "UTF-8")
+ }
+ }
+
+ distZip {
+ doLast checksum
+ }
+
+ distTar {
+ compression = Compression.GZIP
+ doLast checksum
+ }
+
+ installDist {
+ doLast {
+ logger.lifecycle "Distribution assembled under: ${destinationDir}"
+ }
+ }
+ }
+}
diff --git a/gradle/validation/jar-checks.gradle b/gradle/validation/jar-checks.gradle
index 5cdba796a5a..d21cae30c02 100644
--- a/gradle/validation/jar-checks.gradle
+++ b/gradle/validation/jar-checks.gradle
@@ -21,7 +21,6 @@
// 3) checksum validation/ generation.
import org.apache.commons.codec.digest.DigestUtils
-import org.apache.commons.codec.digest.MessageDigestAlgorithms
// This should be false only for debugging.
def failOnError = true
@@ -33,7 +32,7 @@ buildscript {
}
dependencies {
- classpath 'commons-codec:commons-codec:1.13'
+ classpath "commons-codec:commons-codec:${scriptDepVersions['commons-codec']}"
}
}
@@ -152,7 +151,7 @@ subprojects {
jarName : file.toPath().getFileName().toString(),
path : file,
module : resolvedArtifact.moduleVersion,
- checksum : provider { new DigestUtils(MessageDigestAlgorithms.SHA_1).digestAsHex(file).trim() },
+ checksum : provider { new DigestUtils(DigestUtils.sha1Digest).digestAsHex(file).trim() },
// We keep track of the files referenced by this dependency (sha, license, notice, etc.)
// so that we can determine unused dangling files later on.
referencedFiles: []
diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/package-info.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/package-info.java
index 2df570b12ad..a2ff351323d 100644
--- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/package-info.java
+++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/package-info.java
@@ -20,7 +20,7 @@
* <p>
* The benchmark contribution contains tools for benchmarking Lucene using standard, freely available corpora.
* <p>
- * ANT will download the corpus automatically, place it in a temp directory and then unpack it to the
+ * Gradle will download the corpus automatically, place it in a temp directory and then unpack it to the
* working.dir directory specified in the build. The temp directory and working directory can be safely
* removed after a run. However, the next time the task is run, it will need to download the files again.
* <p>
diff --git a/lucene/build.gradle b/lucene/build.gradle
index 1c71edb190b..1d2d60830a1 100644
--- a/lucene/build.gradle
+++ b/lucene/build.gradle
@@ -19,4 +19,4 @@ description = 'Parent project for Apache Lucene Core'
subprojects {
group "org.apache.lucene"
-}
\ No newline at end of file
+}
diff --git a/lucene/luke/build.gradle b/lucene/luke/build.gradle
index 719e11fad1b..9507638c517 100644
--- a/lucene/luke/build.gradle
+++ b/lucene/luke/build.gradle
@@ -24,11 +24,6 @@ ext {
standaloneDistDir = file("$buildDir/${archivesBaseName}-${project.version}")
}
-configurations {
- standalone
- implementation.extendsFrom standalone
-}
-
dependencies {
api project(':lucene:core')
@@ -41,16 +36,16 @@ dependencies {
implementation project(':lucene:queryparser')
implementation project(':lucene:misc')
- standalone project(":lucene:highlighter")
- standalone project(':lucene:analysis:icu')
- standalone project(':lucene:analysis:kuromoji')
- standalone project(':lucene:analysis:morfologik')
- standalone project(':lucene:analysis:nori')
- standalone project(':lucene:analysis:opennlp')
- standalone project(':lucene:analysis:phonetic')
- standalone project(':lucene:analysis:smartcn')
- standalone project(':lucene:analysis:stempel')
- standalone project(':lucene:suggest')
+ implementation project(":lucene:highlighter")
+ implementation project(':lucene:analysis:icu')
+ implementation project(':lucene:analysis:kuromoji')
+ implementation project(':lucene:analysis:morfologik')
+ implementation project(':lucene:analysis:nori')
+ implementation project(':lucene:analysis:opennlp')
+ implementation project(':lucene:analysis:phonetic')
+ implementation project(':lucene:analysis:smartcn')
+ implementation project(':lucene:analysis:stempel')
+ implementation project(':lucene:suggest')
testImplementation project(':lucene:test-framework')
}
@@ -130,14 +125,6 @@ task standalonePackage(type: Tar) {
archiveFileName = "${archivesBaseName}-${project.version}-standalone.tgz"
}
-// Create a set of artifacts for standalone distribution in a specific
-// exported configuration so that it can be pulled in by other projects.
-artifacts {
- standalone standaloneDistDir, {
- builtBy standaloneAssemble
- }
-}
-
// Utility to launch Luke (and fork it from the build).
task run() {
dependsOn standaloneAssemble
diff --git a/lucene/packaging/build.gradle b/lucene/packaging/build.gradle
new file mode 100644
index 00000000000..b21cc189ae4
--- /dev/null
+++ b/lucene/packaging/build.gradle
@@ -0,0 +1,171 @@
+/*
+ * 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.
+ */
+
+// This project puts together a "distribution", assembling dependencies from
+// various other projects.
+
+plugins {
+ id 'distribution'
+}
+
+description = 'Lucene distribution packaging'
+
+// Declare all subprojects that should be included in binary distribution.
+// By default everything is included, unless explicitly excluded.
+def includeInBinaries = project(":lucene").subprojects.findAll {subproject ->
+ return !(subproject.path in [
+ // Exclude packaging, not relevant to binary distribution.
+ ":lucene:packaging",
+ // Exclude parent container project of analysis modules (no artifacts).
+ ":lucene:analysis"
+ ])
+}
+
+// Create a configuration to each subproject and add dependency.
+def binaryArtifactsConf = { Project prj ->
+ "dep-binary" + prj.path.replace(':', '-')
+}
+
+def allDepsConf = { Project prj ->
+ "dep-full" + prj.path.replace(':', '-')
+}
+
+configurations {
+ docs
+}
+
+for (Project includedProject : includeInBinaries) {
+ def confBinaries = binaryArtifactsConf(includedProject)
+ def confFull = allDepsConf(includedProject)
+ configurations.create(confBinaries)
+ configurations.create(confFull)
+ dependencies { DependencyHandler handler ->
+ // Just project binaries.
+ handler.add(confBinaries, project(path: includedProject.path, configuration: "packaging"))
+ // All project dependencies, including transitive dependencies from the runtime configuration.
+ handler.add(confFull, project(path: includedProject.path, configuration: "runtimeElements"), {
+ exclude group: "org.apache.lucene"
+
+ // Exclude these from all projects.
+ exclude group: "commons-logging"
+ exclude group: "org.slf4j"
+ })
+ }
+}
+
+dependencies {
+ docs project(path: ':lucene', configuration: 'docs')
+}
+
+distributions {
+ // The "main" distribution is the binary distribution.
+ // We should also add 'source' distribution at some point
+ // (we can't do it now as the build itself is tangled with Solr).
+ main {
+ distributionBaseName = 'lucene'
+
+ contents {
+ // Manually correct posix permissions (matters when packaging on Windows).
+ filesMatching(["**/*.sh", "**/*.bat"]) { copy ->
+ copy.setMode(0755)
+ }
+
+ // Root distribution files; these are cherry-picked manually.
+ from(project(':lucene').projectDir, {
+ include "CHANGES.txt"
+ include "JRE_VERSION_MIGRATION.md"
+ include "LICENSE.txt"
+ include "licenses/*"
+ include "MIGRATE.md"
+ include "NOTICE.txt"
+ include "README.md"
+ include "SYSTEM_REQUIREMENTS.md"
+ })
+
+ // A couple more missing README files
+ from(project(':lucene:analysis').projectDir) {
+ include "README.txt"
+ into 'analysis'
+ }
+
+ // Copy files from documentation output to 'docs'
+ from(configurations.docs, {
+ into 'docs'
+ })
+
+ // Put included project's binary artifacts under their corresponding subfolders.
+ // This needs to be a for-loop instead of projects.each since the "from" could be resolved at the wrong time
+ for (Project includedProject : includeInBinaries) {
+ def basePath = includedProject.path.replaceFirst("^:lucene:", "").replace(':', '/')
+ def confBinaries = configurations.findByName(binaryArtifactsConf(includedProject))
+ def confFull = configurations.findByName(allDepsConf(includedProject))
+
+ from(confBinaries, {
+ into basePath
+ })
+ from(confFull, {
+ into "${basePath}/lib"
+ // Manually exclude the project's main artifact. Don't know if there is any better way to do this.
+ exclude "lucene-*"
+ })
+ }
+ }
+ }
+}
+
+// Add common packaging artifacts.
+configure(project(":lucene").subprojects) {
+ plugins.withType(JavaPlugin) {
+ ext {
+ packagingDir = file("${buildDir}/packaging")
+ }
+
+ configurations {
+ packaging
+ }
+
+ task assemblePackaging(type: Sync) {
+ from(projectDir, {
+ include "README.*"
+ })
+
+ from(project.file('docs'), {
+ into 'docs'
+ })
+
+ from(tasks.findByName("jar"))
+
+ into packagingDir
+ }
+
+ artifacts {
+ packaging packagingDir, {
+ builtBy assemblePackaging
+ }
+ }
+ }
+}
+
+// Add launch scripts for Luke.
+configure(project(":lucene:luke")) {
+ plugins.withType(JavaPlugin) {
+ assemblePackaging {
+ from("${projectDir}/bin", {
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/lucene/queryparser/build.gradle b/lucene/queryparser/build.gradle
index 365a999b91a..077eb245bc8 100644
--- a/lucene/queryparser/build.gradle
+++ b/lucene/queryparser/build.gradle
@@ -26,5 +26,3 @@ dependencies {
testImplementation project(':lucene:test-framework')
}
-
-
diff --git a/lucene/site/xsl/index.template.md b/lucene/site/index.template.md
similarity index 100%
rename from lucene/site/xsl/index.template.md
rename to lucene/site/index.template.md
diff --git a/lucene/site/xsl/index.xsl b/lucene/site/xsl/index.xsl
deleted file mode 100644
index b3be85f79b5..00000000000
--- a/lucene/site/xsl/index.xsl
+++ /dev/null
@@ -1,117 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:str="http://exslt.org/strings"
- extension-element-prefixes="str"
->
- <xsl:param name="buildfiles"/>
- <xsl:param name="version"/>
- <xsl:param name="defaultCodec"/>
-
- <!-- ANT cannot lowercase a property, so we hack this here: -->
- <xsl:variable name="defaultCodecPackage" select="translate($defaultCodec,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')"/>
-
- <!--
- NOTE: This template matches the root element of any given input XML document!
- The XSL input file is ignored completely, but XSL expects one to be given,
- so build.xml passes itself here. The list of module build.xmls is given via
- string parameter, that must be splitted at '|'.
- -->
- <xsl:template match="/">
- <html>
- <head>
- <title><xsl:text>Apache Lucene </xsl:text><xsl:value-of select="$version"/><xsl:text> Documentation</xsl:text></title>
- </head>
- <body>
- <div><a href="http://lucene.apache.org/core/"><img src="lucene_green_300.gif" title="Apache Lucene Logo" alt="Lucene" border="0"/></a></div>
- <h1>
- <xsl:text>Apache Lucene</xsl:text>
- <span style="vertical-align: top; font-size: x-small">
- <xsl:text>TM</xsl:text>
- </span>
- <xsl:text> </xsl:text>
- <xsl:value-of select="$version"/>
- <xsl:text> Documentation</xsl:text>
- </h1>
- <p>Lucene is a Java full-text search engine. Lucene is not a complete application,
- but rather a code library and API that can easily be used to add search capabilities
- to applications.</p>
- <p>
- This is the official documentation for <b><xsl:text>Apache Lucene </xsl:text>
- <xsl:value-of select="$version"/></b>. Additional documentation is available in the
- <a href="https://cwiki.apache.org/confluence/display/lucene">Wiki</a>.
- </p>
- <h2>Getting Started</h2>
- <p>The following section is intended as a "getting started" guide. It has three
- audiences: first-time users looking to install Apache Lucene in their
- application; developers looking to modify or base the applications they develop
- on Lucene; and developers looking to become involved in and contribute to the
- development of Lucene. The goal is to help you "get started". It does not go into great depth
- on some of the conceptual or inner details of Lucene:</p>
- <ul>
- <li><a href="demo/overview-summary.html#overview.description">Lucene demo, its usage, and sources</a>:
- Tutorial and walk-through of the command-line Lucene demo.</li>
- <li><a href="core/overview-summary.html#overview.description">Introduction to Lucene's APIs</a>:
- High-level summary of the different Lucene packages. </li>
- <li><a href="core/org/apache/lucene/analysis/package-summary.html#package.description">Analysis overview</a>:
- Introduction to Lucene's analysis API. See also the
- <a href="core/org/apache/lucene/analysis/TokenStream.html">TokenStream consumer workflow</a>.</li>
- </ul>
- <h2>Reference Documents</h2>
- <ul>
- <li><a href="changes/Changes.html">Changes</a>: List of changes in this release.</li>
- <li><a href="SYSTEM_REQUIREMENTS.html">System Requirements</a>: Minimum and supported Java versions.</li>
- <li><a href="MIGRATE.html">Migration Guide</a>: What changed in Lucene 9; how to migrate code from Lucene 8.x.</li>
- <li><a href="JRE_VERSION_MIGRATION.html">JRE Version Migration</a>: Information about upgrading between major JRE versions.</li>
- <li><a href="core/org/apache/lucene/codecs/{$defaultCodecPackage}/package-summary.html#package.description">File Formats</a>: Guide to the supported index format used by Lucene. This can be customized by using <a href="core/org/apache/lucene/codecs/package-summary.html#package.description">an alternate codec</a>.</li>
- <li><a href="core/org/apache/lucene/search/package-summary.html#package.description">Search and Scoring in Lucene</a>: Introduction to how Lucene scores documents.</li>
- <li><a href="core/org/apache/lucene/search/similarities/TFIDFSimilarity.html">Classic Scoring Formula</a>: Formula of Lucene's classic <a href="https://en.wikipedia.org/wiki/Vector_Space_Model">Vector Space</a> implementation. (look <a href="core/org/apache/lucene/search/similarities/package-summary.html#package.description">here</a> for other models)</li>
- <li><a href="queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package.description">Classic QueryParser Syntax</a>: Overview of the Classic QueryParser's syntax and features.</li>
- </ul>
- <h2>API Javadocs</h2>
- <xsl:call-template name="modules"/>
- </body>
- </html>
- </xsl:template>
-
- <xsl:template name="modules">
- <ul>
- <xsl:for-each select="str:split($buildfiles,'|')">
- <!-- hack to list "core" first, contains() returns "true" which sorts before "false" if descending: -->
- <xsl:sort select="string(contains(text(), '/core/'))" order="descending" lang="en"/>
- <!-- hack to list "test-framework" at the end, contains() returns "true" which sorts after "false" if ascending: -->
- <xsl:sort select="string(contains(text(), '/test-framework/'))" order="ascending" lang="en"/>
- <!-- sort the remaining build files by path name: -->
- <xsl:sort select="text()" order="ascending" lang="en"/>
-
- <xsl:variable name="buildxml" select="document(.)"/>
- <xsl:variable name="name" select="$buildxml/*/@name"/>
- <li>
- <xsl:if test="$name='core'">
- <xsl:attribute name="style">font-size:larger; margin-bottom:.5em;</xsl:attribute>
- </xsl:if>
- <b><a href="{$name}/index.html"><xsl:value-of select="$name"/>
- </a><xsl:text>: </xsl:text></b>
- <xsl:value-of select="normalize-space($buildxml/*/description)"/>
- </li>
- </xsl:for-each>
- </ul>
- </xsl:template>
-
-</xsl:stylesheet>
diff --git a/lucene/version.properties b/lucene/version.properties
deleted file mode 100644
index a00b0869a8e..00000000000
--- a/lucene/version.properties
+++ /dev/null
@@ -1,10 +0,0 @@
-# This file contains some version properties as used by various build files.
-
-# RELEASE MANAGER must change this file after creating a release and
-# enter new base version (format "x.y.z", no prefix/appendix):
-version.base=9.0.0
-
-# Other version property defaults, don't change:
-version.suffix=SNAPSHOT
-version=${version.base}-${version.suffix}
-spec.version=${version.base}
diff --git a/settings.gradle b/settings.gradle
index 520b7bf4a83..c25071dcf45 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -51,6 +51,7 @@ include "lucene:spatial-extras"
include "lucene:spatial3d"
include "lucene:suggest"
include "lucene:test-framework"
+include "lucene:packaging"
include "solr:solrj"
include "solr:core"
diff --git a/solr/packaging/build.gradle b/solr/packaging/build.gradle
index a017a0dd55b..e3f4967bd6c 100644
--- a/solr/packaging/build.gradle
+++ b/solr/packaging/build.gradle
@@ -23,7 +23,7 @@ plugins {
id 'distribution'
}
-description = 'Solr packaging'
+description = 'Solr distribution packaging'
ext {
distDir = file("$buildDir/solr-${version}")
@@ -38,6 +38,7 @@ configurations {
contrib
example
server
+ docsOnline
}
dependencies {
@@ -62,12 +63,17 @@ dependencies {
example project(path: ":solr:example", configuration: "packaging")
server project(path: ":solr:server", configuration: "packaging")
+
+ // Copy files from documentation output
+ docsOnline project(path: ':solr', configuration: 'docsOnline')
}
distributions {
main {
distributionBaseName = 'solr'
contents {
+ // TODO: This is missing module README files, as compared to 8x
+
// Manually correct posix permissions (matters when packaging on Windows).
filesMatching([
"**/*.sh",
@@ -76,8 +82,8 @@ distributions {
"**/bin/solr",
"**/bin/init.d/solr",
"**/bin/solr-exporter",
- ]) {
- setMode 0755
+ ]) { copy ->
+ copy.setMode(0755)
}
from(project(":solr").projectDir, {
@@ -115,15 +121,13 @@ distributions {
into "server"
})
- // docs/ - TODO: this is assembled via XSLT... leaving out for now.
+ from(configurations.docsOnline, {
+ into "docs"
+ })
}
}
}
-distTar {
- compression = Compression.GZIP
-}
-
installDist {
into distDir
}
diff --git a/solr/site/index.xsl b/solr/site/index.xsl
deleted file mode 100644
index c2ac0105afd..00000000000
--- a/solr/site/index.xsl
+++ /dev/null
@@ -1,112 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:str="http://exslt.org/strings"
- extension-element-prefixes="str"
->
- <xsl:param name="buildfiles"/>
- <xsl:param name="version"/>
- <xsl:param name="luceneJavadocUrl"/>
- <xsl:param name="solrGuideVersion"/>
-
- <!--
- NOTE: This template matches the root element of any given input XML document!
- The XSL input file is ignored completely, but XSL expects one to be given,
- so build.xml passes itself here. The list of module build.xmls is given via
- string parameter, that must be splitted at '|'.
- -->
- <xsl:template match="/">
- <html>
- <head>
- <title><xsl:text>Apache Solr </xsl:text><xsl:value-of select="$version"/><xsl:text> Documentation</xsl:text></title>
- <link rel="icon" type="image/x-icon" href="images/favicon.ico"/>
- <link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico"/>
- </head>
- <body>
- <div>
- <a href="http://lucene.apache.org/solr/">
- <img src="images/solr.svg" style="width:210px; margin:22px 0px 7px 20px; border:none;" title="Apache Solr Logo" alt="Solr" />
- </a>
- <div style="z-index:100;position:absolute;top:25px;left:226px">
- <span style="font-size: x-small">TM</span>
- </div>
- </div>
- <h1>
- <xsl:text>Apache Solr</xsl:text>
- <span style="vertical-align: top; font-size: x-small">
- <xsl:text>TM</xsl:text>
- </span>
- <xsl:text> </xsl:text>
- <xsl:value-of select="$version"/>
- <xsl:text> Documentation</xsl:text>
- </h1>
- <p>Solr is the popular, blazing fast, open source NoSQL search platform from the Apache Lucene project. Its major
- features include powerful full-text search, hit highlighting, faceted search and analytics, rich document
- parsing, geospatial search, extensive REST APIs as well as parallel SQL. Solr is enterprise grade, secure and
- highly scalable, providing fault tolerant distributed search and indexing, and powers the search and navigation
- features of many of the world's largest internet sites.</p>
- <p>Solr is written in Java and runs as a standalone full-text search server. Solr uses the Lucene Java search
- library at its core for full-text indexing and search, and has REST-like JSON APIs that make it easy to use
- from virtually any programming language. Solr's powerful configuration APIs and files allows it to be tailored
- to almost any type of application without Java coding, and it has an extensive plugin architecture when more
- advanced customization is required.</p>
- <p>
- This is the official documentation for <b><xsl:text>Apache Solr </xsl:text>
- <xsl:value-of select="$version"/></b>.
- </p>
- <h2>Reference Documents</h2>
- <ul>
- <li><a href="https://lucene.apache.org/solr/guide/{$solrGuideVersion}/">Reference Guide</a>: The main documentation for Solr</li>
- <li><a href="changes/Changes.html">Changes</a>: List of changes in this release.</li>
- <li><a href="SYSTEM_REQUIREMENTS.html">System Requirements</a>: Minimum and supported Java versions.</li>
- <li><a href="https://lucene.apache.org/solr/guide/{$solrGuideVersion}/solr-tutorial.html">Solr Tutorial</a>: This document covers the basics of running Solr using an example schema, and some sample data.</li>
- <li><a href="{$luceneJavadocUrl}index.html">Lucene Documentation</a></li>
- </ul>
- <h2>API Javadocs</h2>
- <xsl:call-template name="modules"/>
- </body>
- </html>
- </xsl:template>
-
- <xsl:template name="modules">
- <ul>
- <xsl:for-each select="str:split($buildfiles,'|')">
- <!-- hack to list "core" and "solrj" first, contains() returns "true" which sorts before "false" if descending: -->
- <xsl:sort select="string(contains(text(), '/core/'))" order="descending" lang="en"/>
- <xsl:sort select="string(contains(text(), '/solrj/'))" order="descending" lang="en"/>
- <!-- hack to list "test-framework" at the end, contains() returns "true" which sorts after "false" if ascending: -->
- <xsl:sort select="string(contains(text(), '/test-framework/'))" order="ascending" lang="en"/>
- <!-- sort the remaining build files by path name: -->
- <xsl:sort select="text()" order="ascending" lang="en"/>
-
- <xsl:variable name="buildxml" select="document(.)"/>
- <xsl:variable name="name" select="$buildxml/*/@name"/>
- <li>
- <xsl:if test="$name='solr-core'">
- <xsl:attribute name="style">font-size:larger; margin-bottom:.5em;</xsl:attribute>
- </xsl:if>
- <b><a href="{$name}/index.html"><xsl:value-of select="$name"/>
- </a><xsl:text>: </xsl:text></b>
- <xsl:value-of select="normalize-space($buildxml/*/description)"/>
- </li>
- </xsl:for-each>
- </ul>
- </xsl:template>
-
-</xsl:stylesheet>
diff --git a/solr/site/online-link.template.md b/solr/site/online-link.template.md
index 1ea7142d052..a550b8e7ad4 100644
--- a/solr/site/online-link.template.md
+++ b/solr/site/online-link.template.md
@@ -17,3 +17,5 @@ if ("${project.version}" == "${project.baseVersion}") { // compare as strings be
println "Run `gradlew documentation` from `src.tgz` package to build docs locally."
}
%>
+
+Review the [changes](changes/Changes.html) in Apache Solr ${project.version}.
diff --git a/solr/site/online-link.xsl b/solr/site/online-link.xsl
deleted file mode 100644
index 0f2fd189ad7..00000000000
--- a/solr/site/online-link.xsl
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
->
- <xsl:param name="version"/>
- <xsl:param name="solrJavadocUrl"/>
-
- <!--
- NOTE: This template matches the root element of any given input XML document!
- The XSL input file is ignored completely, but XSL expects one to be given,
- so build.xml passes itself here. The list of module build.xmls is given via
- string parameter, that must be splitted at '|'.
- -->
- <xsl:template match="/">
- <html>
- <head>
- <title><xsl:text>Apache Solr </xsl:text><xsl:value-of select="$version"/><xsl:text> Documentation</xsl:text></title>
- <link rel="icon" type="image/x-icon" href="images/favicon.ico"/>
- <link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico"/>
- </head>
- <body>
- <div>
- <a href="http://lucene.apache.org/solr/">
- <img src="images/solr.svg" style="width:210px; margin:22px 0px 7px 20px; border:none;" title="Apache Solr Logo" alt="Solr" />
- </a>
- <div style="z-index:100;position:absolute;top:25px;left:226px">
- <span style="font-size: x-small">TM</span>
- </div>
- </div>
- <h1>
- <xsl:text>Apache Solr</xsl:text>
- <span style="vertical-align: top; font-size: x-small">
- <xsl:text>TM</xsl:text>
- </span>
- <xsl:text> </xsl:text>
- <xsl:value-of select="$version"/>
- <xsl:text> Documentation</xsl:text>
- </h1>
- <p>
- <xsl:choose>
- <xsl:when test="$solrJavadocUrl">
- <a href="{$solrJavadocUrl}">Follow this link to view online documentation for Solr <xsl:value-of select="$version"/>.</a>
- </xsl:when>
- <xsl:otherwise>
- No online documentation available for custom builds or SNAPSHOT versions. Run <code>ant documentation</code> from <code>src.tgz</code> package to build docs locally.
- </xsl:otherwise>
- </xsl:choose>
- </p>
- </body>
- </html>
- </xsl:template>
-
-</xsl:stylesheet>