nashorn/make/nbproject/jdk.xml
changeset 16147 e63b63819133
child 16151 97c1e756ae1e
equal deleted inserted replaced
16146:7b62478ee76c 16147:e63b63819133
       
     1 <?xml version="1.0" encoding="UTF-8"?><project name="jdk" basedir=".">
       
     2 <!--
       
     3  Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
       
     4  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     5  
       
     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.
       
     9  
       
    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).
       
    15  
       
    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.
       
    19  
       
    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 
       
    25     
       
    26     <description>
       
    27         Permits selection of a JDK to use when building and running project.
       
    28         See: http://www.netbeans.org/issues/show_bug.cgi?id=64160
       
    29     </description>
       
    30 
       
    31     <target name="-jdk-pre-preinit">
       
    32         <condition property="nbjdk.active-or-nbjdk.home">
       
    33             <or>
       
    34                 <and>
       
    35                     <isset property="nbjdk.active"/>
       
    36                     <not>
       
    37                         <equals arg1="${nbjdk.active}" arg2="default_platform"/>
       
    38                     </not>
       
    39                 </and>
       
    40                 <and>
       
    41                     <isset property="nbjdk.home"/>
       
    42                     <not>
       
    43                         <isset property="nbjdk.home.defaulted"/>
       
    44                     </not>
       
    45                 </and>
       
    46             </or>
       
    47         </condition>
       
    48     </target>
       
    49 
       
    50     <target xmlns:common="http://java.netbeans.org/freeform/jdk.xml" name="-jdk-preinit" depends="-jdk-pre-preinit" if="nbjdk.active-or-nbjdk.home">
       
    51         <macrodef name="property" uri="http://java.netbeans.org/freeform/jdk.xml">
       
    52             <attribute name="name"/>
       
    53             <attribute name="value"/>
       
    54             <sequential>
       
    55                 <property name="@{name}" value="${@{value}}"/>
       
    56             </sequential>
       
    57         </macrodef>
       
    58         <common:property name="nbjdk.home" value="platforms.${nbjdk.active}.home"/>
       
    59         <common:property name="nbjdk.javac.tmp" value="platforms.${nbjdk.active}.javac"/>
       
    60         <condition property=".exe" value=".exe">
       
    61             <os family="windows"/> 
       
    62         </condition>
       
    63         <property name=".exe" value=""/>
       
    64         <condition property="nbjdk.javac" value="${nbjdk.home}/bin/javac${.exe}">
       
    65             <equals arg1="${nbjdk.javac.tmp}" arg2="$${platforms.${nbjdk.active}.javac}"/>
       
    66         </condition>
       
    67         <property name="nbjdk.javac" value="${nbjdk.javac.tmp}"/>
       
    68         <common:property name="nbjdk.java.tmp" value="platforms.${nbjdk.active}.java"/>
       
    69         <condition property="nbjdk.java" value="${nbjdk.home}/bin/java${.exe}">
       
    70             <equals arg1="${nbjdk.java.tmp}" arg2="$${platforms.${nbjdk.active}.java}"/>
       
    71         </condition>
       
    72         <property name="nbjdk.java" value="${nbjdk.java.tmp}"/>
       
    73         <common:property name="nbjdk.javadoc.tmp" value="platforms.${nbjdk.active}.javadoc"/>
       
    74         <condition property="nbjdk.javadoc" value="${nbjdk.home}/bin/javadoc${.exe}">
       
    75             <equals arg1="${nbjdk.javadoc.tmp}" arg2="$${platforms.${nbjdk.active}.javadoc}"/>
       
    76         </condition>
       
    77         <property name="nbjdk.javadoc" value="${nbjdk.javadoc.tmp}"/>
       
    78         <common:property name="nbjdk.bootclasspath.tmp" value="platforms.${nbjdk.active}.bootclasspath"/>
       
    79         <condition property="nbjdk.bootclasspath" value="${nbjdk.home}/jre/lib/rt.jar">
       
    80             <equals arg1="${nbjdk.bootclasspath.tmp}" arg2="$${platforms.${nbjdk.active}.bootclasspath}"/>
       
    81         </condition>
       
    82         <property name="nbjdk.bootclasspath" value="${nbjdk.bootclasspath.tmp}"/>
       
    83         <condition property="nbjdk.valid">
       
    84             <and>
       
    85                 <available file="${nbjdk.home}" type="dir"/>
       
    86                 <available file="${nbjdk.javac}" type="file"/>
       
    87                 <available file="${nbjdk.java}" type="file"/>
       
    88                 <available file="${nbjdk.javadoc}" type="file"/>
       
    89                 
       
    90             </and>
       
    91         </condition>
       
    92         <echo level="verbose">nbjdk.active=${nbjdk.active} nbjdk.home=${nbjdk.home} nbjdk.java=${nbjdk.java} nbjdk.javac=${nbjdk.javac} nbjdk.javadoc=${nbjdk.javadoc} nbjdk.bootclasspath=${nbjdk.bootclasspath} nbjdk.valid=${nbjdk.valid} have-jdk-1.4=${have-jdk-1.4} have-jdk-1.5=${have-jdk-1.5}</echo>
       
    93     </target>
       
    94 
       
    95     <target name="-jdk-warn" depends="-jdk-preinit" if="nbjdk.active-or-nbjdk.home" unless="nbjdk.valid">
       
    96         <property name="jdkhome.presumed" location="${java.home}/.."/>
       
    97         <echo level="warning">Warning: nbjdk.active=${nbjdk.active} or nbjdk.home=${nbjdk.home} is an invalid Java platform; ignoring and using ${jdkhome.presumed}</echo>
       
    98     </target>
       
    99 
       
   100     <target name="-jdk-presetdef-basic" depends="-jdk-preinit" if="nbjdk.valid" unless="nbjdk.presetdef.basic.done">
       
   101         
       
   102         
       
   103         <macrodef name="javac-presetdef">
       
   104             <attribute name="javacval"/>
       
   105             <sequential>
       
   106                 <presetdef name="javac">
       
   107                     <javac fork="yes" executable="@{javacval}"/>
       
   108                 </presetdef>
       
   109             </sequential>
       
   110         </macrodef>
       
   111         <javac-presetdef javacval="${nbjdk.javac}"/>
       
   112         <macrodef name="java-presetdef">
       
   113             <attribute name="javaval"/>
       
   114             <sequential>
       
   115                 <presetdef name="java">
       
   116                     <java fork="yes" jvm="@{javaval}"/>
       
   117                 </presetdef>
       
   118             </sequential>
       
   119         </macrodef>
       
   120         <java-presetdef javaval="${nbjdk.java}"/>
       
   121         <macrodef name="javadoc-presetdef">
       
   122             <attribute name="javadocval"/>
       
   123             <sequential>
       
   124                 <presetdef name="javadoc">
       
   125                     <javadoc executable="@{javadocval}"/>
       
   126                 </presetdef>
       
   127             </sequential>
       
   128         </macrodef>
       
   129         <javadoc-presetdef javadocval="${nbjdk.javadoc}"/>
       
   130         <macrodef name="junit-presetdef">
       
   131             <attribute name="javaval"/>
       
   132             <sequential>
       
   133                 <presetdef name="junit">
       
   134                     <junit fork="yes" jvm="@{javaval}"/>
       
   135                 </presetdef>
       
   136             </sequential>
       
   137         </macrodef>
       
   138         <junit-presetdef javaval="${nbjdk.java}"/>
       
   139         <property name="nbjdk.presetdef.basic.done" value="true"/>
       
   140     </target>
       
   141 
       
   142     <target name="-jdk-presetdef-nbjpdastart" depends="-jdk-preinit" if="nbjdk.valid" unless="nbjdk.presetdef.nbjpdastart.done">
       
   143         <macrodef name="nbjpdastart-presetdef">
       
   144             <attribute name="bootcpval"/>
       
   145             <sequential>
       
   146                 <presetdef name="nbjpdastart">
       
   147                     <nbjpdastart>
       
   148                         <bootclasspath>
       
   149                             <path path="@{bootcpval}"/>
       
   150                         </bootclasspath>
       
   151                     </nbjpdastart>
       
   152                 </presetdef>
       
   153             </sequential>
       
   154         </macrodef>
       
   155         <nbjpdastart-presetdef bootcpval="${nbjdk.bootclasspath}"/>
       
   156         <property name="nbjdk.presetdef.nbjpdastart.done" value="true"/>
       
   157     </target>
       
   158 
       
   159     <target name="-jdk-default" unless="nbjdk.active-or-nbjdk.home">
       
   160         
       
   161         <property name="java.home.parent" location="${java.home}/.."/>
       
   162         <condition property="nbjdk.home" value="${java.home.parent}">
       
   163             <available file="${java.home.parent}/lib/tools.jar" type="file"/>
       
   164         </condition>
       
   165         <condition property="nbjdk.home" value="${java.home}">
       
   166             <available file="${java.home}/lib/tools.jar" type="file"/>
       
   167         </condition>
       
   168         
       
   169         <condition property="nbjdk.home" value="/Library/Java/Home">
       
   170             <available file="/Library/Java/Home" type="dir"/>
       
   171         </condition>
       
   172         
       
   173         <property name="nbjdk.home" location="${java.home.parent}"/>
       
   174         <property name="nbjdk.home.defaulted" value="true"/>
       
   175     </target>
       
   176 
       
   177     <target name="-jdk-init" depends="-jdk-preinit,-jdk-warn,-jdk-presetdef-basic,-jdk-default"/>
       
   178 
       
   179 </project>