| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| |
| 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. |
| |
| --> |
| <!-- You may freely edit this file. See harness/README in the NetBeans platform --> |
| <!-- for some information on what you could do (e.g. targets to override). --> |
| <!-- If you delete this file and reopen the project it will be recreated. --> |
| <project name="cnd/cnd.modelimpl" default="netbeans" basedir="."> |
| <description>Builds, tests, and runs the project org.netbeans.modules.cnd.modelimpl.</description> |
| <import file="../../nbbuild/templates/projectized.xml"/> |
| |
| <target name="compile" depends="antlr,projectized-common.compile"> |
| <!-- XXX do not modify perms on source files! |
| If you need to chmod a+x, do it on a file in target cluster |
| <chmod file="tracemodel.sh" perm="ugo+rx"/> |
| --> |
| </target> |
| |
| <target name="init-antlr"> |
| <!-- ANTLR output directories --> |
| <!-- |
| <property name="antlr.folding.dir" location="src/org/netbeans/modules/cnd/modelimpl/antlr"/> |
| --> |
| <property name="antlr.output.dir" location="src/org/netbeans/modules/cnd/modelimpl/parser/generated"/> |
| <property name="antlr.jar" location="${cluster}/modules/ext/org-netbeans-modules-cnd-antlr.jar"/> |
| <property name="antlr.grammar.dir" location="src/org/netbeans/modules/cnd/modelimpl/parser"/> |
| |
| <property name="antlr.apt.grammar.dir" location="../cnd.apt/src/org/netbeans/modules/cnd/apt/impl/support"/> |
| <property name="antlr.apt.output.dir" location="${antlr.apt.grammar.dir}/generated"/> |
| |
| <!-- Expression evaluator --> |
| <property name="antlr3.evaluator.output.dir" location="src/org/netbeans/modules/cnd/modelimpl/impl/services/evaluator/parser/generated"/> |
| <downloadbinaries cache="${binaries.cache}" server="${binaries.server}"> |
| <manifest dir="${nb_all}"> |
| <include name="libs.antlr3.devel/external/binaries-list"/> |
| </manifest> |
| </downloadbinaries> |
| <property name="antlr3.jar" location="external/antlr-3.4.jar"/> |
| <property name="antlr3.evaluator.grammar.dir" location="src/org/netbeans/modules/cnd/modelimpl/impl/services/evaluator/parser"/> |
| |
| <!-- New C++ Parser --> |
| <property name="antlr3.cppparser.output.dir" location="src/org/netbeans/modules/cnd/modelimpl/parser/generated"/> |
| <property name="antlr3.cppparser.grammar.dir" location="src/org/netbeans/modules/cnd/modelimpl/parser"/> |
| |
| <!-- Open Fortran Parser --> |
| <property name="open.fortran.parser.src.dir" location="external"/> |
| </target> |
| |
| <target name="check-up-to-date"> |
| <uptodate property="antlr.up-to-date" targetfile="${antlr.output.dir}/APTTokenTypes.txt"> |
| <srcfiles dir="${antlr.apt.output.dir}" includes="APTTokenTypes.txt"/> |
| <srcfiles dir="${antlr.grammar.dir}" includes="*.g"/> |
| <srcfiles dir="${antlr3.evaluator.grammar.dir}" includes="*.g"/> |
| <srcfiles dir="${antlr3.cppparser.grammar.dir}" includes="*.g"/> |
| </uptodate> |
| <echo message="antlr checkUptodate result: ${antlr.up-to-date}"/> |
| </target> |
| |
| <target name="clean" depends="projectized-common.clean, init-antlr"> |
| <delete dir="${antlr.output.dir}"/> |
| <!-- |
| <delete dir="${antlr.apt.output.dir}"/> |
| <property name="antlr.folding.dir" location="src/org/netbeans/modules/cnd/modelimpl/antlr"/> |
| <delete> |
| <fileset dir="${antlr.folding.dir}" includes="CPPFolding*"/> |
| </delete> |
| --> |
| |
| <delete dir="${antlr3.evaluator.output.dir}"/> |
| <delete dir="${antlr3.cppparser.output.dir}"/> |
| </target> |
| |
| <target name="antlr" depends="init-antlr, check-up-to-date" unless="antlr.up-to-date"> |
| <mkdir dir="${antlr.output.dir}"/> |
| <copy file="${antlr.apt.output.dir}/APTTokenTypes.txt" |
| todir="${antlr.output.dir}" |
| overwrite="true"/> |
| |
| <!-- CPP grammar --> |
| <!-- |
| <antlr target="${antlr.grammar.dir}/cppparser.g" |
| outputdirectory="${antlr.output.dir}" traceParser="no"> |
| <classpath path="${antlr.jar}"/> |
| </antlr> |
| --> |
| <java classname="org.netbeans.modules.cnd.antlr.Tool" fork="true" failonerror="true"> |
| <arg value="-o"/> |
| <arg value="${antlr.output.dir}"/> |
| <!--<arg value="-traceParser"/>--> |
| <arg value="${antlr.grammar.dir}/cppparser.g"/> |
| <classpath path="${antlr.jar}"/> |
| </java> |
| |
| <!-- Vocab for Antlr 3 --> |
| <mkdir dir="${antlr.output.dir}"/> |
| <copy file="${antlr.apt.output.dir}/APTTokenTypes.txt" |
| tofile="${antlr.output.dir}/APTTokenTypes.tokens" |
| overwrite="true"/> |
| |
| <replaceregexp file="${antlr.output.dir}/APTTokenTypes.tokens" |
| match='(.*)=".*"(.*)' replace="\1\2" flags="g" /> |
| <replaceregexp file="${antlr.output.dir}/APTTokenTypes.tokens" |
| match='//.*' |
| replace="" /> |
| <replaceregexp file="${antlr.output.dir}/APTTokenTypes.tokens" |
| match='APTGenerated // output token vocab name' |
| replace="" /> |
| |
| <concat destfile="${antlr.output.dir}/APTTokenTypes.tokens2"> |
| <fileset dir= "${antlr.output.dir}" includes="APTTokenTypes.tokens"/> |
| <filterchain> |
| <tokenfilter><ignoreblank/></tokenfilter> |
| </filterchain> |
| </concat> |
| <move file="${antlr.output.dir}/APTTokenTypes.tokens2" |
| tofile="${antlr.output.dir}/APTTokenTypes.tokens" |
| overwrite="true" /> |
| |
| <!-- Fortran grammar --> |
| |
| <echo message="Extracting Open Fortran Parser" /> |
| <unzip src="${open.fortran.parser.src.dir}/open-fortran-parser-0.7.1.2.zip" |
| dest="${antlr.grammar.dir}"/> |
| |
| <echo message="ANTLR Parser Generator Version 3.3" /> |
| <java classname="org.antlr.Tool" fork="true" failonerror="true"> |
| <!--<arg value="-trace"/>--> |
| <arg value="-o"/> |
| <arg value="${antlr.output.dir}"/> |
| <arg value="${antlr.grammar.dir}/FortranParser.g"/> |
| <classpath path="${antlr3.jar}"/> |
| </java> |
| |
| <replaceregexp file="${antlr.output.dir}/FortranParser.java" |
| match='^@SuppressWarnings.*' |
| replace='@SuppressWarnings({"all", "warnings", "unchecked", "cast", "fallthrough"})' |
| flags="mg" /> |
| <replaceregexp file="${antlr.output.dir}/FortranParser_FortranParser2.java" |
| match='^@SuppressWarnings.*' |
| replace='@SuppressWarnings({"all", "warnings", "unchecked", "cast", "fallthrough"})' |
| flags="mg" /> |
| |
| <!-- CXX Parser --> |
| <mkdir dir="${antlr3.cppparser.output.dir}"/> |
| <copy file="${antlr.output.dir}/APTTokenTypes.tokens" |
| tofile="${antlr3.cppparser.output.dir}/APTTokenTypes.tokens" |
| overwrite="true"/> |
| |
| <echo message="ANTLR Parser Generator Version 3.3" /> |
| <java classname="org.antlr.Tool" fork="true" failonerror="true"> |
| <arg value="-trace"/> |
| <arg value="-o"/> |
| <arg value="${antlr3.cppparser.output.dir}"/> |
| <arg value="${antlr3.cppparser.grammar.dir}/CXXParser.g"/> |
| <classpath path="${antlr3.jar}"/> |
| </java> |
| |
| <replaceregexp file="${antlr3.cppparser.output.dir}/CXXParser.java" |
| match='^@SuppressWarnings.*' |
| replace='@SuppressWarnings({"all", "warnings", "unchecked", "cast", "fallthrough"})' |
| flags="mg" /> |
| |
| |
| <!-- Expression evaluator --> |
| <mkdir dir="${antlr3.evaluator.output.dir}"/> |
| <copy file="${antlr.output.dir}/APTTokenTypes.tokens" |
| tofile="${antlr3.evaluator.output.dir}/APTTokenTypes.tokens" |
| overwrite="true"/> |
| |
| <echo message="ANTLR Parser Generator Version 3.3" /> |
| <java classname="org.antlr.Tool" fork="true" failonerror="true"> |
| <!--<arg value="-trace"/>--> |
| <arg value="-o"/> |
| <arg value="${antlr3.evaluator.output.dir}"/> |
| <arg value="${antlr3.evaluator.grammar.dir}/Evaluator.g"/> |
| <classpath path="${antlr3.jar}"/> |
| </java> |
| |
| <replaceregexp file="${antlr3.evaluator.output.dir}/EvaluatorParser.java" |
| match='^@SuppressWarnings.*' |
| replace='@SuppressWarnings({"all", "warnings", "unchecked", "cast", "fallthrough"})' |
| flags="mg" /> |
| |
| <delete file="${antlr3.evaluator.output.dir}/EvaluatorLexer.java" /> |
| |
| </target> |
| |
| <target name="do-test-build" depends="-build-cnd-tests,projectized-common.do-test-build"> |
| </target> |
| |
| <target name="-build-cnd-tests"> |
| <ant dir="../cnd" target="test-build" inheritall="false" /> |
| </target> |
| |
| </project> |