Skip to content

Commit

Permalink
Some more infrastructure changes to work w/ java8 code. Namely, neute…
Browse files Browse the repository at this point in the history
…r ant so that we don't use it for anything other than javadoc & jdiff. A few of the libraries it depended on (jarjar, bnd) didn't work with java8 code. We don't really need ant (we just use it for javadocs & jdiffs right now, and theoretically those could move to mvn too if someone figures out how to do that).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=238041337
  • Loading branch information
sameb authored and ronshapiro committed Apr 7, 2019
1 parent fd04a9e commit c09ba1d
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 398 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ env:
- secure: "pAeI941ODNSo6F7A94WFafxYqp2kdeFTJksMLVHljT0h2nX6/236OXn/iZXiB+FbXe/DkQIHN3n1IZRwE8UJAbSAwoaPUWenPy4mNAhnI4L/rwysREwq5FKSFTWJet9HitfFR57ezLGOV0VLFfH1xGsNWabHzzbwbV3WMl9pH0M="
- secure: "Pqj194YmdK0va4bOkbjVG0wCZ7sbB5k3Qq66zSG2M26M21uHonwhXprdtSeYZ5Oy9fWcQte7jSA69euyYyLriDH6DU2NE34scK2Y1yO6SCfx5SGr3XuxHWqxtNOxoUaH4RP1WR/9CRkBg8kBxzWus3M2ZeqElu33/p2CtgJEdJg="
matrix:
- LABEL=ant CMD="ant dist test.dist" INSTALL="/bin/true"
- LABEL=ant_no_aop CMD="ant -f build/no_aop/build.xml dist test.dist" INSTALL="ant no_aop"
- LABEL=docs CMD="ant javadoc jdiff" INSTALL="/bin/true"
- LABEL=mvn CMD="mvn -B -P!standard-with-extra-repos verify --fail-at-end -Dsource.skip=true -Dmaven.javadoc.skip=true" INSTALL="mvn -P!standard-with-extra-repos dependency:go-offline test clean --quiet --fail-never -DskipTests=true"

install:
Expand All @@ -28,7 +27,6 @@ script:

after_success:
- util/generate-latest-docs.sh
- util/compareBuilds.sh
- util/publish-snapshot-on-commit.sh

branches:
Expand Down
164 changes: 0 additions & 164 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,125 +17,6 @@
<pathelement location="${build.dir}/classes"/>
</path>


<target name="jar" depends="jar.withdeps, manifest" description="Build jar.">
<jar jarfile="${build.dir}/dist/guice-${version}.jar"
manifest="${build.dir}/META-INF/MANIFEST.MF">
<zipfileset src="${build.dir}/${ant.project.name}-with-deps.jar"/>
</jar>
</target>

<target name="dist" depends="distjars, javadoc"
description="Build entire distribution.">
<ant antfile="extensions/servlet/build.xml" target="distjars" inheritAll="false"/>
<ant antfile="extensions/spring/build.xml" target="distjars" inheritAll="false"/>
<ant antfile="extensions/struts2/build.xml" target="distjars" inheritAll="false"/>
<ant antfile="extensions/assistedinject/build.xml" target="distjars" inheritAll="false"/>
<ant antfile="extensions/jmx/build.xml" target="distjars" inheritAll="false"/>
<ant antfile="extensions/jndi/build.xml" target="distjars" inheritAll="false"/>
<ant antfile="extensions/throwingproviders/build.xml" target="distjars" inheritAll="false"/>
<ant antfile="extensions/dagger-adapter/build.xml" target="distjars" inheritAll="false"/>
<ant antfile="extensions/persist/build.xml" target="distjars" inheritAll="false"/>
<ant antfile="extensions/grapher/build.xml" target="distjars" inheritAll="false"/>
<ant antfile="extensions/testlib/build.xml" target="distjars" inheritAll="false"/>

