xref: /aosp_15_r20/external/slf4j/integration/osgi-build.xml (revision d4cc4a21ff30dee54251e974d02850809c70b030)
1<project name="osgi-test" default="testAll">
2
3	<!--
4		This build file is usually run indirectly via Maven.
5
6		When running this build file through Ant directly, you must
7		define the currentVersion property on the command line, e.g.:
8
9		ant  -DcurrentVersion=1.5.4-SNAPSHOT
10	-->
11
12	<echo message="compile classpath: ${currentVersion}" />
13	<echo message="test classpath:    ${test_classpath}" />
14	<echo message="basedir:           ${basedir}" />
15
16  <echo message="ant.java.version:           ${ant.java.version}" />
17
18  <property name="iBundleJar" value="target/iBundle.jar"/>
19  <property name="bundlesDir" value="bundle"/>
20
21
22	<!-- this is really very ugly, but it's the only way to circumvent
23  	     http://jira.codehaus.org/browse/MANTRUN-95
24
25	<taskdef name="junit" classpath="${test_classpath}"
26           classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" />
27  -->
28
29  <condition property="jdk9">
30    <matches pattern="9.*" string="${ant.java.version}" />
31  </condition>
32
33	<path id="minimal">
34		<pathelement location="target/test-classes/" />
35	</path >
36
37	<target name="init">
38		<mkdir dir="target/unit-reports" />
39	</target>
40
41  <target name="createIBundle">
42    <mkdir dir="${bundlesDir}"/>
43    <jar destFile="${iBundleJar}"
44         manifest="src/IBUNDLE-META-INF/MANIFEST.MF"
45         basedir="target/test-classes/"
46         includes="integrator/**.class"/>
47
48  </target>
49
50	<target name="testAll" depends="init, createIBundle, nop, simple, jdk14">
51	</target>
52
53
54  <macrodef name="prepareOSGiHarness">
55    <attribute name="binding"/>
56    <sequential>
57      <delete>
58        <fileset dir="${bundlesDir}" includes="*.jar"/>
59      </delete>
60      <copy file="${iBundleJar}" todir="${bundlesDir}"/>
61      <copy file="../slf4j-api/target/slf4j-api-${currentVersion}.jar" todir="${bundlesDir}"/>
62      <copy file="../slf4j-@{binding}/target/slf4j-@{binding}-${currentVersion}.jar" todir="${bundlesDir}"/>
63      <echo>value of t = @{t}</echo>
64    </sequential>
65  </macrodef>
66
67
68   <!-- for some reason if mvn is invoked from the parent directory, junit gets
69        invoked from the parent dir, which messes up these tests. Hence, the
70        fork="yes" dir="${basedir}" -->
71
72<!--
73      <jvmarg line="MINUS_MINUSadd-opens java.base/java.net=ALL-UNNAMED"/>
74      <jvmarg line="MINUS_MINUSadd-opens java.base/java.security=ALL-UNNAMED"/>
75-->
76
77  <target name="nop" unless="jdk9">
78    <prepareOSGiHarness binding="nop"/>
79    <junit printsummary="yes" fork="yes" dir="${basedir}" haltonfailure="yes">
80			<classpath path="${test_classpath}"/>
81      <formatter type="plain" />
82      <test todir="target/unit-reports"
83            name="org.slf4j.test_osgi.BundleTest"
84            outfile="OSGI-nop" />
85    </junit>
86	</target>
87
88	<target name="simple" unless="jdk9">
89    <prepareOSGiHarness binding="simple"/>
90    <junit printsummary="yes" fork="yes" dir="${basedir}" haltonfailure="yes">
91			<classpath path="${test_classpath}"/>
92      <formatter type="plain" />
93      <test fork="yes" todir="target/unit-reports"
94            name="org.slf4j.test_osgi.BundleTest"
95            outfile="OSGI-simple" />
96    </junit>
97	</target>
98
99	<target name="jdk14" unless="jdk9">
100    <prepareOSGiHarness binding="jdk14"/>
101    <junit printsummary="yes" fork="yes" dir="${basedir}" haltonfailure="yes">
102			<classpath path="${test_classpath}"/>
103      <formatter type="plain" />
104      <test fork="yes" todir="target/unit-reports"
105            name="org.slf4j.test_osgi.BundleTest"
106            outfile="OSGI-jdk14"/>
107    </junit>
108	</target>
109
110</project>
111