https://github.com/adufilie/Weave
Raw File
Tip revision: 78556cf90551aa133f66021f399883036f824bd1 authored by Andy Dufilie on 10 April 2015, 22:32:50 UTC
temp
Tip revision: 78556cf
build.xml
<?xml version="1.0" encoding="utf-8"?>

<!-- This is the build script to build all the projects and their dependencies. To use these scripts, you must
	first do the following
	1) Setup FLEX_HOME as an operating system environment variable pointing to where you installed your Flex 3.6A SDK.
		This Flex 3.6A SDK must be downloaded directly from Adobe-do not attempt to merge the SDK provided in FlashBuilder.
		e.g.) C:\Flex 3.6A SDK
	2) Add the Flex 3.6A SDK's bin folder to your operating system's PATH variable.
	3) Add ANT's bin folder to your operating system's PATH variable.
		e.g.) C:\ant\bin
	 Change FRAMEWORK_SWF property below to be the filename of the framework_*.swf file.
		For example, if yours is
		${FLEX_HOME}/frameworks/rsls/framework_3.6.0.21751.swf
		then the FRAMEWORK_SWF would be framework_3.6.0.21751.swf
	5) Restart Eclipse to let it register the updated PATH.
	6) Change WEAVE_DOCROOT property located in this file. It should be the same as the WEAVE_DOCROOT
		defined in your linked resources variable if you are using Eclipse.
	7) From command prompt, change into the WeaveClient directory and perform this command
		ant -f buildall.xml install
		This will build all the files in order and push the necessary ones to WEAVE_DOCROOT.
		-->
