<project name="settings">

	<import file="build-set-globals.xml" as="globals" />
	<import file="validate-android.xml" as="validate" />
	
	<path id="xslt_classpath">
		<pathelement path="classes"/>
		<pathelement location="libs/xmlparserv2.jar"/>
		<pathelement location="libs/orai18n-mapping.jar"/>
		<pathelement location="libs/orai18n-collation.jar"/>
		<pathelement location="libs/bsh-2.0b4.jar"/>
		<pathelement location="libs/bsf.jar"/>
		<pathelement location="libs/deploy-utils.jar"/>
		<pathelement location="libs/commons-logging-1.0.4.jar"/>
	</path>

	<target name="generateSettings">
		<echo>Application XML: ${oepe.adfmf.dotadf.applicationxml.path}</echo>
		<echo>Fars : ${adf.staging.fars.dir}</echo>
		<echo>XSL : ${basedir}/xsl/preference_transform.xsl</echo>
		
		<script language="beanshell" classpathref="xslt_classpath">
			<![CDATA[
				import 	oracle.eclipse.tools.adf.mobile.rt.v13.build.settings.TransformHelper;
			
				String farsDir = project.getProperty("adf.staging.fars.dir");
				String appXmlPath = project.getProperty("oepe.adfmf.dotadf.applicationxml.path");
				String xslFile = project.getProperty("basedir") + "/xsl/preference_transform.xsl";
				String prefOutput = project.getProperty("adf.staging.pref.out");
				
				System.out.println(xslFile);
				System.out.println(appXmlPath);
				System.out.println(farsDir);
			
				try {
					TransformHelper.executeAndroidTransformation(appXmlPath, xslFile, farsDir, "PackageName", prefOutput);
				}catch (Throwable e){
					e.printStackTrace();
					throw e;
				}
			]]>
		</script>
	</target>
</project>
