| <!-- | |
| Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved. | |
| This program and the accompanying materials are made available under the | |
| terms of the Eclipse Public License v. 2.0, which is available at | |
| http://www.eclipse.org/legal/epl-2.0. | |
| This Source Code may also be made available under the following Secondary | |
| Licenses when the conditions for such availability set forth in the | |
| Eclipse Public License v. 2.0 are satisfied: GNU General Public License, | |
| version 2 with the GNU Classpath Exception, which is available at | |
| https://www.gnu.org/software/classpath/license.html. | |
| SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | |
| --> | |
| <property environment="env"/> | |
| <property file="${env.APS_HOME}/config.properties"/> | |
| <target name="all" depends="clean, compile, run, undeploy, report"/> | |
| <target name="clean"> | |
| <delete dir="${env.APS_HOME}/build/module/classes"/> | |
| </target> | |
| <path id="classpath"> | |
| <fileset dir="${env.S1AS_HOME}/modules"> | |
| <include name="*.jar"/> | |
| </fileset> | |
| <fileset dir="${env.S1AS_HOME}/modules/endorsed"> | |
| <include name="*.jar"/> | |
| </fileset> | |
| <fileset dir="${env.APS_HOME}/lib"> | |
| <include name="*.jar"/> | |
| </fileset> | |
| </path> | |
| <target name="compile"> | |
| <mkdir dir="${env.APS_HOME}/build/module/classes"/> | |
| <basename file="${src-name}" property="server" suffix=".java"/> | |
| <dirname file="${src-name}" property="directory"/> | |
| <basename file="${directory}" property="pkg-name"/> | |
| <property name="class-name" value="${pkg-name}/${server}.class"/> | |
| <echo message="Compiling into ${pkg-name}/${server}.class"/> | |
| <javac srcdir="." destdir="${env.S1AS_HOME}/domains/domain1/autodeploy" | |
| includes="${src-name}"> | |
| <classpath refid="classpath"/> | |
| </javac> | |
| </target> | |
| <target name="compile-client"> | |
| <javac srcdir="." destdir="${env.APS_HOME}/build/module/classes" | |
| classpath="${env.APS_HOME}/lib/reporter.jar:${env.S1AS_HOME}/lib/j2ee.jar:${env.S1AS_HOME}/lib/webservices-rt.jar:${env.S1AS_HOME}/lib/webservices-tools.jar" | |
| includes="${client-src-name}"/> | |
| </target> | |
| <target name="deploy"> | |
| <antcall target="compile"/> | |
| </target> | |
| <target name="undeploy"> | |
| <basename file="${src-name}" property="server" suffix=".java"/> | |
| <dirname file="${src-name}" property="directory"/> | |
| <basename file="${directory}" property="pkg-name"/> | |
| <property name="class-name" value="${pkg-name}/${server}.class"/> | |
| <echo message="Removing file ${class-name} from autodeploy directory"/> | |
| <delete file="${env.S1AS_HOME}/domains/domain1/autodeploy/${class-name}"/> | |
| <waitfor maxwait="100" maxwaitunit="second"> | |
| <or> | |
| <available file="${env.S1AS_HOME}/domains/domain1/autodeploy/${class-name}_undeployed"/> | |
| <available file="${env.S1AS_HOME}/domains/domain1/autodeploy/${class-name}_undeployFailed"/> | |
| </or> | |
| </waitfor> | |
| <condition property="undeploy_succeeded"> | |
| <available file="${env.S1AS_HOME}/domains/domain1/autodeploy/${class-name}_undeployed"/> | |
| </condition> | |
| <condition property="undeploy_failed"> | |
| <available file="${env.S1AS_HOME}/domains/domain1/autodeploy/${class-name}_undeployFailed"/> | |
| </condition> | |
| </target> | |
| <target name="report" depends="internal-report-success, internal-report-failure"> | |
| <delete file="${env.S1AS_HOME}/domains/domain1/autodeploy/${class-name}_*"/> | |
| </target> | |
| <target name="run"> | |
| <waitfor maxwait="100" maxwaitunit="second"> | |
| <or> | |
| <available file="${env.S1AS_HOME}/domains/domain1/autodeploy/${class-name}_deployed"/> | |
| <available file="${env.S1AS_HOME}/domains/domain1/autodeploy/${class-name}_deployFailed"/> | |
| </or> | |
| </waitfor> | |
| <condition property="deploy_succeeded"> | |
| <available file="${env.S1AS_HOME}/domains/domain1/autodeploy/${class-name}_deployed"/> | |
| </condition> | |
| <condition property="deploy_failed"> | |
| <available file="${env.S1AS_HOME}/domains/domain1/autodeploy/${class-name}_deployFailed"/> | |
| </condition> | |
| <antcall target="internal-run"/> | |
| <antcall target="internal-report-failure"/> | |
| </target> | |
| <target name="internal-run" if="deploy_succeeded"> | |
| <basename file="${client-src-name}" property="client" suffix=".java"/> | |
| <dirname file="${client-src-name}" property="client-directory"/> | |
| <basename file="${client-directory}" property="client-pkg-name"/> | |
| <property name="client-class-name" value="${client-pkg-name}/${client}.class"/> | |
| <echo message="wsimporting http://${http.host}:${http.port}/${server}/${server}Service?WSDL"/> | |
| <exec executable="${env.S1AS_HOME}/bin/wsimport"> | |
| <arg line="-keep -d ${env.APS_HOME}/build/module/classes http://${http.host}:${http.port}/${server}/${server}Service?WSDL"/> | |
| </exec> | |
| <antcall target="compile-client"/> | |
| <echo message="Running appclient with ${client-pkg-name}.${client}"/> | |
| <unjar src="${env.APS_HOME}/lib/reporter.jar" dest="${env.APS_HOME}/build/module/classes"/> | |
| <exec executable="${env.S1AS_HOME}/bin/appclient" dir="${env.APS_HOME}/build/module/classes"> | |
| <arg value="${client-pkg-name}.${client}"/> | |
| </exec> | |
| </target> | |
| <target name="internal-report-success" if="undeploy_succeeded"> | |
| <antcall target="report-success"/> | |
| </target> | |
| <target name="internal-report-failure" if="undeploy_failed, deploy_failed"> | |
| <antcall target="report-failure"/> | |
| </target> |