<property name="main.lib" location="lib"/>
<property name="ooxml.lib" location="ooxml-lib"/>
+ <property name="ooxml.test.lib" location="ooxml-testlib"/>
<property name="compile.lib" location="compile-lib"/>
<!-- compiler options options -->
<property name="dsig.sl4j-api.jar" location="${compile.lib}/slf4j-api-1.7.25.jar"/>
<property name="dsig.sl4j-api.url" value="${repository.m2}/maven2/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar"/>
- <!-- jars in the lib-ooxml directory, see the fetch-ooxml-jars target-->
+ <!-- jars in the ooxml-lib directory, see the fetch-ooxml-jars target-->
<property name="ooxml.curvesapi.jar" location="${ooxml.lib}/curvesapi-1.05.jar"/>
<property name="ooxml.curvesapi.url"
value="${repository.m2}/maven2/com/github/virtuald/curvesapi/1.05/curvesapi-1.05.jar"/>
<property name="ooxml.commons-compress.url"
value="${repository.m2}/maven2/org/apache/commons/commons-compress/1.18/commons-compress-1.18.jar"/>
+ <!-- jars in the ooxml-test-lib directory, see the fetch-ooxml-jars target-->
+ <property name="ooxml.test.reflections.jar" location="${ooxml.test.lib}/reflections.jar"/>
+ <property name="ooxml.test.reflections.url"
+ value="${repository.m2}/maven2/org/reflections/reflections/0.9.11/reflections-0.9.11.jar"/>
+ <property name="ooxml.test.guava.jar" location="${ooxml.test.lib}/guava.jar"/>
+ <property name="ooxml.test.guava.url"
+ value="${repository.m2}/maven2/com/google/guava/guava/20.0/guava-20.0.jar"/>
+ <property name="ooxml.test.javassist.jar" location="${ooxml.test.lib}/javassist.jar"/>
+ <property name="ooxml.test.javassist.url"
+ value="${repository.m2}/maven2/org/javassist/javassist/3.21.0-GA/javassist-3.21.0-GA.jar"/>
+
<!-- coverage libs -->
<property name="jacoco.zip" location="${main.lib}/jacoco-0.8.2.zip"/>
<property name="jacoco.url" value="${repository.m2}/maven2/org/jacoco/jacoco/0.8.2/jacoco-0.8.2.zip"/>
<path refid="ooxml.classpath"/>
<path refid="ooxml.xmlsec.classpath"/>
<path refid="test.jar.classpath"/>
+ <pathelement location="${ooxml.test.reflections.jar}"/>
+ <pathelement location="${ooxml.test.guava.jar}"/>
+ <pathelement location="${ooxml.test.javassist.jar}"/>
<pathelement location="${ooxml.output.dir}"/>
<pathelement location="${ooxml.output.test.dir}"/>
<pathelement location="${main.output.test.dir}"/>
<mkdir dir="${main.lib}"/>
<mkdir dir="${compile.lib}"/>
<mkdir dir="${ooxml.lib}"/>
+ <mkdir dir="${ooxml.test.lib}"/>
<delete verbose="true">
<fileset dir="${main.lib}">
<include name="ant-1.8*"/>
<available file="${ooxml.curvesapi.jar}"/>
<available file="${ooxml.xmlbeans.jar}"/>
<available file="${ooxml.commons-compress.jar}"/>
+ <available file="${ooxml.test.reflections.jar}"/>
+ <available file="${ooxml.test.guava.jar}"/>
+ <available file="${ooxml.test.javassist.jar}"/>
</and>
<isset property="disconnected"/>
</or>
</target>
<target name="fetch-ooxml-jars" depends="check-ooxml-jars" unless="ooxml.jars.present">
<mkdir dir="${ooxml.lib}"/>
+ <mkdir dir="${ooxml.test.lib}"/>
<downloadfile src="${ooxml.curvesapi.url}" dest="${ooxml.curvesapi.jar}"/>
<downloadfile src="${ooxml.xmlbeans.url}" dest="${ooxml.xmlbeans.jar}"/>
<downloadfile src="${ooxml.commons-compress.url}" dest="${ooxml.commons-compress.jar}"/>
+ <downloadfile src="${ooxml.test.reflections.url}" dest="${ooxml.test.reflections.jar}"/>
+ <downloadfile src="${ooxml.test.guava.url}" dest="${ooxml.test.guava.jar}"/>
+ <downloadfile src="${ooxml.test.javassist.url}" dest="${ooxml.test.javassist.jar}"/>
</target>
<target name="check-svn-jars">
<condition property="svn.jars.present">
import org.junit.runner.Description;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
+import org.reflections.Reflections;
/**
* Build a 'lite' version of the ooxml-schemas.jar
//see what classes from the ooxml-schemas.jar are loaded
System.out.println("Copying classes to " + _destDest);
Map<String, Class<?>> classes = getLoadedClasses(_ooxmlJar.getName());
+ Set<String> packages = new HashSet<>();
for (Class<?> cls : classes.values()) {
- String className = cls.getName();
- String classRef = className.replace('.', '/') + ".class";
- File destFile = new File(_destDest, classRef);
- IOUtils.copy(cls.getResourceAsStream('/' + classRef), destFile);
+ copyFile(cls);
+ packages.add(cls.getPackage().getName());
if(cls.isInterface()){
/// Copy classes and interfaces declared as members of this class
for(Class<?> fc : cls.getDeclaredClasses()){
- className = fc.getName();
- classRef = className.replace('.', '/') + ".class";
- destFile = new File(_destDest, classRef);
- IOUtils.copy(fc.getResourceAsStream('/' + classRef), destFile);
+ copyFile(fc);
+ }
+ }
+ }
+ for (String pkg : packages) {
+ Reflections reflections = new Reflections(pkg);
+ for (Class listClass : reflections.getSubTypesOf(List.class)) {
+ for (Class<?> compare : classes.values()){
+ if (listClass.getName().startsWith(compare.getName())) {
+ copyFile(listClass);
+ }
}
}
}
}
}
+ private void copyFile(Class<?> cls) throws IOException {
+ String className = cls.getName();
+ String classRef = className.replace('.', '/') + ".class";
+ File destFile = new File(_destDest, classRef);
+ IOUtils.copy(cls.getResourceAsStream('/' + classRef), destFile);
+ }
+
private static boolean checkForTestAnnotation(Class<?> testclass) {
for (Method m : testclass.getDeclaredMethods()) {
if(m.isAnnotationPresent(Test.class)) {