<copy toDir="${build.dir}/dist">
<fileset dir="extensions/servlet/build" includes="*.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="extensions/spring/build" includes="*.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="extensions/struts2/build" includes="*.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="extensions/assistedinject/build" includes="*.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="extensions/jmx/build" includes="*.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="extensions/jndi/build" includes="*.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="extensions/throwingproviders/build" includes="*.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="extensions/dagger-adapter/build" includes="*.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="extensions/persist/build" includes="*.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="extensions/grapher/build" includes="*.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="extensions/testlib/build" includes="*.jar"/>
</copy>

<copy toDir="${build.dir}/dist" file="COPYING"/>
<copy toDir="${build.dir}/dist">
<fileset dir="${lib.dir}"
includes="*.jar"/>
</copy>
<copy toDir="${build.dir}/dist">
<fileset dir="${build.dir}" includes="javadoc/**/*"/>
</copy>

<zip destfile="${build.dir}/guice-${version}.zip">
<zipfileset dir="${build.dir}/dist" prefix="guice-${version}" excludes="*-src.jar"/>
</zip>
<zip destfile="${build.dir}/guice-${version}-src.zip">
<zipfileset dir="." prefix="guice-${version}-src"
excludes="build/**,**/.svn/**,classes/**,.settings/**,bin/**,latest-api-diffs/**,latest-javadoc/**,.classpath,.project"/>
</zip>
</target>

<target name="test.dist"
description="Execute JUnit tests against distribution jar.">
<antcall target="test.dist.run">
<param name="jvmarg-value" value="-Dguice_include_stack_traces="/>
</antcall>
<antcall target="test.dist.run">
<param name="jvmarg-value" value="-Dguice_include_stack_traces=OFF"/>
</antcall>
<antcall target="test.dist.run">
<param name="jvmarg-value" value="-Dguice_include_stack_traces=COMPLETE"/>
</antcall>
</target>

<target name="test.dist.run"
depends="jar, test.withdeps"
description="Execute JUnit tests against distribution jar with the given jvmarg.">
<java fork="true"
classname="junit.textui.TestRunner"
failonerror="true"
taskname="junit">
<classpath>
<pathelement location="${build.dir}/guice-${version}-tests.jar"/>
<pathelement location="${build.dir}/dist/guice-${version}.jar"/>
<pathelement location="lib/javax.inject.jar"/>
<pathelement location="lib/aopalliance.jar"/>
<pathelement location="lib/guava-27.1-jre.jar"/>
<pathelement location="lib/build/guava-testlib-27.1-jre.jar"/>
<pathelement location="lib/build/junit.jar"/>
<pathelement location="lib/build/servlet-api-2.5.jar"/>
<pathelement location="lib/build/truth-0.41.jar"/>
<pathelement location="lib/build/easymock.jar"/>
<pathelement location="lib/build/javax.inject-tck.jar"/>
<pathelement location="lib/build/bnd-0.0.384.jar"/>
<pathelement location="lib/build/felix-2.0.5.jar"/>
</classpath>
<arg value="com.google.inject.AllTests"/>
<jvmarg value="${jvmarg-value}"/>
<syspropertyset>
<propertyref name="version"/>
<propertyref name="build.dir"/>
<propertyref name="lib.dir"/>
</syspropertyset>
</java>
</target>

<property name="old.api" value="4.2.2"/>
<property name="new.api" value="latest"/>
<target name="jdiff" depends="compile">
Expand Down Expand Up @@ -247,51 +128,6 @@
</javadoc>
</target>

