From 4822bf7bab752ae0a7bc628825f6bd836e13ee29 Mon Sep 17 00:00:00 2001 From: Houston Putman Date: Fri, 10 Jan 2025 16:57:34 -0600 Subject: [PATCH] Fix smoketest for Solr 10 --- .../org/apache/lucene/gradle/Checksum.java | 4 +- dev-tools/scripts/smokeTestRelease.py | 111 +++++++++--------- gradle/java/javac.gradle | 24 ++-- 3 files changed, 71 insertions(+), 68 deletions(-) diff --git a/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/Checksum.java b/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/Checksum.java index a1d5c09586f..925493822ef 100644 --- a/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/Checksum.java +++ b/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/Checksum.java @@ -47,7 +47,7 @@ public class Checksum extends DefaultTask { private FileCollection files; private File outputDir; - private Algorithm algorithm = Checksum.Algorithm.SHA512; + private Algorithm algorithm; public enum Algorithm { MD5(new DigestUtils(DigestUtils.getMd5Digest())), @@ -68,7 +68,7 @@ public String getExtension() { public Checksum() { outputDir = new File(getProject().getBuildDir(), "checksums"); - algorithm = Algorithm.SHA256; + algorithm = Checksum.Algorithm.SHA512; } @InputFiles diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.py index 6358a152dd8..6744aea9070 100755 --- a/dev-tools/scripts/smokeTestRelease.py +++ b/dev-tools/scripts/smokeTestRelease.py @@ -141,15 +141,18 @@ def checkJARMetaData(desc, jarFile, gitRevision, version): s = decodeUTF8(z.read(MANIFEST_FILE_NAME)) + compileJDK = '21' + if 'solrj' in desc or 'api' in desc: + compileJDK = '17' for verify in ( 'Specification-Vendor: The Apache Software Foundation', 'Implementation-Vendor: The Apache Software Foundation', 'Specification-Title: Apache Solr Search Server:', 'Implementation-Title: org.apache.solr', - 'X-Compile-Source-JDK: 11', - 'X-Compile-Target-JDK: 11', + 'X-Compile-Source-JDK: %s' % compileJDK, + 'X-Compile-Target-JDK: %s' % compileJDK, 'Specification-Version: %s' % version, - 'X-Build-JDK: 11.', + 'X-Build-JDK: 21.', 'Extension-Name: org.apache.solr'): if type(verify) is not tuple: verify = (verify,) @@ -625,8 +628,8 @@ def verifyUnpacked(java, artifact, unpackPath, gitRevision, version, testArgs): # in_root_folder.remove(fileName) if isSrc: - expected_src_root_folders = ['buildSrc', 'dev-docs', 'dev-tools', 'gradle', 'help', 'solr'] - expected_src_root_files = ['build.gradle', 'gradlew', 'gradlew.bat', 'settings.gradle', 'versions.lock', 'versions.props'] + expected_src_root_folders = ['build-tools', 'dev-docs', 'dev-tools', 'gradle', 'help', 'solr'] + expected_src_root_files = ['build.gradle', 'gradlew', 'gradlew.bat', 'settings.gradle', 'settings-gradle.lockfile', 'versions.lock'] expected_src_solr_files = ['build.gradle'] expected_src_solr_folders = ['benchmark', 'bin', 'modules', 'api', 'core', 'cross-dc-manager', 'docker', 'documentation', 'example', 'licenses', 'packaging', 'distribution', 'prometheus-exporter', 'server', 'solr-ref-guide', 'solrj', 'solrj-streaming', 'solrj-zookeeper', 'test-framework', 'webapp', '.gitignore', '.gitattributes'] is_in_list(in_root_folder, expected_src_root_folders) @@ -660,47 +663,47 @@ def verifyUnpacked(java, artifact, unpackPath, gitRevision, version, testArgs): validateCmd = './gradlew --no-daemon check -p solr/documentation' print(' run "%s"' % validateCmd) - java.run_java11(validateCmd, '%s/validate.log' % unpackPath) - - print(" run tests w/ Java 11 and testArgs='%s'..." % testArgs) - java.run_java11('./gradlew --no-daemon test %s' % testArgs, '%s/test.log' % unpackPath) - print(" run integration tests w/ Java 11") - java.run_java11('./gradlew --no-daemon integrationTest -Dversion.release=%s' % version, '%s/itest.log' % unpackPath) - print(" build binary release w/ Java 11") - java.run_java11('./gradlew --no-daemon dev -Dversion.release=%s' % version, '%s/assemble.log' % unpackPath) - testSolrExample("%s/solr/packaging/build/dev" % unpackPath, java.java11_home, False) - - if java.run_java17: - print(" run tests w/ Java 17 and testArgs='%s'..." % testArgs) - java.run_java17('./gradlew --no-daemon clean test %s' % testArgs, '%s/test-java17.log' % unpackPath) - print(" run integration tests w/ Java 17") - java.run_java17('./gradlew --no-daemon integrationTest -Dversion.release=%s' % version, '%s/itest-java17.log' % unpackPath) - print(" build binary release w/ Java 17") - java.run_java17('./gradlew --no-daemon dev -Dversion.release=%s' % version, '%s/assemble-java17.log' % unpackPath) - testSolrExample("%s/solr/packaging/build/dev" % unpackPath, java.java17_home, False) + java.run_java21(validateCmd, '%s/validate.log' % unpackPath) + + print(" run tests w/ Java 21 and testArgs='%s'..." % testArgs) + java.run_java21('./gradlew --no-daemon test %s' % testArgs, '%s/test.log' % unpackPath) + print(" run integration tests w/ Java 21") + java.run_java21('./gradlew --no-daemon integrationTest -Dversion.release=%s' % version, '%s/itest.log' % unpackPath) + print(" build binary release w/ Java 21") + java.run_java21('./gradlew --no-daemon dev -Dversion.release=%s' % version, '%s/assemble.log' % unpackPath) + testSolrExample("%s/solr/packaging/build/dev" % unpackPath, java.java21_home, False) + + if java.run_java25: + print(" run tests w/ Java 25 and testArgs='%s'..." % testArgs) + java.run_java25('./gradlew --no-daemon clean test %s' % testArgs, '%s/test-java25.log' % unpackPath) + print(" run integration tests w/ Java 25") + java.run_java25('./gradlew --no-daemon integrationTest -Dversion.release=%s' % version, '%s/itest-java25.log' % unpackPath) + print(" build binary release w/ Java 25") + java.run_java25('./gradlew --no-daemon dev -Dversion.release=%s' % version, '%s/assemble-java25.log' % unpackPath) + testSolrExample("%s/solr/packaging/build/dev" % unpackPath, java.java25_home, False) else: # Binary tarball checkAllJARs(os.getcwd(), gitRevision, version) - print(' copying unpacked distribution for Java 11 ...') - java11UnpackPath = '%s-java11' % unpackPath - if os.path.exists(java11UnpackPath): - shutil.rmtree(java11UnpackPath) - shutil.copytree(unpackPath, java11UnpackPath) - os.chdir(java11UnpackPath) - print(' test solr example w/ Java 11...') - testSolrExample(java11UnpackPath, java.java11_home, isSlim) - - if java.run_java17: - print(' copying unpacked distribution for Java 17 ...') - java17UnpackPath = '%s-java17' % unpackPath - if os.path.exists(java17UnpackPath): - shutil.rmtree(java17UnpackPath) - shutil.copytree(unpackPath, java17UnpackPath) - os.chdir(java17UnpackPath) - print(' test solr example w/ Java 17...') - testSolrExample(java17UnpackPath, java.java17_home, isSlim) + print(' copying unpacked distribution for Java 21 ...') + java21UnpackPath = '%s-java21' % unpackPath + if os.path.exists(java21UnpackPath): + shutil.rmtree(java21UnpackPath) + shutil.copytree(unpackPath, java21UnpackPath) + os.chdir(java21UnpackPath) + print(' test solr example w/ Java 21...') + testSolrExample(java21UnpackPath, java.java21_home, isSlim) + + if java.run_java25: + print(' copying unpacked distribution for Java 25 ...') + java25UnpackPath = '%s-java25' % unpackPath + if os.path.exists(java25UnpackPath): + shutil.rmtree(java25UnpackPath) + shutil.copytree(unpackPath, java25UnpackPath) + os.chdir(java25UnpackPath) + print(' test solr example w/ Java 25...') + testSolrExample(java25UnpackPath, java.java25_home, isSlim) os.chdir(unpackPath) @@ -1019,7 +1022,7 @@ def crawl(downloadedFiles, urlString, targetDir, exclusions=set()): sys.stdout.write('.') -def make_java_config(parser, java17_home): +def make_java_config(parser, java25_home): def _make_runner(java_home, version): print('Java %s JAVA_HOME=%s' % (version, java_home)) if cygwin: @@ -1033,23 +1036,23 @@ def _make_runner(java_home, version): def run_java(cmd, logfile): run('%s; %s' % (cmd_prefix, cmd), logfile) return run_java - java11_home = os.environ.get('JAVA_HOME') - if java11_home is None: + java21_home = os.environ.get('JAVA_HOME') + if java21_home is None: parser.error('JAVA_HOME must be set') - run_java11 = _make_runner(java11_home, '11') - run_java17 = None - if java17_home is not None: - run_java17 = _make_runner(java17_home, '17') + run_java21 = _make_runner(java21_home, '21') + run_java25 = None + if java25_home is not None: + run_java25 = _make_runner(java25_home, '25') - jc = namedtuple('JavaConfig', 'run_java11 java11_home run_java17 java17_home') - return jc(run_java11, java11_home, run_java17, java17_home) + jc = namedtuple('JavaConfig', 'run_java21 java21_home run_java25 java25_home') + return jc(run_java21, java21_home, run_java25, java25_home) version_re = re.compile(r'(\d+\.\d+\.\d+(-ALPHA|-BETA)?)') revision_re = re.compile(r'rev-([a-f\d]+)') def parse_config(): epilogue = textwrap.dedent(''' Example usage: - python3 -u dev-tools/scripts/smokeTestRelease.py https://dist.apache.org/repos/dist/dev/solr/solr-9.0.0-RC1-rev-c7510a0... + python3 -u dev-tools/scripts/smokeTestRelease.py https://dist.apache.org/repos/dist/dev/solr/solr-10.0.0-RC1-rev-c7510a0... ''') description = 'Utility to test a release.' parser = argparse.ArgumentParser(description=description, epilog=epilogue, @@ -1064,8 +1067,8 @@ def parse_config(): help='GIT revision number that release was built with, defaults to that in URL') parser.add_argument('--version', metavar='X.Y.Z(-ALPHA|-BETA)?', help='Version of the release, defaults to that in URL') - parser.add_argument('--test-java17', metavar='java17_home', - help='Path to Java17 home directory, to run tests with if specified') + parser.add_argument('--test-java25', metavar='java25_home', + help='Path to Java25 home directory, to run tests with if specified') parser.add_argument('--download-only', action='store_true', default=False, help='Only perform download and sha hash check steps') parser.add_argument('--dev-mode', action='store_true', default=False, @@ -1094,7 +1097,7 @@ def parse_config(): if c.local_keys is not None and not os.path.exists(c.local_keys): parser.error('Local KEYS file "%s" not found' % c.local_keys) - c.java = make_java_config(parser, c.test_java17) + c.java = make_java_config(parser, c.test_java25) if c.tmp_dir: c.tmp_dir = os.path.abspath(c.tmp_dir) diff --git a/gradle/java/javac.gradle b/gradle/java/javac.gradle index ec33f977c64..be0196998a8 100644 --- a/gradle/java/javac.gradle +++ b/gradle/java/javac.gradle @@ -19,19 +19,19 @@ allprojects { plugins.withType(JavaPlugin) { - // Use 'release' flag instead of 'source' and 'target' - tasks.withType(JavaCompile) { - compileTestJava { - sourceCompatibility = project.minJavaTestVersion - targetCompatibility = project.minJavaTestVersion - options.compilerArgs += ["--release", project.minJavaTestVersion.toString()] - } - compileJava { - sourceCompatibility = project.minJavaVersion - targetCompatibility = project.minJavaVersion - options.compilerArgs += ["--release", project.minJavaVersion.toString()] - } + sourceCompatibility = project.minJavaVersion + targetCompatibility = project.minJavaVersion + // Use 'release' flag instead of 'source' and 'target' + tasks.withType(JavaCompile) { + compileTestJava { + sourceCompatibility = project.minJavaTestVersion + targetCompatibility = project.minJavaTestVersion + options.compilerArgs += ["--release", project.minJavaTestVersion.toString()] + } + compileJava { + options.compilerArgs += ["--release", project.minJavaVersion.toString()] } + } // Configure warnings. tasks.withType(JavaCompile) { options.encoding = "UTF-8"