]> source.dussan.org Git - vaadin-framework.git/commitdiff
Support for running sass junit tests
authorArtur Signell <artur@vaadin.com>
Thu, 30 Aug 2012 09:51:25 +0000 (12:51 +0300)
committerArtur Signell <artur@vaadin.com>
Sun, 9 Sep 2012 08:23:03 +0000 (11:23 +0300)
common.xml
theme-compiler/build.xml
theme-compiler/ivy.xml

index 2e9341c4236c2f12f0ec932ab3f3be07b45fced8..0d6c0bb3b28b3e6868f741699a47c1a2c9a97df4 100644 (file)
@@ -81,7 +81,7 @@
                <property name="src" location="{$result.dir}/../src" />
 
                <union id="jar.files">
-                       <fileset dir="${classes}" excludes="${classes.exclude}" />
+                       <fileset dir="${tests.classes}" excludes="${tests.classes.exclude}" />
                        <fileset dir="${src}" excludes="${jar.exclude}" />
                        <fileset refid="common.files.for.all.jars" />
                        <fileset file="${pom.xml}" />
                </javac>
        </target>
 
+       <target name="tests.run" depends="tests.compile">
+               <fail unless="module.name" message="No module name given" />
+
+               <property name="result.dir" location="result" />
+               <property name="classes" location="${result.dir}/classes" />
+               <property name="tests.classes" location="${result.dir}/tests/classes" />
+
+               <junit printsummary="withOutAndErr">
+                       <formatter usefile="false" type="plain" />
+
+                       <classpath location="${tests.classes}" />
+                       <classpath location="${classes}" />
+                       <classpath refid="classpath.compile.custom" />
+                       <classpath refid="classpath.tests.dependencies" />
+
+                       <batchtest fork="yes">
+                               <fileset dir="${tests.classes}">
+                               </fileset>
+                       </batchtest>
+               </junit>
+       </target>
+
+       <target name="tests.compile" description="Compiles tests" depends="compile, dependencies.tests">
+               <fail unless="module.name" message="No module name given" />
+               <property name="result.dir" location="result" />
+               <property name="base.dir" location="${result.dir}/.." />
+               <property name="tests.src" location="${base.dir}/tests/src" />
+               <property name="tests.resources" location="${base.dir}/tests/resources" />
+               <property name="tests.classes" location="${result.dir}/tests/classes" />
+               <property name="classes" location="${result.dir}/classes" />
+
+               <mkdir dir="${tests.classes}" />
+
+               <javac srcdir="${tests.src}" destdir="${tests.classes}" source="${vaadin.java.version}" target="${vaadin.java.version}" debug="true" encoding="UTF-8" includeantruntime="false">
+                       <classpath refid="classpath.tests.dependencies" />
+                       <classpath location="${classes}" />
+                       <classpath refid="classpath.tests.custom" />
+               </javac>
+               <copy todir="${tests.classes}">
+                       <fileset dir="${tests.resources}" />
+               </copy>
+       </target>
+
        <target name="dependencies" description="Resolves dependencies needed by this module">
                <ivy:resolve resolveid="common" conf="build, build-provided" />
                <ivy:cachepath pathid="classpath.compile.dependencies" conf="build, build-provided" />
        </target>
 
+       <target name="dependencies.tests" description="Resolves dependencies needed by tests">
+               <ivy:resolve resolveid="common" conf="tests" />
+               <ivy:cachepath pathid="classpath.tests.dependencies" conf="tests" />
+       </target>
+
        <target name="clean">
                <fail unless="result.dir" message="No result.dir parameter given" />
                <delete dir="${result.dir}" />
index 9c3e5f46ced1085953982e05380f0ef18d7c35c6..71b1a6ae3ef6871b5fa4ebf950284561fd775997 100644 (file)
        <property name="module.name" value="vaadin-theme-compiler" />
        <property name="result.dir" value="result" />
        <path id="classpath.compile.custom" />
+       <path id="classpath.tests.custom" />
 
        <property name="classes.exclude" value="com/vaadin/buildhelpers/**" />
 
        <target name="jar">
                <antcall target="common.jar">
-                       <reference torefid="extra.jar.includes" refid="empty.reference"/>
+                       <reference torefid="extra.jar.includes" refid="empty.reference" />
                </antcall>
        </target>
        <target name="publish-local" depends="jar">
@@ -26,4 +27,9 @@
        <target name="clean">
                <antcall target="common.clean" />
        </target>
+
+       <target name="tests">
+               <antcall target="common.tests.run" />
+       </target>
+
 </project>
\ No newline at end of file
index 45a7fd918a59d2b786062ec01ac07a3a6558b43b..be6a1d702136ade612656b9b76f55569c1b9b3a4 100644 (file)
@@ -10,6 +10,7 @@
         <conf name="build" />
         <conf name="build-provided" />
         <conf name="ide" />
+        <conf name="tests" />
     </configurations>
     <publications>
         <artifact type="jar" />
         <artifact type="javadoc" ext="jar" />
     </publications>
     <dependencies defaultconf="*->default">
-        <dependency org="org.w3c.css" name="sac" rev="1.3"/>
-        <dependency org="milyn" name="flute" rev="1.3" conf="*->default"/>
+        <dependency org="org.w3c.css" name="sac" rev="1.3" />
+        <dependency org="milyn" name="flute" rev="1.3" conf="*->default" />
         <dependency org="javax.servlet" name="servlet-api"
             rev="2.5" />
         <dependency org="com.carrotsearch" name="smartsprites"
             rev="0.2.3-itmill" />
         <dependency org="com.vaadin" name="vaadin-buildhelpers"
             rev="${vaadin.version}" conf="build"></dependency>
-
+        <dependency org="junit" name="junit" rev="4.5"
+            conf="tests -> master" />
+        <dependency org="net.sourceforge.cssparser" name="cssparser"
+            rev="0.9.5" conf="tests,ide->master" />
     </dependencies>
 
 </ivy-module>