Use maven properties from within the build.xml

This commit is contained in:
Clément Fournier
2020-01-10 23:23:39 +01:00
parent efc3becc01
commit f715e6af72
4 changed files with 23 additions and 21 deletions

View File

@ -13,17 +13,19 @@
By convention the grammar file must be named exactly
so with a .jj[t] extension.
- lang-terse-name: Terse name, used in the conventional package names
- target: Directory in which to root the generated package tree
- source-dir: Root of the package tree in which the main sources live (src/main/java).
This is used to check for duplicate files, any duplicate
JJTree nodes will be removed automatically.
It also uses the following maven properties:
- javacc.outputDirectory: Directory in which to root the generated package tree
- javacc.jar: JAR of JavaCC in the local maven repository
- some properties of project.build
-->
<property name="target-package-dir" value="${target}/net/sourceforge/pmd/lang/${lang-terse-name}/ast" />
<property name="stamp-file" value="${target}/../../last-generated-timestamp" />
<property name="target-package-dir" value="${javacc.outputDirectory}/net/sourceforge/pmd/lang/${lang-terse-name}/ast" />
<property name="stamp-file" value="${project.build.directory}/last-generated-timestamp" />
<property name="javacc-home.path" value="target/lib" />
<property name="javacc-home.path" value="${project.build.directory}/lib/javacc" />
<property name="ast-api-package" value="net.sourceforge.pmd.lang.ast" />
<property name="ast-impl-package" value="${ast-api-package}.impl.javacc" />
@ -74,7 +76,7 @@
<mkdir dir="${javacc-home.path}" />
<copy file="${javacc.jar}" tofile="${javacc-home.path}/javacc.jar" />
<mkdir dir="${target}" />
<mkdir dir="${javacc.outputDirectory}" />
<touch file="${stamp-file}" />
<delete dir="${target-package-dir}" />
<mkdir dir="${target-package-dir}" />
@ -118,8 +120,8 @@
<delete file="${target-package-dir}/TokenMgrError.java" />
<!-- Remove all duplicate files -->
<delete>
<fileset dir="${target}">
<present present="both" targetdir="${source-dir}" />
<fileset dir="${javacc.outputDirectory}">
<present present="both" targetdir="${project.build.sourceDirectory}" />
</fileset>
</delete>

View File

@ -52,17 +52,18 @@
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<target>
<ant antfile="src/main/ant/alljavacc.xml">
<property name="target" value="${project.build.directory}/generated-sources/javacc" />
<property name="javacc.jar" value="${javacc.jar}" />
</ant>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<ant antfile="${javacc.ant.wrapper}" target="alljavacc-visitor+">
<property name="javacc.jar" value="${javacc.jar}" />
<property name="lang-name" value="Java" />
<property name="lang-terse-name" value="java" />
</ant>
</target>
</configuration>
</execution>
</executions>
</plugin>

View File

@ -40,8 +40,6 @@
<configuration>
<target>
<ant antfile="${javacc.ant.wrapper}" target="alljavacc">
<property name="target" value="${project.build.directory}/generated-sources/javacc" />
<property name="source-dir" value="${project.basedir}/src/main/java" />
<property name="javacc.jar" value="${javacc.jar}" />
<property name="lang-name" value="Modelica" />
<property name="lang-terse-name" value="modelica" />

View File

@ -108,7 +108,8 @@ Objective-C, Perl, PHP, PLSQL, Python, Ruby, Salesforce.com Apex, Scala, Swift a
<pmd-designer.version>6.19.0</pmd-designer.version>
<javacc.jar>${settings.localRepository}/net/java/dev/javacc/javacc/${javacc.version}/javacc-${javacc.version}.jar</javacc.jar>
<javacc.ant.wrapper>../javacc-wrapper.xml</javacc.ant.wrapper>
<javacc.outputDirectory>${project.build.directory}/generated-sources/javacc</javacc.outputDirectory>
<javacc.ant.wrapper>${project.basedir}/../javacc-wrapper.xml</javacc.ant.wrapper>
</properties>
<build>