mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 15:36:20 -05:00
guix: ant: Optionally build with java modules.
Modules were introduced in Java 9 and are not supported by the default icedtea compiler, so this feature is disabled by default. * guix/build-system/ant.scm (ant-build): Add use-java-modules? parameter. * guix/build/ant-build-system.scm (default-build.xml) (configure): Use it. Change-Id: I3b99238e4cd262332fa5c818be1af5477c7374fd
This commit is contained in:
parent
5392d9db46
commit
00ec39a4e4
2 changed files with 25 additions and 8 deletions
|
@ -103,6 +103,7 @@ (define* (ant-build name inputs
|
|||
(build-target "jar")
|
||||
(jar-name #f)
|
||||
(main-class #f)
|
||||
(use-java-modules? #f)
|
||||
(test-include (list "**/*Test.java"))
|
||||
(test-exclude (list "**/Abstract*.java"))
|
||||
(source-dir "src")
|
||||
|
@ -131,6 +132,7 @@ (define builder
|
|||
#:build-target #$build-target
|
||||
#:jar-name #$jar-name
|
||||
#:main-class #$main-class
|
||||
#:use-java-modules? #$use-java-modules?
|
||||
#:test-include (list #$@test-include)
|
||||
#:test-exclude (list #$@test-exclude)
|
||||
#:source-dir #$source-dir
|
||||
|
|
|
@ -37,6 +37,7 @@ (define-module (guix build ant-build-system)
|
|||
|
||||
(define* (default-build.xml jar-name prefix #:optional
|
||||
(source-dir ".") (test-dir "./test") (main-class #f)
|
||||
(use-java-modules? #f)
|
||||
(test-include '("**/*Test.java"))
|
||||
(test-exclude '("**/Abstract*Test.java")))
|
||||
"Create a simple build.xml with standard targets for Ant."
|
||||
|
@ -65,7 +66,7 @@ (define* (default-build.xml jar-name prefix #:optional
|
|||
(value "first")))
|
||||
(property (@ (environment "env")))
|
||||
(path (@ (id "classpath"))
|
||||
(pathelement (@ (location "${env.CLASSPATH}"))))
|
||||
(pathelement (@ (path "${env.CLASSPATH}"))))
|
||||
|
||||
(target (@ (name "manifest"))
|
||||
(mkdir (@ (dir "${manifest.dir}")))
|
||||
|
@ -79,18 +80,30 @@ (define* (default-build.xml jar-name prefix #:optional
|
|||
(mkdir (@ (dir "${classes.dir}")))
|
||||
(javac (@ (includeantruntime "false")
|
||||
(srcdir ,source-dir)
|
||||
(destdir "${classes.dir}")
|
||||
(classpath (@ (refid "classpath"))))))
|
||||
(destdir "${classes.dir}"))
|
||||
,(if use-java-modules?
|
||||
`((modulepath (@ (refid "classpath"))))
|
||||
'())
|
||||
(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}"))))))
|
||||
,(if use-java-modules?
|
||||
`((classpath
|
||||
(pathelement
|
||||
(@ (path "${env.CLASSPATH}")))
|
||||
(pathelement
|
||||
(@ (location "${classes.dir}")))
|
||||
(pathelement
|
||||
(@ (location "${test.classes.dir}")))))
|
||||
'())
|
||||
(classpath
|
||||
(pathelement (@ (path "${env.CLASSPATH}")))
|
||||
(pathelement (@ (location "${classes.dir}")))
|
||||
(pathelement (@ (location "${test.classes.dir}"))))))
|
||||
|
||||
(target (@ (name "check")
|
||||
(depends "compile-tests"))
|
||||
|
@ -156,13 +169,15 @@ (define* (configure #:key inputs outputs (jar-name #f)
|
|||
(source-dir "src")
|
||||
(test-dir "src/test")
|
||||
(main-class #f)
|
||||
(use-java-modules? #f)
|
||||
(test-include '("**/*Test.java"))
|
||||
(test-exclude '("**/Abstract*.java")) #:allow-other-keys)
|
||||
(when jar-name
|
||||
(default-build.xml jar-name
|
||||
(string-append (assoc-ref outputs "out")
|
||||
"/share/java")
|
||||
source-dir test-dir main-class test-include test-exclude))
|
||||
source-dir test-dir main-class use-java-modules?
|
||||
test-include test-exclude))
|
||||
(setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
|
||||
(setenv "CLASSPATH" (generate-classpath inputs))
|
||||
#t)
|
||||
|
|
Loading…
Reference in a new issue