From: Scott L. <sl...@sl...> - 2002-04-12 20:32:19
Attachments:
mockobjects-build.patch
|
I was trying to make some changes to the SQL stuff and noticed problems with the build system. Specifically, clicking on a java compilation error would bring my editor to out/src/blah.java, a copy of the code that is made immediately before compiling. This is a pain because I would make changes that would be overwritten. Also, the entire system seems to be rebuilt after any change, because the modification dates are not preserved in this copy. (Looks like Jeff Martin noted this on the list about a month ago.) Apparently this was done to allow filtering @version@, @year@, and @today@ for the Javadocs. None of these tokens are used now in the source code. (Though they are used in the manifest.) So, the attached patch compiles the source in-place instead of copying first. I think I've got the correct files compiled in all cases by building a path to be compiled and adding the appropriate j2ee stuff as necessary. Please try it and apply it. I also tried to simplify things a bit. I removed some targets that just define properties. These were pretty confusing to me. I left the check-availabilities one, because <available/> only works inside a target. I think many of the properties being set could be removed to simplify things further - setting properties doesn't make sense to me unless something is long/complicated or you'd want to override it. Stuff like this strikes me as extraneous: <property name="src.dir" value="src"/> <property name="src.core.dir" value="${src.dir}/core"/> <property name="src.j2ee.dir" value="${src.dir}/j2ee"/> <property name="src.examples.dir" value="${src.dir}/examples"/> When would you ever want src.core.dir to be anything other than "${src.dir}/core"? I think just saying the latter is more clear. Thanks. -- Scott Lamb |
From: <tk...@10...> - 2004-04-26 12:37:59
|
The sequence <available property="jdk.version" value="1.2" classname="java.lang.ThreadLocal" /> <available property="jdk.version" value="1.3" classname="java.lang.StrictMath" /> <available property="jdk.version" value="1.4" classname="java.lang.CharSequence" /> generates a message "DEPRECATED - <available> used to override an existing property.". Replaced with a sequence of <condition >-tasks. |
From: Jeff M. <je...@mk...> - 2004-04-27 10:27:25
|
Committed. Thanks On Mon, 2004-04-26 at 13:37, tk...@10... wrote: > The sequence > > <available property="jdk.version" value="1.2" classname="java.lang.ThreadLocal" /> > <available property="jdk.version" value="1.3" classname="java.lang.StrictMath" /> > <available property="jdk.version" value="1.4" classname="java.lang.CharSequence" > /> > > generates a message > "DEPRECATED - <available> used to override an existing property.". Replaced with a > sequence of <condition >-tasks. > > > ______________________________________________________________________ > Index: build.xml > =================================================================== > RCS file: /cvsroot/mockobjects/mockobjects-java/build.xml,v > retrieving revision 1.40 > diff -u -r1.40 build.xml > --- build.xml 12 Aug 2003 12:16:12 -0000 1.40 > +++ build.xml 26 Apr 2004 12:27:03 -0000 > @@ -67,28 +67,47 @@ > <pathelement location="${j2ee.lib}"/> > </path> > > - <available property="jdk.version" value="1.2" classname="java.lang.ThreadLocal" /> > - <available property="jdk.version" value="1.3" classname="java.lang.StrictMath" /> > - <available property="jdk.version" value="1.4" classname="java.lang.CharSequence" /> > - <available property="j2ee.version" value="1.2" > - classpathref="lib.classpath" > - classname="javax.servlet.Servlet" /> > - <available property="j2ee.version" value="1.3" > - classpathref="lib.classpath" > - classname="javax.servlet.Filter" /> > - <available property="j2ee.version" value="1.4" > - classpathref="lib.classpath" > - classname="javax.servlet.jsp.ErrorData" /> > + <condition property="jdk.version" value="1.4"> > + <available classname="java.lang.CharSequence" /> > + </condition> > + <condition property="jdk.version" value="1.3"> > + <and> > + <not><isset property="jdk.version" /></not> > + <available classname="java.lang.StrictMath" /> > + </and> > + </condition> > + <condition property="jdk.version" value="1.2"> > + <and> > + <not><isset property="jdk.version" /></not> > + <available classname="java.lang.ThreadLocal" /> > + </and> > + </condition> > + <condition property="j2ee.version" value="1.4"> > + <available classpathref="lib.classpath" classname="javax.servlet.jsp.ErrorData" /> > + </condition> > + <condition property="j2ee.version" value="1.3"> > + <and> > + <not><isset property="j2ee.version" /></not> > + <available classpathref="lib.classpath" classname="javax.servlet.Filter" /> > + </and> > + </condition> > + <condition property="j2ee.version" value="1.2"> > + <and> > + <not><isset property="j2ee.version" /></not> > + <available classpathref="lib.classpath" classname="javax.servlet.Servlet" /> > + </and> > + </condition> > <available property="httpclient" value="true" > classpathref="lib.classpath" > classname="org.apache.commons.httpclient.HttpClient" /> > > - <property name="jar.j2ee.name" value="" /> > - > <available property="jar.j2ee.name" > value="_j2ee${j2ee.version}" > classpathref="lib.classpath" > classname="javax.servlet.Servlet" /> > + <condition property="jar.j2ee.name" value=""> > + <not><isset property="jar.j2ee.name" /></not> > + </condition> > </target> > > <target name="call-me-first" -- jeff martin information technologist mkodo limited mobile: 44 (0) 78 5547 8331 phone: 44 (0) 20 2226 4545 email: je...@mk... www.mkodo.com |
From: Jeff M. <je...@cu...> - 2002-04-13 15:17:37
|
Sorry Scott I got there before you. Your patch is now redundent ;) Totally agree with you about the build file. Simple is best and I've still not got my head around everything that's in there. On Fri, 2002-04-12 at 21:29, Scott Lamb wrote: > I was trying to make some changes to the SQL stuff and noticed problems with > the build system. > > Specifically, clicking on a java compilation error would bring my editor to > out/src/blah.java, a copy of the code that is made immediately before > compiling. This is a pain because I would make changes that would be > overwritten. > > Also, the entire system seems to be rebuilt after any change, because the > modification dates are not preserved in this copy. (Looks like Jeff Martin > noted this on the list about a month ago.) > > Apparently this was done to allow filtering @version@, @year@, and @today@ for > the Javadocs. None of these tokens are used now in the source code. (Though > they are used in the manifest.) > > So, the attached patch compiles the source in-place instead of copying first. > I think I've got the correct files compiled in all cases by building a path to > be compiled and adding the appropriate j2ee stuff as necessary. Please try it > and apply it. > > I also tried to simplify things a bit. I removed some targets that just define > properties. These were pretty confusing to me. I left the check-availabilities > one, because <available/> only works inside a target. > > I think many of the properties being set could be removed to simplify things > further - setting properties doesn't make sense to me unless something is > long/complicated or you'd want to override it. Stuff like this strikes me as > extraneous: > > <property name="src.dir" value="src"/> > <property name="src.core.dir" value="${src.dir}/core"/> > <property name="src.j2ee.dir" value="${src.dir}/j2ee"/> > <property name="src.examples.dir" value="${src.dir}/examples"/> > > When would you ever want src.core.dir to be anything other than > "${src.dir}/core"? I think just saying the latter is more clear. > > Thanks. > > -- > Scott Lamb > ---- > > Index: build.xml > =================================================================== > RCS file: /cvsroot/mockobjects/mockobjects-java/build.xml,v > retrieving revision 1.19 > diff -u -r1.19 build.xml > --- build.xml 23 Feb 2002 19:20:49 -0000 1.19 > +++ build.xml 5 Apr 2002 00:43:40 -0000 > @@ -44,75 +44,72 @@ > <property file="${user.home}/build.properties" /> > <property file="build.properties" /> > > - <target name="project-properties"> > - <property name="project.fullname" value="Mock Objects"/> > - <property name="project.version" value="0.03"/> > - <property name="project.name" value="mockobjects"/> > - > - <!-- Miscellaneous settings --> > - <property name="year" value="2002"/> > - <property name="debug" value="on"/> > - <property name="optimize" value="off"/> > - <property name="deprecation" value="off"/> > - </target> > - > - <target name="source-locations"> > - <property name="src.dir" value="src"/> > - <property name="src.core.dir" value="${src.dir}/core"/> > - <property name="src.j2ee.dir" value="${src.dir}/j2ee"/> > - <property name="src.examples.dir" value="${src.dir}/examples"/> > - <property name="conf.dir" value="conf"/> > - <property name="doc.dir" value="doc"/> > - <property name="xdoc.dir" value="${doc.dir}/xdocs"/> > - <property name="skin.dir" value="${doc.dir}/skins"/> > - <property name="lib.dir" value="lib"/> > - </target> > - > - <target name="build-locations"> > - <!-- Destination locations for the build (relative to the basedir as > - specified in the basedir attribute of the project tag) --> > - <property name="out.dir" value="out"/> > - <property name="out.doc.dir" value="${out.dir}/doc"/> > - <property name="out.javadoc.dir" value="${out.doc.dir}/javadoc"/> > - <property name="out.classes.dir" value="${out.dir}/classes"/> > - <property name="out.site.dir" value="${out.dir}/site"/> > - <property name="out.src.dir" value="${out.dir}/src"/> > - <property name="out.src.examples.dir" value="${out.src.dir}/examples"/> > - <property name="out.conf.dir" value="${out.dir}/conf"/> > - <property name="out.xdoc.doc.dir" value="${out.dir}/xdoc/doc"/> > - <property name="out.xdoc.site.dir" value="${out.dir}/xdoc/site"/> > - </target> > - > - <target name="deliverable-names" > - depends="project-properties"> > - <property name="dist.dir" value="dist"/> > - > - <property name="jar.base.name" value="mocks"/> > - <property name="sources.zip.name" value="${project.name}-src"/> > - > - <!-- The project web site in a zip file (without the Javadoc but > - with a link pointing to javadoc : <htdocs>/javadoc/index.html --> > - <property name="site.name" value="${project.name}-website"/> > - <property name="javadoc.name" value="${project.name}-javadoc"/> > - > - <property name="project.zip.name" value="${project.name}-${project.version}"/> > - </target> > - > - <target name="useful-file-patterns"> > - <!-- All conf files (including test files) --> > - <patternset id="nonjava.src.files"> > - <include name="**/*.txt"/> > - <include name="**/*.xml"/> > - <include name="**/*.properties"/> > - </patternset> > - > - <patternset id="java.src.files"> > - <include name="**/*.java"/> > - </patternset> > - </target> > + <!-- > + - Project properties > + --> > + <property name="project.fullname" value="Mock Objects"/> > + <property name="project.version" value="0.03"/> > + <property name="project.name" value="mockobjects"/> > + > + <!-- Miscellaneous settings --> > + <property name="year" value="2002"/> > + <property name="debug" value="on"/> > + <property name="optimize" value="off"/> > + <property name="deprecation" value="off"/> > + > + <!-- > + - Source locations > + --> > + <property name="src.dir" value="src"/> > + <property name="src.core.dir" value="${src.dir}/core"/> > + <property name="src.j2ee.dir" value="${src.dir}/j2ee"/> > + <property name="src.examples.dir" value="${src.dir}/examples"/> > + <property name="conf.dir" value="conf"/> > + <property name="doc.dir" value="doc"/> > + <property name="xdoc.dir" value="${doc.dir}/xdocs"/> > + <property name="skin.dir" value="${doc.dir}/skins"/> > + <property name="lib.dir" value="lib"/> > + > + <!-- > + - Destination locations for the build (relative to the basedir as > + - specified in the basedir attribute of the project tag) > + --> > + <property name="out.dir" value="out"/> > + <property name="out.doc.dir" value="${out.dir}/doc"/> > + <property name="out.javadoc.dir" value="${out.doc.dir}/javadoc"/> > + <property name="out.classes.dir" value="${out.dir}/classes"/> > + <property name="out.site.dir" value="${out.dir}/site"/> > + <property name="out.conf.dir" value="${out.dir}/conf"/> > + <property name="out.xdoc.doc.dir" value="${out.dir}/xdoc/doc"/> > + <property name="out.xdoc.site.dir" value="${out.dir}/xdoc/site"/> > + > + <!-- > + - Deliverable names > + --> > + <property name="dist.dir" value="dist"/> > + > + <property name="jar.base.name" value="mocks"/> > + <property name="sources.zip.name" value="${project.name}-src"/> > + > + <!-- The project web site in a zip file (without the Javadoc but > + with a link pointing to javadoc : <htdocs>/javadoc/index.html --> > + <property name="site.name" value="${project.name}-website"/> > + <property name="javadoc.name" value="${project.name}-javadoc"/> > + > + <property name="project.zip.name" value="${project.name}-${project.version}"/> > + > + <!-- > + - Useful file patterns > + --> > + > + <!-- All conf files (including test files) --> > + <patternset id="nonjava.src.files"> > + <include name="**/*.txt"/> > + <include name="**/*.xml"/> > + <include name="**/*.properties"/> > + </patternset> > > - <target name="check-availabilities" > - depends="source-locations"> > + <target name="check-availabilities"> > > <path id="lib.classpath"> > <fileset dir="${lib.dir}"> > @@ -129,6 +126,11 @@ > <available property="j2ee.version" value="1.3" > classpathref="lib.classpath" classname="javax.servlet.Filter" /> > > + <property name="src.path" value="${src.core.dir}" /> > + <available property="src.path" > + value="${src.path}:${src.j2ee.dir}/common:${src.j2ee.dir}/${j2ee.version}" > + classpathref="lib.classpath" classname="javax.servlet.Servlet" /> > + > <!-- sorry about this. It seems to be the easiest way to set a marker to describe > which j2ee the .jar supports. Later versions of Ant include an 'isset' > condition, which should do the trick --> > @@ -137,8 +139,7 @@ > classpathref="lib.classpath" classname="javax.servlet.Servlet" /> > </target> > > - <target name="call-me-first" > - depends="project-properties, useful-file-patterns, check-availabilities"> > + <target name="call-me-first" depends="check-availabilities"> > <!-- Initialize the build. Must be called by all targets --> > > <tstamp/> > @@ -182,7 +183,7 @@ > </target> > > <target name="_copy-from-src" > - depends="useful-file-patterns, _copy-from-j2ee" > > + depends="_copy-from-j2ee" > > <!-- requires copy.todir, src.patternset.id --> > > <copy todir="${copy.todir}" > @@ -194,23 +195,8 @@ > </copy> > </target> > > - <target name="clear-class-files" > - depends="build-locations"> > - <antcall target="_flush-dir"> > - <param name="flush.dir" value="${out.classes.dir}" /> > - </antcall> > - </target> > - > - <target name="copy-java-files" > - depends="source-locations, build-locations, check-availabilities"> > - <antcall target="_copy-from-src"> > - <param name="copy.todir" value="${out.src.dir}" /> > - <param name="src.patternset.id" value="java.src.files" /> > - </antcall> > - </target> > - > <target name="compile" > - depends="call-me-first, clear-class-files, copy-java-files" > + depends="call-me-first" > description="Compile all the java files for included libraries" > > > <javac destdir="${out.classes.dir}" > @@ -218,7 +204,7 @@ > deprecation="${deprecation}" > verbose="true" > optimize="${optimize}" > - srcdir="${out.src.dir}"> > + srcdir="${src.path}"> > <classpath> > <path refid="lib.classpath"/> > <pathelement path="${java.class.path}"/> > @@ -248,8 +234,7 @@ > </junit> > </target> > > - <target name="copy-nonjava-files" > - depends="source-locations, build-locations, check-availabilities, call-me-first"> > + <target name="copy-nonjava-files" depends="check-availabilities, call-me-first"> > <antcall target="_copy-from-src"> > <param name="copy.todir" value="${out.classes.dir}" /> > <param name="src.patternset.id" value="nonjava.src.files" /> > @@ -271,7 +256,7 @@ > </target> > > <target name="make-jar-name" > - depends="deliverable-names, check-availabilities"> > + depends="check-availabilities"> > <property name="jar.name" > value="${jar.base.name}${project.version}_jdk${jdk.version}${jar.j2ee.name}" /> > </target> > @@ -289,20 +274,19 @@ > </jar> > </target> > > - <target name="prepare-javadoc" > - depends="build-locations, copy-java-files" > > + <target name="prepare-javadoc"> > <antcall target="_flush-dir"> > <param name="flush.dir" value="${out.javadoc.dir}" /> > </antcall> > </target> > > <target name="javadoc" > - depends="call-me-first, deliverable-names, prepare-javadoc" > + depends="call-me-first, prepare-javadoc" > unless="javadoc.notrequired" > description="Generate the javadoc for the current version" > > > <javadoc > - sourcepath="${out.src.dir}" > + sourcepath="${src.path}" > packagenames="com.mockobjects.*" > destdir="${out.javadoc.dir}" > author="true" > @@ -407,7 +391,7 @@ > ======================================================================== > --> > <target name="prepare-site" > - depends="build-locations, deliverable-names, call-me-first"> > + depends="call-me-first"> > > <mkdir dir="${out.site.dir}"/> > <mkdir dir="${out.site.dir}/images"/> > @@ -450,7 +434,7 @@ > > <!-- Generate the web site --> > <target name="site" > - depends="build-locations, deliverable-names, prepare-site, zip-javadoc-for-website" > + depends="prepare-site, zip-javadoc-for-website" > unless="stylebook.site.notrequired" > description="Generate the web site"> > > @@ -496,10 +480,9 @@ > <mkdir dir="${dist.dir}"/> > </target> > > - <target name="zip-java-sources" > - depends="build-locations, deliverable-names"> > + <target name="zip-java-sources"> > <zip zipfile="${out.dir}/${sources.zip.name}.zip" > - basedir="${out.src.dir}" /> > + basedir="${src.path}" includes="**/*.java"/> > </target> > > <target name="dist" > @@ -511,7 +494,7 @@ > <include name="${jar.name}.jar"/> > </zipfileset> > <zipfileset dir="${out.doc.dir}" prefix="doc"/> > - <zipfileset dir="${out.dir}" prefix="src"> > + <zipfileset dir="${out.dir}" prefix="src"> > <include name="${src.name}.zip"/> > </zipfileset> > </zip> -- Jeff Martin Memetic Engineer http://www.custommonkey.org/ |