aboutsummaryrefslogtreecommitdiff
path: root/guix/build/ant-build-system.scm
diff options
context:
space:
mode:
authorJulien Lepiller <julien@lepiller.eu>2017-09-05 19:04:38 +0200
committerJulien Lepiller <julien@lepiller.eu>2017-10-03 21:37:47 +0200
commit8df1faa047870c51954275664e8e7efc94e6fc56 (patch)
tree4987e1636a97c41f33bf8d07e799f8edafd6ee2a /guix/build/ant-build-system.scm
parent4d6801b735550ee804454a6d4f0d44c3372e0ae9 (diff)
downloadgnu-guix-8df1faa047870c51954275664e8e7efc94e6fc56.tar
gnu-guix-8df1faa047870c51954275664e8e7efc94e6fc56.tar.gz
guix: ant-build-system: Add main-class support.
* guix/build-system/ant.scm: New #:main-class argument * guix/build/ant-build-system.scm: Generate a manifest file with additional properties. * doc/guix.texi (Build Systems): Document it.
Diffstat (limited to 'guix/build/ant-build-system.scm')
-rw-r--r--guix/build/ant-build-system.scm27
1 files changed, 22 insertions, 5 deletions
diff --git a/guix/build/ant-build-system.scm b/guix/build/ant-build-system.scm
index 4042630a10..727d3a3b25 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 ".") (test-dir "./test"))
+ (source-dir ".") (test-dir "./test") (main-class #f))
"Create a simple build.xml with standard targets for Ant."
(call-with-output-file "build.xml"
(lambda (port)
@@ -44,6 +44,10 @@
`(project (@ (basedir "."))
(property (@ (name "classes.dir")
(value "${basedir}/build/classes")))
+ (property (@ (name "manifest.dir")
+ (value "${basedir}/build/manifest")))
+ (property (@ (name "manifest.file")
+ (value "${manifest.dir}/MANIFEST.MF")))
(property (@ (name "jar.dir")
(value "${basedir}/build/jar")))
(property (@ (name "dist.dir")
@@ -60,6 +64,17 @@
(path (@ (id "classpath"))
(pathelement (@ (location "${env.CLASSPATH}"))))
+ (target (@ (name "manifest"))
+ (mkdir (@ (dir "${manifest.dir}")))
+ (echo (@ (file "${manifest.file}")
+ (message ,(string-append
+ (if main-class
+ (string-append
+ "Main-Class: " main-class
+ "${line.separator}")
+ "")
+ "")))))
+
(target (@ (name "compile"))
(mkdir (@ (dir "${classes.dir}")))
(javac (@ (includeantruntime "false")
@@ -97,10 +112,11 @@
(include (@ (name "**/*Test.java" )))))))
(target (@ (name "jar")
- (depends "compile"))
+ (depends "compile, manifest"))
(mkdir (@ (dir "${jar.dir}")))
(exec (@ (executable "jar"))
- (arg (@ (line ,(string-append "-cf ${jar.dir}/" jar-name
+ (arg (@ (line ,(string-append "-cmf ${manifest.file} "
+ "${jar.dir}/" jar-name
" -C ${classes.dir} ."))))))
(target (@ (name "install"))
@@ -133,12 +149,13 @@ to the default GNU unpack strategy."
(define* (configure #:key inputs outputs (jar-name #f)
(source-dir "src")
- (test-dir "src/test") #:allow-other-keys)
+ (test-dir "src/test")
+ (main-class #f) #:allow-other-keys)
(when jar-name
(default-build.xml jar-name
(string-append (assoc-ref outputs "out")
"/share/java")
- source-dir test-dir))
+ source-dir test-dir main-class))
(setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
(setenv "CLASSPATH" (generate-classpath inputs)))