1 <?xml version="1.0" encoding="UTF-8"?>
   2 <!-- 
   3 /*
   4  * Copyright (c) 2009, 2012, 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  */
  26 -->
  27 <project name="plugin_utility" default="default" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
  28 
  29     <!-- ============================================================== -->
  30     <!--                          plugin support                        -->
  31     <!-- ============================================================== -->
  32 <!--    <target name="dist-plugin" depends="check-javafx-home, check-compiled" unless="testbase.readonly">  -->
  33     <target name="dist-plugin" depends="check-compiled" unless="testbase.readonly">
  34         <basename property="suitename" file="${basedir}"/>
  35         
  36 
  37 
  38         <echo message="debug: ant-javafx.jar = ${javafx.home}/lib/ant-javafx.jar"/>
  39 
  40         <condition property="file.reference.ant-javafx.jar" value="${javafx.home}/lib/ant-javafx.jar" else="${javafx.rt}/lib/ant-javafx.jar">
  41             <isset property="javafx.home"/>
  42         </condition>
  43         <echo message="debug: file.reference.ant-javafx.jar = ${file.reference.ant-javafx.jar}"/>
  44 
  45         <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
  46                  uri="javafx:com.sun.javafx.tools.ant"
  47                  classpath="${file.reference.ant-javafx.jar}"/>
  48 
  49         <jar destfile="${dist.dir}/${suitename}-web.jar">
  50             <fileset dir="${build.classes.dir}"/>
  51             <fileset dir="${build.test.classes.dir}"/>
  52             <manifest>
  53                 <attribute name="Implementation-Vendor" value="Oracle"/>
  54                 <attribute name="Implementation-Title" value="FXSQE Plugin Test"/>
  55                 <attribute name="Implementation-Version" value="1.0"/>
  56             </manifest>
  57         </jar>
  58 
  59         <jar destfile="../../tools/FxTestRunner/dist/FxTestRunner.jar"  update="true" >
  60           <manifest>
  61             <attribute name="Permissions" value="sandbox"/>
  62           </manifest>
  63         </jar>
  64 
  65         <fx:deploy width="1400" height="900"
  66                    outdir="${basedir}/dist-plugin" outfile="JavaClientPluginTest">
  67             <info title="FXSQE Plugin Test"/>
  68             <!--<fx:application mainClass="test.scenegraph.debug.PluginValidatorApp"/>-->
  69             <fx:application mainClass="client.test.runner.JNLPJUnitTestRunner" name="PluginTestRunner" />
  70             <fx:resources>
  71                 <fx:fileset dir="dist">
  72                     <include name="${suitename}-web.jar"/>
  73                 </fx:fileset>
  74                 <fx:fileset dir="../../tools/SharedTestUtilsOpen/dist/">
  75                     <include name="SharedTestUtilsOpen.jar"/>
  76                 </fx:fileset>
  77                 <fx:fileset dir="../../tools/FxTestRunner/dist/">
  78                     <include name="FxTestRunner.jar"/>
  79                 </fx:fileset>
  80                 <fx:fileset dir="../../tools/Jemmy/GlassImage/dist/">
  81                     <include name="GlassImage.jar"/>
  82                 </fx:fileset>
  83                 <fx:fileset dir="../../tools/Jemmy/GlassRobot/dist/">
  84                     <include name="GlassRobot.jar"/>
  85                 </fx:fileset>
  86                 <fx:fileset dir="../../tools/Jemmy/jemmy_core/">
  87                     <include name="JemmyCore.jar"/>
  88                     <include name="JemmyBrowser.jar"/>
  89                     <include name="JemmyAWTInput.jar"/>
  90                     <include name="junit.jar"/>
  91                 </fx:fileset>
  92                 <fx:fileset dir="../../tools/Jemmy/JemmyFXBrowser/dist/">
  93                     <include name="JemmyFXBrowser.jar" />
  94                 </fx:fileset>
  95                 <fx:fileset dir="../../tools/Jemmy/JemmyFX/dist/">
  96                     <include name="JemmyFX.jar" />
  97                 </fx:fileset>
  98                 <fx:fileset dir="../../tools/lib/">
  99                     <include name="jemmy.jar" />
 100                     <include name="JemmyAWT.jar"/>
 101                 </fx:fileset>
 102             </fx:resources>
 103         </fx:deploy>
 104         
 105         <!-- this target appeared due to fx:deploy creating plugin refererring to http://java.com/js/dtjava.js which doesn't work for 2.2 -->
 106         <echo message="jclient.root.dir = ${jclient.root.dir}"/>
 107         <copy todir="${basedir}/dist-plugin" overwrite="true">
 108             <fileset dir="${jclient.root.dir}/../../tools/FxTestRunner/plugin_files"/>
 109         </copy>        
 110 
 111     </target>
 112     <target name="javatest.plugin.mac" if="isMac">
 113         <property name="javatest.plugin.java.home" value="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/"/>
 114         <property name="javatest.javawsPath" value="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/javaws"/>
 115     </target>
 116 
 117     <target name="-load-suite-id">
 118         <condition property="jttfiletmp" value="${basedir}/javatest_files/${javatest.testmode}.jtt" else="${basedir}/javatest_files/automated.jtt">
 119             <available file="${basedir}/javatest_files/${javatest.testmode}.jtt" type="file" />
 120         </condition>
 121         <condition property="jttfile" value="${jttfiletmp}" else="${basedir}/testsuite.jtt">
 122             <available file="${jttfiletmp}" type="file"/>
 123         </condition>
 124 
 125         <echo message="suite id file: ${jttfile}" />
 126 
 127         <loadproperties srcFile="${jttfile}" prefix="suite">
 128             <filterchain>
 129                 <linecontains>
 130                     <contains value="id"/>
 131                 </linecontains>
 132             </filterchain>
 133         </loadproperties>
 134         <echo message="suite id: ${suite.id}" />
 135     </target>
 136 
 137 
 138     <target name="notify-about-used-java" unless="javatest.plugin.java.home" if="${javatest.copy.policy}"/>
 139 
 140     <target name="prepare-policy-file" depends="javatest.plugin.mac,notify-about-used-java,-load-suite-id" if="${javatest.copy.policy}">
 141         <copy overwrite="true" file="${javatest.plugin.java.home}/lib/security/java.policy"
 142               tofile="${fxtest.basedir}/java.policy.fxsqe.bak"/>
 143 
 144         <copy overwrite="true" file="${jclient.root.dir}/../../tools/FxTestRunner/src/java-plugin.policy" tofile="${fxtest.basedir}/java-plugin.${suite.id}.policy" />
 145 
 146         <pathconvert targetos="unix" property="user.home.converted">
 147             <path location="${user.home}"/>
 148         </pathconvert>
 149         <pathconvert targetos="unix" property="jclient.root.dir.converted">
 150             <path location="${jclient.root.dir}"/>
 151         </pathconvert>
 152         <replace file="${fxtest.basedir}/java-plugin.${suite.id}.policy" token="__USERDIR__" value="${user.home.converted}"/>
 153         <replace file="${fxtest.basedir}/java-plugin.${suite.id}.policy" token="__JAVACLIENTDIR__" value="${jclient.root.dir.converted}"/>
 154 
 155         <echo message="N.B.: if next command is failing, please, manually append content of java-plugin.policy to ${javatest.plugin.java.home}/lib/security/java.policy before starting the suite."/>
 156         <echo message="      And add next option to suite run -Djavatest.copy.policy=false"/>
 157         <concat destfile="${javatest.plugin.java.home}/lib/security/java.policy" append="true">
 158             <fileset file="${fxtest.basedir}/java-plugin.${suite.id}.policy" />
 159         </concat>
 160 
 161         <antcall target="external-sign-jars">
 162             <param name="jars.dir.to.sign" value="${basedir}/dist-plugin"/>
 163         </antcall>
 164         <antcall target="external-import-fxsqetrusted-to-all-jdk-cacerts">
 165         </antcall>
 166 
 167     </target>
 168 
 169 <!-- fake targets -->
 170     <target name="external-import-fxsqetrusted-to-all-jdk-cacerts" if="${jarsigner.defined}">
 171         <echo message=" call to import-fxsqetrusted-to-all-jdk-cacerts"/>
 172         <antcall target="import-fxsqetrusted-to-all-jdk-cacerts">
 173         </antcall>
 174     </target>
 175     <target name="external-sign-jars" if="${jarsigner.defined}">
 176         <echo message=" call to sign-jars"/>
 177         <antcall target="sign-jars">
 178         </antcall>
 179     </target>
 180 <!-- fake targets -->
 181 
 182 </project>