summaryrefslogtreecommitdiffstats
path: root/docs/test/antScriptTest/build.xml
blob: 7f875625c4d165394ba66fb0fbdda43b8ae209c6 (plain)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<project default="build-test" basedir=".">

	<target name="info">
	<echo>
	This script verifies that the example build script in the
	Ant section of the development environment guide works.
	
	The target "build-test" should be exactly what's copied from
	the development environment guide, as rendered.
	
	To setup for a given version of AspectJ, either build the
	tools distribution or define the variable aspectj.home.
	
	This should build the two input jars and then run the
	test, which builds and runs an application.  It should 
	request incremental input (press "q{enter}" to quit)
	and emit the text:

     [java] called Util.utility("persistMe shouting!")
     [java] set persistMe to PERSISTME SHOUTING!

	Use the "clean" target to remove generated files.
	
	When running from eclipse, set fork.iajc="true" and
	change build-test iajc call to avoid incremental mode.
	
</echo>
	</target>
	
	<target name="init">
		<property name="fork.iajc"
			value="false"/>			
		<property name="home.dir"
			location="${basedir}"/>
		<property name="aspectj.modules.dir"
			location="../../.."/>
		<property name="aspectj.home"
			location="${aspectj.modules.dir}/aj-build/dist/tools"/>

		<available property="aspectj.home.available"
			file="${aspectj.home}/lib/aspectjtools.jar"/>

		<available property="aspectjtools.jar.available"
			file="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
		<available property="aspectjrt.jar.available"
			file="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>

		<available property="persist.jar.available"
			file="${home.dir}/ec/int/persist.jar"/>
		<available property="module.jar.available"
			file="${home.dir}/build/module.jar"/>
	</target>
	
	<target name="taskdef" depends="init,local.aspectj.setup">
		<taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
			<classpath>
				<path location="${home.dir}/tools/aspectj/lib/aspectjtools.jar"/>
			</classpath>
		</taskdef>	
	</target>

	<target name="clean" depends="init">
		<delete quiet="on">
			<fileset dir="${home.dir}/build/binary-input"
		    	excludes="ignore.txt"/>
			<fileset dir="${home.dir}"
				includes="ec/int/persist.jar,
						build/module.jar,
						output/application.jar,
						tools/aspectj/lib/aspectj*.jar"/>
		</delete>
	</target>
	
	<target name="local.aspectj.setup" depends="init"
		unless="aspectjtools.jar.available,aspectjrt.jar.available">
		<fail unless="aspectj.home.available"
			message="define or build aspectj.home: ${aspectj.home}"/>
		<mkdir dir="${home.dir}/tools/aspectj/lib/"/>
		<copy todir="${home.dir}/tools/aspectj/lib"
			filtering="off">
			<fileset dir="${aspectj.home}/lib" includes="aspectj*.jar"/>
		</copy>
		<available property="aspectjtools.jar.available"
			file="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
		<available property="aspectjrt.jar.available"
			file="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
	</target>
	
	<target name="setup" depends="init,taskdef,local.aspectj.setup"
		unless="module.jar.available,persist.jar.available">
		<iajc outJar="${home.dir}/ec/int/persist.jar"
			failonerror="true"
			fork="${fork.iajc}"
			sourceroots="${home.dir}/ec/int/src"
			classpath="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
		<iajc outJar="${home.dir}/build/module.jar"
			failonerror="true"
			fork="${fork.iajc}"
			sourceroots="${home.dir}/ec/module/src"
			classpath="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
		<mkdir dir="${home.dir}/build/binary-input"/>
	    <iajc destdir="${home.dir}/build/binary-input"
			failonerror="true"
			fork="${fork.iajc}"
			sourceroots="${home.dir}/ec/inpathDirSrc"
			classpath="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
	</target>
	
  <target name="build-test" depends="init,taskdef,setup"
  	description="test Ant script from the devguide">
  	<!-- copy below from the Ant section of the rendered devguide -->
  	<!-- in eclipse, must run forked and not incremental -->

      <iajc outjar="${home.dir}/output/application.jar" 
              sourceRootCopyFilter="**/CVS/*,**/*.java"
              inpathDirCopyFilter="**/CVS/*,**/*.java,**/*.class"
              incremental="true" >
        <sourceroots>
          <pathelement location="${home.dir}/ec/project/src"/>
          <pathelement location="${home.dir}/ec/project/testsrc"/>
        </sourceroots>
        <inpath>
          <pathelement location="${home.dir}/build/module.jar"/>
          <pathelement location="${home.dir}/build/binary-input"/>
        </inpath>
        <aspectpath>
          <pathelement location="${home.dir}/ec/int/persist.jar"/>
        </aspectpath>
        <classpath>
          <pathelement location="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
        </classpath>
      </iajc>
      
      <java classname="org.smart.app.Main">
        <classpath>
          <pathelement location="${home.dir}/tools/aspectj/lib/aspectjrt.jar"/>
          <pathelement location="${home.dir}/ec/int/persist.jar"/>
          <pathelement location="${home.dir}/output/application.jar"/>
        </classpath>
      </java>
    </target>
</project>