<target name="no_aop"
description="Create a copy of the Guice source that doesn't do bytecode generation.">
<taskdef name="munge" classname="MungeTask" classpath="lib/build/munge.jar"/>
<mkdir dir="build/no_aop"/>
<munge todir="build/no_aop">
<fileset dir=".">
<!-- exclude generated files -->
<exclude name="build/**"/>
<exclude name="classes/**"/>
<exclude name="latest-api-diffs/**"/>
<exclude name="javadoc/**"/>
<exclude name="latest-javadoc/**"/>
<!-- exclude AOP-specific libraries -->
<exclude name="lib/aopalliance.jar"/>
<exclude name="lib/build/asm-*.jar"/>
<exclude name="lib/build/cglib-*.jar"/>
<!-- exclude AOP-specific classes -->
<exclude name="**/LineNumbers.java"/>
<exclude name="**/InterceptorBindingProcessor.java"/>
<exclude name="**/ProxyFactory.java"/>
<exclude name="**/ProxyFactoryTest.java"/>
<exclude name="**/InterceptorStackCallback.java"/>
<exclude name="**/InterceptorBinding.java"/>
<exclude name="**/MethodAspect.java"/>
<exclude name="**/MethodInterceptionTest.java"/>
<exclude name="**/BytecodeGenTest.java"/>
<exclude name="**/IntegrationTest.java"/>
<exclude name="**/MethodInterceptionTest.java"/>
</fileset>
<arg value="-DNO_AOP" />
</munge>
<replace file="build/no_aop/common.xml" value="">
<replacetoken><![CDATA[<zipfileset src="${common.basedir}/lib/build/asm-7.0.jar"/>]]></replacetoken>
</replace>
<replace file="build/no_aop/common.xml" value="">
<replacetoken><![CDATA[<zipfileset src="${common.basedir}/lib/build/cglib-3.2.9.jar"/>]]></replacetoken>
</replace>
<replace file="build/no_aop/common.xml" value="">
<replacetoken><![CDATA[<zipfileset src="${common.basedir}/lib/build/cglib-3.2.9.jar"><include name="LICENSE"/><include name="NOTICE"/></zipfileset>]]></replacetoken>
</replace>
<replace file="build/no_aop/common.xml" value='Bundle-Name" value="$${ant.project.name} (no_aop)'>
<replacetoken><![CDATA[Bundle-Name" value="${ant.project.name}]]></replacetoken>
</replace>
</target>

<target name="clean.all"
depends="clean"
description="Remove generated files.">
Expand Down
126 changes: 0 additions & 126 deletions common.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,134 +23,8 @@
</copy>
</target>

<target name="manifest" description="Generate OSGi manifest." depends="compile">
<dirname property="common.basedir" file="${ant.file.common}"/>
<taskdef resource="aQute/bnd/ant/taskdef.properties"
classpath="${common.basedir}/lib/build/bnd-0.0.384.jar"/>

<fail unless="module" message="Missing 'module' property (use the primary package name in this jar)"/>
<property name="imports" value=""/>

<property name="Bundle-Name" value="${ant.project.name}"/>
<property name="Bundle-SymbolicName" value="${module}"/>
<property name="Bundle-Version" value="${replace;${version};^[^0-9];0.0.0.$0}"/>

<property name="Bundle-Description" value="Guice is a lightweight dependency injection framework for Java 6 and above"/>
<property name="Bundle-DocURL" value="https://github.com/google/guice"/>
<property name="Bundle-Copyright" value="Copyright (C) 2006 Google Inc."/>
<property name="Bundle-License" value="http://www.apache.org/licenses/LICENSE-2.0.txt"/>
<property name="Bundle-RequiredExecutionEnvironment" value="JavaSE-1.7"/>
<property name="Bundle-Vendor" value="Google, Inc."/>

<property name="Export-Package" value="!${module}.internal.*,${module}.*;version=${api.version}"/>

<condition property="Eclipse-ExtensibleAPI" value="true">
<equals arg1="${module}" arg2="com.google.inject"/>
</condition>

<condition property="Import-Package" value="!com.google.inject.*,*" else="!${module}.*,${imports},*">
<istrue value="${fragment}"/>
</condition>

<condition property="Fragment-Host" value="com.google.inject">
<istrue value="${fragment}"/>
</condition>

<property name="-nouses" value="true"/>

<property name="-removeheaders" value="Bnd-LastModified,Ignore-Package,Include-Resource,Private-Package,Tool"/>

<bndwrap jars="${build.dir}/classes" output="${build.dir}"/>

