jdk.xml revision 6:5a1b0714df0e
11573Srgrimes<?xml version="1.0" encoding="UTF-8"?><project name="jdk" basedir=".">
21573Srgrimes<!--
31573Srgrimes Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
41573Srgrimes DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
51573Srgrimes 
61573Srgrimes This code is free software; you can redistribute it and/or modify it
71573Srgrimes under the terms of the GNU General Public License version 2 only, as
81573Srgrimes published by the Free Software Foundation.
91573Srgrimes 
101573Srgrimes This code is distributed in the hope that it will be useful, but WITHOUT
111573Srgrimes ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
121573Srgrimes FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
131573Srgrimes version 2 for more details (a copy is included in the LICENSE file that
141573Srgrimes accompanied this code).
151573Srgrimes 
161573Srgrimes You should have received a copy of the GNU General Public License version
171573Srgrimes 2 along with this work; if not, write to the Free Software Foundation,
181573Srgrimes Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
191573Srgrimes 
201573Srgrimes Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
211573Srgrimes or visit www.oracle.com if you need additional information or have any
221573Srgrimes questions.
231573Srgrimes-->
241573Srgrimes
251573Srgrimes    
261573Srgrimes    <description>
271573Srgrimes        Permits selection of a JDK to use when building and running project.
281573Srgrimes        See: http://www.netbeans.org/issues/show_bug.cgi?id=64160
2950476Speter    </description>
301573Srgrimes
311573Srgrimes    <target name="-jdk-pre-preinit">
321573Srgrimes        <condition property="nbjdk.active-or-nbjdk.home">
3379531Sru            <or>
341573Srgrimes                <and>
351573Srgrimes                    <isset property="nbjdk.active"/>
361573Srgrimes                    <not>
3759460Sphantom                        <equals arg1="${nbjdk.active}" arg2="default_platform"/>
3859460Sphantom                    </not>
391573Srgrimes                </and>
4084306Sru                <and>
411573Srgrimes                    <isset property="nbjdk.home"/>
421573Srgrimes                    <not>
431573Srgrimes                        <isset property="nbjdk.home.defaulted"/>
441573Srgrimes                    </not>
451573Srgrimes                </and>
4677747Simp            </or>
4777747Simp        </condition>
4877747Simp    </target>
491573Srgrimes
501573Srgrimes    <target xmlns:common="http://java.netbeans.org/freeform/jdk.xml" name="-jdk-preinit" depends="-jdk-pre-preinit" if="nbjdk.active-or-nbjdk.home">
511573Srgrimes        <macrodef name="property" uri="http://java.netbeans.org/freeform/jdk.xml">
521573Srgrimes            <attribute name="name"/>
531573Srgrimes            <attribute name="value"/>
541573Srgrimes            <sequential>
55108087Sru                <property name="@{name}" value="${@{value}}"/>
561573Srgrimes            </sequential>
571573Srgrimes        </macrodef>
581573Srgrimes        <common:property name="nbjdk.home" value="platforms.${nbjdk.active}.home"/>
59108028Sru        <common:property name="nbjdk.javac.tmp" value="platforms.${nbjdk.active}.javac"/>
601573Srgrimes        <condition property=".exe" value=".exe">
611573Srgrimes            <os family="windows"/> 
62108028Sru        </condition>
631573Srgrimes        <property name=".exe" value=""/>
64108028Sru        <condition property="nbjdk.javac" value="${nbjdk.home}/bin/javac${.exe}">
65108028Sru            <equals arg1="${nbjdk.javac.tmp}" arg2="$${platforms.${nbjdk.active}.javac}"/>
661573Srgrimes        </condition>
671573Srgrimes        <property name="nbjdk.javac" value="${nbjdk.javac.tmp}"/>
681573Srgrimes        <common:property name="nbjdk.java.tmp" value="platforms.${nbjdk.active}.java"/>
691573Srgrimes        <condition property="nbjdk.java" value="${nbjdk.home}/bin/java${.exe}">
70108028Sru            <equals arg1="${nbjdk.java.tmp}" arg2="$${platforms.${nbjdk.active}.java}"/>
711573Srgrimes        </condition>
7281352Syar        <property name="nbjdk.java" value="${nbjdk.java.tmp}"/>
731573Srgrimes        <common:property name="nbjdk.javadoc.tmp" value="platforms.${nbjdk.active}.javadoc"/>
7459954Sphantom        <condition property="nbjdk.javadoc" value="${nbjdk.home}/bin/javadoc${.exe}">
751573Srgrimes            <equals arg1="${nbjdk.javadoc.tmp}" arg2="$${platforms.${nbjdk.active}.javadoc}"/>
761573Srgrimes        </condition>
771573Srgrimes        <property name="nbjdk.javadoc" value="${nbjdk.javadoc.tmp}"/>
781573Srgrimes        <common:property name="nbjdk.bootclasspath.tmp" value="platforms.${nbjdk.active}.bootclasspath"/>
791573Srgrimes        <condition property="nbjdk.bootclasspath" value="${nbjdk.home}/jre/lib/rt.jar">
801573Srgrimes            <equals arg1="${nbjdk.bootclasspath.tmp}" arg2="$${platforms.${nbjdk.active}.bootclasspath}"/>
811573Srgrimes        </condition>
8224503Smpp        <property name="nbjdk.bootclasspath" value="${nbjdk.bootclasspath.tmp}"/>
831573Srgrimes        <condition property="nbjdk.valid">
841573Srgrimes            <and>
851573Srgrimes                <available file="${nbjdk.home}" type="dir"/>
861573Srgrimes                <available file="${nbjdk.javac}" type="file"/>
871573Srgrimes                <available file="${nbjdk.java}" type="file"/>
8817782Smpp                <available file="${nbjdk.javadoc}" type="file"/>
898020Sache                
908020Sache            </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>
180