You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2019/04/03 09:33:28 UTC
[lucene-solr] branch jira/LUCENE-8738 updated: LUCENE-8738,
LUCENE-7966: Remove MR-JAR classfile patching from Lucene 9
completely (minimum Java 11)
This is an automated email from the ASF dual-hosted git repository.
uschindler pushed a commit to branch jira/LUCENE-8738
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/jira/LUCENE-8738 by this push:
new ba01df2 LUCENE-8738, LUCENE-7966: Remove MR-JAR classfile patching from Lucene 9 completely (minimum Java 11)
ba01df2 is described below
commit ba01df2c22840b699a758df930e0212e1682457b
Author: Uwe Schindler <us...@apache.org>
AuthorDate: Wed Apr 3 11:33:10 2019 +0200
LUCENE-8738, LUCENE-7966: Remove MR-JAR classfile patching from Lucene 9 completely (minimum Java 11)
---
build.xml | 1 -
lucene/build.xml | 2 +-
lucene/common-build.xml | 55 +-------------
lucene/core/build.xml | 9 ---
lucene/module-build.xml | 9 ---
lucene/tools/src/groovy/patch-mrjar-classes.groovy | 83 ----------------------
solr/common-build.xml | 3 -
7 files changed, 4 insertions(+), 158 deletions(-)
diff --git a/build.xml b/build.xml
index 97735a5..f945499 100755
--- a/build.xml
+++ b/build.xml
@@ -692,5 +692,4 @@ Test args: [${args}]</echo>
<!-- useless targets (override common-build.xml): -->
<target name="generate-test-reports"/>
- <target name="patch-mrjar-classes"/>
</project>
diff --git a/lucene/build.xml b/lucene/build.xml
index 3c1439c..2b62123 100644
--- a/lucene/build.xml
+++ b/lucene/build.xml
@@ -541,7 +541,7 @@
</target>
<!-- Override common-build.xml definition to check for the jar already being up-to-date -->
- <target name="jar-core" depends="resolve-groovy,check-lucene-core-uptodate,compile-lucene-core" unless="lucene-core.uptodate">
+ <target name="jar-core" depends="check-lucene-core-uptodate,compile-lucene-core" unless="lucene-core.uptodate">
<ant dir="${common.dir}/core" target="jar-core" inheritAll="false">
<propertyset refid="uptodate.and.compiled.properties"/>
</ant>
diff --git a/lucene/common-build.xml b/lucene/common-build.xml
index e63d077..75c3486 100644
--- a/lucene/common-build.xml
+++ b/lucene/common-build.xml
@@ -166,10 +166,6 @@
<!-- Display at most this many failures as a summary at the end of junit4 run. -->
<property name="tests.showNumFailures" value="10" />
-
- <!-- If we detect Java 9+, should we test the patched classes of the
- multi-release JAR or still run with our own classes? -->
- <property name="tests.withJava9Patches" value="true" />
<property name="javac.deprecation" value="off"/>
<property name="javac.debug" value="on"/>
@@ -533,55 +529,10 @@
<!-- convenience target to compile core -->
</target>
- <!-- Disabled now that we require Java 11+
- Special targets to patch all class files by replacing some method calls with new Java 9 methods:
- <target name="-mrjar-classes-uptodate">
- <uptodate property="mrjar-classes-uptodate" targetfile="${build.dir}/patch-mrjar.stamp">
- <srcfiles dir= "${build.dir}/classes/java" includes="**/*.class"/>
- </uptodate>
- </target>
-
- <target xmlns:ivy="antlib:org.apache.ivy.ant" name="patch-mrjar-classes" depends="-mrjar-classes-uptodate,ivy-availability-check,ivy-configure,resolve-groovy,compile-core"
- unless="mrjar-classes-uptodate" description="Patches compiled class files for usage with Java 9 in MR-JAR">
- <loadproperties prefix="ivyversions" srcFile="${common.dir}/ivy-versions.properties"/>
- <ivy:cachepath organisation="org.ow2.asm" module="asm-commons" revision="${ivyversions./org.ow2.asm/asm-commons}"
- inline="true" conf="default" transitive="true" log="download-only" pathid="asm.classpath"/>
- <groovy taskname="patch-cls" classpathref="asm.classpath" src="${common.dir}/tools/src/groovy/patch-mrjar-classes.groovy"/>
- <touch file="${build.dir}/patch-mrjar.stamp"/>
- </target>
-
- <target name="-mrjar-check" depends="patch-mrjar-classes">
- <zipfileset id="mrjar-patched-files" prefix="META-INF/versions/9" dir="${build.dir}/classes/java9" erroronmissingdir="false"/>
- <condition property="has-mrjar-patched-files">
- <resourcecount refid="mrjar-patched-files" when="greater" count="0" />
- </condition>
- </target>
-
- <target name="-mrjar-core" depends="-mrjar-check" if="has-mrjar-patched-files">
- <jarify>
- <filesets>
- <zipfileset refid="mrjar-patched-files"/>
- </filesets>
- <jarify-additional-manifest-attributes>
- <attribute name="Multi-Release" value="true"/>
- </jarify-additional-manifest-attributes>
- </jarify>
- </target>
-
- <target name="-jar-core" depends="-mrjar-check" unless="has-mrjar-patched-files">
- <jarify/>
- </target>
-
- <target name="jar-core" depends="-mrjar-core,-jar-core"/>-->
-
- <target name="patch-mrjar-classes" depends="ivy-availability-check,ivy-configure,resolve-groovy,compile-core"/> <!-- empty -->
-
- <target name="jar-core" depends="patch-mrjar-classes">
+ <target name="jar-core" depends="compile-core">
<jarify/>
</target>
- <!-- Packaging targets: -->
-
<property name="lucene.tgz.file" location="${common.dir}/dist/lucene-${version}.tgz"/>
<available file="${lucene.tgz.file}" property="lucene.tgz.exists"/>
<property name="lucene.tgz.unpack.dir" location="${common.build.dir}/lucene.tgz.unpacked"/>
@@ -1480,8 +1431,8 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
</taskdef>
</target>
- <target name="test" depends="clover,compile-test,patch-mrjar-classes,install-junit4-taskdef,validate,-init-totals,-test,-check-totals" description="Runs unit tests"/>
- <target name="beast" depends="install-ant-contrib,clover,compile-test,patch-mrjar-classes,install-junit4-taskdef,validate,-init-totals,-beast,-check-totals" description="Runs unit tests in a loop (-Dbeast.iters=n)"/>
+ <target name="test" depends="clover,compile-test,install-junit4-taskdef,validate,-init-totals,-test,-check-totals" description="Runs unit tests"/>
+ <target name="beast" depends="install-ant-contrib,clover,compile-test,install-junit4-taskdef,validate,-init-totals,-beast,-check-totals" description="Runs unit tests in a loop (-Dbeast.iters=n)"/>
<target name="test-nocompile" depends="-clover.disable,install-junit4-taskdef,-init-totals,-test,-check-totals"
description="Only runs unit tests. Jars are not downloaded; compilation is not updated; and Clover is not enabled."/>
diff --git a/lucene/core/build.xml b/lucene/core/build.xml
index 46183b0..d968798 100644
--- a/lucene/core/build.xml
+++ b/lucene/core/build.xml
@@ -31,19 +31,10 @@
<path id="classpath"/>
- <!-- if we run with Java 9+, we refer to the java9 classes directory and insert this before the main classpath (to "emulate" a MR-JAR): -->
- <condition property="-test.classpath.java9.addon" value="${build.dir}/classes/java9" else="${build.dir}/classes/java">
- <and>
- <not><equals arg1="${build.java.runtime}" arg2="1.8"/></not>
- <istrue value="${tests.withJava9Patches}"/>
- </and>
- </condition>
-
<path id="test.classpath">
<pathelement location="${common.dir}/build/codecs/classes/java"/>
<pathelement location="${common.dir}/build/test-framework/classes/java"/>
<path refid="junit-path"/>
- <pathelement location="${-test.classpath.java9.addon}"/><!-- if it's a duplicate it gets removed by Ant! -->
<pathelement location="${build.dir}/classes/java"/>
<pathelement location="${build.dir}/classes/test"/>
</path>
diff --git a/lucene/module-build.xml b/lucene/module-build.xml
index d5798de..cf26a21 100644
--- a/lucene/module-build.xml
+++ b/lucene/module-build.xml
@@ -34,20 +34,11 @@
<!-- default classpath refid, can be overridden by contrib's build.xml (use the above base.classpath as basis): -->
<path id="classpath" refid="base.classpath"/>
- <!-- if we run with Java 9+, we refer to the java9 classes directory and insert this before the main classpath (to "emulate" a MR-JAR): -->
- <condition property="-test.classpath.java9.addon" value="${build.dir}/classes/java9" else="${build.dir}/classes/java">
- <and>
- <not><equals arg1="${build.java.runtime}" arg2="1.8"/></not>
- <istrue value="${tests.withJava9Patches}"/>
- </and>
- </condition>
-
<path id="test.base.classpath">
<pathelement location="${common.dir}/build/test-framework/classes/java"/>
<pathelement location="${common.dir}/build/codecs/classes/java"/>
<path refid="classpath"/>
<path refid="junit-path"/>
- <pathelement location="${-test.classpath.java9.addon}"/><!-- if it's a duplicate it gets removed by Ant! -->
<pathelement location="${build.dir}/classes/java"/>
</path>
diff --git a/lucene/tools/src/groovy/patch-mrjar-classes.groovy b/lucene/tools/src/groovy/patch-mrjar-classes.groovy
deleted file mode 100644
index 1ba6a98..0000000
--- a/lucene/tools/src/groovy/patch-mrjar-classes.groovy
+++ /dev/null
@@ -1,83 +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.
- */
-
-/** Task script that is called by Ant's common-build.xml file:
- * Patches Java 8 class files to replace method signatures by
- * native Java 9 optimized ones (to be placed in MR-JAR).
- */
-
-import org.apache.tools.ant.Project;
-
-import org.objectweb.asm.ClassReader;
-import org.objectweb.asm.ClassWriter;
-import org.objectweb.asm.commons.ClassRemapper;
-import org.objectweb.asm.commons.Remapper;
-
-def mappings = [
- 'org/apache/lucene/util/FutureObjects': 'java/util/Objects',
- 'org/apache/lucene/util/FutureArrays': 'java/util/Arrays',
-];
-
-if (properties['run.clover'] != null) {
- task.log("Disabled class file remapping for Java 9, because Clover code coverage is enabled.", Project.MSG_INFO);
- return;
-}
-
-File inputDir = new File(properties['build.dir'], 'classes/java');
-File outputDir = new File(properties['build.dir'], 'classes/java9');
-
-outputDir.mkdirs();
-
-def scanner = ant.fileScanner {
- fileset(dir:inputDir) {
- include(name:"**/*.class")
- }
-}
-
-int count = 0;
-for (f in scanner) {
- ClassReader reader = new ClassReader(f.getBytes());
- if (mappings.containsKey(reader.className)) {
- // we do not remap our replacements! :-)
- continue;
- }
-
- ClassWriter writer = new ClassWriter(0 /* no recalculations needed */);
- boolean remapped = false;
- ClassRemapper remapper = new ClassRemapper(writer, new Remapper() {
- @Override
- public String map(String typeName) {
- if (mappings.containsKey(typeName)) {
- remapped = true;
- return mappings.get(typeName);
- }
- return typeName;
- }
- });
-
- reader.accept(remapper, 0 /* keep everything as-is*/);
-
- if (remapped) {
- task.log("Remapped: "+reader.className, Project.MSG_INFO);
- File output = new File(outputDir, reader.className + '.class');
- output.parentFile.mkdirs();
- output.setBytes(writer.toByteArray());
- count++;
- }
-}
-
-task.log("Remapped $count class files for Java 9 to: $outputDir", Project.MSG_INFO);
diff --git a/solr/common-build.xml b/solr/common-build.xml
index 80002a4..823d962 100644
--- a/solr/common-build.xml
+++ b/solr/common-build.xml
@@ -557,7 +557,4 @@
<target name="test" unless="tests.disable-solr">
<antcall target="common.test" inheritrefs="true" inheritall="true"/>
</target>
-
- <!-- In Solr we do not generate MR-JARs yet; disable completely so we do not accidentally patch -->
- <target name="patch-mrjar-classes"/>
</project>