<project name="Weave" basedir="." default="build">
	<property environment="env"/>
	<property file="user.properties"/>
	<property file="build.properties"/>

	<target name="dist" depends="build">
		<zip destfile="weave.zip">
			<zipfileset dir="${WEAVE_DESTROOT}" prefix="ROOT" excludes="${DESKTOP}.swf ${DESKTOP}.air *.png defaults.xml"/>
			<zipfileset file="${basedir}/WeaveServices.war"/>
		</zip>
	</target>

	<target name="air"  depends="build, desktop"> 
		<copy todir="${WEAVE_DESTROOT}">
			<fileset dir="${DESKTOP}/src/">
				<include name="*.png"/>
			</fileset>
			<fileset dir="${CLIENT}/configurations">
				<include name="defaults.xml"/>
			</fileset>
		</copy>
		<path id="FILE-LIST">
			<fileset dir="${WEAVE_DESTROOT}">
				<include name="*" />
				<exclude name="${CLIENT}.swf"/>
				<exclude name="${DESKTOP}.air"/>
			</fileset>
		</path>
		<pathconvert pathsep=" " property="FILE-LIST.csv"
			refid="FILE-LIST"/>
			<java 
				jar ="${ADT_JAR}" 
				fork = "true"  
				dir ="${WEAVE_DESTROOT}"   
				failonerror="true"> 
				<arg value="-package"/> 
				<arg value="-storetype"/> 
				<arg value="pkcs12"/> 
				<arg value="-keystore"/> 
				<arg value="${AIR_CERT}"/> 
				<arg value="-storepass"/>
				<arg value="${AIR_CERT_PASS}"/>
				<arg value="${DESKTOP}"/> 
				<arg value="${basedir}/${DESKTOP}/src/WeaveDesktop-app.xml"/> 
				<arg line="${FILE-LIST.csv}"/> 
				<!--  <arg value="icons/*.png"/>  -->
			</java> 
	</target>
	
	<target name="install" depends="build">
		<!-- This target will install the files to WEAVE_DOCROOT. -->
		<copy todir="${WEAVE_DOCROOT}">
			<fileset dir="${WEAVE_DESTROOT}">
			<include name="*.swf"/>
			<include name="*.html"/>
			<include name="*.js"/>
			<include name="*.css"/>
			<exclude name="${DESKTOP}.swf"/>
			<exclude name="${DESKTOP}.air"/>
			<exclude name="*.png"/>
			<exclude name="defaults.xml"/>
			</fileset>
		</copy>
		<copy todir="${WEAVE_DOCROOT}/../">
			<fileset dir="${basedir}">
			<include name="WeaveServices.war"/>
			</fileset>
		</copy> 
	</target>

	<!-- This target will extract the swf files from the swc archives
		and extract them to the WEAVE_DESTROOT -->
	<target name="build" depends="client, admin, uispark, ui, data, core, api, services, exampleplugin">
		<mkdir dir="${WEAVE_DESTROOT}"/>
		<build-html-wrapper project="${CLIENT}" swf="weave" title="Weave"/>
		<build-html-wrapper project="${ADMIN}" swf="AdminConsole" title="Weave Admin Console"/>
		<extract_swc swc="${basedir}/${API}/bin/${API}.swc" rsl="${API}.swf"/>
		<extract_swc swc="${basedir}/${CORE}/bin/${CORE}.swc" rsl="${CORE}.swf"/>
		<extract_swc swc="${basedir}/${DATA}/bin/${DATA}.swc" rsl="${DATA}.swf"/>
		<extract_swc swc="${basedir}/${UISPARK}/bin/${UISPARK}.swc" rsl="${UISPARK}.swf"/>
		<extract_swc swc="${basedir}/${UI}/bin/${UI}.swc" rsl="${UI}.swf"/>
		<copy file="${basedir}/${CLIENT}/swf/${FONTS}.swf" tofile="${WEAVE_DESTROOT}/${FONTS}.swf"/>
		<copy file="${basedir}/${CLIENT}/bin/weave.swf" tofile="${WEAVE_DESTROOT}/weave.swf"/>
		<copy file="${basedir}/${CLIENT}/src/weaveStyle.css" tofile="${WEAVE_DESTROOT}/weaveStyle.css"/>
		<copy file="${basedir}/${CLIENT}/html-template/playerProductInstall.swf" tofile="${WEAVE_DESTROOT}/playerProductInstall.swf"/>
		<copy file="${basedir}/${CLIENT}/html-template/swfobject.js" tofile="${WEAVE_DESTROOT}/swfobject.js"/>
		<copy file="${basedir}/${ADMIN}/bin/AdminConsole.swf" tofile="${WEAVE_DESTROOT}/AdminConsole.swf"/>
		<copy file="${basedir}/${UI}/src/weave/visualization/tools/CytoscapeWebPopout.html" tofile="${WEAVE_DESTROOT}/CytoscapeWebPopout.html"/>
		<copy file="${basedir}/${SERVICES}/bin/${SERVICES}.war" tofile="${basedir}/${SERVICES}.war"/>
		<copy failonerror="false" file="${basedir}/${EXAMPLEPLUGIN}/bin/${EXAMPLEPLUGIN}.swc" tofile="${WEAVE_DESTROOT}/${EXAMPLEPLUGIN}.swc"/>
		<copy file="${FLEX_HOME}/frameworks/rsls/${FRAMEWORK_SWF}" tofile="${WEAVE_DESTROOT}/framework.swf"/>
		<copy file="${FLEX_HOME}/frameworks/rsls/${RPC_SWF}" tofile="${WEAVE_DESTROOT}/rpc.swf"/>
		<copy file="${FLEX_HOME}/frameworks/rsls/${SPARK_SWF}" tofile="${WEAVE_DESTROOT}/spark.swf"/>
		<copy file="${FLEX_HOME}/frameworks/rsls/${MX_SWF}" tofile="${WEAVE_DESTROOT}/mx.swf"/>
		<copy file="${FLEX_HOME}/frameworks/rsls/${TEXTLAYOUT_SWF}" tofile="${WEAVE_DESTROOT}/textLayout.swf"/>
	</target>

	<!-- These targets will build each project -->
	<target name="api">
		<buildproject targetproject="${API}" targetfileext="swc"/>
	</target>
	<target name="core" depends="api">
		<buildproject targetproject="${CORE}" targetfileext="swc"/>
	</target>
	<target name="data" depends="core">
		<buildproject targetproject="${DATA}" targetfileext="swc"/>
	</target>
	<target name="uispark" depends="data">
		<buildproject targetproject="${UISPARK}" targetfileext="swc"/>
	</target>
	<target name="ui" depends="uispark">
		<buildproject targetproject="${UI}" targetfileext="swc"/>
	</target>
	<target name="client" depends="ui">
		<buildproject targetproject="${CLIENT}" targetfileext="swf"/>
	</target>
	<target name="admin" depends="ui">
		<buildproject targetproject="${ADMIN}" targetfileext="swf"/>
	</target>
	<target name="desktop" depends="ui">
		<buildproject targetproject="${DESKTOP}" targetfileext="swf"/>
		<copy file="${basedir}/${DESKTOP}/bin/${DESKTOP}.swf" tofile="${WEAVE_DESTROOT}/${DESKTOP}.swf"/>
	</target>
	<target name="servletutils">
		<ant dir="${basedir}/${SERVLETUTILS}" target="build"/>
	</target>
	<target name="exampleplugin" depends="ui">
		<ant dir="${basedir}/${EXAMPLEPLUGIN}" target="build"/>
	</target>
	<target name="services" depends="servletutils">
		<ant dir="${basedir}/${SERVICES}" target="dist"/>
	</target>


	<!-- This target calls the clean targets of each project's build file -->
	<target name="clean">
		<echo message="Cleaning all projects..."/>
		<delete quiet="false" includeemptydirs="true" dir="${WEAVE_DESTROOT}">
			<fileset file="${basedir}/${SERVICES}.war"/>
			<fileset file="${basedir}/weave.zip"/>
		</delete>
		<ant dir="${basedir}/${CLIENT}" target="clean" />
		<ant dir="${basedir}/${DESKTOP}" target="clean" />
		<ant dir="${basedir}/${ADMIN}" target="clean" />
		<ant dir="${basedir}/${API}" target="clean" />
		<ant dir="${basedir}/${CORE}" target="clean" />
		<ant dir="${basedir}/${DATA}" target="clean" />
		<ant dir="${basedir}/${UISPARK}" target="clean" />
		<ant dir="${basedir}/${UI}" target="clean" />
		<ant dir="${basedir}/${SERVICES}" target="clean" />
		<ant dir="${basedir}/${EXAMPLEPLUGIN}" target="clean" />
		<ant dir="${basedir}/${SERVLETUTILS}" target="clean" />
	</target>

	<macrodef name="build-html-wrapper">
		<attribute name="project"/>
		<attribute name="swf"/>
		<attribute name="title"/>
		<sequential>
			<copy file="${basedir}/@{project}/html-template/index.template.html"
				tofile="${WEAVE_DESTROOT}/@{swf}.html" overwrite="true"/>
			<replace file="${WEAVE_DESTROOT}/@{swf}.html" token="$${title}" value="@{title}"/>
			<replace file="${WEAVE_DESTROOT}/@{swf}.html" token="$${swf}" value="@{swf}"/>
			<replace file="${WEAVE_DESTROOT}/@{swf}.html" token="$${width}" value="100%"/>
			<replace file="${WEAVE_DESTROOT}/@{swf}.html" token="$${height}" value="100%"/>
			<replace file="${WEAVE_DESTROOT}/@{swf}.html" token="$${bgcolor}" value="#FFFFFF"/>
			<replace file="${WEAVE_DESTROOT}/@{swf}.html" token="$${application}" value="@{swf}"/>
			<replace file="${WEAVE_DESTROOT}/@{swf}.html" token="$${version_major}" value="10"/>
			<replace file="${WEAVE_DESTROOT}/@{swf}.html" token="$${version_minor}" value="2"/>
			<replace file="${WEAVE_DESTROOT}/@{swf}.html" token="$${version_revision}" value="0"/>
			<replace file="${WEAVE_DESTROOT}/@{swf}.html" token="$${expressInstallSwf}" value="playerProductInstall.swf"/>
		</sequential>
	</macrodef>

	<macrodef name="extract_swc">
		<attribute name="swc"/>
		<attribute name="rsl"/>
		<sequential>
			<unzip src="@{swc}" dest="${WEAVE_DESTROOT}/temp">
				<patternset>
					<include name="library.swf" />
				</patternset>
			</unzip>
			<move file="${WEAVE_DESTROOT}/temp/library.swf" tofile="${WEAVE_DESTROOT}/@{rsl}"/>
			<delete dir="${WEAVE_DESTROOT}/temp"/>
		</sequential>
	</macrodef>
	
	<macrodef name="buildproject">
		<attribute name="targetproject"/>
		<attribute name="targetfileext"/>
		<sequential>
			<echo message="Checking @{targetproject}..."/>
			<uptodate targetfile="${basedir}/@{targetproject}/bin/@{targetproject}.@{targetfileext}" property="@{targetproject}.uptodate">
				<srcfiles dir="${basedir}/@{targetproject}" includes="**/*"/>
			</uptodate>
			<antcall target="conditional_build">
				<param name="targetproject" value="@{targetproject}"/>
			</antcall>
		</sequential>
	</macrodef>
	<target name="conditional_build" unless="${targetproject}.uptodate">
		<sequential>
			<echo message="Building ${targetproject}..."/>
			<ant dir="${basedir}/${targetproject}" target="build"/>
		</sequential>
	</target>
</project>
back to top