<unjar src="${build.dir}/classes.bar" dest="${build.dir}">
<patternset>
<include name="META-INF/MANIFEST.MF"/>
</patternset>
</unjar>
</target>

<target name="test.compile"
depends="compile"
description="Compile test source.">
<mkdir dir="${build.dir}/test"/>
<javac srcdir="${test.dir}"
debug="on"
destdir="${build.dir}/test"
source="1.7" target="1.7" includeantruntime="false">
<classpath path="${build.dir}/classes"/>
<classpath path="${build.dir}/test"/>
<classpath refid="compile.classpath"/>
</javac>
<copy toDir="${build.dir}/test">
<fileset dir="${test.dir}" excludes="**/*.java"/>
</copy>
</target>

<target name="test"
depends="test.compile"
description="Execute JUnit tests.">
<java fork="true"
classname="junit.textui.TestRunner"
failonerror="true"
taskname="junit">
<classpath>
<pathelement location="${build.dir}/test"/>
<pathelement location="${build.dir}/classes"/>
<path refid="compile.classpath"/>
</classpath>
<arg value="${test.class}"/>
</java>
</target>

<target name="clean"
description="Remove generated files.">
<delete dir="${build.dir}"/>
</target>

<target name="source.jar"
description="Create a .jar file with sources">
<mkdir dir="${build.dir}"/>
<zip destfile="${build.dir}/${ant.project.name}-${version}-src.jar">
<fileset dir="${src.dir}"/>
</zip>
</target>

<target name="distjars"
depends="source.jar, jar"
description="Build jar files"/>

<target name="test.withdeps" depends="test.compile"
description="Build a jar of tests with internal.util refocused.">
<mkdir dir="${build.dir}/dist"/>
<dirname property="common.basedir" file="${ant.file.common}"/>
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"
classpath="${common.basedir}/lib/build/jarjar-1.1.jar"/>
<jarjar jarfile="${build.dir}/${ant.project.name}-${version}-tests.jar">
<fileset dir="${build.dir}/test"/>
<rule pattern="net.sf.cglib.*" result="com.google.inject.internal.cglib.$@1"/>
<rule pattern="net.sf.cglib.**.*" result="com.google.inject.internal.cglib.@1.$@2"/>
<rule pattern="org.objectweb.asm.*" result="com.google.inject.internal.asm.$@1"/>
<rule pattern="org.objectweb.asm.**.*" result="com.google.inject.internal.asm.@1.$@2"/>
<keep pattern="com.google.inject.**"/>
<keep pattern="com.googlecode.**"/>
</jarjar>
</target>

<target name="jar.withdeps" depends="compile"
description="Build jar with dependencies embedded.">
<mkdir dir="${build.dir}/dist"/>
<dirname property="common.basedir" file="${ant.file.common}"/>
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"
classpath="${common.basedir}/lib/build/jarjar-1.1.jar"/>
<jarjar jarfile="${build.dir}/${ant.project.name}-with-deps.jar">
<fileset dir="${build.dir}/classes"/>
<zipfileset src="${common.basedir}/lib/build/cglib-3.2.9.jar"/>
<zipfileset src="${common.basedir}/lib/build/asm-7.0.jar"/>
<rule pattern="net.sf.cglib.*" result="com.google.inject.internal.cglib.$@1"/>
<rule pattern="net.sf.cglib.**.*" result="com.google.inject.internal.cglib.@1.$@2"/>
<rule pattern="org.objectweb.asm.*" result="com.google.inject.internal.asm.$@1"/>
<rule pattern="org.objectweb.asm.**.*" result="com.google.inject.internal.asm.@1.$@2"/>
<keep pattern="com.google.inject.**"/>
</jarjar>
</target>
</project>
Binary file removed lib/build/bnd-0.0.384.jar
Binary file not shown.
Binary file removed lib/build/jarjar-1.1.jar
Binary file not shown.
Loading

0 comments on commit c09ba1d

Please sign in to comment.