Author: doogie
Date: Tue Oct 28 17:05:36 2008 New Revision: 708734 URL: http://svn.apache.org/viewvc?rev=708734&view=rev Log: Add javacc, with support script. Added: ofbiz/trunk/framework/base/ant-scripts/ofbiz-jjtree.groovy ofbiz/trunk/framework/base/lib/javacc/ ofbiz/trunk/framework/base/lib/javacc/javacc.jar (with props) Modified: ofbiz/trunk/LICENSE ofbiz/trunk/NOTICE ofbiz/trunk/macros.xml Modified: ofbiz/trunk/LICENSE URL: http://svn.apache.org/viewvc/ofbiz/trunk/LICENSE?rev=708734&r1=708733&r2=708734&view=diff ============================================================================== --- ofbiz/trunk/LICENSE (original) +++ ofbiz/trunk/LICENSE Tue Oct 28 17:05:36 2008 @@ -420,6 +420,7 @@ ========================================================================= The following libraries distributed with Apache OFBiz are licensed under the BSD License: +ofbiz/trunk/framework/base/lib/javacc/javacc-4.1.jar ofbiz/trunk/framework/base/lib/httpunit.jar ofbiz/trunk/framework/base/lib/freemarker-2.3.10.jar ofbiz/trunk/framework/base/lib/junitperf.jar Modified: ofbiz/trunk/NOTICE URL: http://svn.apache.org/viewvc/ofbiz/trunk/NOTICE?rev=708734&r1=708733&r2=708734&view=diff ============================================================================== --- ofbiz/trunk/NOTICE (original) +++ ofbiz/trunk/NOTICE Tue Oct 28 17:05:36 2008 @@ -371,3 +371,9 @@ Java PIM Library (jpim) Copyright (c) 2001-2003 jpim development team. +========================================================================= +== JavaCC Notice == +========================================================================= + +This product includes software developed by the javacc team +(http://javacc.dev.java.net/). The included version is 4.1. Added: 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=708734&view=auto ============================================================================== --- ofbiz/trunk/framework/base/ant-scripts/ofbiz-jjtree.groovy (added) +++ ofbiz/trunk/framework/base/ant-scripts/ofbiz-jjtree.groovy Tue Oct 28 17:05:36 2008 @@ -0,0 +1,75 @@ +/* +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. +*/ + +import org.apache.tools.ant.BuildException + +def resolveFile = { name -> + return project.resolveFile(project.replaceProperties(name)) +} + +def getAttribute = { name, defaultValue -> + def value = attributes[name] + if (value == null) { + if (!defaultValue) throw new BuildException("No default for attribute($name)") + value = defaultValue + } + return value +} + +def uptodate = { left, right -> + def uptodateTask = project.createTask('uptodate') + uptodateTask.srcfile = left + uptodateTask.targetFile = right + return uptodateTask.eval() +} + +def ant = new AntBuilder(self) +def javacchome = resolveFile('${ofbiz.home.dir}/framework/base/lib/javacc') +def src = getAttribute('src', 'src') +def dir = getAttribute('dir', null) +def file = getAttribute('file', null) +def srcfile = resolveFile("$src/$dir/${file}.jjt") +def dirs = [ + jjtree: resolveFile(getAttribute('gendir', '${build.dir}/gen-src') + '/jjtree/' + dir), + javacc: resolveFile(getAttribute('gendir', '${build.dir}/gen-src') + '/javacc/' + dir), +] +def gen = [ + jjfile: new File(dirs.jjtree, project.replaceProperties("${file}.jj")), + javafile: new File(dirs.javacc, project.replaceProperties("${file}.java")), +] +if (!uptodate(srcfile, gen.jjfile)) { + ant.delete(dir:dirs.jjtree) + ant.mkdir(dir:dirs.jjtree) + ant.jjtree( + target: srcfile, + javacchome: javacchome, + outputdirectory: dirs.jjtree, + ) +} +if (!uptodate(gen.jjfile, gen.javafile)) { + ant.delete(dir:dirs.javacc) + ant.mkdir(dir:dirs.javacc) + + ant.javacc( + target: gen.jjfile, + javacchome: javacchome, + outputdirectory: dirs.javacc, + ) + ant.delete(dir:resolveFile('${build.classes}/' + dir)) +} Added: ofbiz/trunk/framework/base/lib/javacc/javacc.jar URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/lib/javacc/javacc.jar?rev=708734&view=auto ============================================================================== Binary file - no diff available. Propchange: ofbiz/trunk/framework/base/lib/javacc/javacc.jar ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Modified: ofbiz/trunk/macros.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/macros.xml?rev=708734&r1=708733&r2=708734&view=diff ============================================================================== --- ofbiz/trunk/macros.xml (original) +++ ofbiz/trunk/macros.xml Tue Oct 28 17:05:36 2008 @@ -58,4 +58,11 @@ <element name="commands" classname="org.apache.tools.ant.taskdefs.Sequential"/> <element name="else" classname="org.apache.tools.ant.taskdefs.Sequential"/> </scriptdef> + + <scriptdef name="ofbiz-jjtree" language="groovy" src="${ofbiz.home.dir}/framework/base/ant-scripts/ofbiz-jjtree.groovy" classpathref="groovy.class.path"> + <attribute name="src"/> + <attribute name="dir"/> + <attribute name="file"/> + <attribute name="gendir"/> + </scriptdef> </project> |
Free forum by Nabble | Edit this page |