[PATCH] guix: ant-build-system: Install resources.

  • Open
  • quality assurance status badge
Details
One participant
  • Danny Milosavljevic
Owner
unassigned
Submitted by
Danny Milosavljevic
Severity
normal
D
D
Danny Milosavljevic wrote on 7 Oct 2018 11:45
(address . guix-patches@gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20181007094549.4289-1-dannym@scratchpost.org
* guix/build/ant-build-system.scm (default-build.xml): Install resources.
---
guix/build/ant-build-system.scm | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)

Toggle diff (50 lines)
diff --git a/guix/build/ant-build-system.scm b/guix/build/ant-build-system.scm
index d79a2d55e..cb3164211 100644
--- a/guix/build/ant-build-system.scm
+++ b/guix/build/ant-build-system.scm
@@ -38,7 +38,8 @@
(define* (default-build.xml jar-name prefix #:optional
(source-dir ".") (test-dir "./test") (main-class #f)
(test-include '("**/*Test.java"))
- (test-exclude '("**/Abstract*Test.java")))
+ (test-exclude '("**/Abstract*Test.java"))
+ (source-resource-dir #f))
"Create a simple build.xml with standard targets for Ant."
(call-with-output-file "build.xml"
(lambda (port)
@@ -81,6 +82,14 @@
(destdir "${classes.dir}")
(classpath (@ (refid "classpath"))))))
+ (target (@ (name "add-resources")
+ (depends "compile"))
+ ,(if source-resource-dir
+ `(copy (@ (todir "${classes.dir}"))
+ (fileset (@ (dir ,source-resource-dir))
+ (include (@ (name "**/*")))))
+ ""))
+
(target (@ (name "compile-tests"))
(mkdir (@ (dir "${test.classes.dir}")))
(javac (@ (includeantruntime "false")
@@ -116,7 +125,7 @@
test-exclude)))))
(target (@ (name "jar")
- (depends "compile, manifest"))
+ (depends "compile, add-resources, manifest"))
(mkdir (@ (dir "${jar.dir}")))
(exec (@ (executable "jar"))
(arg (@ (line ,(string-append "-cmf ${manifest.file} "
@@ -162,7 +171,10 @@ to the default GNU unpack strategy."
(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 test-include test-exclude
+ (if (file-exists? "src/main/resources")
+ "src/main/resources"
+ #f)))
(setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
(setenv "CLASSPATH" (generate-classpath inputs))
#t)
?