_addPrivateLibs.xml 2.01 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
<?xml version="1.0" encoding="UTF-8" ?> 
<project name="_addPrivateLibs" default="build">


<!--	INTERNAL: _addPrivateLibs
		Check, whether there are privare jars that should be added to the classpath.
		Those must be located under resouces/libs or libs in the project directory.
		Note that jars under resources/libs will be included in the resulting jar.
-->
<target name="_addPrivateLibs">
	<!-- look for jar files in the projects resources libs directory -->
	<path id="idPrivatelibs">
		<fileset dir="resources/libs">
			<include name="*.jar" />
		</fileset>
	</path>

	<trycatch>
		<try>
			<!-- try to access the private jars. If those don't exist, the following code is *not* executed -->
			<var name="tmp" value="${toString:idPrivatelibs}" />
			<!-- add them to the classpath file -->
			<for list="${tmp}" delimiter=":" param="jfile">
			<sequential>
				<propertyregex	override="yes" 
								property="tmp"
								input="@{jfile}"
								regexp=".*[/\\]([^/\\]*)"
								select="\1" />
				<echo file="${path.gen.classpathfile}" append="true">projects/${projectname}/resources/libs/${tmp}${line.separator}</echo>
			</sequential>
			</for>
		</try>
		<catch>
			<!-- if no lib available then do nothing -->
		</catch>
	</trycatch>


	<path id="idPrivateExternallibs">
		<fileset dir="libs">
			<include name="*.jar" />
		</fileset>

	</path>

	<trycatch>
		<try>
			<!-- try to access the private jars. If those don't exist, the following code is *not* executed -->
			<var name="tmp" value="${toString:idPrivateExternallibs}" />
			<!-- add them to the classpath file -->
			<for list="${tmp}" delimiter=":" param="jfile">
			<sequential>
				<propertyregex	override="yes" 
								property="tmp"
								input="@{jfile}"
								regexp=".*[/\\]([^/\\]*)"
								select="\1" />
				<echo file="${path.gen.classpathfile}" append="true">projects/${projectname}/libs/${tmp}${line.separator}</echo>
			</sequential>
			</for>
		</try>
		<catch>
			<!-- if no lib available then do nothing -->
		</catch>
	</trycatch>

</target>

</project>