blob: 7e6b433cd779cf7e808323a5370327592926a554 [file] [log] [blame]
<!--
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
-->
<path id="class.path">
<fileset dir="${env.S1AS_HOME}/modules">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${env.APS_HOME}/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<path id="run.classpath">
<fileset dir="${dist}">
<include name="*.jar"/>
</fileset>
<fileset dir="${env.S1AS_HOME}/modules">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${env.APS_HOME}/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="build-static" depends="clean,generate-stubs,compile-client,package-client"
description="Executes the targets needed to build a static stub client.">
</target>
<target name="prepare-dist"
description="Creates the dist directory" >
<echo message="Creating the required directories...." />
<mkdir dir="${dist}" />
</target>
<target name="generate-stubs"
description="Runs wscompile to generate the client stub classes">
<antcall target="run-wscompile">
<param name="param1" value="-gen:client -d ${build.classes.dir} -classpath ${build.classes.dir} ${config.wsdl.file}"/>
</antcall>
</target>
<target name="compile-client" depends="prepare"
description="Compiles the client-side source code" >
<echo message="Compiling the client source code...."/>
<javac srcdir="${client.src}" destdir="${build}">
<include name="**/*.java" />
<classpath refid="jaxrpc.classpath"/>
<classpath path="${build}" />
</javac>
</target>
<target name="package-client" depends="prepare-dist"
description="Builds the JAR file that contains the client">
<echo message="Building the client JAR file...."/>
<delete file="${dist}/${client.jar}" />
<jar jarfile="${dist}/${client.jar}" >
<fileset dir="${build}" />
</jar>
</target>
<target name="clean" >
<delete dir="${build}" />
<delete dir="${env.APS_HOME}/build" />
<delete dir="${dist}" />
<delete dir="${assemble}" />
<delete dir="${assemble.dir}" />
<delete file="${ear.name}" />
<delete file="${war.name}" />
<delete file="${war.file}" />
<delete file="${client.jar.name}" />
</target>
<target name="generate-wsdl"
description="Runs wscompile to generate the WSDL file and mapping file">
<antcall target="run-wscompile">
<param name="param1" value="-define -mapping ${build}/${mapping.file} -keep -d ${build} -nd ${build} -classpath ${build} ${config.interface.file}"/>
</antcall>
</target>
<target name="run-wscompile" depends="prepare,set-wscompile"
description="Runs wscompile">
<echo message="Running wscompile:"/>
<echo message=" ${wscompile} ${param1}"/>
<exec executable="${wscompile}">
<arg line="${param1}"/>
</exec>
</target>
<target name="set-wscompile" >
<condition property="wscompile" value="${env.S1AS_HOME}/bin/wscompile.bat">
<os family="windows"/>
</condition>
<condition property="wscompile" value="${env.S1AS_HOME}/bin/wscompile">
<not>
<os family="windows"/>
</not>
</condition>
</target>
<target name="set-asadmin" >
<condition property="ASADMIN" value="${env.S1AS_HOME}/bin/asadmin.bat">
<os family="windows"/>
</condition>
<condition property="ASADMIN" value="${env.S1AS_HOME}/bin/asadmin">
<not>
<os family="windows"/>
</not>
</condition>
</target>
<target name="prepare" depends="init"
description="Creates the build directory" >
<echo message="Creating the required directories...." />
<mkdir dir="${build}" />
</target>
<target name="init" >
<tstamp/>
<condition property="stub.file" value="${appname}Client.jar">
<available file="${appname}Client.jar"/>
</condition>
<condition property="deploy.file" value="${assemble.ear}/${ear}">
<available file="${assemble.ear}/${ear}"/>
</condition>
<condition property="deploy.file" value="${assemble.war}/${war.file}">
<available file="${assemble.war}/${war.file}"/>
</condition>
<property name="deploy.file" value="${war.file}"/>
<condition property="verify.file" value="${assemble.ear}/${ear}">
<available file="${assemble.ear}/${ear}"/>
</condition>
<condition property="verify.file" value="${assemble.war}/${war.file}">
<available file="${assemble.war}/${war.file}"/>
</condition>
<property name="verify.file" value="${war.file}"/>
</target>
<path id="db.classpath">
<fileset dir="${db.root}/lib">
<include name="*.jar"/>
</fileset>
</path>
<target name="create-db_common"
depends="init,start-db,delete-db"
description="Create database tables and populate database." >
<sql driver="${db.driver}"
url="${db.url}"
userid="${db.user}"
password="${db.password}"
classpathref="db.classpath"
delimiter="${db.delimiter}"
autocommit="false"
onerror="abort" >
<transaction src="${sql.script}"/>
</sql>
</target>
<target name="delete-db"
description="Deletes the database tables." >
<sql driver="${db.driver}"
url="${db.url}"
userid="${db.user}"
password="${db.password}"
classpathref="db.classpath"
delimiter="${db.delimiter}"
autocommit="false"
onerror="continue" >
<transaction src="${delete.sql.script}"/>
</sql>
</target>
<target name="ping-db"
description="Checks to see if Derby is running." >
<java classname="org.apache.derby.drda.NetworkServerControl"
fork="yes"
resultproperty="db.ping.result">
<jvmarg line="${db.jvmargs}" />
<arg line="ping" />
<classpath refid="db.classpath" />
</java>
<condition property="db.running">
<equals arg1="${db.ping.result}" arg2="0" />
</condition>
</target>
<target name="start-db"
unless="db.running"
description="Starts the Derby databse server."
depends="ping-db">
<sun-appserv-admin
explicitcommand="start-database" />
</target>
<target name="stop-db"
description="Stops the Derby database server."
depends="ping-db"
if="db.running">
<sun-appserv-admin
explicitcommand="stop-database" />
</target>
<target name="admin_command_common">
<echo message="Doing admin task ${admin.command}"/>
<sun-appserv-admin
command="${admin.command}"
user="${admin.user}"
passwordfile="${admin.password.file}"
host="${admin.host}"
port="${admin.port}"
asinstalldir="${j2ee.home}" />
</target>
<target name="create-jdbc-resource_common">
<antcall target="admin_command_common">
<param name="admin.command"
value="create-jdbc-resource
--connectionpoolid ${conpool.name} ${jdbc.resource.name}" />
</antcall>
</target>
<target name="delete-jdbc-resource_common">
<antcall target="admin_command_common">
<param name="admin.command"
value="delete-jdbc-resource ${jdbc.resource.name}" />
</antcall>
</target>
<target name="deploy-war">
<antcall target="admin_command_common">
<param name="admin.command"
value="deploy ${war.file}" />
</antcall>
</target>
<target name="undeploy-war">
<antcall target="admin_command_common">
<param name="admin.command"
value="undeploy ${example}" />
</antcall>
</target>
<property environment="env" />
<target name="build-service" depends="compile-service,generate-wsdl"
description="Executes the targets needed to build the service.">
</target>
<target name="compile-service" depends="prepare"
description="Compiles the server-side source code">
<echo message="Compiling the server-side source code...."/>
<javac
srcdir="src"
destdir="${build}"
includes="**/*.java"
excludes="**/*Client.java">
<classpath refid="class.path" />
</javac>
</target>
<target name="listprops"
description="Displays values of some of the properties of this build file">
<property file="../../common/admin-password.txt" />
<echo message="Path information" />
<echo message="j2ee.home = ${j2ee.home}" />
<echo message="j2ee.tutorial.home = ${j2ee.tutorial.home}" />
<echo message="env.Path = ${env.Path}" />
<echo message="env.PATH = ${env.PATH}" />
<echo message="" />
<echo message="Classpath information" />
<echo message="classpath = ${env.CLASSPATH}" />
<echo message="" />
<echo message="Admin information" />
<echo message="admin.password = ${AS_ADMIN_PASSWORD}" />
<echo message="admin.password.file = ${admin.password.file}" />
<echo message="admin.host = ${admin.host}" />
<echo message="admin.user = ${admin.user}" />
<echo message="admin.port = ${admin.port}" />
<echo message="https.port = ${https.port}" />
<echo message="" />
<echo message="Domain information" />
<echo message="domain.resources = ${domain.resources}" />
<echo message="domain.resources.port = ${domain.resources.port}" />
<echo message="" />
<echo message="Database information" />
<echo message="db.root = ${db.root}" />
<echo message="db.driver = ${db.driver}" />
<echo message="db.host = ${db.host}" />
<echo message="db.port = ${db.port}" />
<echo message="db.sid = ${db.sid}" />
<echo message="db.url = ${db.url}" />
<echo message="db.user = ${db.user}" />
<echo message="db.pwd = ${db.pwd}" />
<echo message="url.prop = ${url.prop}" />
<echo message="ds.class = ${ds.class}" />
<echo message="db.jvmargs = ${db.jvmargs}" />
</target>