Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-9488 Update release process to work with gradle (#1860)

Mike Drob3134f10a4255
diff --git a/dev-tools/scripts/buildAndPushRelease.py b/dev-tools/scripts/buildAndPushRelease.py
index 58dbe8b321f..1742813818e 100755
--- a/dev-tools/scripts/buildAndPushRelease.py
+++ b/dev-tools/scripts/buildAndPushRelease.py
@@ -23,7 +23,6 @@ import os
import sys
import subprocess
from subprocess import TimeoutExpired
-from scriptutil import check_ant
import textwrap
import urllib.request, urllib.error, urllib.parse
import xml.etree.ElementTree as ET
@@ -108,37 +107,26 @@ def prepare(root, version, gpgKeyID, gpgPassword):
print(' Check DOAP files')
checkDOAPfiles(version)
- print(' ant -Dtests.badapples=false clean validate documentation-lint test')
- run('ant -Dtests.badapples=false clean validate documentation-lint test')
+ print(' ./gradlew -Dtests.badapples=false clean check')
+ run('./gradlew -Dtests.badapples=false clean check')
open('rev.txt', mode='wb').write(rev.encode('UTF-8'))
- print(' lucene prepare-release')
- os.chdir('lucene')
- cmd = 'ant -Dversion=%s' % version
+ print(' prepare-release')
+ cmd = './gradlew -Dversion=%s clean' % version
+ # TODO cd lucene ; ant dist-all?
+ # TODO cd solr ; ant package?
if gpgKeyID is not None:
- cmd += ' -Dgpg.key=%s prepare-release' % gpgKeyID
- else:
- cmd += ' prepare-release-no-sign'
+ # TODO sign
+ # cmd += ' -Psigning.keyId=%s publishSignedPublicationToMavenLocal' % gpgKeyID
+ pass
+ cmd += ' mavenLocal'
if gpgPassword is not None:
runAndSendGPGPassword(cmd, gpgPassword)
else:
run(cmd)
- print(' solr prepare-release')
- os.chdir('../solr')
- cmd = 'ant -Dversion=%s' % version
- if gpgKeyID is not None:
- cmd += ' -Dgpg.key=%s prepare-release' % gpgKeyID
- else:
- cmd += ' prepare-release-no-sign'
-
- if gpgPassword is not None:
- runAndSendGPGPassword(cmd, gpgPassword)
- else:
- run(cmd)
-
print(' done!')
print()
return rev
@@ -287,7 +275,6 @@ def parse_config():
def check_cmdline_tools(): # Fail fast if there are cmdline tool problems
if os.system('git --version >/dev/null 2>/dev/null'):
raise RuntimeError('"git --version" returned a non-zero exit code.')
- check_ant()
def check_key_in_keys(gpgKeyID, local_keys):
if gpgKeyID is not None:
diff --git a/dev-tools/scripts/releaseWizard.py b/dev-tools/scripts/releaseWizard.py
index 9c702376134..8a9306bf9d5 100755
--- a/dev-tools/scripts/releaseWizard.py
+++ b/dev-tools/scripts/releaseWizard.py
@@ -64,7 +64,7 @@ import scriptutil
from consolemenu import ConsoleMenu
from consolemenu.items import FunctionItem, SubmenuItem, ExitItem
from consolemenu.screen import Screen
-from scriptutil import BranchType, Version, check_ant, download, run
+from scriptutil import BranchType, Version, download, run
# Solr-to-Java version mapping
java_versions = {6: 8, 7: 8, 8: 8, 9: 11}
@@ -100,6 +100,7 @@ def expand_jinja(text, vars=None):
'release_version_refguide': state.get_refguide_release() ,
'state': state,
'gpg_key' : state.get_gpg_key(),
+ 'gradle_cmd' : 'gradlew.bat' if is_windows() else './gradlew',
'epoch': unix_time_millis(datetime.utcnow()),
'get_next_version': state.get_next_version(),
'current_git_rev': state.get_current_git_rev(),
@@ -179,12 +180,10 @@ def check_prerequisites(todo=None):
gpg_ver = run("gpg --version").splitlines()[0]
except:
sys.exit("You will need gpg installed")
- if not check_ant().startswith('1.8'):
- print("WARNING: This script will work best with ant 1.8. The script buildAndPushRelease.py may have problems with PGP password input under ant 1.10")
if not 'GPG_TTY' in os.environ:
print("WARNING: GPG_TTY environment variable is not set, GPG signing may not work correctly (try 'export GPG_TTY=$(tty)'")
- if not 'JAVA8_HOME' in os.environ or not 'JAVA11_HOME' in os.environ:
- sys.exit("Please set environment variables JAVA8_HOME and JAVA11_HOME")
+ if not 'JAVA11_HOME' in os.environ:
+ sys.exit("Please set environment variables JAVA11_HOME")
try:
asciidoc_ver = run("asciidoctor -V").splitlines()[0]
except:
@@ -572,14 +571,17 @@ class ReleaseState:
raise Exception("Cannot find latest version")
def get_stable_branch_name(self):
- v = Version.parse(self.get_latest_version())
+ if self.release_type == 'major':
+ v = Version.parse(self.get_master_version())
+ else:
+ v = Version.parse(self.get_latest_version())
return "branch_%sx" % v.major
def get_next_version(self):
if self.release_type == 'major':
- return "%s.0" % (self.release_version_major + 1)
+ return "%s.0.0" % (self.release_version_major + 1)
if self.release_type == 'minor':
- return "%s.%s" % (self.release_version_major, self.release_version_minor + 1)
+ return "%s.%s.0" % (self.release_version_major, self.release_version_minor + 1)
if self.release_type == 'bugfix':
return "%s.%s.%s" % (self.release_version_major, self.release_version_minor, self.release_version_bugfix + 1)
@@ -1364,7 +1366,6 @@ def main():
release_version = get_release_version()
store_rc(release_root, release_version)
-
check_prerequisites()
try:
@@ -1379,7 +1380,7 @@ def main():
state.save()
- # Smoketester requires JAVA_HOME to point to JAVA8 and JAVA11_HOME to point ot Java11
+ # Smoketester requires JAVA11_HOME to point to Java11
os.environ['JAVA_HOME'] = state.get_java_home()
os.environ['JAVACMD'] = state.get_java_cmd()
@@ -1395,7 +1396,7 @@ def main():
subtitle=get_releasing_text,
prologue_text="Welcome to the release wizard. From here you can manage the process including creating new RCs. "
"All changes are persisted, so you can exit any time and continue later. Make sure to read the Help section.",
- epilogue_text="® 2019 The Lucene/Solr project. Licensed under the Apache License 2.0\nScript version v%s ALPHA)" % getScriptVersion(),
+ epilogue_text="® 2020 The Lucene/Solr project. Licensed under the Apache License 2.0\nScript version v%s ALPHA)" % getScriptVersion(),
screen=MyScreen())
todo_menu = UpdatableConsoleMenu(title=get_releasing_text,
diff --git a/dev-tools/scripts/releaseWizard.yaml b/dev-tools/scripts/releaseWizard.yaml
index 09be4772d0a..6de5ab1c75e 100644
--- a/dev-tools/scripts/releaseWizard.yaml
+++ b/dev-tools/scripts/releaseWizard.yaml
@@ -296,8 +296,7 @@ groups:
You will need these tools:
* Python v3.4 or later, with dependencies listed in requirements.txt
- * Java 8 in $JAVA8_HOME and Java 11 in $JAVA11_HOME
- * Apache Ant 1.8 or later. (Known issue with 1.10 and GPG password entry)
+ * Java 11 in $JAVA11_HOME
* gpg
* git
* svn
@@ -375,7 +374,7 @@ groups:
todos:
- !Todo
id: clean_git_checkout
- title: Do a clean git clone to do the release from.
+ title: Do a clean git clone to do the release from
description: This eliminates the risk of a dirty checkout
commands: !Commands
root_folder: '{{ release_folder }}'
@@ -387,8 +386,8 @@ groups:
cmd: git clone --progress https://gitbox.apache.org/repos/asf/lucene-solr.git lucene-solr
logfile: git_clone.log
- !Todo
- id: ant_precommit
- title: Run ant precommit and fix issues
+ id: gradle_precommit
+ title: Run gradle precommit and fix issues
depends: clean_git_checkout
commands: !Commands
root_folder: '{{ git_checkout_folder }}'
@@ -396,7 +395,7 @@ groups:
From the base branch {{ base_branch }} we'll run precommit tests.
Fix any problems that are found by pushing fixes to the branch
and then running this task again. This task will always do `git pull`
- before `ant precommit` so it will catch changes to your branch :)
+ before `{{ gradle_cmd }} precommit` so it will catch changes to your branch :)
confirm_each_command: false
commands:
- !Command
@@ -408,10 +407,12 @@ groups:
logfile: git_clean.log
tee: true
- !Command
- cmd: git pull
+ cmd: git pull --ff-only
stdout: true
- !Command
- cmd: ant clean precommit
+ cmd: "{{ gradle_cmd }} localSettings"
+ - !Command
+ cmd: "{{ gradle_cmd }} clean check -x test"
- !Todo
id: create_stable_branch
title: Create a new stable branch, off from master
@@ -427,7 +428,7 @@ groups:
cmd: git checkout master
tee: true
- !Command
- cmd: git pull
+ cmd: git pull --ff-only
tee: true
- !Command
cmd: git ls-remote --exit-code --heads origin {{ stable_branch }}
@@ -456,7 +457,7 @@ groups:
cmd: git checkout {{ stable_branch }}
tee: true
- !Command
- cmd: git pull
+ cmd: git pull --ff-only
tee: true
- !Command
cmd: git ls-remote --exit-code --heads origin {{ release_branch }}
@@ -672,27 +673,23 @@ groups:
cmd: git checkout {{ release_branch }}
stdout: true
- !Command
- cmd: ant javadocs
- cwd: lucene
- - !Command
- cmd: ant javadocs
- cwd: solr
+ cmd: "{{ gradle_cmd }} documentation"
post_description: Check that both tests pass. If they fail, commit fixes for the failures before proceeding.
- !Todo
- id: clear_ivy_cache
- title: Clear the ivy cache
+ id: clear_gradle_cache
+ title: Clear the gradle cache
description: |
- It is recommended to clean your Ivy cache before building the artifacts.
- This ensures that all Ivy dependencies are freshly downloaded,
+ It is recommended to clean your Gradle cache before building the artifacts.
+ This ensures that all Gradle dependencies are freshly downloaded,
so we emulate a user that never used the Lucene build system before.
commands: !Commands
root_folder: '{{ home }}'
- remove_files: .ivy2/cache_bak
+ remove_files: .gradle/caches/modules-2/files-2.1_bak
commands_text: These commands will help you rename the folder so you can get it back later if you wish
commands:
- !Command
- cmd: "{{ rename_cmd }} cache cache_bak"
- cwd: .ivy2
+ cmd: "{{ rename_cmd }} files-2.1 files-2.1_bak"
+ cwd: .gradle/caches/modules-2
stdout: true
- !Todo
id: build_rc
@@ -728,7 +725,7 @@ groups:
logfile: git_clean.log
tee: true
- !Command
- cmd: git pull
+ cmd: git pull --ff-only
tee: true
- !Command
cmd: python3 -u dev-tools/scripts/buildAndPushRelease.py {{ local_keys }} --logfile {{ logfile }} --push-local "{{ dist_file_path }}" --rc-num {{ rc_number }} --sign {{ gpg_key | default("<gpg_key_id>", True) }}
@@ -1059,7 +1056,7 @@ groups:
logfile: checkout-release-tag.log
tee: true
- !Command
- cmd: ant documentation -Dversion={{ release_version }}
+ cmd: "{{ gradle_cmd }} documentation -Dversion={{ 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 }}
@@ -1239,7 +1236,7 @@ groups:
root_folder: '{{ git_website_folder }}'
commands:
- !Command
- cmd: git checkout production && git pull
+ cmd: git checkout production && git pull --ff-only
stdout: true
- !Command
cmd: git merge master
@@ -1273,7 +1270,7 @@ groups:
commands_text: Edit DOAP files
commands:
- !Command
- cmd: git checkout master && git pull
+ cmd: git checkout master && git pull --ff-only
stdout: true
comment: Goto master branch
- !Command
@@ -1294,7 +1291,7 @@ groups:
stdout: true
comment: Push the master branch
- !Command
- cmd: "git checkout {{ stable_branch }} && git pull"
+ cmd: "git checkout {{ stable_branch }} && git pull --ff-only"
stdout: true
comment: Checkout the stable branch
- !Command
@@ -1312,7 +1309,7 @@ groups:
stdout: true
comment: Push the stable branch
- !Command
- cmd: "git checkout {{ release_branch }} && git pull"
+ cmd: "git checkout {{ release_branch }} && git pull --ff-only"
stdout: true
comment: Checkout the release branch
- !Command
@@ -1406,7 +1403,7 @@ groups:
confirm_each_command: true
commands:
- !Command
- cmd: git checkout master && git pull && git clean -df && git checkout -- .
+ cmd: git checkout master && git pull --ff-only && git clean -df && git checkout -- .
comment: Go to master branch
logfile: checkout-master.log
- !Command
@@ -1420,7 +1417,7 @@ groups:
cmd: git add -u . && git commit -m "Add bugfix version {{ release_version }}" && git push
logfile: commit-master.log
- !Command
- cmd: git checkout {{ stable_branch }} && git pull && git clean -df && git checkout -- .
+ cmd: git checkout {{ stable_branch }} && git pull --ff-only && git clean -df && git checkout -- .
logfile: checkout-stable.log
comment: Now the same for the stable branch
- !Command
@@ -1459,7 +1456,7 @@ groups:
tee: true
comment: Find version regexes
- !Command
- cmd: git checkout master && git pull && git clean -df && git checkout -- .
+ cmd: git checkout master && git pull --ff-only && git clean -df && git checkout -- .
comment: Go to master branch
logfile: checkout-master.log
- !Command
@@ -1474,7 +1471,7 @@ groups:
cmd: git add -u . && git commit -m "Sync CHANGES for {{ release_version }}" && git push
logfile: commit-master.log
- !Command
- cmd: git checkout {{ stable_branch }} && git pull && git clean -df && git checkout -- .
+ cmd: git checkout {{ stable_branch }} && git pull --ff-only && git clean -df && git checkout -- .
comment: Go to stable branch
logfile: checkout-stable.log
- !Command
@@ -1540,11 +1537,11 @@ groups:
commands_text: Run these commands to add back-compat indices to release branch
commands:
- !Command
- cmd: git checkout {{ release_branch }} && git pull && git clean -df && git checkout -- .
+ cmd: git checkout {{ release_branch }} && git pull --ff-only && git clean -df && git checkout -- .
tee: true
logfile: checkout.log
- !Command
- cmd: ant clean
+ cmd: "{{ gradle_cmd }} clean"
- !Command
cmd: python3 -u dev-tools/scripts/addBackcompatIndexes.py --no-cleanup --temp-dir {{ temp_dir }} {{ release_version }} && git add lucene/backward-codecs/src/test/org/apache/lucene/index/
logfile: add-backcompat.log
@@ -1569,11 +1566,11 @@ groups:
commands_text: Run these commands to add back-compat indices to {{ stable_branch }}
commands:
- !Command
- cmd: git checkout {{ stable_branch }} && git pull && git clean -df && git checkout -- .
+ cmd: git checkout {{ stable_branch }} && git pull --ff-only && git clean -df && git checkout -- .
tee: true
logfile: checkout.log
- !Command
- cmd: ant clean
+ cmd: "{{ gradle_cmd }} clean"
- !Command
cmd: python3 -u dev-tools/scripts/addBackcompatIndexes.py --no-cleanup --temp-dir {{ temp_dir }} {{ release_version }} && git add lucene/backward-codecs/src/test/org/apache/lucene/index/
logfile: add-backcompat.log
@@ -1600,11 +1597,11 @@ groups:
commands_text: Run these commands to add back-compat indices to master
commands:
- !Command
- cmd: git checkout master && git pull && git clean -df && git checkout -- .
+ cmd: git checkout master && git pull --ff-only && git clean -df && git checkout -- .
tee: true
logfile: checkout.log
- !Command
- cmd: ant clean
+ cmd: "{{ gradle_cmd }} clean"
- !Command
cmd: python3 -u dev-tools/scripts/addBackcompatIndexes.py --temp-dir {{ temp_dir }} {{ release_version }} && git add lucene/backward-codecs/src/test/org/apache/lucene/index/
logfile: add-backcompat.log
diff --git a/dev-tools/scripts/scriptutil.py b/dev-tools/scripts/scriptutil.py
index 6a30508d669..254f6b6958d 100644
--- a/dev-tools/scripts/scriptutil.py
+++ b/dev-tools/scripts/scriptutil.py
@@ -109,17 +109,6 @@ def update_file(filename, line_re, edit):
return True
-def check_ant():
- antVersion = os.popen('ant -version').read().strip()
- if (antVersion.startswith('Apache Ant(TM) version 1.8')):
- return antVersion.split(" ")[3]
- if (antVersion.startswith('Apache Ant(TM) version 1.9')):
- return antVersion.split(" ")[3]
- if (antVersion.startswith('Apache Ant(TM) version 1.10')):
- return antVersion.split(" ")[3]
- raise RuntimeError('Unsupported ant version (must be 1.8 - 1.10): "%s"' % antVersion)
-
-
# branch types are "release", "stable" and "unstable"
class BranchType(Enum):
unstable = 1
diff --git a/lucene/version.properties b/lucene/version.properties
new file mode 100644
index 00000000000..a00b0869a8e
--- /dev/null
+++ b/lucene/version.properties
@@ -0,0 +1,10 @@
+# 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}