Skip to content

Commit 91b4684

Browse files
committed
Merge branch 'master' into datablock-wr-order
2 parents 7a5d21f + 6ceb6b4 commit 91b4684

File tree

2 files changed

+34
-8
lines changed

2 files changed

+34
-8
lines changed

ant_tasks/GetTestNameTask.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
}

build.xml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@
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"/>
@@ -53,6 +49,7 @@
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>
@@ -96,9 +93,14 @@
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>
@@ -213,5 +215,4 @@
213215
test.thread_pool_throughput,
214216
test.timer_queue,
215217
test.unit"/>
216-
217218
</project>

0 commit comments

Comments
 (0)