Skip to main content

Source code file content

Revision: 57029

GLASSFISH-18987 Remove call to getService in critical path
» Project Revision History

» Checkout URL

svn / tags / 3.0-b60 / installer / build.xml

Size: 12809 bytes, 1 line
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- 
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# 
# Use is subject to License Terms
#
-->
<!DOCTYPE project []>

<project name="GlassFish Installer build" default="all" basedir=".">
	<property name="stage.dir" value="${basedir}/target/stage" />
	<property name="component.classes.dir" value="${basedir}/target/classes" />
	<property name="maven.repo.local" value="${user.home}/.m2/repository"/>
	<property name="tmp.dir" value="${basedir}/target/tmp" />
	<!-- 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">
			<param name="bundle.name" value="GlassFishV3WebProfilePreview" />
			<param name="sourcezip.name" value="../distributions/glassfish/target/web-ips-installer.zip" />
			<param name="selfextractexe.name" value="glassfish-web" />
		</antcall>

		<!-- Build GlassFish Enterprise Server v3 Preview distribution. -->
		<!-- Could have used ant-contrib's foreach :-) -->
		<antcall target="do_processing">
			<param name="bundle.name" value="GlassFishV3Preview" />
			<param name="sourcezip.name" value="../distributions/glassfish/target/glassfish-ips-installer.zip" />
			<param name="selfextractexe.name" value="glassfish-full" />
		</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>

	<!-- Set up staging directories for build/runtime. -->
	<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" />
		<resolveArtifact groupID="com.sun.pkg" artifactId="pkg-bootstrap" property="pkg-bootstrap.jar" />
		<resolveArtifact groupID="com.sun.pkg" artifactId="pkg-client" property="pkg-client.jar" />

		<echo message="Setting up required registration module dependencies" />
		<resolveArtifact groupID="org.glassfish.registration" artifactId="registration-api" property="registration-api.jar" />
		<resolveArtifact groupID="org.glassfish.registration" artifactId="registration-impl" property="registration-impl.jar" />
		<resolveArtifact groupID="org.glassfish.external" artifactId="sysnet-registration-repackaged" property="sysnet-registration.jar" />
		<resolveArtifact groupID="org.glassfish.external" artifactId="commons-codec-repackaged" property="commons-codec.jar" />

		<echo message="Setting up required OpenInstaller dependencies" />
		<resolveArtifact groupID="org.openinstaller" artifactId="resources" property="resources.zip" />
		<resolveArtifact groupID="org.openinstaller" artifactId="engine" property="engine.zip" />
	</target>

	<!-- Extract Open Installer's resource.zip file. -->
	<target name="extract_resource_zip" description="Extract resource.zip">
		<!-- Explode the resources.zip to enable installer to refer the contents -->
		<unzip src="${resources.zip}" dest="${stage.dir}/${bundle.name}" />
	</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. -->
	<target name="extract_engine_zip" description="Extract engine.zip">
		<!-- Explode the engine.zip to repack -->
		<unzip src="${engine.zip}" dest="${stage.dir}/${bundle.name}_engine_tmp" />
	</target>


	<!-- Compile configurator classes. -->
	<target name="compile" description="Compiling configurator classes">
		<mkdir dir="${component.classes.dir}" />
		<javac srcdir="${basedir}/src/main/java" destdir="${component.classes.dir}" failonerror="true">
			<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. -->
	<target name="update_engine_zip" description="Recreating the engine.zip with updated contents">
		<!-- Overwrite the Default resource file bundled in OI with GlassFish Resource file -->
		<copy tofile="${stage.dir}/${bundle.name}_engine_tmp/install/lib/resources/org/openinstaller/resources/ResourceMsgs.properties" file="${basedir}/src/${bundle.name}/java/org/openinstaller/resource/ResourceMsgs.properties" overwrite="true" />

		<!-- 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. -->
		<chmod file="${stage.dir}/${bundle.name}_engine_tmp/install/bin/engine-wrapper" perm="ugo+rx" />


		<!-- Update providers.jar that is part of the original Open Installer distribution. -->
		<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. -->
		<chmod file="${stage.dir}/${bundle.name}/install/bin/engine-wrapper" perm="ugo+rx" />
	</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">
			<fileset dir="${basedir}/src/${bundle.name}/resources/dependency" excludes=".svn" />
		</copy>
		<copy todir="${stage.dir}/${bundle.name}/install/metadata/model">
			<fileset dir="${basedir}/src/${bundle.name}/resources/model" excludes=".svn" />
		</copy>
		<copy todir="${stage.dir}/${bundle.name}/install/metadata/templates">
			<fileset dir="${basedir}/src/${bundle.name}/resources/templates" excludes=".svn" />
		</copy>
		<copy todir="${stage.dir}/${bundle.name}/install/metadata/view">
			<fileset dir="${basedir}/src/${bundle.name}/resources/view" excludes=".svn" />
		</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" file="${basedir}/src/${bundle.name}/resources/pagesequence.properties">
		</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}">
			<fileset dir="${basedir}/src/${bundle.name}/resources/wrappers" excludes=".svn,engine-wrapper" />
		</copy>

		<echo message="Staging registration jar files" />
		<copy tofile="${stage.dir}/${bundle.name}/registration-api.jar" file="${registration-api.jar}" />
		<copy tofile="${stage.dir}/${bundle.name}/registration-impl.jar" file="${registration-impl.jar}" />
		<copy tofile="${stage.dir}/${bundle.name}/sysnet-registration.jar" file="${sysnet-registration.jar}" />
		<copy tofile="${stage.dir}/${bundle.name}/commons-codec-1.3.jar" file="${commons-codec.jar}" />

		<echo message="Staging binaries required for IPS" />
		<copy tofile="${stage.dir}/${bundle.name}/pkg-client.jar" file="${pkg-client.jar}" />
		<copy tofile="${stage.dir}/${bundle.name}/pkg-bootstrap.jar" file="${pkg-bootstrap.jar}" />

		<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 todir="${tmp.dir}/glassfish/icons">
             		<fileset dir="${basedir}/src/${bundle.name}/resources/icons" excludes=".svn"/>
         	</copy>
         	<zip destfile="${stage.dir}/${bundle.name}/Product/Packages/icons.zip" basedir="${tmp.dir}" />
                <delete dir="${tmp.dir}"/>
		<chmod file="${stage.dir}/${bundle.name}/product-installer.sh" perm="ugo+rx" />
	</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 -->
		<zip destfile="${stage.dir}/installer_distro.zip" basedir="${stage.dir}/${bundle.name}" />
		<copy tofile="${stage.dir}/${selfextractexe.name}.exe" file="${basedir}/src/${bundle.name}/resources/wrappers/setup.exe" overwrite="true" />
		<concat append="true" encoding="ISO-8859-1" destfile="${stage.dir}/${selfextractexe.name}.exe">
			<fileset dir="${stage.dir}" includes="installer_distro.zip" />
		</concat>
		<delete file="${stage.dir}/installer_distro.zip"/>

		<!-- Unix -->
		<jar jarfile="${stage.dir}/installer_distro.jar" basedir="${stage.dir}/${bundle.name}">
		</jar>
		<copy tofile="${stage.dir}/${selfextractexe.name}.sh" file="${basedir}/src/${bundle.name}/resources/wrappers/wrapper.sh" overwrite="true" />
		<concat append="true" encoding="ISO-8859-1" destfile="${stage.dir}/${selfextractexe.name}.sh">
			<fileset dir="${stage.dir}" includes="installer_distro.jar" />
		</concat>
		<delete file="${stage.dir}/installer_distro.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>
 
 
Close
loading
Please Confirm
Close