1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
|
<?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.
-->
<project name="jdk" basedir=".">
<description>
Permits selection of a JDK to use when building and running NetBeans.
For details on usage, see apisupport/harness/release/README (in sources)
or harness/README (in binaries). Cf. issue #63541.
</description>
<target name="-jdk-pre-preinit">
<condition property="nbjdk.active-or-nbjdk.home">
<or>
<and>
<isset property="nbjdk.active"/>
<not>
<equals arg1="${nbjdk.active}" arg2="default"/>
</not>
</and>
<and>
<isset property="nbjdk.home"/>
<not>
<isset property="nbjdk.home.defaulted"/>
</not>
</and>
</or>
</condition>
</target>
<target name="-jdk-preinit" depends="-jdk-pre-preinit" if="nbjdk.active-or-nbjdk.home" xmlns:common="http://nbbuild.netbeans.org/jdk.xml">
<macrodef name="property" uri="http://nbbuild.netbeans.org/jdk.xml">
<attribute name="name"/>
<attribute name="value"/>
<sequential>
<property name="@{name}" value="${@{value}}"/>
</sequential>
</macrodef>
<common:property name="nbjdk.home" value="platforms.${nbjdk.active}.home"/>
<common:property name="nbjdk.javac.tmp" value="platforms.${nbjdk.active}.javac"/>
<condition property=".exe" value=".exe">
<os family="windows"/> <!-- #72467 -->
</condition>
<property name=".exe" value=""/>
<condition property="nbjdk.javac" value="${nbjdk.home}/bin/javac${.exe}">
<equals arg1="${nbjdk.javac.tmp}" arg2="$${platforms.${nbjdk.active}.javac}"/>
</condition>
<property name="nbjdk.javac" value="${nbjdk.javac.tmp}"/>
<common:property name="nbjdk.java.tmp" value="platforms.${nbjdk.active}.java"/>
<condition property="nbjdk.java" value="${nbjdk.home}/bin/java${.exe}">
<equals arg1="${nbjdk.java.tmp}" arg2="$${platforms.${nbjdk.active}.java}"/>
</condition>
<property name="nbjdk.java" value="${nbjdk.java.tmp}"/>
<common:property name="nbjdk.javadoc.tmp" value="platforms.${nbjdk.active}.javadoc"/>
<condition property="nbjdk.javadoc" value="${nbjdk.home}/bin/javadoc${.exe}">
<equals arg1="${nbjdk.javadoc.tmp}" arg2="$${platforms.${nbjdk.active}.javadoc}"/>
</condition>
<property name="nbjdk.javadoc" value="${nbjdk.javadoc.tmp}"/>
<common:property name="nbjdk.bootclasspath.tmp" value="platforms.${nbjdk.active}.bootclasspath"/>
<condition property="nbjdk.bootclasspath" value="${nbjdk.home}/../Classes/classes.jar:${nbjdk.home}/../Classes/jsse.jar:${nbjdk.home}/../Classes/jce.jar:${nbjdk.home}/../Classes/ui.jar:${nbjdk.home}/../Classes/laf.jar:${nbjdk.home}/../Classes/sunrsasign.jar:${nbjdk.home}/../Classes/charsets.jar">
<and>
<equals arg1="${nbjdk.bootclasspath.tmp}" arg2="$${platforms.${nbjdk.active}.bootclasspath}"/>
<available file="${nbjdk.home}/../Classes/classes.jar" type="file"/>
</and>
</condition>
<pathconvert property="nbjdk.bootclasspath.standard">
<path>
<fileset dir="${nbjdk.home}/jre/lib" erroronmissingdir="false" includes="*.jar"/>
</path>
</pathconvert>
<condition property="nbjdk.bootclasspath" value="${nbjdk.bootclasspath.standard}">
<equals arg1="${nbjdk.bootclasspath.tmp}" arg2="$${platforms.${nbjdk.active}.bootclasspath}"/>
</condition>
<property name="nbjdk.bootclasspath" value="${nbjdk.bootclasspath.tmp}"/>
<condition property="nbjdk.valid">
<and>
<available file="${nbjdk.home}" type="dir"/>
<available file="${nbjdk.javac}" type="file"/>
<available file="${nbjdk.java}" type="file"/>
<available file="${nbjdk.javadoc}" type="file"/>
<or>
<available classname="java.lang.Object" classpath="${nbjdk.bootclasspath}" ignoresystemclasses="true"/>
<available file="${nbjdk.home}/bin/jmod${.exe}"/>
</or>
</and>
</condition>
<available property="have-jdk-1.4" classname="java.lang.CharSequence" classpath="${nbjdk.bootclasspath}" ignoresystemclasses="true"/>
<available property="have-jdk-1.5" classname="java.lang.StringBuilder" classpath="${nbjdk.bootclasspath}" ignoresystemclasses="true"/>
<available property="have-jdk-1.6" classname="java.util.ServiceLoader" classpath="${nbjdk.bootclasspath}" ignoresystemclasses="true"/>
<available property="have-jdk-1.7" classname="java.lang.ReflectiveOperationException" classpath="${nbjdk.bootclasspath}" ignoresystemclasses="true"/>
<available property="have-jdk-1.8" classname="java.lang.FunctionalInterface" classpath="${nbjdk.bootclasspath}" ignoresystemclasses="true"/>
<available property="have-jdk-1.9" file="${nbjdk.home}/bin/jmod${.exe}"/>
<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} have-jdk-1.6=${have-jdk-1.6} have-jdk-1.7=${have-jdk-1.7} have-jdk-1.8=${have-jdk-1.8} have-jdk-1.9=${have-jdk-1.9}</echo>
</target>
<target name="-jdk-warn" depends="-jdk-preinit" if="nbjdk.active-or-nbjdk.home" unless="nbjdk.valid">
<property name="jdkhome.presumed" location="${java.home}/.."/>
<echo level="warning">Warning: nbjdk.active=${nbjdk.active} or nbjdk.home=${nbjdk.home} is an invalid Java platform; ignoring and using ${jdkhome.presumed}</echo>
</target>
<target name="-jdk-presetdef-basic" depends="-jdk-preinit" if="nbjdk.valid" unless="jdk.presetdef.basic.done">
<!-- Have to eval these props now, not when used, because of usages of <ant ... inheritall="false"> -->
<!-- (cf. http://issues.apache.org/bugzilla/show_bug.cgi?id=38040) -->
<macrodef name="javac-presetdef">
<attribute name="javacval"/>
<sequential>
<presetdef name="javac">
<javac fork="yes" executable="@{javacval}"/>
</presetdef>
</sequential>
</macrodef>
<javac-presetdef javacval="${nbjdk.javac}"/>
<macrodef name="java-presetdef">
<attribute name="javaval"/>
<sequential>
<presetdef name="java">
<java fork="yes" jvm="@{javaval}"/>
</presetdef>
</sequential>
</macrodef>
<java-presetdef javaval="${nbjdk.java}"/>
<macrodef name="javadoc-presetdef">
<attribute name="javadocval"/>
<sequential>
<presetdef name="javadoc">
<javadoc executable="@{javadocval}"/>
</presetdef>
</sequential>
</macrodef>
<javadoc-presetdef javadocval="${nbjdk.javadoc}"/>
<macrodef name="junit-presetdef">
<attribute name="javaval"/>
<sequential>
<presetdef name="junit">
<junit fork="yes" jvm="@{javaval}"/>
</presetdef>
</sequential>
</macrodef>
<junit-presetdef javaval="${nbjdk.java}"/>
<property name="jdk.presetdef.basic.done" value="true"/>
</target>
<target name="-jdk-presetdef-nbjpdastart" depends="-jdk-preinit" if="nbjdk.valid" unless="jdk.presetdef.nbjpdastart.done">
<macrodef name="nbjpdastart-presetdef">
<attribute name="bootcpval"/>
<sequential>
<presetdef name="nbjpdastart">
<nbjpdastart>
<bootclasspath>
<path path="@{bootcpval}"/>
</bootclasspath>
</nbjpdastart>
</presetdef>
</sequential>
</macrodef>
<nbjpdastart-presetdef bootcpval="${nbjdk.bootclasspath}"/>
<property name="jdk.presetdef.nbjpdastart.done" value="true"/>
</target>
<target name="-jdk-presetdef-nbprofiledirect" depends="-jdk-preinit" if="nbjdk.valid" unless="jdk.presetdef.nbprofiledirect.done">
<!-- XXX disable for now, but could be considered:
<macrodef name="nbprofiledirect-presetdef">
<attribute name="javaval"/>
<sequential>
<presetdef name="nbprofiledirect">
<nbprofiledirect jvmproperty="@{javaval}"/>
</presetdef>
</sequential>
</macrodef>
<nbprofiledirect-presetdef javaval="${nbjdk.java}"/>
-->
<property name="jdk.presetdef.nbprofiledirect.done" value="true"/>
</target>
<target name="-jdk-default" unless="nbjdk.active-or-nbjdk.home">
<!-- Define fallback values of some things. -->
<property name="java.home.parent" location="${java.home}/.."/>
<condition property="nbjdk.home" value="${java.home.parent}">
<available file="${java.home.parent}/lib/tools.jar" type="file"/>
</condition>
<condition property="nbjdk.home" value="${java.home}">
<available file="${java.home}/lib/tools.jar" type="file"/>
</condition>
<!-- Mac OS X -->
<condition property="nbjdk.home" value="${java.home}">
<available file="${java.home}/../Classes/classes.jar" type="file"/>
</condition>
<!-- Fallback? -->
<property name="nbjdk.home" location="${java.home}"/>
<available property="have-jdk-1.4" classname="java.lang.CharSequence"/>
<available property="have-jdk-1.5" classname="java.lang.StringBuilder"/>
<available property="have-jdk-1.6" classname="java.util.ServiceLoader"/>
<available property="have-jdk-1.7" classname="java.lang.ReflectiveOperationException"/>
<available property="have-jdk-1.8" classname="java.lang.FunctionalInterface"/>
<available property="have-jdk-1.9" classname="java.util.zip.CRC32C"/>
<property name="nbjdk.home.defaulted" value="true"/>
</target>
<target name="-jdk-init" depends="-jdk-preinit,-jdk-warn,-jdk-presetdef-basic,-jdk-default">
<!-- Will be bogus on Mac OS X, but doesn't matter - Classes/classes.jar should have this anyway -->
<property name="tools.jar" location="${nbjdk.home}/lib/tools.jar"/>
<!--<echo level="info">Using JDK: ${nbjdk.home}</echo>-->
<condition property=".exe" value=".exe">
<os family="windows"/> <!-- #72467 -->
</condition>
<property name=".exe" value=""/>
<condition property="test.nbjdk.java" value="${test.nbjdk.home}/bin/java${.exe}" else="${nbjdk.home}/bin/java${.exe}">
<and>
<isset property="test.nbjdk.home" />
<available file="${test.nbjdk.home}/bin/java${.exe}" type="file"/>
</and>
</condition>
</target>
</project>
|