| <?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="MD5Checker" basedir="." default="main"> |
| |
| <!--load environment variables prefixed with env --> |
| <property environment="env"/> |
| <property file="${basedir}/local.properties" /> |
| |
| <!-- |
| Properties are immutable so value frozen first time property is set. |
| If FLEX_HOME is not set with -DFLEX_HOME=/path/to/flex/sdk on the ant command line |
| use the environment variable, if it exists. Else if windows, use FLEX_HOME_WIN |
| else use FLEX_HOME_MAC, which are both defined in build.properties. |
| --> |
| <condition property="FLEX_HOME" value="${env.FLEX_HOME}"> |
| <isset property="env.FLEX_HOME" /> |
| </condition> |
| <condition property="AIR_HOME" value="${env.AIR_HOME}"> |
| <isset property="env.AIR_HOME" /> |
| </condition> |
| |
| <condition property="theOS" value="Windows"> |
| <os family="windows"/> |
| </condition> |
| <condition property="theOS" value="Mac"> |
| <os family="mac"/> |
| </condition> |
| <condition property="isMac" value="Mac"> |
| <os family="mac"/> |
| </condition> |
| |
| <target name="main" depends="build"> |
| <exec executable="${AIR_HOME}/bin/adl.exe" dir="${basedir}/src" osfamily="windows" resultproperty="md5result" failonerror="false"> |
| <arg value="-runtime"/> |
| <arg value="${AIR_HOME}/runtimes/air/win"/> |
| <arg value="${basedir}/src/MD5Checker-app.xml"/> |
| <arg value="--" /> |
| <arg value="-log=${basedir}/MD5CheckerLog.txt"/> |
| </exec> |
| <exec executable="${AIR_HOME}/bin/adl" dir="${basedir}/src" osfamily="mac" resultproperty="md5result" failonerror="false"> |
| <arg value="-runtime"/> |
| <arg value="${AIR_HOME}/runtimes/air/mac"/> |
| <arg value="${basedir}/src/MD5Checker-app.xml"/> |
| <arg value="--" /> |
| <arg value="-log=${basedir}/MD5CheckerLog.txt"/> |
| <arg value="-out=${basedir}/sdk-installer-config-4.0.xml"/> |
| </exec> |
| <loadfile property="md5log" srcfile="${basedir}/MD5CheckerLog.txt" /> |
| <echo>${md5log}</echo> |
| <antcall target="autoupdate" /> |
| <fail message="MD5's changed!" > |
| <condition> |
| <not> |
| <equals arg1="0" arg2="${md5result}" /> |
| </not> |
| </condition> |
| </fail> |
| </target> |
| |
| <target name="load-task" > |
| <!-- load the <mxmlc> task; we can't do this at the <project> level --> |
| <!-- because targets that run before flexTasks.jar gets built would fail --> |
| <taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/lib/flexTasks.jar"/> |
| </target> |
| |
| <target name="build" depends="load-task" description="compile it"> |
| |
| <!-- compile the basic tests --> |
| <mxmlc fork="true" debug="true" |
| file="${basedir}/src/MD5Checker.mxml"> |
| <jvmarg line="-Xms64m -Xmx384m -ea -Dapple.awt.UIElement=true"/> |
| <load-config filename="${FLEX_HOME}/frameworks/air-config.xml"/> |
| <source-path path-element="${basedir}/../flex-installer/ant_on_air/src" /> |
| </mxmlc> |
| </target> |
| |
| <target name="autoupdate" if="svn.site"> |
| <condition property="needsupdate"> |
| <not> |
| <equals arg1="0" arg2="${md5result}" /> |
| </not> |
| </condition> |
| <antcall target="updatesvn" /> |
| </target> |
| |
| <target name="updatesvn" if="needsupdate"> |
| <available file="${env.ProgramFiles}/SlikSVN/bin/svn.exe" |
| type="file" |
| property="svn" value="${env.ProgramFiles}/SlikSVN/bin/svn.exe" /> |
| <available file="${env.ProgramFiles(x86)}/SlikSVN/bin/svn.exe" |
| type="file" |
| property="svn" value="${env.ProgramFiles}/SlikSVN/bin/svn.exe" /> |
| <available file="/opt/subversion/bin/svn" |
| type="file" |
| property="svn" value="/opt/subversion/bin/svn" /> |
| <available file="/usr/bin/svn" |
| type="file" |
| property="svn" value="/usr/bin/svn" /> |
| <fail message="Could not locate SVN command-line. Please specify the path to SVN with |
| -Dsvn=<path-to-svn>" |
| unless="svn"/> |
| |
| <available file="${svn.site}" |
| type="dir" |
| property="site" value="${svn.site}" /> |
| |
| <fail message="The svn.site property is not set to the working copy for https://flex.apache.org." |
| unless="site"/> |
| |
| <echo>updating svn</echo> |
| <exec executable="${svn}" dir="${site}" failonerror="true" > |
| <arg value="update" /> |
| <arg value="sdk-installer-config-4.0.xml" /> |
| </exec> |
| <copy file="${basedir}/sdk-installer-config-4.0.xml" tofile="${svn.site}/sdk-installer-config-4.0.xml" /> |
| <antcall target="commit" /> |
| </target> |
| |
| <target name="commit" depends="credentials"> |
| <delete file="${basedir}/getresult.txt" failonerror="false"/> |
| <exec executable="${svn}" dir="${site}" failonerror="true" > |
| <arg value="commit" /> |
| <arg value="--username" /> |
| <arg value="${apache.username}" /> |
| <arg value="--password" /> |
| <arg value="${apache.password}" /> |
| <arg value="-m" /> |
| <arg value=""update md5s"" /> |
| </exec> |
| <!-- pause to give buildbot chance to react --> |
| <sleep seconds="60" /> |
| <get src="https://cms.apache.org/flex/publish" username="${apache.username}" password="${apache.password}" dest="${basedir}/getresult.txt" /> |
| </target> |
| |
| <target name="credentials" depends="get-username,get-password"> |
| <echo>${apache.username}</echo> |
| <echo>${apache.password}</echo> |
| </target> |
| <target name="get-username" unless="apache.username" > |
| <input |
| message="Enter Apache account username:" |
| addproperty="apache.username"/> |
| <condition property="have.username"> |
| <not> |
| <equals trim="true" arg1="" arg2="${apache.username}"/> |
| </not> |
| </condition> |
| <fail message="The apache.username property is not set. It should be the username for Apache SVN and Git." |
| unless="have.username"/> |
| </target> |
| <target name="get-password" unless="apache.password" > |
| <input |
| message="Enter Apache account password:" |
| addproperty="apache.password"/> |
| <condition property="have.password"> |
| <not> |
| <equals trim="true" arg1="" arg2="${apache.password}"/> |
| </not> |
| </condition> |
| <fail message="The apache.password property is not set. It should be the password for Apache SVN and Git." |
| unless="have.password"/> |
| </target> |
| |
| </project> |