>From 9b82f683a34f9179b18e4b6a04652888ba347c68 Mon Sep 17 00:00:00 2001 From: Julien Lepiller
Date: Thu, 13 Apr 2017 20:18:15 +0200 Subject: [PATCH 1/4] guix: ant-build-system: Add src-dir parameter. * guix/build-system/ant.scm (ant-build): Add src-dir parameter. * guix/build/ant-build-system.scm (configure): Add src-dir parameter. (default-build.xml): Use it. * doc/guix.texi: Document it. --- doc/guix.texi | 6 +++++- guix/build-system/ant.scm | 2 ++ guix/build/ant-build-system.scm | 9 +++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 07f52becf..b9dfc03e1 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3321,7 +3321,11 @@ parameters, respectively. When the original package does not provide a suitable Ant build file, the parameter @code{#:jar-name} can be used to generate a minimal Ant build file @file{build.xml} with tasks to build the specified jar -archive. +archive. By default, @file{src} will be used as the source directory. +The parameter @code{#:src-dir} can be used to change the default source +directory. This parameter accepts the ant syntax for @code{srcdir} +parameters, allowing to specify more than one directory by separating +each directory with a semicolon (as in @code{"src1:src2"}). The parameter @code{#:build-target} can be used to specify the Ant task that should be run during the @code{build} phase. By default the diff --git a/guix/build-system/ant.scm b/guix/build-system/ant.scm index 550f92bc7..cd544ad0d 100644 --- a/guix/build-system/ant.scm +++ b/guix/build-system/ant.scm @@ -98,6 +98,7 @@ (make-flags ''()) (build-target "jar") (jar-name #f) + (src-dir "src") (phases '(@ (guix build ant-build-system) %standard-phases)) (outputs '("out")) @@ -126,6 +127,7 @@ #:test-target ,test-target #:build-target ,build-target #:jar-name ,jar-name + #:src-dir ,src-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 00a4a46d8..e2f3d4a9e 100644 --- a/guix/build/ant-build-system.scm +++ b/guix/build/ant-build-system.scm @@ -35,7 +35,7 @@ ;; ;; Code: -(define (default-build.xml jar-name prefix) +(define (default-build.xml jar-name prefix src-dir) "Create a simple build.xml with standard targets for Ant." (call-with-output-file "build.xml" (lambda (port) @@ -58,7 +58,7 @@ (target (@ (name "compile")) (mkdir (@ (dir "${classes.dir}"))) (javac (@ (includeantruntime "false") - (srcdir "src") + (srcdir ,src-dir) (destdir "${classes.dir}") (classpath (@ (refid "classpath")))))) @@ -97,12 +97,13 @@ to the default GNU unpack strategy." ;; Use GNU unpack strategy for things that aren't jar archives. ((assq-ref gnu:%standard-phases 'unpack) #:source source))) -(define* (configure #:key inputs outputs (jar-name #f) +(define* (configure #:key inputs outputs (jar-name #f) (src-dir "src") #:allow-other-keys) (when jar-name (default-build.xml jar-name (string-append (assoc-ref outputs "out") - "/share/java"))) + "/share/java") + src-dir)) (setenv "JAVA_HOME" (assoc-ref inputs "jdk")) (setenv "CLASSPATH" (generate-classpath inputs))) -- 2.12.2