Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

399 lines (337 sloc) 16.771 kB
<project name="Cesium" default="combine">
<target name="build" description="A developer build that runs in-place.">
<glslToJavascript stripcomments="${build.minification}">
<glslfiles dir="${shadersDirectory}" includes="**/*.glsl" />
<existingjsfiles dir="${shadersDirectory}" includes="**/*.js" excludes="*.profile.js" />
</glslToJavascript>
<parallel>
<createCesiumJs output="${sourceDirectory}/Cesium.js">
<sourcefiles dir="${sourceDirectory}">
<include name="**/*.js" />
<exclude name="*.js" />
<exclude name="Widgets/**" />
<exclude name="Workers/**" />
<exclude name="**/*.profile.js" />
</sourcefiles>
</createCesiumJs>
<createSpecList output="${specsDirectory}/SpecList.js">
<specs dir="${specsDirectory}" includes="**/*.js" excludes="*.js" />
</createSpecList>
<createGalleryList output="${galleryDirectory}/gallery-index.js">
<demos dir="${galleryDirectory}" includes="**/*.html" />
</createGalleryList>
</parallel>
</target>
<target name="combine" description="Combines all source files into a single stand-alone script." depends="build, combineJavaScript" />
<target name="minify" description="Combines all source files into a single stand-alone, minified script.">
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="${shadersDirectory}" includes="**/*.js" excludes="*.profile.js" />
</delete>
<antcall target="combine">
<param name="build.minification" value="true" />
</antcall>
</target>
<target name="release" description="A full release build that creates a shippable product, including building apps and generating documentation.">
<antcall target="combine">
<param name="build.minification" value="true" />
</antcall>
<antcall target="generateDocumentation" />
<antcall target="buildApps" />
</target>
<target name="instrumentForCoverage" description="A debug build instrumented for JSCoverage (currently Windows only)." depends="build">
<exec executable="${jscoveragePath}">
<arg line="${sourceDirectory} ${instrumentedDirectory}" />
<arg line="--no-instrument=./ThirdParty" />
</exec>
</target>
<target name="makeZipFile" description="Builds a zip file containing all release files." depends="release">
<zip destfile="Cesium-${version}.zip" basedir="${basedir}">
<include name="Build/**" />
<include name="Apps/**" />
<include name="Examples/**" />
<include name="Source/**" />
<include name="Specs/**" />
<include name="ThirdParty/**" />
<include name="index.html" />
<include name="LICENSE.md" />
<include name="CHANGES.md" />
<include name="README.md" />
</zip>
</target>
<target name="clean" description="Cleans the build.">
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="${buildDirectory}" defaultexcludes="false" />
<fileset dir="${instrumentedDirectory}" defaultexcludes="false" />
<fileset dir="${shadersDirectory}" includes="**/*.js" excludes="*.profile.js" />
<fileset dir="${specsDirectory}" includes="SpecList.js" />
<fileset dir="${galleryDirectory}" includes="gallery-index.js" />
<fileset dir="." includes="Cesium-*.zip" />
</delete>
</target>
<!-- properties controlling which steps get run -->
<property name="build.minification" value="false" />
<!-- Inputs -->
<!-- this version should be set to the upcoming version, so it can be tagged without requiring a bump first -->
<property name="version" value="b13" />
<property name="sourceDirectory" location="Source" />
<property name="shadersDirectory" location="${sourceDirectory}/Shaders" />
<property name="examplesDirectory" location="Examples" />
<property name="galleryDirectory" location="Apps/Sandcastle/gallery" />
<property name="specsDirectory" location="Specs" />
<property name="toolsDirectory" location="Tools" />
<property name="tasksDirectory" location="${toolsDirectory}/buildTasks" />
<property name="thirdPartyDirectory" location="ThirdParty" />
<property name="rjsPath" location="${thirdPartyDirectory}/requirejs-2.1.2/r.js" />
<property name="almondPath" location="${thirdPartyDirectory}/almond-0.2.3/almond.js" />
<property name="jscoveragePath" location="${toolsDirectory}/jscoverage-0.5.1/jscoverage.exe" />
<property name="documentationImagesDirectory" location="Documentation/Images" />
<property name="jsdoc3Directory" location="${toolsDirectory}/jsdoc3" />
<property name="webProxyDirectory" location="${toolsDirectory}/proxy" />
<property name="dojoPath" location="${thirdPartyDirectory}/dojo-release-1.8.3-src" />
<!-- Outputs -->
<property name="buildDirectory" location="Build" />
<property name="buildOutputDirectory" location="${buildDirectory}/Cesium" />
<property name="unminifiedOutputDirectory" location="${buildDirectory}/CesiumUnminified" />
<property name="buildDocumentationDirectory" location="${buildDirectory}/Documentation" />
<property name="buildDocumentationImagesDirectory" location="${buildDocumentationDirectory}/images" />
<property name="instrumentedDirectory" location="Instrumented" />
<scriptdef name="glslToJavascript" language="javascript" src="${tasksDirectory}/glslToJavaScript.js">
<attribute name="stripcomments" />
<element name="glslfiles" type="fileset" />
<element name="existingjsfiles" type="fileset" />
</scriptdef>
<scriptdef name="extractShaderComments" language="javascript" src="${tasksDirectory}/extractShaderComments.js">
<element name="glslfiles" type="fileset" />
</scriptdef>
<scriptdef name="createCesiumJs" language="javascript" src="${tasksDirectory}/createCesiumJs.js">
<attribute name="output" />
<element name="sourcefiles" type="fileset" />
</scriptdef>
<scriptdef name="createSpecList" language="javascript" src="${tasksDirectory}/createSpecList.js">
<attribute name="output" />
<element name="specs" type="fileset" />
</scriptdef>
<scriptdef name="createGalleryList" language="javascript" src="${tasksDirectory}/createGalleryList.js">
<attribute name="output" />
<element name="demos" type="fileset" />
</scriptdef>
<target name="combineJavaScript.setNodePathValue">
<condition property="nodePathValue" value="${toolsDirectory}/nodejs-0.6.17/windows/node.exe">
<os family="windows" />
</condition>
<condition property="nodePathValue" value="${toolsDirectory}/nodejs-0.6.17/mac/node">
<os family="mac" />
</condition>
<condition property="nodePathValue" value="${toolsDirectory}/nodejs-0.6.17/linux/node">
<os family="unix" />
</condition>
</target>
<target name="combineJavaScript.setNodePathLocation" if="nodePathValue">
<property name="nodePath" location="${nodePathValue}" />
</target>
<target name="combineJavaScript.setNodePath" depends="combineJavaScript.setNodePathValue,combineJavaScript.setNodePathLocation">
<condition property="nodePath" value="node">
<not>
<isset property="nodePath" />
</not>
</condition>
</target>
<target name="combineJavaScript.create">
<!-- create relative paths because r.js can't handle full Windows paths -->
<property name="relativeAlmondPath" location="${almondPath}" relative="true" basedir="${sourceDirectory}" />
<property name="combineOutputDirectory" location="${buildDirectory}/combineOutput" />
<mkdir dir="${combineOutputDirectory}" />
<property name="relativeCombineOutputDirectory" location="${combineOutputDirectory}" relative="true" basedir="${sourceDirectory}" />
<!-- create combined Cesium.js -->
<exec executable="${nodePath}" dir="${sourceDirectory}">
<arg line="${rjsPath} -o optimize=${optimize} wrap=true baseUrl=. name=${relativeAlmondPath} include=main out=${relativeCombineOutputDirectory}/Cesium.js" />
</exec>
<!-- create cesiumWorkerBootstrapper -->
<exec executable="${nodePath}" dir="${sourceDirectory}">
<arg line="${rjsPath} -o optimize=${optimize} baseUrl=. include=Workers/cesiumWorkerBootstrapper.js out=${relativeCombineOutputDirectory}/Workers/cesiumWorkerBootstrapper.js" />
</exec>
<!-- create each combined worker layer -->
<antcall target="combineJavaScript.combineWorker">
<param name="worker" value="createVerticesFromExtent" />
</antcall>
<!-- copy to build folder with copyright header added at the top -->
<copy todir="${buildOutputDirectory}">
<fileset dir="${combineOutputDirectory}" />
<filterchain>
<concatfilter prepend="${sourceDirectory}/copyrightHeader.js" />
</filterchain>
</copy>
<delete dir="${combineOutputDirectory}" />
<!-- copy other resources -->
<copy todir="${buildOutputDirectory}" includeEmptyDirs="false">
<fileset dir="${sourceDirectory}">
<exclude name="**/*.js" />
<exclude name="**/*.glsl" />
<exclude name="**/.gitignore" />
<exclude name="**/package.json" />
<exclude name="Widgets/Dojo/**" />
</fileset>
</copy>
</target>
<target name="combineJavaScript.combineWorker">
<exec executable="${nodePath}" dir="${sourceDirectory}">
<arg line="${rjsPath} -o optimize=${optimize} baseUrl=. name=Workers/${worker} out=${relativeCombineOutputDirectory}/Workers/${worker}.js" />
</exec>
</target>
<target name="combineJavaScript.createUnminified" depends="combineJavaScript.setNodePath">
<antcall target="combineJavaScript.create">
<param name="optimize" value="none" />
</antcall>
<mkdir dir="${unminifiedOutputDirectory}" />
<copy todir="${unminifiedOutputDirectory}">
<fileset dir="${buildOutputDirectory}" />
</copy>
</target>
<target name="combineJavaScript.createMinified" if="${build.minification}">
<antcall target="combineJavaScript.create">
<param name="optimize" value="uglify2" />
</antcall>
</target>
<target name="combineJavaScript" depends="combineJavaScript.createUnminified,combineJavaScript.createMinified" />
<target name="generateDocumentation">
<extractShaderComments>
<glslfiles dir="${shadersDirectory}" includes="**/*.glsl" />
</extractShaderComments>
<!--
These needs to be a relative path because Rhino doesn't work properly with Windows
absolute paths:
https://github.com/mozilla/rhino/issues/10
-->
<property name="relativeDocOutputDirectory" location="${buildDocumentationDirectory}" relative="true" basedir="${jsdoc3Directory}" />
<property name="relativeSourceFilesPath" location="${sourceDirectory}" relative="true" basedir="${jsdoc3Directory}" />
<java jar="${jsdoc3Directory}/lib/js.jar" dir="${jsdoc3Directory}" fork="true">
<arg line="-modules node_modules -modules rhino_modules -modules ." />
<arg line="jsdoc.js" />
<arg line="-r" />
<arg line="-d ${relativeDocOutputDirectory}" />
<arg line="${relativeSourceFilesPath}" />
</java>
<copy todir="${buildDocumentationImagesDirectory}">
<fileset dir="${documentationImagesDirectory}" />
</copy>
</target>
<target name="runServer" description="Runs a local web server ">
<taskdef name="server" classname="com.agi.ServerTask">
<classpath>
<fileset dir="${webProxyDirectory}" includes="**/*.jar" />
</classpath>
</taskdef>
<!--
Other server options:
upstreamProxyHost: a standard proxy server that the local server will use to retrieve data
upstreamProxyPort: the port number of the upstream proxy, default 80
noUpstreamProxyHostList: A comma-separated list of hosts that will not use the upstreamProxy
listenOnAllAddresses: Set to true if you want the server to listen to all addresses, not just localhost.
-->
<server proxyContextPath="/proxy" terrainTranscodingContextPath="/terrain" allowedHostList="localhost,*.arcgisonline.com,tile.openstreetmap.org,otile1.mqcdn.com,oatile1.mqcdn.com,tile.stamen.com,*.virtualearth.net,mesonet.agron.iastate.edu" port="8080" baseDir="${basedir}" />
</target>
<target name="buildApps" description="Create built versions of all example applications.">
<antcall target="combine">
<param name="build.minification" value="true" />
</antcall>
<antcall target="buildApp">
<param name="app.path" value="Apps/CesiumViewer" />
<param name="app.name" value="CesiumViewer" />
</antcall>
</target>
<target name="buildApp">
<local name="appStartupScript" />
<property name="appStartupScript" value="${app.name}Startup.js" />
<java classname="org.mozilla.javascript.tools.shell.Main" fork="true">
<classpath>
<pathelement location="${dojoPath}/util/shrinksafe/js.jar" />
<pathelement location="${dojoPath}/util/closureCompiler/compiler.jar" />
</classpath>
<sysproperty key="java.util.logging.config.file" value="${toolsDirectory}/dojoBuildLogging.properties" />
<arg line="${dojoPath}/dojo/dojo.js" />
<arg line="baseUrl=${dojoPath}/dojo" />
<arg line="load=build" />
<arg line="--require ${app.path}/${appStartupScript}" />
<arg line="--profile ${app.path}/${app.name}.profile.js" />
</java>
<local name="appOutputDirectory" />
<property name="appOutputDirectory" location="${buildDirectory}/${app.path}" />
<!-- move the build-report file elsewhere -->
<move file="${appOutputDirectory}/build-report.txt" tofile="${buildDirectory}/${app.name}-build-report.txt" />
<delete includeemptydirs="true">
<fileset dir="${appOutputDirectory}">
<!-- get rid of the unneeded unminified copies of the files -->
<include name="**/*.uncompressed.js" />
<!-- get rid of leftover junk -->
<include name="**/package.json" />
<include name="**/*.profile.js" />
<include name="dojo/_firebug/**" />
</fileset>
</delete>
<delete includeemptydirs="true">
<fileset dir="${appOutputDirectory}">
<!-- delete individual files on the assumption that the app layer includes them all -->
<!-- delete individual css on the assumption that the css in the root directory includes them all -->
<include name="**" />
<exclude name="*.css" />
<exclude name="*.html" />
<exclude name="*.ico" />
<exclude name="dojo/dojo.js" />
<exclude name="${app.name}.js" />
<exclude name="${appStartupScript}" />
<!-- keep some necessary dojo stuff -->
<exclude name="**/nls/**" />
<exclude name="dojo/resources/blank.gif" />
<exclude name="dijit/**/*.png" />
<exclude name="dijit/**/*.gif" />
<exclude name="Widgets/**/*.png" />
<exclude name="Widgets/**/*.gif" />
<!-- always keep assets -->
<exclude name="Assets/**" />
<exclude name="**/*.czml" />
</fileset>
</delete>
<!-- rewrite the paths to the files in Source that are now under app.path -->
<replace dir="${appOutputDirectory}" summary="true">
<replacefilter token="../../" value="" />
<replacefilter token="Source/" value="" />
<include name="index.html" />
<include name="*.css" />
</replace>
<!-- rewrite the paths to the dojo packages that are now directly under app.path -->
<replace dir="${appOutputDirectory}" summary="true">
<replacefilter token="ThirdParty/dojo-release-1.8.3-src/" value="" />
<include name="${appStartupScript}" />
<include name="index.html" />
<include name="*.css" />
</replace>
<!-- remove the Source/ prefix on the packages in the startup script -->
<replaceregexp match="(location\s*:\s*[&quot;'])Source/" flags="g" replace="\1">
<fileset dir="${appOutputDirectory}" includes="${appStartupScript}" />
</replaceregexp>
<!-- replace the Apps/AppName prefix with '.' on the packages in the startup script -->
<replaceregexp match="(location\s*:\s*[&quot;'])${app.path}" flags="g" replace="\1.">
<fileset dir="${appOutputDirectory}" includes="${appStartupScript}" />
</replaceregexp>
<!-- change the baseUrl from '../..' to '.' in the startup script -->
<replaceregexp match="(baseUrl\s*:\s*[&quot;'])\.\./\.\." flags="g" replace="\1.">
<fileset dir="${appOutputDirectory}" includes="${appStartupScript}" />
</replaceregexp>
<!-- replace '.' with 'dojo' in packages in dojo.js -->
<replaceregexp match="(location\s*:\s*[&quot;'])\.([&quot;'])" flags="g" replace="\1dojo\2">
<fileset dir="${appOutputDirectory}" includes="dojo/dojo.js" />
</replaceregexp>
<!-- replace ../../AppName prefix with '.' in packages in dojo.js -->
<replaceregexp match="(location\s*:\s*[&quot;'])\.\./\.\./${app.name}" flags="g" replace="\1.">
<fileset dir="${appOutputDirectory}" includes="dojo/dojo.js" />
</replaceregexp>
<!-- remove ../ prefix from packages '.' in dojo.js -->
<replaceregexp match="(location\s*:\s*[&quot;'])\.\./" flags="g" replace="\1">
<fileset dir="${appOutputDirectory}" includes="dojo/dojo.js" />
</replaceregexp>
<!-- Copy the r.js built versions of the worker files over top of the dojo built ones -->
<copy todir="${appOutputDirectory}/Workers" overwrite="true">
<fileset dir="${buildOutputDirectory}/Workers" includes="*.js" />
</copy>
</target>
</project>
Jump to Line
Something went wrong with that request. Please try again.