summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-11-11 16:11:50 +0200
committerVaadin Code Review <review@vaadin.com>2013-11-12 06:53:39 +0000
commit3680505544b3130f5399bdbd64ef7b7973db709d (patch)
tree70fb681c975c2a6109540596850eafbd058f1817
parent84521fa4b432ca8107a030a6bebfdf484bbee35a (diff)
downloadvaadin-framework-3680505544b3130f5399bdbd64ef7b7973db709d.tar.gz
vaadin-framework-3680505544b3130f5399bdbd64ef7b7973db709d.zip
Ensure generated parser is re-generated during build (#12937)
Ultimately we should remove Parser.java and other generated files from the project but this still needs tweaking ide.xml somehow so the parser is built. Change-Id: Iac491c6a50c87e1e8e0bb2f612e82186319a6de3
-rw-r--r--theme-compiler/apache2header.txt15
-rw-r--r--theme-compiler/build.xml28
2 files changed, 40 insertions, 3 deletions
diff --git a/theme-compiler/apache2header.txt b/theme-compiler/apache2header.txt
new file mode 100644
index 0000000000..5e94497098
--- /dev/null
+++ b/theme-compiler/apache2header.txt
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * Licensed 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.
+ */
diff --git a/theme-compiler/build.xml b/theme-compiler/build.xml
index 9141605fbf..fbc5112be4 100644
--- a/theme-compiler/build.xml
+++ b/theme-compiler/build.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<project name="vaadin-theme-compiler" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant">
+<project name="vaadin-theme-compiler" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:antcontrib="antlib:net.sf.antcontrib">
<description>
Compiles build helpers used when building other modules.
</description>
@@ -12,7 +12,10 @@
<property name="module.name" value="vaadin-theme-compiler" />
<property name="module.symbolic" value="com.vaadin.theme-compiler" />
<property name="result.dir" value="result" />
- <property name="sass.parser.jj" location="src/com/vaadin/sass/internal/parser/Parser.jj" />
+ <property name="parser.src.dir" value="src/com/vaadin/sass/internal/parser" />
+ <property name="generate.dir" value="${result.dir}/generated/${parser.src.dir}" />
+ <property name="header.file" location="apache2header.txt" />
+
<path id="classpath.compile.custom">
</path>
<path id="classpath.test.custom" />
@@ -25,8 +28,27 @@
javacc task requires the jar to be named javacc.jar -->
<property name="javacc.home" location="${result.dir}/javacc" />
<ivy:retrieve organisation="net.java.dev.javacc" module="javacc" revision="5.0" inline="true" type="jar" pattern="${javacc.home}/[artifact].[ext]" />
- <javacc target="${sass.parser.jj}" javacchome="${javacc.home}">
+ <delete dir="${generate.dir}" />
+ <mkdir dir="${generate.dir}" />
+ <!-- Generate new parser files in another directory, this ensure
+ they are always generated -->
+ <copy file="${parser.src.dir}/Parser.jj" todir="${generate.dir}" />
+ <javacc target="${generate.dir}/Parser.jj" javacchome="${javacc.home}">
</javacc>
+ <!-- Add headers to the generated files and copy back to src -->
+ <antcontrib:foreach target="prepend.generated.file.header" param="path">
+ <path>
+ <fileset dir="${generate.dir}" includes="*.java" />
+ </path>
+ </antcontrib:foreach>
+ </target>
+
+ <target name="prepend.generated.file.header">
+ <basename property="file" file="${path}" />
+ <concat destfile="${parser.src.dir}/${file}">
+ <header filtering="no" trimleading="no" file="${header.file}" />
+ <path path="${generate.dir}/${file}" />
+ </concat>
</target>
<target name="jar" depends="parser">