Author: doogie
Date: Tue Oct 28 20:22:05 2008 New Revision: 708760 URL: http://svn.apache.org/viewvc?rev=708760&view=rev Log: Finish feature integration; the ofbiz-jjtree task now works. Modified: ofbiz/trunk/framework/base/ant-scripts/ofbiz-jjtree.groovy ofbiz/trunk/macros.xml Modified: ofbiz/trunk/framework/base/ant-scripts/ofbiz-jjtree.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/ant-scripts/ofbiz-jjtree.groovy?rev=708760&r1=708759&r2=708760&view=diff ============================================================================== --- ofbiz/trunk/framework/base/ant-scripts/ofbiz-jjtree.groovy (original) +++ ofbiz/trunk/framework/base/ant-scripts/ofbiz-jjtree.groovy Tue Oct 28 20:22:05 2008 @@ -19,8 +19,8 @@ import org.apache.tools.ant.BuildException -def resolveFile = { name -> - return project.resolveFile(project.replaceProperties(name)) +def resolveFile = { name, base -> + return project.resolveFile(project.replaceProperties(name), base) } def getAttribute = { name, defaultValue -> @@ -40,19 +40,35 @@ } def ant = new AntBuilder(self) -def javacchome = resolveFile('${ofbiz.home.dir}/framework/base/lib/javacc') +def javacchome = resolveFile('${ofbiz.home.dir}/framework/base/lib/javacc', null) def src = getAttribute('src', 'src') def dir = getAttribute('dir', null) def file = getAttribute('file', null) -def srcfile = resolveFile("$src/$dir/${file}.jjt") +def srcfile = resolveFile("$src/$dir/${file}.jjt", null) +def srcpaths = [ + jjtree: resolveFile(getAttribute('gendir', '${build.dir}/gen-src') + '/jjtree/', null), + javacc: resolveFile(getAttribute('gendir', '${build.dir}/gen-src') + '/javacc/', null), +] def dirs = [ - jjtree: resolveFile(getAttribute('gendir', '${build.dir}/gen-src') + '/jjtree/' + dir), - javacc: resolveFile(getAttribute('gendir', '${build.dir}/gen-src') + '/javacc/' + dir), + jjtree: resolveFile(dir, srcpaths.jjtree), + javacc: resolveFile(dir, srcpaths.javacc), ] def gen = [ jjfile: new File(dirs.jjtree, project.replaceProperties("${file}.jj")), javafile: new File(dirs.javacc, project.replaceProperties("${file}.java")), ] +def srcpath = project.getReference('src-path') +def foundpath = [ + jjtree: false, + javacc: false, +] +srcpath.each { + foundpath.jjtree |= it.file == srcpaths.jjtree + foundpath.javacc |= it.file == srcpaths.javacc +} +if (!foundpath.jjtree) srcpath.append(ant.path{pathelement(location: srcpaths.jjtree)}) +if (!foundpath.javacc) srcpath.append(ant.path{pathelement(location: srcpaths.javacc)}) + if (!uptodate(srcfile, gen.jjfile)) { ant.delete(dir:dirs.jjtree) ant.mkdir(dir:dirs.jjtree) @@ -71,5 +87,5 @@ javacchome: javacchome, outputdirectory: dirs.javacc, ) - ant.delete(dir:resolveFile('${build.classes}/' + dir)) + ant.delete(dir:resolveFile('${build.classes}/' + dir, null)) } Modified: ofbiz/trunk/macros.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/macros.xml?rev=708760&r1=708759&r2=708760&view=diff ============================================================================== --- ofbiz/trunk/macros.xml (original) +++ ofbiz/trunk/macros.xml Tue Oct 28 20:22:05 2008 @@ -30,6 +30,8 @@ </sequential> </macrodef> + <path id="src-path"/> + <path id="groovy.class.path"> <pathelement location="${ofbiz.home.dir}/framework/base/lib/scripting/groovy-1.5.6.jar"/> <pathelement location="${ofbiz.home.dir}/framework/base/lib/scripting/asm-2.2.jar"/> @@ -42,11 +44,11 @@ </presetdef> <presetdef name="javac14"> - <default-javac compiler="javac1.4" target="1.4" source="1.4" encoding="UTF-8"/> + <default-javac compiler="javac1.4" target="1.4" source="1.4" encoding="UTF-8" sourcepathref="src-path"/> </presetdef> <presetdef name="javac15"> - <default-javac compiler="javac1.5" target="1.5" source="1.5" encoding="UTF-8"> + <default-javac compiler="javac1.5" target="1.5" source="1.5" encoding="UTF-8" sourcepathref="src-path"> <!-- <compilerarg value="-Xlint:unchecked"/> --> |
Free forum by Nabble | Edit this page |