Created
February 23, 2012 03:16
-
-
Save jessefreeman/1889757 to your computer and use it in GitHub Desktop.
Simple ImpactJS Ant Build - Use this to bake and copy your game over to a deploy folder so you can easily publish it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<project name="Impact Ant Build" basedir="." default="full-build"> | |
<!-- Change these properties based on your project --> | |
<!-- Project meta data --> | |
<property name="project.name" value="Resident Raver"/> | |
<property name="company.name" value="GameCook"/> | |
<property name="company.site" value="http://gamecook.com"/> | |
<property name="project.version" value="0.8.1"/> | |
<property name="project.description" value="This is Resident Raver the Game!"/> | |
<property name="project.url" value="http://gamecook.com/games/resident-raver/"/> | |
<!-- Deployment directories --> | |
<property name="deploy.dir" value="deploy"/> | |
<property name="web.dir" value="${deploy.dir}/web"/> | |
<property name="chrome.dir" value="${deploy.dir}/chrome"/> | |
<property name="mozilla.dir" value="${deploy.dir}/mozilla"/> | |
<property name="ios.dir" value="${deploy.dir}/ios"/> | |
<property name="win8.dir" value="${deploy.dir}/win8"/> | |
<!-- Path to Impact directory --> | |
<property name="impact.dir" value="${basedir}/impact"/> | |
<target name="full-build"> | |
<!-- Clean --> | |
<antcall target="pre-build-cleanup"/> | |
<antcall target="bake"/> | |
<antcall target="web-build"/> | |
<antcall target="ios-build"/> | |
<antcall target="win8-build"/> | |
<antcall target="chrome-build"/> | |
<antcall target="mozilla-build"/> | |
<antcall target="post-build-cleanup"/> | |
<!-- Bake --> | |
</target> | |
<!-- Delete deploy directory and create a new one --> | |
<target name="pre-build-cleanup"> | |
<delete dir="${deploy.dir}"/> | |
<mkdir dir="${deploy.dir}"/> | |
</target> | |
<!-- Removes the minified game from the impact directory--> | |
<target name="post-build-cleanup"> | |
<delete file="${impact.dir}/game.min.js"/> | |
</target> | |
<!-- Run the bake script - you need PHP to be runnable from the command line. --> | |
<target name="bake"> | |
<exec dir="${impact.dir}" executable="php"> | |
<arg value="${impact.dir}/tools/bake.php"/> | |
<arg value="lib/impact/impact.js"/> | |
<arg value="lib/game/main.js"/> | |
<arg value="game.min.js"/> | |
</exec> | |
</target> | |
<target name="web-build"> | |
<!-- Copy over the impact directory to the deploy folder and ignore what is not needed. --> | |
<sync todir="${web.dir}"> | |
<fileset dir="${impact.dir}"> | |
<exclude name="weltmeister.html"/> | |
<exclude name="**/tools/*"/> | |
<exclude name="**/lib/**"/> | |
</fileset> | |
</sync> | |
<!-- replace js source paths in HTML with minified game js. Make sure code is surrounded by "source script" comments so the regex can find it. --> | |
<replaceregexp file="${web.dir}/index.html" | |
match="\<!--source scripts--\>(.*?)\<!--end source scripts--\>" | |
replace="\<script src='game.min.js'\>\</script\>" flags="gs"> | |
</replaceregexp> | |
<!-- This will copy over debug CSS if game is running in debug mode. --> | |
<copy file="${impact.dir}/lib/impact/debug/debug.css" | |
tofile="${web.dir}/lib/impact/debug/debug.css"/> | |
</target> | |
<target name="ios-build"> | |
<!-- copy over files for iOS --> | |
<sync todir="${ios.dir}"> | |
<fileset dir="${web.dir}"> | |
</fileset> | |
</sync> | |
</target> | |
<target name="win8-build"> | |
<!-- copy over files for Win8 --> | |
<sync todir="${win8.dir}"> | |
<fileset dir="${web.dir}"> | |
</fileset> | |
</sync> | |
</target> | |
<target name="chrome-build"> | |
<!-- Create chrome market app --> | |
<sync todir="${chrome.dir}/tmp"> | |
<fileset dir="${web.dir}"> | |
</fileset> | |
</sync> | |
<echo file="${chrome.dir}/tmp/manifest.json" append="false"> | |
{ | |
"name": "${project.name}", | |
"description": "${project.description}", | |
"version": "${project.version}", | |
"icons": { | |
"16": "images/icons/icon-16x16.png", | |
"48": "images/icons/icon-48x48.png", | |
"128": "images/icons/icon-128x128.png" | |
}, | |
"app": {"launch": { | |
"local_path": "index.html" | |
}}, | |
"homepage_url": "${project.url}" | |
} | |
</echo> | |
<zip destfile="${chrome.dir}/${project.name}-${project.version}.zip" basedir="${chrome.dir}"/> | |
<delete dir="${chrome.dir}/tmp/"/> | |
</target> | |
<target name="mozilla-build"> | |
<!-- Create Mozilla App --> | |
<sync todir="${mozilla.dir}"> | |
<fileset dir="${web.dir}"> | |
</fileset> | |
</sync> | |
<echo file="${mozilla.dir}/manifest.json" append="false"> | |
{ | |
"name":"${project.name}", | |
"developer": { | |
"name":"${company.name}", | |
"url":"${company.site}" | |
}, | |
"description":"${project.description}", | |
"icons":{ | |
"16": "/images/icons/icon-16x16.png", | |
"48": "/images/icons/icon-48x48.png", | |
"128": "/images/icons/icon-128x128.png" | |
} | |
} | |
</echo> | |
</target> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've updated this to now create a Chrome Market zip of the app as well as a web deployable build.