Bryan Duxbury | 321eb7a | 2010-04-22 21:17:39 +0000 | [diff] [blame] | 1 | <?xml version="1.0"?> |
| 2 | <!-- |
| 3 | Licensed to the Apache Software Foundation (ASF) under one |
| 4 | or more contributor license agreements. See the NOTICE file |
| 5 | distributed with this work for additional information |
| 6 | regarding copyright ownership. The ASF licenses this file |
| 7 | to you under the Apache License, Version 2.0 (the |
| 8 | "License"); you may not use this file except in compliance |
| 9 | with the License. You may obtain a copy of the License at |
| 10 | |
| 11 | http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | |
| 13 | Unless required by applicable law or agreed to in writing, |
| 14 | software distributed under the License is distributed on an |
| 15 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 16 | KIND, either express or implied. See the License for the |
| 17 | specific language governing permissions and limitations |
| 18 | under the License. |
| 19 | --> |
| 20 | <project name="libthrift" default="compile" basedir="."> |
| 21 | |
| 22 | <description>Thrift Build File</description> |
| 23 | |
| 24 | <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" /> |
| 25 | |
| 26 | <property name="src" value="${basedir}/src" /> |
| 27 | <property name="build" value="${basedir}/build" /> |
| 28 | |
| 29 | <target name="checkFlexHome" unless="FLEX_HOME"> |
| 30 | <fail message='You must set the property FLEX_HOME with the path to your flex SDK, eg. ant -DFLEX_HOME="/Applications/Adobe Flex Builder 3/sdks/3.2.0"'/> |
| 31 | </target> |
| 32 | |
| 33 | <target name="compile" depends="checkFlexHome"> |
| 34 | |
| 35 | <mkdir dir="${build}"/> |
| 36 | |
| 37 | <!-- compc takes a list of classes separated by spaces, eg. "pkg.Class pkg.Class2" |
| 38 | To generate this, we have to create an ant path, then convert it using |
| 39 | pathconvert, removing the prefix with a map and removing the .as suffix using |
| 40 | a mapper. From http://snippets.dzone.com/posts/show/3627. |
| 41 | --> |
| 42 | <path id="classesRaw"> |
| 43 | <fileset dir="${src}/"> |
| 44 | <include name="**/*.as"/> |
| 45 | </fileset> |
| 46 | </path> |
| 47 | <pathconvert |
| 48 | property="classesClean" |
| 49 | pathsep=" " |
| 50 | dirsep="." |
| 51 | refid="classesRaw"> |
| 52 | <map from="${src}/" to=""/> |
| 53 | <mapper type="glob" from="*.as" to="*"/> |
| 54 | </pathconvert> |
| 55 | |
| 56 | <compc output="${build}/libthrift.swc" include-classes="${classesClean}"> |
| 57 | <source-path path-element="${src}"/> |
| 58 | </compc> |
| 59 | |
| 60 | </target> |
| 61 | |
| 62 | <target name="clean"> |
| 63 | <delete dir="${build}" /> |
| 64 | </target> |
| 65 | |
| 66 | </project> |