|
Java example source code file (build.xml)
The build.xml Java example source code<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. This code is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 only, as published by the Free Software Foundation. This code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License version 2 for more details (a copy is included in the LICENSE file that accompanied this code). You should have received a copy of the GNU General Public License version 2 along with this work; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or visit www.oracle.com if you need additional information or have any questions. --> <project name="nashorn" default="test" basedir=".."> <import file="build-nasgen.xml"/> <import file="build-benchmark.xml"/> <import file="code_coverage.xml"/> <target name="init-conditions"> <!-- loading locally defined resources and properties. NB they owerwrite default ones defined later --> <property file="${user.home}/.nashorn.project.local.properties"/> <loadproperties srcFile="make/project.properties"/> <path id="nashorn.ext.path"> <pathelement location="${dist.dir}"/> </path> <property name="ext.class.path" value="-Djava.ext.dirs="${toString:nashorn.ext.path}""/> <condition property="svn.executable" value="/usr/local/bin/svn" else="svn"> <available file="/usr/local/bin/svn"/> </condition> <condition property="hg.executable" value="/usr/local/bin/hg" else="hg"> <available file="/usr/local/bin/hg"/> </condition> <!-- check if JDK already has ASM classes --> <available property="asm.available" classname="jdk.internal.org.objectweb.asm.Type"/> <!-- check if testng.jar is avaiable --> <available property="testng.available" file="${file.reference.testng.jar}"/> <!-- check if Jemmy ang testng.jar are avaiable --> <condition property="jemmy.jfx.testng.available" value="true"> <and> <available file="${file.reference.jemmyfx.jar}"/> <available file="${file.reference.jemmycore.jar}"/> <available file="${file.reference.jemmyawtinput.jar}"/> <available file="${file.reference.jfxrt.jar}"/> <isset property="testng.available"/> </and> </condition> <!-- enable/disable make code coverage --> <condition property="cc.enabled"> <istrue value="${make.code.coverage}" /> </condition> <!-- exclude tests in exclude lists --> <condition property="exclude.list" value="./exclude/exclude_list_cc.txt" else="./exclude/exclude_list.txt"> <istrue value="${make.code.coverage}" /> </condition> </target> <target name="init" depends="init-conditions, init-cc"> <!-- extends jvm args --> <property name="run.test.jvmargs" value="${run.test.jvmargs.main} ${run.test.cc.jvmargs}"/> <property name="run.test.jvmargs.octane" value="${run.test.jvmargs.octane.main} ${run.test.cc.jvmargs}" /> <echo message="run.test.jvmargs=${run.test.jvmargs}"/> <echo message="run.test.jvmargs.octane=${run.test.jvmargs.octane}"/> <echo message="run.test.xms=${run.test.xms}"/> <echo message="run.test.xmx=${run.test.xmx}"/> </target> <target name="prepare" depends="init"> <mkdir dir="${build.dir}"/> <mkdir dir="${build.classes.dir}"/> <mkdir dir="${build.classes.dir}/META-INF/services"/> <mkdir dir="${build.test.classes.dir}"/> <mkdir dir="${dist.dir}"/> <mkdir dir="${dist.javadoc.dir}"/> </target> <target name="clean" depends="init, clean-nasgen, init-cc-cleanup"> <delete includeemptydirs="true"> <fileset dir="${build.dir}" erroronmissingdir="false"/> </delete> <delete dir="${dist.dir}"/> </target> <!-- do it only if ASM is not available --> <target name="compile-asm" depends="prepare" unless="asm.available"> <javac srcdir="${jdk.asm.src.dir}" destdir="${build.classes.dir}" excludes="**/optimizer/* **/xml/* **/attrs/*" source="${javac.source}" target="${javac.target}" debug="${javac.debug}" encoding="${javac.encoding}" includeantruntime="false"/> </target> <target name="compile" depends="compile-asm" description="Compiles nashorn"> <javac srcdir="${src.dir}" destdir="${build.classes.dir}" classpath="${javac.classpath}" source="${javac.source}" target="${javac.target}" debug="${javac.debug}" encoding="${javac.encoding}" includeantruntime="false" fork="true"> <compilerarg value="-J-Djava.ext.dirs="/> <compilerarg value="-Xlint:unchecked"/> <compilerarg value="-Xlint:deprecation"/> <compilerarg value="-XDignore.symbol.file"/> </javac> <copy todir="${build.classes.dir}/META-INF/services"> <fileset dir="${meta.inf.dir}/services/"/> </copy> <copy todir="${build.classes.dir}/jdk/nashorn/api/scripting/resources"> <fileset dir="${src.dir}/jdk/nashorn/api/scripting/resources/"/> </copy> <copy todir="${build.classes.dir}/jdk/nashorn/internal/runtime/resources"> <fileset dir="${src.dir}/jdk/nashorn/internal/runtime/resources/"/> </copy> <copy todir="${build.classes.dir}/jdk/nashorn/tools/resources"> <fileset dir="${src.dir}/jdk/nashorn/tools/resources/"/> </copy> <copy file="${src.dir}/jdk/internal/dynalink/support/messages.properties" todir="${build.classes.dir}/jdk/internal/dynalink/support"/> <echo message="full=${nashorn.fullversion}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties"/> <echo file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true">${line.separator} <echo message="release=${nashorn.version}" file="${build.classes.dir}/jdk/nashorn/internal/runtime/resources/version.properties" append="true"/> </target> <target name="jar" depends="compile, run-nasgen, generate-cc-template" description="Creates nashorn.jar" unless="compile.suppress.jar"> <jar jarfile="${dist.jar}" manifest="${meta.inf.dir}/MANIFEST.MF" index="true" filesetmanifest="merge"> <fileset dir="${build.classes.dir}"/> <manifest> <attribute name="Archiver-Version" value="n/a"/> <attribute name="Build-Jdk" value="${java.runtime.version}"/> <attribute name="Built-By" value="n/a"/> <attribute name="Created-By" value="Ant jar task"/> <section name="jdk/nashorn/"> <attribute name="Implementation-Title" value="${nashorn.product.name}"/> <attribute name="Implementation-Version" value="${nashorn.version}"/> </section> </manifest> </jar> </target> <target name="use-promoted-nashorn" depends="init"> <delete file="${dist.dir}/nashorn.jar"/> <copy file="${java.home}/lib/ext/nashorn.jar" todir="${dist.dir}"/> <property name="compile.suppress.jar" value="defined"/> </target> <target name="build-fxshell" depends="jar"> <description>Builds the javafx shell. <mkdir dir="${fxshell.classes.dir}"/> <javac srcdir="${fxshell.dir}" destdir="${fxshell.classes.dir}" classpath="${dist.jar}:${javac.classpath}" debug="${javac.debug}" encoding="${javac.encoding}" includeantruntime="false"> </javac> <jar jarfile="${fxshell.jar}" manifest="${meta.inf.dir}/MANIFEST.MF" index="true" filesetmanifest="merge"> <fileset dir="${fxshell.classes.dir}"/> <manifest> <attribute name="Archiver-Version" value="n/a"/> <attribute name="Build-Jdk" value="${java.runtime.version}"/> <attribute name="Built-By" value="n/a"/> <attribute name="Created-By" value="Ant jar task"/> <section name="jdk/nashorn/"> <attribute name="Implementation-Title" value="Oracle Nashorn FXShell"/> <attribute name="Implementation-Version" value="${nashorn.version}"/> </section> </manifest> </jar> </target> <target name="javadoc" depends="prepare"> <javadoc destdir="${dist.javadoc.dir}" use="yes" overview="src/overview.html" windowtitle="${nashorn.product.name} ${nashorn.version}" additionalparam="-quiet" failonerror="true"> <classpath> <pathelement location="${build.classes.dir}"/> </classpath> <fileset dir="${src.dir}" includes="**/*.java"/> <fileset dir="${jdk.asm.src.dir}" includes="**/*.java"/> <link href="http://docs.oracle.com/javase/7/docs/api/"/> <!-- The following tags are used only in ASM sources - just ignore these --> <tag name="label" description="label tag in ASM sources" enabled="false"/> <tag name="linked" description="linked tag in ASM sources" enabled="false"/> <tag name="associates" description="associates tag in ASM sources" enabled="false"/> </javadoc> </target> <!-- generate shell.html for shell tool documentation --> <target name="shelldoc" depends="jar"> <java classname="${nashorn.shell.tool}" dir="${basedir}" output="${dist.dir}/shell.html" failonerror="true" fork="true"> <jvmarg line="${ext.class.path}"/> <arg value="-scripting"/> <arg value="docs/genshelldoc.js"/> </java> </target> <!-- generate all docs --> <target name="docs" depends="javadoc, shelldoc"/> <!-- create .zip and .tar.gz for nashorn binaries and scripts. --> <target name="dist" depends="jar"> <zip destfile="${build.zip}" basedir=".." excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/> <tar destfile="${build.gzip}" basedir=".." compression="gzip" excludes="nashorn/bin/*.sh" includes="nashorn/bin/** nashorn/dist/**"/> </target> <target name="compile-test" depends="compile, run-nasgen" if="testng.available"> <!-- testng task --> <taskdef name="testng" classname="org.testng.TestNGAntTask" classpath="${file.reference.testng.jar}"/> <javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" source="${javac.source}" target="${javac.target}" debug="${javac.debug}" encoding="${javac.encoding}" includeantruntime="false" fork="true"> <compilerarg value="-J-Djava.ext.dirs="/> <compilerarg value="-Xlint:unchecked"/> <compilerarg value="-Xlint:deprecation"/> </javac> <copy todir="${build.test.classes.dir}/META-INF/services"> <fileset dir="${test.src.dir}/META-INF/services/"/> </copy> <copy todir="${build.test.classes.dir}/jdk/nashorn/internal/runtime/resources"> <fileset dir="${test.src.dir}/jdk/nashorn/internal/runtime/resources"/> </copy> <!-- tests that check nashorn internals and internal API --> <jar jarfile="${nashorn.internal.tests.jar}"> <fileset dir="${build.test.classes.dir}" excludes="**/api/**"/> </jar> <!-- tests that check nashorn script engine (jsr-223) API --> <jar jarfile="${nashorn.api.tests.jar}"> <fileset dir="${build.test.classes.dir}" includes="**/api/**"/> <fileset dir="${build.test.classes.dir}" includes="**/META-INF/**"/> <fileset dir="${build.test.classes.dir}" includes="**/resources/*.js"/> </jar> </target> <target name="generate-policy-file" depends="prepare"> <echo file="${build.dir}/nashorn.policy"> grant codeBase "file:/${basedir}/${nashorn.internal.tests.jar}" { permission java.security.AllPermission; }; grant codeBase "file:/${basedir}/${file.reference.testng.jar}" { permission java.security.AllPermission; }; grant codeBase "file:/${basedir}/test/script/trusted/*" { permission java.security.AllPermission; }; grant codeBase "file:/${basedir}/test/script/basic/*" { permission java.io.FilePermission "${basedir}/test/script/-", "read"; permission java.io.FilePermission "$${user.dir}", "read"; permission java.util.PropertyPermission "user.dir", "read"; permission java.util.PropertyPermission "nashorn.test.*", "read"; }; grant codeBase "file:/${basedir}/test/script/basic/parser/*" { permission java.io.FilePermission "${basedir}/test/script/-", "read"; permission java.io.FilePermission "$${user.dir}", "read"; permission java.util.PropertyPermission "user.dir", "read"; permission java.util.PropertyPermission "nashorn.test.*", "read"; }; grant codeBase "file:/${basedir}/test/script/basic/JDK-8010946-privileged.js" { permission java.util.PropertyPermission "java.security.policy", "read"; }; grant codeBase "file:/${basedir}/test/script/basic/classloader.js" { permission java.lang.RuntimePermission "nashorn.JavaReflection"; }; </echo> <replace file="${build.dir}/nashorn.policy"> Other Java examples (source code examples)Here is a short list of links related to this Java build.xml source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.