<?xml version="1.0" encoding="utf-8"?>
<project name="lplib.build" default="build" basedir=".">
	
	<property name="tools.dir" location="../../tools"/>
  <property name="build.dir" location="./"/>
  <property name="des.dir" location="./"/>
  <property name="charset" value="UTF-8"/>
	
	<target name="build" depends="prepare,compress,native2ascii">
  </target>

  <target name="prepare">
    <delete>
      <fileset dir="${des.dir}" includes="**/*-min.js"/>
    </delete>
  </target>

  <!-- 用 YUICompressor 压缩 js -->
  <target name="compress">           
    <apply executable="java" verbose="true" dest="${des.dir}">
        <fileset dir="${des.dir}" includes="**/*.js"/>
        <arg line="-jar"/>
        <arg path="${tools.dir}/yuicompressor.jar"/>
        <arg line="--charset utf-8"/>
        <srcfile/>
        <arg line="-o"/>
        <targetfile/>
        <mapper type="regexp" from="^(.*)\.(js)$" to="\1-min.\2"/>
    </apply>
  </target>

  <target name="native2ascii" depends="compress">
    <mkdir dir="${build.dir}/tmp"/>
    <move todir="${build.dir}/tmp">
        <fileset dir="${des.dir}" includes="*-min.js"/>
    </move>
    <native2ascii encoding="${charset}"
                  src="${build.dir}/tmp"
                  dest="${des.dir}"
                  includes="*.js"/>
    <delete dir="${build.dir}/tmp"/>

  </target>
<!---->
</project>
