<?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="aeon-desktop-theme" default="main" basedir=".">
	<property name="FLEX_HOME" location="${basedir}/../../.."/>

	<property file="${FLEX_HOME}/env.properties"/>
	<property environment="env"/>
	<property file="${FLEX_HOME}/build.properties"/>

	<target name="main" depends="clean,compile,copy-assets" description="Clean build of AeonDesktopTheme.swc"/>

	<target name="clean">
		<delete failonerror="false">
			<fileset dir="${FLEX_HOME}/frameworks/themes/AeonDesktopTheme">
				<include name="AeonDesktopTheme.swc"/>
				<include name="AeonDesktopTheme.swc.incr"/>
			</fileset>
		</delete>
	</target>

	<target name="compile" description="Compiles AeonDesktopTheme.swc">
		<echo message="Compiling frameworks/themes/AeonDesktopTheme/AeonDesktopTheme.swc"/>
		<!-- Load the <compc> 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}/ant/lib/flexTasks.jar;${FLEX_HOME}/lib/flexTasks.jar"/>
		
		<compc fork="true"
			   output="${FLEX_HOME}/frameworks/themes/AeonDesktopTheme/AeonDesktopTheme.swc">
			<jvmarg line="${compc.jvm.args}"/>
			<load-config filename="compile-config.xml" />
			<arg value="+playerglobal.version=${playerglobal.version}" />
			<arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" />
		</compc>
	</target>

	<target name="copy-assets">
		<mkdir dir="${FLEX_HOME}/frameworks/themes/AeonDesktopTheme/images"/>
		<copy todir="${FLEX_HOME}/frameworks/themes/AeonDesktopTheme/images">
			<fileset dir="${basedir}/../feathers/feathers/themes/AeonDesktopTheme/assets/images">
				<include name="aeon_desktop.png"/>
				<include name="aeon_desktop.xml"/>
			</fileset>
		</copy>
	</target>

</project>
