File tree Expand file tree Collapse file tree 2 files changed +34
-8
lines changed Expand file tree Collapse file tree 2 files changed +34
-8
lines changed Original file line number Diff line number Diff line change 1+ import java .util .Map ;
2+ import org .apache .tools .ant .BuildException ;
3+ import org .apache .tools .ant .Project ;
4+ import org .apache .tools .ant .Task ;
5+
6+ public class GetTestNameTask extends Task {
7+ private String m_propertyName ;
8+
9+ public void setPropertyName (String propertyName ) {
10+ m_propertyName = propertyName ;
11+ }
12+
13+ public void execute () throws BuildException {
14+ final String owningTargetName = getOwningTarget ().getName ();
15+ final String prefix = "test." ;
16+ if (!owningTargetName .startsWith (prefix )) {
17+ throw new BuildException ("target name must has prefix '" + prefix + "'" );
18+ }
19+ if (m_propertyName == null ) {
20+ throw new BuildException ("missing 'propertyName' attribite value" );
21+ }
22+ final Project project = getProject ();
23+ project .setProperty (m_propertyName , owningTargetName .substring (prefix .length ()));
24+ }
25+ }
Original file line number Diff line number Diff line change 3535 <macrodef name =" run-test" >
3636 <sequential >
3737 <property name =" testName" value =" " />
38- <script language =" javascript" > <![CDATA[
39- targetName = self.getOwningTarget().toString();
40- project.setProperty( "testName", targetName.slice(5) );
41- ]]>
42- </script >
38+ <get-test-name propertyName =" testName" />
4339 <java classname =" org.jsl.tests.${ testName } .Main" fork =" true" >
4440 <classpath >
4541 <pathelement location =" ${ build } /classes" />
5349 </macrodef >
5450
5551 <target name =" init" >
52+ <mkdir dir =" ${ build } /ant_tasks" />
5653 <mkdir dir =" ${ build } /classes" />
5754 <mkdir dir =" ${ dist } /lib" />
5855 </target >
9693 <copy file =" pom.xml" tofile =" ${ dist } /lib/${ ant.project.name } -${ version } .pom" />
9794 </target >
9895
99- <target name =" compile_tests" depends =" compile" >
96+ <target name =" compile_ant_tasks" depends =" init" >
97+ <javac srcdir =" ant_tasks" destdir =" ${ build } /ant_tasks" includeAntRuntime =" true" debug =" true" />
98+ <taskdef name =" get-test-name" classname =" GetTestNameTask" classpath =" ${ build } /ant_tasks" />
99+ </target >
100+
101+ <target name =" compile_tests" depends =" compile, compile_ant_tasks" >
100102 <mkdir dir =" ${ build } /tests" />
101- <javac srcdir =" tests/src" destdir =" ${ build } /tests" includeantruntime =" false" debug =" true" >
103+ <javac srcdir =" tests/src" destdir =" ${ build } /tests" includeAntRuntime =" false" debug =" true" >
102104 <classpath >
103105 <pathelement location =" ${ build } /classes" />
104106 </classpath >
213215 test.thread_pool_throughput,
214216 test.timer_queue,
215217 test.unit" />
216-
217218</project >
You can’t perform that action at this time.
0 commit comments