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 |
Jake Farrell | c023d90 | 2011-05-20 19:04:13 +0000 | [diff] [blame^] | 10 | |
| 11 | http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | |
Bryan Duxbury | 321eb7a | 2010-04-22 21:17:39 +0000 | [diff] [blame] | 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. |
Jake Farrell | c023d90 | 2011-05-20 19:04:13 +0000 | [diff] [blame^] | 19 | --> |
| 20 | <project name="libthrift-as3" default="compile" basedir="." |
| 21 | xmlns:artifact="antlib:org.apache.maven.artifact.ant"> |
| 22 | |
| 23 | <property name="as3.artifactid" value="${ant.project.name}"/> |
| 24 | |
| 25 | <property name="thrift.root" location="${basedir}/../../"/> |
| 26 | <property name="thrift.java.dir" location="${thrift.root}/lib/java"/> |
| 27 | <property name="build.tools.dir" location="${thrift.java.dir}/build/tools/"/> |
| 28 | <property name="thrift_compiler" value="${thrift.root}/compiler/cpp/thrift"/> |
Bryan Duxbury | 321eb7a | 2010-04-22 21:17:39 +0000 | [diff] [blame] | 29 | |
Jake Farrell | c023d90 | 2011-05-20 19:04:13 +0000 | [diff] [blame^] | 30 | <!-- inherit from the java build file for version and other properties --> |
| 31 | <property file="${thrift.java.dir}/build.properties" /> |
Bryan Duxbury | 321eb7a | 2010-04-22 21:17:39 +0000 | [diff] [blame] | 32 | |
Jake Farrell | c023d90 | 2011-05-20 19:04:13 +0000 | [diff] [blame^] | 33 | <property environment="env"/> |
Bryan Duxbury | 321eb7a | 2010-04-22 21:17:39 +0000 | [diff] [blame] | 34 | |
Jake Farrell | c023d90 | 2011-05-20 19:04:13 +0000 | [diff] [blame^] | 35 | <condition property="version" value="${thrift.version}"> |
| 36 | <isset property="release"/> |
| 37 | </condition> |
| 38 | <property name="version" value="${thrift.version}-snapshot"/> |
Bryan Duxbury | 321eb7a | 2010-04-22 21:17:39 +0000 | [diff] [blame] | 39 | |
Jake Farrell | c023d90 | 2011-05-20 19:04:13 +0000 | [diff] [blame^] | 40 | <property name="as3.final.name" value="${as3.artifactid}-${version}"/> |
| 41 | |
| 42 | <property name="src" value="${basedir}/src"/> |
| 43 | <property name="build.dir" value="${basedir}/build"/> |
| 44 | |
| 45 | <property name="as3.swc.file" location="${build.dir}/${as3.final.name}.swc"/> |
| 46 | <property name="as3.pom.xml" location="${build.dir}/${as3.final.name}.pom"/> |
| 47 | |
| 48 | <target name="init" depends="setup.init,flex.init" unless="init.finished"> |
| 49 | <property name="init.finished" value="true"/> |
Bryan Duxbury | 321eb7a | 2010-04-22 21:17:39 +0000 | [diff] [blame] | 50 | </target> |
| 51 | |
Jake Farrell | c023d90 | 2011-05-20 19:04:13 +0000 | [diff] [blame^] | 52 | <target name="setup.init"> |
| 53 | <tstamp/> |
| 54 | <mkdir dir="${build.dir}"/> |
| 55 | </target> |
Bryan Duxbury | 321eb7a | 2010-04-22 21:17:39 +0000 | [diff] [blame] | 56 | |
Jake Farrell | c023d90 | 2011-05-20 19:04:13 +0000 | [diff] [blame^] | 57 | <target name="flex.check" unless="FLEX_HOME"> |
| 58 | <fail message='You must set the FLEX_HOME property pointing to your flex SDK, eg. ant -DFLEX_HOME="/Applications/Adobe Flex Builder 3/sdks/3.2.0"'/> |
| 59 | </target> |
| 60 | |
| 61 | <target name="flex.init" depends="flex.check" unless="flex.finished"> |
| 62 | <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" /> |
| 63 | <property name="flex.finished" value="true"/> |
| 64 | </target> |
Bryan Duxbury | 321eb7a | 2010-04-22 21:17:39 +0000 | [diff] [blame] | 65 | |
Jake Farrell | c023d90 | 2011-05-20 19:04:13 +0000 | [diff] [blame^] | 66 | <target name="compile" depends="init"> |
| 67 | <path id="as.src.files"> |
Bryan Duxbury | 321eb7a | 2010-04-22 21:17:39 +0000 | [diff] [blame] | 68 | <fileset dir="${src}/"> |
Jake Farrell | c023d90 | 2011-05-20 19:04:13 +0000 | [diff] [blame^] | 69 | <include name="**/*.as"/> |
Bryan Duxbury | 321eb7a | 2010-04-22 21:17:39 +0000 | [diff] [blame] | 70 | </fileset> |
| 71 | </path> |
| 72 | <pathconvert |
Jake Farrell | c023d90 | 2011-05-20 19:04:13 +0000 | [diff] [blame^] | 73 | property="as.src.classes" |
Bryan Duxbury | 321eb7a | 2010-04-22 21:17:39 +0000 | [diff] [blame] | 74 | pathsep=" " |
| 75 | dirsep="." |
Jake Farrell | c023d90 | 2011-05-20 19:04:13 +0000 | [diff] [blame^] | 76 | refid="as.src.files" |
| 77 | > |
Bryan Duxbury | 321eb7a | 2010-04-22 21:17:39 +0000 | [diff] [blame] | 78 | <map from="${src}/" to=""/> |
| 79 | <mapper type="glob" from="*.as" to="*"/> |
| 80 | </pathconvert> |
| 81 | |
Jake Farrell | c023d90 | 2011-05-20 19:04:13 +0000 | [diff] [blame^] | 82 | <compc output="${as3.swc.file}" include-classes="${as.src.classes}"> |
Bryan Duxbury | 321eb7a | 2010-04-22 21:17:39 +0000 | [diff] [blame] | 83 | <source-path path-element="${src}"/> |
| 84 | </compc> |
Bryan Duxbury | 321eb7a | 2010-04-22 21:17:39 +0000 | [diff] [blame] | 85 | </target> |
| 86 | |
| 87 | <target name="clean"> |
Jake Farrell | c023d90 | 2011-05-20 19:04:13 +0000 | [diff] [blame^] | 88 | <delete dir="${build.dir}" /> |
Bryan Duxbury | 321eb7a | 2010-04-22 21:17:39 +0000 | [diff] [blame] | 89 | </target> |
| 90 | |
Jake Farrell | c023d90 | 2011-05-20 19:04:13 +0000 | [diff] [blame^] | 91 | <target name="mvn.ant.tasks.download" depends="setup.init,mvn.ant.tasks.check" unless="mvn.ant.tasks.found"> |
| 92 | <get src="${mvn.ant.task.url}/${mvn.ant.task.jar}" dest="${build.tools.dir}/${mvn.ant.task.jar}" usetimestamp="true"/> |
| 93 | </target> |
| 94 | |
| 95 | <target name="mvn.ant.tasks.check"> |
| 96 | <condition property="mvn.ant.tasks.found"> |
| 97 | <typefound uri="antlib:org.apache.maven.artifact.ant" name="artifact"/> |
| 98 | </condition> |
| 99 | </target> |
| 100 | |
| 101 | <target name="mvn.init" depends="mvn.ant.tasks.download" unless="mvn.finished"> |
| 102 | <echo message="${mvn.ant.task.jar}"/> |
| 103 | <!-- Download mvn ant tasks, download dependencies, and setup pom file --> |
| 104 | <typedef uri="antlib:org.apache.maven.artifact.ant" classpath="${build.tools.dir}/${mvn.ant.task.jar}"/> |
| 105 | |
| 106 | <!-- remote repositories used to download dependencies from --> |
| 107 | <artifact:remoteRepository id="central" url="${mvn.repo}"/> |
| 108 | <artifact:remoteRepository id="apache" url="${apache.repo}"/> |
| 109 | |
| 110 | <!-- Pom file information --> |
| 111 | <artifact:pom id="pom" |
| 112 | groupId="${thrift.groupid}" |
| 113 | artifactId="${as3.artifactid}" |
| 114 | version="${version}" |
| 115 | url="http://thrift.apache.org" |
| 116 | name="Apache Thrift" |
| 117 | description="Thrift is a software framework for scalable cross-language services development." |
| 118 | packaging="pom" |
| 119 | > |
| 120 | <remoteRepository refid="central"/> |
| 121 | <remoteRepository refid="apache"/> |
| 122 | <license name="The Apache Software License, Version 2.0" url="${license}"/> |
| 123 | <scm connection="scm:svn:http://svn.apache.org/repos/asf/thrift/trunk/" |
| 124 | developerConnection="scm:svn:http://svn.apache.org/repos/asf/thrift/trunk/" |
| 125 | url="http://svn.apache.org/viewcvs.cgi/thrift" |
| 126 | /> |
| 127 | <!-- Thrift Developers --> |
| 128 | <developer id="mcslee" name="Mark Slee"/> |
| 129 | <developer id="dreiss" name="David Reiss"/> |
| 130 | <developer id="aditya" name="Aditya Agarwal"/> |
| 131 | <developer id="marck" name="Marc Kwiatkowski"/> |
| 132 | <developer id="jwang" name="James Wang"/> |
| 133 | <developer id="cpiro" name="Chris Piro"/> |
| 134 | <developer id="bmaurer" name="Ben Maurer"/> |
| 135 | <developer id="kclark" name="Kevin Clark"/> |
| 136 | <developer id="jake" name="Jake Luciani"/> |
| 137 | <developer id="bryanduxbury" name="Bryan Duxbury"/> |
| 138 | <developer id="esteve" name="Esteve Fernandez"/> |
| 139 | <developer id="todd" name="Todd Lipcon"/> |
| 140 | <developer id="geechorama" name="Andrew McGeachie"/> |
| 141 | <developer id="molinaro" name="Anthony Molinaro"/> |
| 142 | <developer id="roger" name="Roger Meier"/> |
| 143 | <developer id="jfarrell" name="Jake Farrell"/> |
| 144 | </artifact:pom> |
| 145 | |
| 146 | <!-- Generate the pom file --> |
| 147 | <artifact:writepom pomRefId="pom" file="${as3.pom.xml}"/> |
| 148 | |
| 149 | <property name="mvn.finished" value="true"/> |
| 150 | </target> |
| 151 | |
| 152 | <macrodef name="signAndDeploy"> |
| 153 | <!-- Sign and deploy jars to apache repo --> |
| 154 | <attribute name="file"/> |
| 155 | <attribute name="classifier" default=""/> |
| 156 | <attribute name="packaging" default="jar"/> |
| 157 | <attribute name="pom" default=""/> |
| 158 | <sequential> |
| 159 | <artifact:mvn fork="true"> |
| 160 | <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file"/> |
| 161 | <arg value="-DrepositoryId=${maven-repository-id}"/> |
| 162 | <arg value="-Durl=${maven-repository-url}"/> |
| 163 | <arg value="-DpomFile=@{pom}"/> |
| 164 | <arg value="-Dfile=@{file}"/> |
| 165 | <arg value="-Dclassifier=@{classifier}"/> |
| 166 | <arg value="-Dpackaging=@{packaging}"/> |
| 167 | <arg value="-Pgpg"/> |
| 168 | </artifact:mvn> |
| 169 | </sequential> |
| 170 | </macrodef> |
| 171 | |
| 172 | <target name="publish" depends="clean,compile,mvn.init"> |
| 173 | <!-- Compile, packages and then send release to apache maven repo --> |
| 174 | <!-- run with: ant -Drelease=true publish --> |
| 175 | <signAndDeploy file="${as3.pom.xml}" packaging="pom" classifier="" pom="${as3.pom.xml}"/> |
| 176 | <signAndDeploy file="${as3.swc.file}" packaging="swc" classifier="" pom="${as3.pom.xml}"/> |
| 177 | </target> |
Bryan Duxbury | 321eb7a | 2010-04-22 21:17:39 +0000 | [diff] [blame] | 178 | </project> |