make/build.xml

Tue, 08 Jan 2013 08:51:00 +0530

author
sundar
date
Tue, 08 Jan 2013 08:51:00 +0530
changeset 10
d14da0d0c577
parent 7
5a1b0714df0e
child 19
4cd65798ec70
permissions
-rw-r--r--

8005782: get rid of javadoc errors, warnings in nashorn build
Reviewed-by: lagergren

     1 <?xml version="1.0" encoding="UTF-8"?>
     2 <!--
     3  Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
     4  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6  This code is free software; you can redistribute it and/or modify it
     7  under the terms of the GNU General Public License version 2 only, as
     8  published by the Free Software Foundation.
    10  This code is distributed in the hope that it will be useful, but WITHOUT
    11  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    12  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    13  version 2 for more details (a copy is included in the LICENSE file that
    14  accompanied this code).
    16  You should have received a copy of the GNU General Public License version
    17  2 along with this work; if not, write to the Free Software Foundation,
    18  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    21  or visit www.oracle.com if you need additional information or have any
    22  questions.
    23 -->
    24 <project name="nashorn" default="all" basedir="..">
    25   <import file="build-nasgen.xml"/>
    26   <import file="build-benchmark.xml"/>
    28   <target name="init">
    29     <loadproperties srcFile="make/project.properties"/>
    30     <path id="nashorn.ext.path">
    31       <pathelement location="${dist.dir}"/>
    32     </path>
    33     <property name="ext.class.path" value="-Djava.ext.dirs=&quot;${toString:nashorn.ext.path}&quot;"/>
    34   </target>
    36   <target name="prepare" depends="init">
    37     <mkdir dir="${build.dir}"/>
    38     <mkdir dir="${build.classes.dir}"/>
    39     <mkdir dir="${build.classes.dir}/META-INF/services"/>
    40     <mkdir dir="${build.test.classes.dir}"/>
    41     <mkdir dir="${dist.dir}"/>
    42     <mkdir dir="${dist.javadoc.dir}"/>
    43     <!-- check if JDK already has ASM classes -->
    44     <available property="asm.available" classname="jdk.internal.org.objectweb.asm.Type"/>
    45     <!-- check if testng.jar is avaiable -->
    46     <available property="testng.available" file="${file.reference.testng.jar}"/>
    47   </target>
    49   <target name="clean" depends="init, clean-nasgen">
    50     <delete includeemptydirs="true">
    51       <fileset dir="${build.dir}" excludes="${dynalink.dir.name}/**/*" erroronmissingdir="false"/>
    52     </delete>
    53     <delete dir="${dist.dir}"/>
    54   </target>
    56   <target name="clean-dynalink">
    57     <delete dir="${dynalink.dir}"/>
    58   </target>
    60   <target name="clean-all" depends="clean-dynalink, clean">
    61     <delete dir="${build.dir}"/>
    62   </target>
    64   <!-- do it only if ASM is not available -->
    65   <target name="compile-asm" depends="prepare" unless="asm.available">
    66     <javac srcdir="${jdk.asm.src.dir}"
    67            destdir="${build.classes.dir}"
    68            excludes="**/optimizer/* **/xml/* **/attrs/*"
    69            source="${javac.source}"
    70            target="${javac.target}"
    71            debug="${javac.debug}"
    72            encoding="${javac.encoding}"
    73            includeantruntime="false"/>
    74   </target>
    76   <target name="check-dynalink-uptodate" depends="init">
    77     <property name="versioned.dynalink.jar" value="${dynalink.dir}/dynalink-${dynalink.jar.version}.jar"/>
    78     <condition property="dynalink.uptodate">
    79       <and>
    80         <available file="${versioned.dynalink.jar}"/>
    81         <filesmatch file1="${versioned.dynalink.jar}" file2="${dynalink.jar}"/>
    82       </and>
    83     </condition>
    84   </target>
    86   <target name="get-dynalink" depends="check-dynalink-uptodate" unless="dynalink.uptodate">
    87     <mkdir dir="${dynalink.dir}"/>
    88     <!-- Delete previous snapshots, if any -->
    89     <delete>
    90       <fileset dir="${dynalink.dir}" includes="*"/>
    91     </delete>
    92     <property name="dynalink.download.base.url" value="http://oss.sonatype.org/content/repositories/${dynalink.version.type}s/org/dynalang/dynalink/${dynalink.version}/dynalink-${dynalink.jar.version}"/>
    93     <get src="${dynalink.download.base.url}.jar" dest="${versioned.dynalink.jar}" usetimestamp="true"/>
    94     <get src="${dynalink.download.base.url}-sources.jar" dest="${dynalink.dir}/dynalink-sources.jar" usetimestamp="true"/>
    95     <copy file="${versioned.dynalink.jar}" tofile="${dynalink.jar}" overwrite="true"/>
    96   </target>
    98   <target name="compile" depends="compile-asm, get-dynalink" description="Compiles nashorn">
    99     <javac srcdir="${src.dir}"
   100            destdir="${build.classes.dir}"
   101            classpath="${javac.classpath}"
   102            source="${javac.source}"
   103            target="${javac.target}"
   104            debug="${javac.debug}"
   105            encoding="${javac.encoding}"
   106            includeantruntime="false">
   107       <compilerarg value="-Xlint:unchecked"/>
   108       <compilerarg value="-Xlint:deprecation"/>
   109       <compilerarg value="-XDignore.symbol.file"/>
   110     </javac>
   111     <copy todir="${build.classes.dir}/META-INF/services">
   112        <fileset dir="${meta.inf.dir}/services/"/>
   113     </copy>
   114      <copy todir="${build.classes.dir}/jdk/nashorn/api/scripting/resources">
   115        <fileset dir="${src.dir}/jdk/nashorn/api/scripting/resources/"/>
   116     </copy>
   117     <copy todir="${build.classes.dir}/jdk/nashorn/internal/runtime/resources">
   118        <fileset dir="${src.dir}/jdk/nashorn/internal/runtime/resources/"/>
   119     </copy>
   120     <copy todir="${build.classes.dir}/jdk/nashorn/tools/resources">
   121        <fileset dir="${src.dir}/jdk/nashorn/tools/resources/"/>
   122     </copy>
   123     <echo message="full=${nashorn.fullversion}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties"/>
   124     <echo file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true">${line.separator}</echo>
   125     <echo message="release=${nashorn.version}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true"/>
   126   </target>
   128   <target name="jar" depends="compile, run-nasgen" description="Creates nashorn.jar">
   129     <jar jarfile="${dist.jar}" manifest="${meta.inf.dir}/MANIFEST.MF" index="true" filesetmanifest="merge">
   130       <fileset dir="${build.classes.dir}"/>
   131       <zipfileset src="${dynalink.jar}"/>
   132       <manifest>
   133         <attribute name="Archiver-Version" value="n/a"/>
   134         <attribute name="Build-Jdk" value="${java.runtime.version}"/>
   135         <attribute name="Built-By" value="n/a"/>
   136         <attribute name="Created-By" value="Ant jar task"/>
   137         <section name="jdk/nashorn/">
   138           <attribute name="Implementation-Title" value="${nashorn.product.name}"/>
   139           <attribute name="Implementation-Version" value="${nashorn.version}"/>
   140         </section>
   141       </manifest>
   142     </jar>
   143   </target>
   145   <target name="javadoc" depends="prepare">
   146     <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="src/overview.html" windowtitle="${nashorn.product.name} ${nashorn.version}" additionalparam="-quiet" failonerror="true">
   147       <classpath>
   148         <pathelement location="${build.classes.dir}"/>
   149         <pathelement location="${dynalink.jar}"/>
   150       </classpath>
   151       <fileset dir="${src.dir}" includes="**/*.java"/>
   152       <fileset dir="${jdk.asm.src.dir}" includes="**/*.java"/>
   153       <link href="http://docs.oracle.com/javase/7/docs/api/"/>
   154       <link href="http://szegedi.github.com/dynalink/0.4/javadoc/"/>
   155       <!-- The following tags are used only in ASM sources - just ignore these -->
   156       <tag name="label" description="label tag in ASM sources" enabled="false"/>
   157       <tag name="linked" description="linked tag in ASM sources" enabled="false"/>
   158       <tag name="associates" description="associates tag in ASM sources" enabled="false"/>
   159     </javadoc>
   160   </target>
   162   <!-- generate shell.html for shell tool documentation -->
   163   <target name="shelldoc" depends="jar">
   164     <java classname="${nashorn.shell.tool}" dir="${basedir}" output="${dist.dir}/shell.html" failonerror="true" fork="true">
   165       <jvmarg line="${ext.class.path}"/>
   166       <arg value="-scripting"/>
   167       <arg value="docs/genshelldoc.js"/>
   168     </java>
   169   </target>
   171   <!-- generate all docs -->
   172   <target name="docs" depends="javadoc, shelldoc"/>
   174   <!-- create .zip and .tar.gz for nashorn binaries and scripts. -->
   175   <target name="dist" depends="jar">
   176       <zip destfile="${build.zip}" basedir=".."
   177           excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/>
   178       <tar destfile="${build.gzip}" basedir=".." compression="gzip"
   179           excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/>
   180   </target>
   182   <target name="compile-test" depends="compile, run-nasgen" if="testng.available">
   183     <!-- testng task -->
   184     <taskdef name="testng" classname="org.testng.TestNGAntTask"
   185         classpath="${file.reference.testng.jar}"/>
   187     <javac srcdir="${test.src.dir}"
   188            destdir="${build.test.classes.dir}"
   189            classpath="${javac.test.classpath}"
   190            source="${javac.source}"
   191            target="${javac.target}"
   192            debug="${javac.debug}"
   193            encoding="${javac.encoding}"
   194            includeantruntime="false"/>
   195   </target>
   197   <target name="generate-policy-file">
   198     <!-- Generating nashorn.policy file -->
   199     <echo message="grant codeBase &quot;file:/${basedir}/dist/nashorn.jar&quot; {" file="${build.dir}/nashorn.policy"/>
   200     <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
   201     <echo message="permission java.security.AllPermission;" file="${build.dir}/nashorn.policy" append="true"/>
   202     <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
   203     <echo message="};" file="${build.dir}/nashorn.policy" append="true"/>
   204     <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
   206     <echo message="grant codeBase &quot;file:/${basedir}/build/test/classes&quot; {" file="${build.dir}/nashorn.policy" append="true"/>
   207     <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
   208     <echo message="    permission java.security.AllPermission;" file="${build.dir}/nashorn.policy" append="true"/>
   209     <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
   210     <echo message="};" file="${build.dir}/nashorn.policy" append="true"/>
   211     <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
   213     <echo message="grant codeBase &quot;file:/${basedir}/${file.reference.testng.jar}&quot; {" file="${build.dir}/nashorn.policy" append="true"/>
   214     <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
   215     <echo message="    permission java.security.AllPermission;" file="${build.dir}/nashorn.policy" append="true"/>
   216     <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
   217     <echo message="};" file="${build.dir}/nashorn.policy" append="true"/>
   218     <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
   220     <echo message="grant codeBase &quot;file:/${basedir}/test/script/basic/*&quot; {" file="${build.dir}/nashorn.policy" append="true"/>
   221     <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
   222     <echo message="    permission java.security.AllPermission;" file="${build.dir}/nashorn.policy" append="true"/>
   223     <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
   224     <echo message="};" file="${build.dir}/nashorn.policy" append="true"/>
   225     <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
   227     <echo message="grant codeBase &quot;file:/${basedir}/test/perf/*&quot; {" file="${build.dir}/nashorn.policy" append="true"/>
   228     <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
   229     <echo message="    permission java.security.AllPermission;" file="${build.dir}/nashorn.policy" append="true"/>
   230     <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
   231     <echo message="};" file="${build.dir}/nashorn.policy" append="true"/>
   232     <echo message="" file="${build.dir}/nashorn.policy" append="true"/>
   234     <replace file="${build.dir}/nashorn.policy"><replacetoken>\</replacetoken><replacevalue>/</replacevalue></replace>    <!--hack for Windows - to make URLs with normal path separators -->
   235     <replace file="${build.dir}/nashorn.policy"><replacetoken>//</replacetoken><replacevalue>/</replacevalue></replace>   <!--hack for Unix - to avoid leading // in URLs -->
   237   </target>
   239   <target name="check-external-tests">
   240       <available file="${test.external.dir}/prototype" property="test-sys-prop.external.prototype"/>
   241       <available file="${test.external.dir}/sunspider" property="test-sys-prop.external.sunspider"/>
   242       <available file="${test.external.dir}/underscore" property="test-sys-prop.external.underscore"/>
   243       <available file="${test.external.dir}/octane" property="test-sys-prop.external.octane"/>
   244       <available file="${test.external.dir}/yui" property="test-sys-prop.external.yui"/>
   245       <available file="${test.external.dir}/jquery" property="test-sys-prop.external.jquery"/>
   246       <available file="${test.external.dir}/test262" property="test-sys-prop.external.test262"/>
   247   </target>
   249   <target name="check-testng" unless="testng.available">
   250     <echo message="WARNING: TestNG not available, will not run tests. Please copy testng.jar under test/lib directory."/>
   251   </target>
   253   <target name="test" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
   254     <java classname="${nashorn.shell.tool}" fork="true" dir="${test.script.dir}/representations" output="${build.dir}/output1.log" error="${build.dir}/err.log">
   255       <jvmarg line="${ext.class.path}"/>
   256       <jvmarg line="-Dnashorn.fields.dual=true"/>
   257       <arg value="NASHORN-592a.js"/>
   258     </java>
   259     <java classname="${nashorn.shell.tool}" fork="true" dir="${test.script.dir}/representations" output="${build.dir}/output2.log" error="${build.dir}/err.log">
   260       <jvmarg line="${ext.class.path}"/>
   261       <arg value="NASHORN-592a.js"/>
   262     </java>
   263     <condition property="representation-ok">
   264       <filesmatch file1="${build.dir}/output1.log" file2="${build.dir}/output2.log"/>
   265     </condition>
   266     <fail unless="representation-ok">Representation test failed - output differs!</fail>
   267     <fileset id="test.classes" dir="${build.test.classes.dir}">
   268       <include name="**/access/*Test.class"/>
   269       <include name="**/api/scripting/*Test.class"/>
   270       <include name="**/codegen/*Test.class"/>
   271       <include name="**/parser/*Test.class"/>
   272       <include name="**/runtime/*Test.class"/>
   273       <include name="**/framework/*Test.class"/>
   274     </fileset>
   276     <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
   277        verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
   278       <jvmarg line="${ext.class.path}"/>
   279       <jvmarg line="${run.test.jvmargs} ${run.test.jvmsecurityargs}"/>
   280       <propertyset>
   281         <propertyref prefix="test-sys-prop."/>
   282         <mapper from="test-sys-prop.*" to="*" type="glob"/>
   283       </propertyset>
   284       <classpath>
   285           <pathelement path="${run.test.classpath}"/>
   286       </classpath>
   287     </testng>
   288   </target>
   290   <target name="test-basicparallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file">
   291       <!-- use just build.test.classes.dir to avoid referring to TestNG -->
   292       <java classname="${parallel.test.runner}" dir="${basedir}" classpath="${build.test.classes.dir}" failonerror="true" fork="true">
   293       <jvmarg line="${ext.class.path}"/>
   294       <jvmarg line="${run.test.jvmargs} ${run.test.jvmsecurityargs}"/>
   295       <syspropertyset>
   296           <propertyref prefix="test-sys-prop."/>
   297           <mapper type="glob" from="test-sys-prop.*" to="*"/>
   298       </syspropertyset>
   299       </java>
   300   </target>
   302   <target name="test262" depends="jar, check-testng, check-external-tests, compile-test" if="testng.available">
   303     <fileset id="test.classes" dir="${build.test.classes.dir}">
   304        <include name="**/framework/*Test.class"/>
   305     </fileset>
   307     <testng outputdir="${build.test.results.dir}" classfilesetref="test.classes"
   308        verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
   309       <jvmarg line="${ext.class.path}"/>
   310       <jvmarg line="${run.test.jvmargs}"/>
   311       <propertyset>
   312         <propertyref prefix="test262-test-sys-prop."/>
   313         <mapper from="test262-test-sys-prop.*" to="*" type="glob"/>
   314       </propertyset>
   315       <classpath>
   316           <pathelement path="${run.test.classpath}"/>
   317       </classpath>
   318     </testng>
   319   </target>
   321   <target name="test262parallel" depends="test262-parallel"/>
   323   <target name="test262-parallel" depends="jar, check-testng, check-external-tests, compile-test" if="testng.available">
   324     <!-- use just build.test.classes.dir to avoid referring to TestNG -->
   325     <java classname="${parallel.test.runner}" dir="${basedir}" classpath="${build.test.classes.dir}" fork="true">
   326       <jvmarg line="${ext.class.path}"/>
   327       <jvmarg line="${run.test.jvmargs}"/>
   328       <syspropertyset>
   329           <propertyref prefix="test262-test-sys-prop."/>
   330           <mapper type="glob" from="test262-test-sys-prop.*" to="*"/>
   331       </syspropertyset>
   332     </java>
   333   </target>
   335   <target name="all" depends="test, docs"
   336       description="Build, test and generate docs for nashorn"/>
   338   <target name="run" depends="jar"
   339       description="Run the shell with a sample script">
   340     <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
   341         <jvmarg line="${ext.class.path}"/>
   342         <jvmarg line="${run.test.jvmargs}"/>
   343         <arg value="-dump-on-error"/>
   344         <arg value="test.js"/>
   345     </java>
   346   </target>
   348   <target name="debug" depends="jar"
   349       description="Debug the shell with a sample script">
   350     <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
   351         <jvmarg line="${ext.class.path}"/>
   352         <jvmarg line="${run.test.jvmargs}"/>
   353         <arg value="--print-code"/>
   354         <arg value="--verify-code"/>
   355         <arg value="--print-symbols"/>
   356         <jvmarg value="-Dnashorn.codegen.debug=true"/>
   357         <arg value="test.js"/>
   358     </java>
   359   </target>
   360 </project>

mercurial