1 <?xml version="1.0" encoding="UTF-8"?>
   2 <!--
   3 /*
   4  * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
   5  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   6  *
   7  * This code is free software; you can redistribute it and/or modify it
   8  * under the terms of the GNU General Public License version 2 only, as
   9  * published by the Free Software Foundation.  Oracle designates this
  10  * particular file as subject to the "Classpath" exception as provided
  11  * by Oracle in the LICENSE file that accompanied this code.
  12  *
  13  * This code is distributed in the hope that it will be useful, but WITHOUT
  14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  15  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  16  * version 2 for more details (a copy is included in the LICENSE file that
  17  * accompanied this code).
  18  *
  19  * You should have received a copy of the GNU General Public License version
  20  * 2 along with this work; if not, write to the Free Software Foundation,
  21  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  22  *
  23  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  24  * or visit www.oracle.com if you need additional information or have any
  25  * questions.
  26  */
  27 -->
  28 <project>
  29     <property name="jfxlauncher" value="${basedir}/target/jfxlauncher"/>
  30     <property name="jdk8mobile.sdk.root" value="./jdk8-mobile-ios-ejdk"/>
  31     <property name="jfx.ios.artifacts.root" value="./JFXLibs"/>
  32 
  33     <available property="jfxlauncher.exists" file="${jfxlauncher}/build.xml"/>
  34     <target name="-copy-launcher" unless="jfxlauncher.exists">
  35         <mkdir dir="${jfxlauncher}"/>
  36         <copy todir="${jfxlauncher}">
  37             <fileset dir="${basedir}/target/ios-maven-plugin/JFXLauncher">
  38                 <exclude name="**/*.pbxproj"/>
  39             </fileset>
  40         </copy>
  41         <copy todir="${jfxlauncher}">
  42             <fileset dir="${basedir}/target/ios-maven-plugin/JFXLauncher">
  43                 <include name="**/*.pbxproj"/>
  44             </fileset>
  45             <filterset>
  46                 <filter token="JVMROOT_TOKEN" value="${jdk8mobile.sdk.root}"/>
  47                 <filter token="JFXSDKROOT_TOKEN" value="${jfx.ios.artifacts.root}"/>
  48                 <filter token="RESDIR_TOKEN" value="${resourcesDirResolved}"/>
  49                 <filter token="APPLICATIONJAR_TOKEN" value="${jarfile}"/>
  50                 <filter token="JAVA_PROFILE_TOKEN" value="${javaProfile}"/>
  51             </filterset>
  52         </copy>
  53         <chmod dir="${jfxlauncher}" perm="a+x" includes="*.sh,ios-sim"/>
  54     </target>
  55 
  56     <condition property="do.fast.deploy">
  57         <and>
  58             <equals arg1="true" arg2="${fastDeploy}"/>
  59             <not>
  60                 <isset property="jpdaAddress"/>
  61             </not>
  62         </and>
  63     </condition>
  64     <condition property="resourcesDirResolved" value="${basedir}/${resourcesDir}">
  65         <isset property="resourcesDir"/>
  66     </condition>
  67     <property name="resourcesDirResolved" value=""/>
  68 
  69     <target name="-fast-deploy" depends="-copy-launcher" if="do.fast.deploy">
  70         <java fork="true" failonerror="false" classname="org.netbeans.mobilecenter.Redeploy"
  71           resultproperty="deploy.result"
  72         >
  73             <classpath>
  74                 <pathelement location="${basedir}/target/ios-maven-plugin/mobilecenter.jar"/>
  75             </classpath>
  76             <arg value="${jarfile}"/>
  77         </java>
  78         <condition property="skip.run" value="true">
  79             <equals arg1="0" arg2="${deploy.result}"/>
  80         </condition>
  81         <pathconvert property="appjarDebugName">
  82             <flattenmapper/>
  83             <path>
  84                 <pathelement path="${jarfile}"/>
  85             </path>
  86         </pathconvert>
  87     </target>
  88 
  89     <target name="runJFXLauncher" depends="-copy-launcher,-fast-deploy" unless="skip.run">
  90         <property name="runtime.classpath.tmp" refid="maven.runtime.classpath"/>
  91         <condition value="${runtime.classpath.tmp}:${basedir}/target/ios-maven-plugin/mobilecenter.jar" property="runtime.classpath">
  92             <isset property="fastDeploy"/>
  93         </condition>
  94         <property name="runtime.classpath" value="${runtime.classpath.tmp}"/>
  95 
  96         <condition value="org.netbeans.mobilecenter.MobileCenter" property="app.main.class">
  97             <isset property="fastDeploy"/>
  98         </condition>
  99         <property name="app.main.class" value="${mainclass}"/>
 100 
 101         <antcall target="write.plist.debug">
 102             <param name="ipAddress" value="127.0.0.1" />
 103             <param name="jpdaAddress" value="${jpdaAddress}" />
 104         </antcall>
 105         <antcall target="write.appjar.debug">
 106             <param name="appjarDebugName" value="${appjarDebugName}" />
 107         </antcall>
 108         <ant dir="${jfxlauncher}" target="runsim-mvn">
 109             <property name="mvn.classpath" value="${runtime.classpath}"/>
 110             <property name="mvn.app.jar" value="${jarfile}"/>
 111             <property name="launcher.CFBundleDisplayName" value="${title}"/>
 112             <property name="application.title" value="${title}"/>
 113             <property name="javafx.enable" value="${javafx}"/>
 114             <property name="launcher.javaMainClass" value="${app.main.class}"/>
 115             <property name="product.config" value="${runMode}" />
 116             <property name="resources.dir" value="${resourcesDirResolved}"/>
 117             <property name="launcher.IconImagesDir" value="${basedir}/${iconsDir}" />
 118             <property name="launcher.DefaultImagesDir" value="${basedir}/${imagesDir}" />
 119             <property name="launcher.MinimumOSVersion" value="${deploymentTarget}" />
 120             <property name="launcher.UIDeviceFamily" value="${targetDevices}" />
 121             <property name="launcher.UISupportedInterfaceOrientations" value="${supportedInterfaceOrientations}" />
 122             <property name="launcher.UISupportedInterfaceOrientations~ipad" value="${iPadSupportedInterfaceOrientations}" />
 123             <property name="launcher.UIPrerenderedIcon" value="${prerenderedIcons}" />
 124             <property name="launcher.CFBundleIdentifier" value="${bundleId}" />
 125             <property name="provisioning.profile" value="${provisioningProfile}" />
 126         </ant>
 127         <delete dir="${basedir}/target/ios-maven-plugin" />
 128     </target>
 129 
 130     <!-- ************* DEBUG helpers ************* -->
 131     <target name="write.plist.debug">
 132         <property name="plist.file" value="${jfxlauncher}/jfx-runjava.properties" />
 133         <echo message="jpdaAddress=${ipAddress}:${jpdaAddress}${line.separator}" file="${plist.file}" append="true" />
 134     </target>
 135     <target name="write.appjar.debug" if="fastDeploy" >
 136         <property name="plist.file" value="${jfxlauncher}/jfx-runjava.properties" />
 137         <echo message="bgReloadJar=${appjarDebugName}${line.separator}" file="${plist.file}" append="true" />
 138     </target>
 139 
 140     <!-- ************* BUILD IPA TARGET ************* -->
 141     <target name="buildIPA" depends="-copy-launcher">
 142         <property name="runtime.classpath.tmp" refid="maven.runtime.classpath"/>
 143         <condition value="${runtime.classpath.tmp}:${basedir}/target/ios-maven-plugin/mobilecenter.jar" property="runtime.classpath">
 144             <isset property="fastDeploy"/>
 145         </condition>
 146         <property name="runtime.classpath" value="${runtime.classpath.tmp}"/>
 147 
 148         <condition value="org.netbeans.mobilecenter.MobileCenter" property="app.main.class">
 149             <isset property="fastDeploy"/>
 150         </condition>
 151         <property name="app.main.class" value="${mainclass}"/>
 152 
 153         <chmod dir="${basedir}/target/ios-maven-plugin/JFXLauncher" perm="ugo+rx" includes="**/*"/>
 154         <antcall target="write.plist.debug">
 155             <param name="ipAddress" value="${ipAddress}" />
 156             <param name="jpdaAddress" value="${jpdaAddress}" />
 157         </antcall>
 158         <antcall target="write.appjar.debug">
 159             <param name="appjarDebugName" value="${appjarDebugName}" />
 160         </antcall>
 161         <ant dir="${jfxlauncher}" target="package-mvn">
 162             <property name="mvn.classpath" value="${runtime.classpath}"/>
 163             <property name="mvn.app.jar" value="${jarfile}"/>
 164             <property name="launcher.CFBundleDisplayName" value="${title}"/>
 165             <property name="application.title" value="${title}"/>
 166             <property name="javafx.enable" value="${javafx}"/>
 167             <property name="launcher.javaMainClass" value="${app.main.class}"/>
 168             <property name="product.config" value="${runMode}" />
 169             <property name="provisioning.profile" value="${provisioningProfile}" />
 170             <property name="resources.dir" value="${resourcesDirResolved}"/>
 171             <property name="launcher.IconImagesDir" value="${basedir}/${iconsDir}" />
 172             <property name="launcher.DefaultImagesDir" value="${basedir}/${imagesDir}" />
 173             <property name="launcher.MinimumOSVersion" value="${deploymentTarget}" />
 174             <property name="launcher.UIDeviceFamily" value="${targetDevices}" />
 175             <property name="launcher.UISupportedInterfaceOrientations" value="${supportedInterfaceOrientations}" />
 176             <property name="launcher.UISupportedInterfaceOrientations~ipad" value="${iPadSupportedInterfaceOrientations}" />
 177             <property name="launcher.UIPrerenderedIcon" value="${prerenderedIcons}" />
 178             <property name="launcher.CFBundleIdentifier" value="${bundleId}" />
 179             <property name="provisioning.profile" value="${provisioningProfile}" />
 180         </ant>
 181         <copy file="${jfxlauncher}/build/${title}.ipa" tofile="${basedir}/target/${title}.ipa" />
 182         <ant dir="${jfxlauncher}" target="open-ipa-in-itunes-mvn">
 183             <property name="application.title" value="${title}"/>
 184             <property name="project.target" value="${basedir}/target" />
 185         </ant>
 186         <delete dir="${basedir}/target/ios-maven-plugin" />
 187     </target>
 188 </project>