[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/22: ant-build-system: Add default "check" target.
From: |
Ricardo Wurmus |
Subject: |
02/22: ant-build-system: Add default "check" target. |
Date: |
Wed, 10 May 2017 11:59:38 -0400 (EDT) |
rekado pushed a commit to branch master
in repository guix.
commit 52a791f50ffe460e2985dc356f08789d2d6f9f12
Author: Ricardo Wurmus <address@hidden>
Date: Mon Oct 17 19:32:14 2016 +0200
ant-build-system: Add default "check" target.
* guix/build-system/ant.scm (ant-build): Change default test target to
"check"; add "test-dir" argument.
* guix/build/ant-build-system.scm (default-build.xml): Add "test-dir"
argument; add ant targets "compile-tests" and "check".
(configure): Add "test-dir" argument; pass it to "default-build.xml".
---
guix/build-system/ant.scm | 4 +++-
guix/build/ant-build-system.scm | 40 +++++++++++++++++++++++++++++++++++++---
2 files changed, 40 insertions(+), 4 deletions(-)
diff --git a/guix/build-system/ant.scm b/guix/build-system/ant.scm
index a309a0c..bf2f3b4 100644
--- a/guix/build-system/ant.scm
+++ b/guix/build-system/ant.scm
@@ -93,12 +93,13 @@
(define* (ant-build store name inputs
#:key
(tests? #t)
- (test-target "tests")
+ (test-target "check")
(configure-flags ''())
(make-flags ''())
(build-target "jar")
(jar-name #f)
(source-dir "src")
+ (test-dir "src/test")
(phases '(@ (guix build ant-build-system)
%standard-phases))
(outputs '("out"))
@@ -128,6 +129,7 @@
#:build-target ,build-target
#:jar-name ,jar-name
#:source-dir ,source-dir
+ #:test-dir ,test-dir
#:phases ,phases
#:outputs %outputs
#:search-paths ',(map search-path-specification->sexp
diff --git a/guix/build/ant-build-system.scm b/guix/build/ant-build-system.scm
index 8ec7a94..4042630 100644
--- a/guix/build/ant-build-system.scm
+++ b/guix/build/ant-build-system.scm
@@ -36,7 +36,7 @@
;; Code:
(define* (default-build.xml jar-name prefix #:optional
- (source-dir "."))
+ (source-dir ".") (test-dir "./test"))
"Create a simple build.xml with standard targets for Ant."
(call-with-output-file "build.xml"
(lambda (port)
@@ -48,6 +48,10 @@
(value "${basedir}/build/jar")))
(property (@ (name "dist.dir")
(value ,prefix)))
+ (property (@ (name "test.home")
+ (value ,test-dir)))
+ (property (@ (name "test.classes.dir")
+ (value "${basedir}/build/test-classes")))
;; respect the CLASSPATH environment variable
(property (@ (name "build.sysclasspath")
@@ -63,6 +67,35 @@
(destdir "${classes.dir}")
(classpath (@ (refid "classpath"))))))
+ (target (@ (name "compile-tests"))
+ (mkdir (@ (dir "${test.classes.dir}")))
+ (javac (@ (includeantruntime "false")
+ (srcdir ,test-dir)
+ (destdir "${test.classes.dir}"))
+ (classpath
+ (pathelement (@ (path "${env.CLASSPATH}")))
+ (pathelement (@ (location "${classes.dir}")))
+ (pathelement (@ (location
"${test.classes.dir}"))))))
+
+ (target (@ (name "check")
+ (depends "compile-tests"))
+ (mkdir (@ (dir "${test.home}/test-reports")))
+ (junit (@ (printsummary "true")
+ (showoutput "true")
+ (fork "yes")
+ (haltonfailure "yes"))
+ (classpath
+ (pathelement (@ (path "${env.CLASSPATH}")))
+ (pathelement (@ (location
"${test.home}/resources")))
+ (pathelement (@ (location "${classes.dir}")))
+ (pathelement (@ (location
"${test.classes.dir}"))))
+ (formatter (@ (type "plain")
+ (usefile "true")))
+ (batchtest (@ (fork "yes")
+ (todir
"${test.home}/test-reports"))
+ (fileset (@ (dir
"${test.home}/java"))
+ (include (@ (name
"**/*Test.java" )))))))
+
(target (@ (name "jar")
(depends "compile"))
(mkdir (@ (dir "${jar.dir}")))
@@ -99,12 +132,13 @@ to the default GNU unpack strategy."
((assq-ref gnu:%standard-phases 'unpack) #:source source)))
(define* (configure #:key inputs outputs (jar-name #f)
- (source-dir "src") #:allow-other-keys)
+ (source-dir "src")
+ (test-dir "src/test") #:allow-other-keys)
(when jar-name
(default-build.xml jar-name
(string-append (assoc-ref outputs "out")
"/share/java")
- source-dir))
+ source-dir test-dir))
(setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
(setenv "CLASSPATH" (generate-classpath inputs)))
- 01/22: ant-build-system: Allow specifying source directory., (continued)
- 01/22: ant-build-system: Allow specifying source directory., Ricardo Wurmus, 2017/05/10
- 07/22: gnu: Add java-cglib., Ricardo Wurmus, 2017/05/10
- 10/22: gnu: Add java-jopt-simple., Ricardo Wurmus, 2017/05/10
- 12/22: gnu: Add java-commons-math3., Ricardo Wurmus, 2017/05/10
- 20/22: gnu: Add java-commons-daemon., Ricardo Wurmus, 2017/05/10
- 08/22: gnu: Add java-objenesis., Ricardo Wurmus, 2017/05/10
- 06/22: gnu: Add java-asm., Ricardo Wurmus, 2017/05/10
- 21/22: gnu: Add java-jmock-1., Ricardo Wurmus, 2017/05/10
- 04/22: gnu: Add java-plexus-utils., Ricardo Wurmus, 2017/05/10
- 05/22: gnu: Add java-plexus-interpolation., Ricardo Wurmus, 2017/05/10
- 02/22: ant-build-system: Add default "check" target.,
Ricardo Wurmus <=
- 13/22: gnu: Add java-jmh., Ricardo Wurmus, 2017/05/10
- 15/22: gnu: Add java-commons-io., Ricardo Wurmus, 2017/05/10
- 16/22: gnu: Add java-commons-lang., Ricardo Wurmus, 2017/05/10
- 19/22: gnu: Add java-commons-codec., Ricardo Wurmus, 2017/05/10
- 09/22: gnu: Add java-easymock., Ricardo Wurmus, 2017/05/10
- 11/22: gnu: java-hamcrest-core: Install all jars without version suffix., Ricardo Wurmus, 2017/05/10
- 18/22: gnu: Add java-commons-cli., Ricardo Wurmus, 2017/05/10
- 14/22: gnu: Add java-commons-collections4., Ricardo Wurmus, 2017/05/10
- 03/22: guix: Add java-utils., Ricardo Wurmus, 2017/05/10
- 22/22: gnu: java-hamcrest-core: Declare test target., Ricardo Wurmus, 2017/05/10