jdk.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  4. Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
  5. Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  6. Other names may be trademarks of their respective owners.
  7. The contents of this file are subject to the terms of either the GNU
  8. General Public License Version 2 only ("GPL") or the Common
  9. Development and Distribution License("CDDL") (collectively, the
  10. "License"). You may not use this file except in compliance with the
  11. License. You can obtain a copy of the License at
  12. http://www.netbeans.org/cddl-gplv2.html
  13. or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
  14. specific language governing permissions and limitations under the
  15. License. When distributing the software, include this License Header
  16. Notice in each file and include the License file at
  17. nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
  18. particular file as subject to the "Classpath" exception as provided
  19. by Oracle in the GPL Version 2 section of the License file that
  20. accompanied this code. If applicable, add the following below the
  21. License Header, with the fields enclosed by brackets [] replaced by
  22. your own identifying information:
  23. "Portions Copyrighted [year] [name of copyright owner]"
  24. Contributor(s):
  25. The Original Software is NetBeans. The Initial Developer of the Original
  26. Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
  27. Microsystems, Inc. All Rights Reserved.
  28. If you wish your version of this file to be governed by only the CDDL
  29. or only the GPL Version 2, indicate your decision by adding
  30. "[Contributor] elects to include this software in this distribution
  31. under the [CDDL or GPL Version 2] license." If you do not indicate a
  32. single choice of license, a recipient has the option to distribute
  33. your version of this file under either the CDDL, the GPL Version 2 or
  34. to extend the choice of license to its licensees as provided above.
  35. However, if you add GPL Version 2 code and therefore, elected the GPL
  36. Version 2 license, then the option applies only if the new code is
  37. made subject to such option by the copyright holder.
  38. -->
  39. <project name="jdk" basedir=".">
  40. <description>
  41. Permits selection of a JDK to use when building and running NetBeans.
  42. For details on usage, see apisupport/harness/release/README (in sources)
  43. or harness/README (in binaries). Cf. issue #63541.
  44. </description>
  45. <target name="-jdk-pre-preinit">
  46. <condition property="nbjdk.active-or-nbjdk.home">
  47. <or>
  48. <and>
  49. <isset property="nbjdk.active"/>
  50. <not>
  51. <equals arg1="${nbjdk.active}" arg2="default"/>
  52. </not>
  53. </and>
  54. <and>
  55. <isset property="nbjdk.home"/>
  56. <not>
  57. <isset property="nbjdk.home.defaulted"/>
  58. </not>
  59. </and>
  60. </or>
  61. </condition>
  62. </target>
  63. <target name="-jdk-preinit" depends="-jdk-pre-preinit" if="nbjdk.active-or-nbjdk.home" xmlns:common="http://nbbuild.netbeans.org/jdk.xml">
  64. <macrodef name="property" uri="http://nbbuild.netbeans.org/jdk.xml">
  65. <attribute name="name"/>
  66. <attribute name="value"/>
  67. <sequential>
  68. <property name="@{name}" value="${@{value}}"/>
  69. </sequential>
  70. </macrodef>
  71. <common:property name="nbjdk.home" value="platforms.${nbjdk.active}.home"/>
  72. <common:property name="nbjdk.javac.tmp" value="platforms.${nbjdk.active}.javac"/>
  73. <condition property=".exe" value=".exe">
  74. <os family="windows"/> <!-- #72467 -->
  75. </condition>
  76. <property name=".exe" value=""/>
  77. <condition property="nbjdk.javac" value="${nbjdk.home}/bin/javac${.exe}">
  78. <equals arg1="${nbjdk.javac.tmp}" arg2="$${platforms.${nbjdk.active}.javac}"/>
  79. </condition>
  80. <property name="nbjdk.javac" value="${nbjdk.javac.tmp}"/>
  81. <common:property name="nbjdk.java.tmp" value="platforms.${nbjdk.active}.java"/>
  82. <condition property="nbjdk.java" value="${nbjdk.home}/bin/java${.exe}">
  83. <equals arg1="${nbjdk.java.tmp}" arg2="$${platforms.${nbjdk.active}.java}"/>
  84. </condition>
  85. <property name="nbjdk.java" value="${nbjdk.java.tmp}"/>
  86. <common:property name="nbjdk.javadoc.tmp" value="platforms.${nbjdk.active}.javadoc"/>
  87. <condition property="nbjdk.javadoc" value="${nbjdk.home}/bin/javadoc${.exe}">
  88. <equals arg1="${nbjdk.javadoc.tmp}" arg2="$${platforms.${nbjdk.active}.javadoc}"/>
  89. </condition>
  90. <property name="nbjdk.javadoc" value="${nbjdk.javadoc.tmp}"/>
  91. <common:property name="nbjdk.bootclasspath.tmp" value="platforms.${nbjdk.active}.bootclasspath"/>
  92. <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">
  93. <and>
  94. <equals arg1="${nbjdk.bootclasspath.tmp}" arg2="$${platforms.${nbjdk.active}.bootclasspath}"/>
  95. <os family="mac"/>
  96. </and>
  97. </condition>
  98. <pathconvert property="nbjdk.bootclasspath.standard">
  99. <path>
  100. <fileset dir="${nbjdk.home}/jre/lib" erroronmissingdir="false" includes="*.jar"/>
  101. </path>
  102. </pathconvert>
  103. <condition property="nbjdk.bootclasspath" value="${nbjdk.bootclasspath.standard}">
  104. <equals arg1="${nbjdk.bootclasspath.tmp}" arg2="$${platforms.${nbjdk.active}.bootclasspath}"/>
  105. </condition>
  106. <property name="nbjdk.bootclasspath" value="${nbjdk.bootclasspath.tmp}"/>
  107. <condition property="nbjdk.valid">
  108. <and>
  109. <available file="${nbjdk.home}" type="dir"/>
  110. <available file="${nbjdk.javac}" type="file"/>
  111. <available file="${nbjdk.java}" type="file"/>
  112. <available file="${nbjdk.javadoc}" type="file"/>
  113. <available classname="java.lang.Object" classpath="${nbjdk.bootclasspath}" ignoresystemclasses="true"/>
  114. </and>
  115. </condition>
  116. <available property="have-jdk-1.4" classname="java.lang.CharSequence" classpath="${nbjdk.bootclasspath}" ignoresystemclasses="true"/>
  117. <available property="have-jdk-1.5" classname="java.lang.StringBuilder" classpath="${nbjdk.bootclasspath}" ignoresystemclasses="true"/>
  118. <available property="have-jdk-1.6" classname="java.util.ServiceLoader" classpath="${nbjdk.bootclasspath}" ignoresystemclasses="true"/>
  119. <available property="have-jdk-1.7" classname="java.lang.ReflectiveOperationException" classpath="${nbjdk.bootclasspath}" ignoresystemclasses="true"/>
  120. <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}</echo>
  121. </target>
  122. <target name="-jdk-warn" depends="-jdk-preinit" if="nbjdk.active-or-nbjdk.home" unless="nbjdk.valid">
  123. <property name="jdkhome.presumed" location="${java.home}/.."/>
  124. <echo level="warning">Warning: nbjdk.active=${nbjdk.active} or nbjdk.home=${nbjdk.home} is an invalid Java platform; ignoring and using ${jdkhome.presumed}</echo>
  125. </target>
  126. <target name="-jdk-presetdef-basic" depends="-jdk-preinit" if="nbjdk.valid" unless="jdk.presetdef.basic.done">
  127. <!-- Have to eval these props now, not when used, because of usages of <ant ... inheritall="false"> -->
  128. <!-- (cf. http://issues.apache.org/bugzilla/show_bug.cgi?id=38040) -->
  129. <macrodef name="javac-presetdef">
  130. <attribute name="javacval"/>
  131. <sequential>
  132. <presetdef name="javac">
  133. <javac fork="yes" executable="@{javacval}"/>
  134. </presetdef>
  135. </sequential>
  136. </macrodef>
  137. <javac-presetdef javacval="${nbjdk.javac}"/>
  138. <macrodef name="java-presetdef">
  139. <attribute name="javaval"/>
  140. <sequential>
  141. <presetdef name="java">
  142. <java fork="yes" jvm="@{javaval}"/>
  143. </presetdef>
  144. </sequential>
  145. </macrodef>
  146. <java-presetdef javaval="${nbjdk.java}"/>
  147. <macrodef name="javadoc-presetdef">
  148. <attribute name="javadocval"/>
  149. <sequential>
  150. <presetdef name="javadoc">
  151. <javadoc executable="@{javadocval}"/>
  152. </presetdef>
  153. </sequential>
  154. </macrodef>
  155. <javadoc-presetdef javadocval="${nbjdk.javadoc}"/>
  156. <macrodef name="junit-presetdef">
  157. <attribute name="javaval"/>
  158. <sequential>
  159. <presetdef name="junit">
  160. <junit fork="yes" jvm="@{javaval}"/>
  161. </presetdef>
  162. </sequential>
  163. </macrodef>
  164. <junit-presetdef javaval="${nbjdk.java}"/>
  165. <property name="jdk.presetdef.basic.done" value="true"/>
  166. </target>
  167. <target name="-jdk-presetdef-nbjpdastart" depends="-jdk-preinit" if="nbjdk.valid" unless="jdk.presetdef.nbjpdastart.done">
  168. <macrodef name="nbjpdastart-presetdef">
  169. <attribute name="bootcpval"/>
  170. <sequential>
  171. <presetdef name="nbjpdastart">
  172. <nbjpdastart>
  173. <bootclasspath>
  174. <path path="@{bootcpval}"/>
  175. </bootclasspath>
  176. </nbjpdastart>
  177. </presetdef>
  178. </sequential>
  179. </macrodef>
  180. <nbjpdastart-presetdef bootcpval="${nbjdk.bootclasspath}"/>
  181. <property name="jdk.presetdef.nbjpdastart.done" value="true"/>
  182. </target>
  183. <target name="-jdk-presetdef-nbprofiledirect" depends="-jdk-preinit" if="nbjdk.valid" unless="jdk.presetdef.nbprofiledirect.done">
  184. <!-- XXX disable for now, but could be considered:
  185. <macrodef name="nbprofiledirect-presetdef">
  186. <attribute name="javaval"/>
  187. <sequential>
  188. <presetdef name="nbprofiledirect">
  189. <nbprofiledirect jvmproperty="@{javaval}"/>
  190. </presetdef>
  191. </sequential>
  192. </macrodef>
  193. <nbprofiledirect-presetdef javaval="${nbjdk.java}"/>
  194. -->
  195. <property name="jdk.presetdef.nbprofiledirect.done" value="true"/>
  196. </target>
  197. <target name="-jdk-default" unless="nbjdk.active-or-nbjdk.home">
  198. <!-- Define fallback values of some things. -->
  199. <property name="java.home.parent" location="${java.home}/.."/>
  200. <condition property="nbjdk.home" value="${java.home.parent}">
  201. <available file="${java.home.parent}/lib/tools.jar" type="file"/>
  202. </condition>
  203. <condition property="nbjdk.home" value="${java.home}">
  204. <available file="${java.home}/lib/tools.jar" type="file"/>
  205. </condition>
  206. <!-- Mac OS X -->
  207. <condition property="nbjdk.home" value="${java.home}">
  208. <available file="${java.home}/../Classes/classes.jar" type="file"/>
  209. </condition>
  210. <!-- Fallback? -->
  211. <property name="nbjdk.home" location="${java.home.parent}"/>
  212. <available property="have-jdk-1.4" classname="java.lang.CharSequence"/>
  213. <available property="have-jdk-1.5" classname="java.lang.StringBuilder"/>
  214. <available property="have-jdk-1.6" classname="java.util.ServiceLoader"/>
  215. <available property="have-jdk-1.7" classname="java.lang.ReflectiveOperationException"/>
  216. <property name="nbjdk.home.defaulted" value="true"/>
  217. </target>
  218. <target name="-jdk-init" depends="-jdk-preinit,-jdk-warn,-jdk-presetdef-basic,-jdk-default">
  219. <!-- Will be bogus on Mac OS X, but doesn't matter - Classes/classes.jar should have this anyway -->
  220. <property name="tools.jar" location="${nbjdk.home}/lib/tools.jar"/>
  221. <!--<echo level="info">Using JDK: ${nbjdk.home}</echo>-->
  222. </target>
  223. </project>