THRIFT-518. as3: Add the AS3 generator and library

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@937067 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/as3/build.xml b/lib/as3/build.xml
new file mode 100644
index 0000000..1b7a544
--- /dev/null
+++ b/lib/as3/build.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project name="libthrift" default="compile" basedir=".">
+
+  <description>Thrift Build File</description>
+
+  <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
+
+  <property name="src" value="${basedir}/src" />
+  <property name="build" value="${basedir}/build" />
+
+  <target name="checkFlexHome" unless="FLEX_HOME">
+    <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"'/>
+  </target>
+
+  <target name="compile" depends="checkFlexHome">
+
+    <mkdir dir="${build}"/>
+
+    <!-- compc takes a list of classes separated by spaces, eg. "pkg.Class pkg.Class2"
+         To generate this, we have to create an ant path, then convert it using
+         pathconvert, removing the prefix with a map and removing the .as suffix using
+         a mapper.  From http://snippets.dzone.com/posts/show/3627.
+    -->
+    <path id="classesRaw">
+      <fileset dir="${src}/">
+         <include name="**/*.as"/>
+      </fileset>
+    </path>
+    <pathconvert 
+      property="classesClean" 
+      pathsep=" " 
+      dirsep="." 
+      refid="classesRaw">
+      <map from="${src}/" to=""/>
+      <mapper type="glob" from="*.as" to="*"/>
+    </pathconvert>
+
+    <compc output="${build}/libthrift.swc" include-classes="${classesClean}">
+      <source-path path-element="${src}"/>
+    </compc>
+
+  </target>
+
+  <target name="clean">
+    <delete dir="${build}" />
+  </target>
+
+</project>