[bug#36695,3/3] guix: ant-build-system: Use absolute path as base-dir.
diff mbox series

Message ID 20190716201020.3303-3-h.goebel@crazy-compilers.com
State New
Headers show
Series
  • Enhancemante for the ant-build-system
Related show

Commit Message

Hartmut Goebel July 16, 2019, 8:10 p.m. UTC
This allows to chdir into some sub-project prior to building.

* guix/build/ant-build-system.scm (default-build.xml): Add parameter.
  (configure): Pass current directory as base-dir to default-build.xml.
---
 guix/build/ant-build-system.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Julien Lepiller July 17, 2019, 8:17 a.m. UTC | #1
Le 16 juillet 2019 22:10:20 GMT+02:00, Hartmut Goebel <h.goebel@crazy-compilers.com> a écrit :
>This allows to chdir into some sub-project prior to building.
>
>* guix/build/ant-build-system.scm (default-build.xml): Add parameter.
>  (configure): Pass current directory as base-dir to default-build.xml.
>---
> guix/build/ant-build-system.scm | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/guix/build/ant-build-system.scm
>b/guix/build/ant-build-system.scm
>index 49549c1b4b..3fe7808db5 100644
>--- a/guix/build/ant-build-system.scm
>+++ b/guix/build/ant-build-system.scm
>@@ -36,6 +36,7 @@
> ;; Code:
> 
> (define* (default-build.xml jar-name prefix #:optional
>+                            (base-dir ".")
>                   (source-dir ".") (test-dir "./test") (main-class #f)
>                             (test-include '("**/*Test.java"))
>                             (test-exclude '("**/Abstract*Test.java")))
>@@ -43,7 +44,7 @@
>   (call-with-output-file "build.xml"
>     (lambda (port)
>       (sxml->xml
>-       `(project (@ (basedir ".")
>+       `(project (@ (basedir ,base-dir)
>                     (name ,jar-name))
>                  (property (@ (name "classes.dir")
>                               (value "${basedir}/build/classes")))
>@@ -162,6 +163,7 @@ to the default GNU unpack strategy."
>     (default-build.xml jar-name
>                        (string-append (assoc-ref outputs "out")
>                                       "/share/java")
>+                       (getcwd)
>             source-dir test-dir main-class test-include test-exclude))
>   (setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
>   (setenv "CLASSPATH" (generate-classpath inputs))

I don't understand the point of that patch. I can already add a chdir phase just after unpack to do just that. What does this patch give us?

The other two patches lgtm, but I think they need to go to staging instead of master, because they will cause a rebuild of every java package.
Hartmut Goebel July 19, 2019, 10:43 a.m. UTC | #2
Am 17.07.19 um 10:17 schrieb Julien Lepiller:
> I don't understand the point of that patch. I can already add a chdir phase just after unpack to do just that. What does this patch give us?

This patch only ensures the build-directory is an absolute path instead
of a relative one. It does not enable to specify the build-dir as an
option to the ant-build-system. Thus it is different from using a chdir
phase.

As this patch is some years old now, I can't remember the exact case.
AFAIR the relative path did not work for some packages for some reason.

Please let me know if I should include this one, too. (No reasoning
necessary.)

(I'm just waiting for your answer to avoid rebuilding all java-packages
twice - even on staging)
Julien Lepiller July 19, 2019, 10:56 a.m. UTC | #3
Le 19 juillet 2019 12:43:50 GMT+02:00, Hartmut Goebel <h.goebel@crazy-compilers.com> a écrit :
>Am 17.07.19 um 10:17 schrieb Julien Lepiller:
>> I don't understand the point of that patch. I can already add a chdir
>phase just after unpack to do just that. What does this patch give us?
>
>This patch only ensures the build-directory is an absolute path instead
>of a relative one. It does not enable to specify the build-dir as an
>option to the ant-build-system. Thus it is different from using a chdir
>phase.
>
>As this patch is some years old now, I can't remember the exact case.
>AFAIR the relative path did not work for some packages for some reason.
>
>Please let me know if I should include this one, too. (No reasoning
>necessary.)
>
>(I'm just waiting for your answer to avoid rebuilding all java-packages
>twice - even on staging)

I'm fine with this patch, but I still don't see the point.
Julien Lepiller July 19, 2019, 10:57 a.m. UTC | #4
Le 19 juillet 2019 12:43:50 GMT+02:00, Hartmut Goebel <h.goebel@crazy-compilers.com> a écrit :
>Am 17.07.19 um 10:17 schrieb Julien Lepiller:
>> I don't understand the point of that patch. I can already add a chdir
>phase just after unpack to do just that. What does this patch give us?
>
>This patch only ensures the build-directory is an absolute path instead
>of a relative one. It does not enable to specify the build-dir as an
>option to the ant-build-system. Thus it is different from using a chdir
>phase.
>
>As this patch is some years old now, I can't remember the exact case.
>AFAIR the relative path did not work for some packages for some reason.
>
>Please let me know if I should include this one, too. (No reasoning
>necessary.)
>
>(I'm just waiting for your answer to avoid rebuilding all java-packages
>twice - even on staging)

I'm fine with this patch, but I still don't see the point.
Hartmut Goebel July 19, 2019, 11:04 a.m. UTC | #5
Am 19.07.19 um 12:56 schrieb Julien Lepiller:
> I'm fine with this patch, but I still don't see the point.

So I'll leave it out - it can still be fixed if it actually occurs in a
current package.

Patch
diff mbox series

diff --git a/guix/build/ant-build-system.scm b/guix/build/ant-build-system.scm
index 49549c1b4b..3fe7808db5 100644
--- a/guix/build/ant-build-system.scm
+++ b/guix/build/ant-build-system.scm
@@ -36,6 +36,7 @@ 
 ;; Code:
 
 (define* (default-build.xml jar-name prefix #:optional
+                            (base-dir ".")
                             (source-dir ".") (test-dir "./test") (main-class #f)
                             (test-include '("**/*Test.java"))
                             (test-exclude '("**/Abstract*Test.java")))
@@ -43,7 +44,7 @@ 
   (call-with-output-file "build.xml"
     (lambda (port)
       (sxml->xml
-       `(project (@ (basedir ".")
+       `(project (@ (basedir ,base-dir)
                     (name ,jar-name))
                  (property (@ (name "classes.dir")
                               (value "${basedir}/build/classes")))
@@ -162,6 +163,7 @@  to the default GNU unpack strategy."
     (default-build.xml jar-name
                        (string-append (assoc-ref outputs "out")
                                       "/share/java")
+                       (getcwd)
                        source-dir test-dir main-class test-include test-exclude))
   (setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
   (setenv "CLASSPATH" (generate-classpath inputs))