<?xml version="1.0" encoding="iso-8859-1"?>
<!--
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common Development
and Distribution License("CDDL") (collectively, the "License"). You
may not use this file except in compliance with the License. You can
obtain a copy of the License at
or packager/legal/LICENSE.txt. See the License for the specific
language governing permissions and limitations under the License.
When distributing the software, include this License Header Notice in each
file and include the License file at packager/legal/LICENSE.txt.
GPL Classpath Exception:
Oracle designates this particular file as subject to the "Classpath"
exception as provided by Oracle in the GPL Version 2 section of the License
file that accompanied this code.
Modifications:
If applicable, add the following below the License Header, with the fields
enclosed by brackets [] replaced by your own identifying information:
"Portions Copyright [year] [name of copyright owner]"
Contributor(s):
If you wish your version of this file to be governed by only the CDDL or
only the GPL Version 2, indicate your decision by adding "[Contributor]
elects to include this software in this distribution under the [CDDL or GPL
Version 2] license." If you don't indicate a single choice of license, a
recipient has the option to distribute your version of this file under
either the CDDL, the GPL Version 2 or to extend the choice of license to
its licensees as provided above. However, if you add GPL Version 2 code
and therefore, elected the GPL Version 2 license, then the option applies
only if the new code is made subject to such option by the copyright
holder.
-->
<!DOCTYPE project []>
<project name="GlassFish Installer build" default="all" basedir=".">
<!-- all -->
<target name="all" description="Build all of GlassFish distritions" depends="setup_dependencies">
<!-- Build GlassFish Enterprise Server v3 Web Profile Preview distribution. -->
<!-- Could have used ant-contrib's foreach :-) -->
<antcall target="do_processing">
</antcall>
<!-- Build GlassFish Enterprise Server v3 Preview distribution. -->
<!-- Could have used ant-contrib's foreach :-) -->
<antcall target="do_processing">
<param name="sourcezip.ml.name" value="/distributions/glassfish/target/glassfish-ips-ml-installer.zip" />
</antcall>
<antcall target="push_zip_artifact_to_repository"/>
<delete dir="${stage.dir}/GlassFishV3WebProfilePreview"/>
<delete dir="${stage.dir}/GlassFishV3Preview"/>
</target>
<!-- Repeatedly called for each bundle, currently only 2. -->
<target name="do_processing">
<antcall target="prepare_stage" />
<antcall target="recreate_resource_zip" />
<antcall target="recreate_engine_zip" />
<antcall target="create_final_stage_area" />
<antcall target="create_self_extract_executable" />
</target>
<target name="prepare_stage" description="Setup appropriate staging directories for each bundle to be used for build/runtime">
<echo message="Setting up staging directories for ${bundle.name}" />
<delete dir="${stage.dir}/${bundle.name}" />
<mkdir dir="${stage.dir}/${bundle.name}" />
<mkdir dir="${stage.dir}/${bundle.name}/Product/Packages" />
<mkdir dir="${stage.dir}/${bundle.name}_engine_tmp" />
</target>
<!-- This is a onetime task, so just do this once. -->
<target name="setup_dependencies" description="Pull in required dependencies for build/runtime of installer.">
<echo message="Setting up required IPS dependencies" />
<echo message="Setting up required registration module dependencies" />
<resolveArtifact groupID="org.glassfish.main.registration" artifactId="registration-api" property="registration-api.jar" />
<resolveArtifact groupID="org.glassfish.main.registration" artifactId="registration-impl" property="registration-impl.jar" />
<resolveArtifact groupID="org.glassfish.main.common" artifactId="common-util" property="common-util.jar" />
<echo message="Setting up required OpenInstaller dependencies" />
</target>
<!-- Extract Open Installer's resource.zip file. -->
<!-- Explode the resources.zip to enable installer to refer the contents -->
<delete>
<fileset dir="${stage.dir}/${bundle.name}">
<include name="**/ui_*.prefs"/>
</fileset>
</delete>
</target>
<!-- No changes are required for resource.zip, so just copy to the CD image. -->
<target name="recreate_resource_zip" depends="extract_resource_zip" description="Re-create resource.zip">
<!-- Copy Resources.zip to payload directly as there are no changes to it for now-->
<copy tofile="${stage.dir}/${bundle.name}/Product/Packages/Resources.zip" file="${resources.zip}" />
</target>
<!-- Extract Open Installer's engine.zip file. -->
<!-- Explode the engine.zip to repack -->
<delete>
<fileset dir="${stage.dir}/${bundle.name}_engine_tmp">
<include name="**/ResourceMsgs_*.properties"/>
</fileset>
</delete>
</target>
<!-- Compile configurator classes. -->
<target name="compile" description="Compiling configurator classes">
<mkdir dir="${component.classes.dir}" />
<classpath>
<pathelement location="${stage.dir}/${bundle.name}_engine_tmp/install/lib/engine.jar" />
<pathelement location="${stage.dir}/${bundle.name}_engine_tmp/install/lib/config.jar" />
<pathelement location="${stage.dir}/${bundle.name}_engine_tmp/install/lib/providers/providers.jar" />
<pathelement location="${pkg-bootstrap.jar}" />
</classpath>
</javac>
</target>
<!-- Create a modified Engine.zip file new configurator, wrappers and provider.jar. -->
<!-- Overwrite the Default resource file bundled in OI with GlassFish Resource file -->
<copy todir="${stage.dir}/${bundle.name}_engine_tmp/install/lib/resources/org/openinstaller/resources">
<fileset dir="${basedir}/src/${bundle.name}/java/org/openinstaller/resource">
<include name="ResourceMsg*.properties"/>
</fileset>
</copy>
<!-- Copy the uninstaller wrapper also into Engine.zip -->
<copy todir="${stage.dir}/${bundle.name}_engine_tmp">
<fileset dir="${basedir}/src/${bundle.name}/resources/wrappers">
<include name="uninstall*" />
</fileset>
</copy>
<!-- Copy the modified uninstaller wrapper of OI into Engine.zip -->
<copy tofile="${stage.dir}/${bundle.name}_engine_tmp/install/bin/uninstaller" file="${basedir}/src/${bundle.name}/resources/wrappers/oiuninstaller" overwrite="true" />
<!-- Change the permission on wrapper that is also to be used for uninstaller. -->
<!-- Update providers.jar that is part of the original Open Installer distribution. -->
<mkdir dir="${tmp.dir}"/>
<unjar src="${stage.dir}/${bundle.name}_engine_tmp/install/lib/providers/providers.jar" dest="${tmp.dir}" />
<copy todir="${tmp.dir}">
<fileset dir="${component.classes.dir}">
<include name="**/*.class" />
</fileset>
</copy>
<jar jarfile="${stage.dir}/${bundle.name}_engine_tmp/install/lib/providers/providers.jar" basedir="${tmp.dir}" manifest="${tmp.dir}/META-INF/MANIFEST.MF">
</jar>
<delete dir="${tmp.dir}" />
</target>
<!-- Cleanup temporary engine.zip staging area. -->
<target name="recreate_engine_zip" depends="extract_engine_zip, compile, update_engine_zip" description="Recreating the engine.zip with updated contents">
<!-- Now create the updated engine.zip directly under payload -->
<zip destfile="${stage.dir}/${bundle.name}/Product/Packages/Engine.zip" basedir="${stage.dir}/${bundle.name}_engine_tmp" />
<!-- Delete the temporary install stage directory used to host engine.zip contents. -->
<delete dir="${stage.dir}/${bundle.name}_engine_tmp" />
<!-- unzip the newly created file under stage.dir for reference to installer. -->
<unzip src="${stage.dir}/${bundle.name}/Product/Packages/Engine.zip" dest="${stage.dir}/${bundle.name}" />
<!-- Change wrapper permission on exploded directory to be used for install. -->
</target>
<!-- Pull up required pieces all in one place as the final staging area. -->
<target name="create_final_stage_area" description="Assembling installer distribution layout">
<echo message="Staging installer metadata" />
<copy todir="${stage.dir}/${bundle.name}/install/metadata/dependency">
</copy>
<copy todir="${stage.dir}/${bundle.name}/install/metadata/model">
</copy>
<copy todir="${stage.dir}/${bundle.name}/install/metadata/templates">
</copy>
<copy todir="${stage.dir}/${bundle.name}/install/metadata/view">
</copy>
<copy todir="${stage.dir}/${bundle.name}/install/metadata" file="${basedir}/src/${bundle.name}/resources/pagesequence.xml">
</copy>
<copy todir="${stage.dir}/${bundle.name}/install/metadata">
<fileset dir="${basedir}/src/${bundle.name}/resources">
<include name="pagesequence*.properties"/>
</fileset>
</copy>
<zip destfile="${stage.dir}/${bundle.name}/Product/Packages/metadata.zip" basedir="${stage.dir}/${bundle.name}" includes="install/metadata/**" />
<echo message="Staging wrappers" />
<copy todir="${stage.dir}/${bundle.name}">
</copy>
<echo message="Staging registration jar files" />
<echo message="Staging binaries required for IPS" />
<echo message="Staging product payload" />
<copy tofile="${stage.dir}/${bundle.name}/Product/Packages/glassfish.zip" file="${sourcezip.name}" />
<echo message="Creating icons zip file" />
<delete dir="${tmp.dir}"/>
</copy>
<delete dir="${tmp.dir}"/>
</target>
<!-- Create self-extract file on both windows and unix platforms, irrespective of where the build is run.
Currently there is no native component that might require a forking here. -->
<target name="create_self_extract_executable" description="Packaging installer distributions">
<delete dir="${stage.dir}/${bundle.name}/install" />
<!-- Windows -->
<copy tofile="${stage.dir}/${bundle.name}/Product/Packages/glassfish.zip" file="${sourcezip.name}" overwrite="true"/>
<copy tofile="${stage.dir}/${selfextractexe.name}.exe" file="${basedir}/src/${bundle.name}/resources/wrappers/setup.exe" overwrite="true" />
</concat>
<delete file="${stage.dir}/installer_distro.zip"/>
<!-- Create ML bundle -->
<!-- Update GlassFish bundle with L10n bundle -->
<copy tofile="${stage.dir}/${bundle.name}/Product/Packages/glassfish.zip" file="${sourcezip.ml.name}" overwrite="true"/>
<copy tofile="${stage.dir}/${selfextractexe.ml.name}.exe" file="${basedir}/src/${bundle.name}/resources/wrappers/setup.exe" overwrite="true" />
</concat>
<delete file="${stage.dir}/installer_distro_ml.zip"/>
<!-- Unix -->
<copy tofile="${stage.dir}/${bundle.name}/Product/Packages/glassfish.zip" file="${sourcezip.name}" overwrite="true"/>
</jar>
<copy tofile="${stage.dir}/${selfextractexe.name}.sh" file="${basedir}/src/${bundle.name}/resources/wrappers/wrapper.sh" overwrite="true" />
</concat>
<delete file="${stage.dir}/installer_distro.jar"/>
<!-- Create ML bundle -->
<!-- Update GlassFish bundle with L10n bundle -->
<copy tofile="${stage.dir}/${bundle.name}/Product/Packages/glassfish.zip" file="${sourcezip.ml.name}" overwrite="true"/>
</jar>
<copy tofile="${stage.dir}/${selfextractexe.ml.name}.sh" file="${basedir}/src/${bundle.name}/resources/wrappers/wrapper.sh" overwrite="true" />
</concat>
<delete file="${stage.dir}/installer_distro_ml.jar"/>
</target>
<target name="push_zip_artifact_to_repository" description="Pushing the distros created to be used for internal builds">
<!-- prepare installer zip artifact for consumption in Sun branded build -->
<zip destfile="${stage.dir}/installer_artifact.zip" basedir="${stage.dir}/GlassFishV3Preview" excludes="**/glassfish.zip" />
<attachArtifact file="${stage.dir}/installer_artifact.zip" />
</target>
</project>