/
build.xml
149 lines (123 loc) · 6.24 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?xml version="1.0" encoding="UTF-8"?>
<project name="kitchensynclib" default="build" basedir=".">
<!-- The Title and version of the Application -->
<property name="app.title" value="KitchenSyncLib"/>
<property name="app.version" value="2.0" /> <!-- Change this to match the current version of KitchenSyncLib -->
<echo>${app.title} ${app.version}</echo>
<!-- Check for the build.properties file and force the user to create one before compiling. -->
<available file="build.properties" filePath="." property="build.propsExist" />
<fail unless="build.propsExist" message="You must create a file called 'build.properties' with your local settings in order to use ant with this project. You can use the build.properties.template file as a starting point." />
<property file="build.properties" />
<echo message="Successfully loaded properties." />
<!-- The Location of FlexSDK on your Computer. Required by Flex ant tasks -->
<property name="FLEX_HOME" location="${flex.sdkPath}" description="Required by flex ant tasks" />
<!--
The Location of your Application Classes on your Computer
NOTE: This Path should be reletive to the build.xml file.
NOTE: ${basedir} is an ant property that represents the directory holding the build.xml file
-->
<property name="project.sourcePath" location="${basedir}/src"/>
<property name="project.libraryPath" location="${basedir}/libs"/>
<property name="ant.libsPath" location="${project.libraryPath}/ant" />
<!--
The Location you wish to output to on your Computer
NOTE: I have encountered issues with this folder containing Spaces
-->
<property name="project.output.docsPath" location="${basedir}/docs/asdoc"/>
<property name="project.output.binaryPath" location="${basedir}/bin"/>
<property name="project.output.name" value="${app.title}-${app.version}" />
<!-- Define addtional tasks -->
<!-- path to the svnant libraries. -->
<path id="svnant.classpath">
<fileset dir="${ant.libsPath}/svnant">
<include name="*.jar"/>
</fileset>
</path>
<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="svnant.classpath" />
<!-- path to the flex task libraries. -->
<path id="flex.tasksClasspath">
<fileset dir="${flex.antLibsPath}">
<include name="*.jar"/>
</fileset>
</path>
<typedef resource="flexTasks.tasks" classpathref="flex.tasksClasspath" />
<!-- Update to the latest version of the source -->
<target name="svnUpdate">
<echo>Updating to the latest version from SVN</echo>
<svn><update dir="." /></svn>
</target>
<target name="buildAll" description="Runs all compile targets">
<antcall target="svnUpdate" />
<antcall target="releaseBuild" />
<antcall target="buildEasing" />
<antcall target="docs" />
</target>
<target name="incrementalBuild">
<property name="incremental" value="true" />
<antcall target="build" />
</target>
<target name="build" description="Compiles the kitchensynclib into a SWC library file.">
<echo>Compiling library. Incremental build = ${incremental}</echo>
<compc o="${project.output.binaryPath}/${project.output.name}.swc" incremental="${incremental}">
<sp path-element="${project.sourcePath}" />
<library-path dir="${project.libraryPath}" includes="*" />
<is dir="${project.sourcePath}" includes="*" />
</compc>
<echo>Success! Created ${project.output.name}.swc</echo>
</target>
<target name="releaseBuild" description="Compiles the kitchensynclib into a SWC library file and creates a zip of the source.">
<antcall target="build" />
<echo>Creating temp files.</echo>
<property name="tempPath" location="${project.output.binaryPath}/compileTemp" />
<delete dir="${tempPath}" description="delete any old temp files." />
<mkdir dir="${tempPath}" />
<echo>Exporting source code to temp path</echo>
<svn>
<export srcpath="${project.sourcePath}" destpath="${tempPath}/src" />
</svn>
<echo>Zipping files</echo>
<copy file="${project.output.binaryPath}/${project.output.name}.swc" toDir="${tempPath}" description="make a copy of the swc in the temp path." />
<zip destfile="${project.output.binaryPath}/${project.output.name}.zip" update="true" whenempty="fail" description="Zipping all files in temp path.">
<zipfileset dir="${tempPath}" />
</zip>
<delete dir="${tempPath}" description="delete the temp files." />
<echo>Created zip file ${project.output.name}.zip</echo>
</target>
<target name="buildEasing" description="Compiles the easing functions into a SWC and packages the code and swc into a folder.">
<echo>Creating temp files.</echo>
<property name="easingName" value="KSEasing" />
<property name="tempPath" location="${project.output.binaryPath}/easingTemp" />
<property name="tempSrcPath" location="${tempPath}/src" />
<property name="easingSrcPath" value="org/as3lib/kitchensync/easing" />
<property name="easingBinaryPath" value="${tempPath}/${easingName}.swc" />
<delete dir="${tempPath}" description="delete any old temp files." />
<mkdir dir="${tempSrcPath}/org/as3lib/kitchensync"/>
<svn>
<export srcpath="${project.sourcePath}/${easingSrcPath}" destpath="${tempSrcPath}/${easingSrcPath}" />
</svn>
<echo>Compiling easing code</echo>
<compc o="${easingBinaryPath}">
<sp path-element="${tempSrcPath}" />
<is dir="${tempSrcPath}" includes="*" />
</compc>
<echo>Success! Created ${easingName}.swc</echo>
<echo>Zipping files</echo>
<zip destfile="${project.output.binaryPath}/${easingName}.zip" update="true" whenempty="fail" description="Zipping all files in temp path.">
<zipfileset dir="${tempPath}" />
</zip>
<delete dir="${tempPath}" description="delete the temp files." />
<echo>Created zip file at ${project.output.binaryPath}/${easingName}.zip</echo>
</target>
<!--
Run the ASDoc executable and generate the ASDocs to the new output folder
-->
<target name="docs" description="Compiles the asdocs in the source code into HTML.">
<exec executable="${flex.binaryPath}/asdoc" failonerror="true" description="Compiles the asdocs">
<arg line="-source-path ${project.sourcePath}"/>
<arg line="-library-path ${project.libraryPath}"/>
<arg line="-doc-sources ${project.sourcePath}"/>
<arg line="-window-title "${app.title} v${app.version}""/>
<arg line="-output ${project.output.docsPath}"/>
</exec>
</target>
</project>