unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Julien Lepiller <julien@lepiller.eu>
To: 66879@debbugs.gnu.org
Cc: "Björn Höfling" <bjoern.hoefling@bjoernhoefling.de>,
	"Julien Lepiller" <julien@lepiller.eu>
Subject: [bug#66879] [PATCH v2 2/5] guix: ant: Optionally build with java modules.
Date: Thu,  2 Nov 2023 07:50:10 +0100	[thread overview]
Message-ID: <22eb344213118281d23de74102ba475ca7f33b20.1698907813.git.julien@lepiller.eu> (raw)
In-Reply-To: <a56b64518165eee5dad9935874bba9aca60c47c8.1698907813.git.julien@lepiller.eu>

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
---
 guix/build-system/ant.scm       |  2 ++
 guix/build/ant-build-system.scm | 31 +++++++++++++++++++++++--------
 2 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/guix/build-system/ant.scm b/guix/build-system/ant.scm
index e191fd3c99..84bf951fab 100644
--- a/guix/build-system/ant.scm
+++ b/guix/build-system/ant.scm
@@ -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* (ant-build name inputs
                      #: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
diff --git a/guix/build/ant-build-system.scm b/guix/build/ant-build-system.scm
index d29912bf59..ced34177f4 100644
--- a/guix/build/ant-build-system.scm
+++ b/guix/build/ant-build-system.scm
@@ -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)
-- 
2.41.0





  reply	other threads:[~2023-11-02  6:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-01 12:53 [bug#66879] [PATCH] gnu: josm: Update to 18822 Julien Lepiller
2023-11-02  6:50 ` [bug#66879] [PATCH v2 1/5] gnu: openjdk9: Install default certificates Julien Lepiller
2023-11-02  6:50   ` Julien Lepiller [this message]
2023-11-02  6:50   ` [bug#66879] [PATCH v2 3/5] gnu: Add java-jakarta-json Julien Lepiller
2023-11-02  6:50   ` [bug#66879] [PATCH v2 4/5] gnu: Add java-parsson Julien Lepiller
2023-11-02  6:50   ` [bug#66879] [PATCH v2 5/5] gnu: josm: Update to 18822 Julien Lepiller
2023-11-02 10:00     ` Andreas Enge
2023-11-09 18:10       ` bug#66879: " Julien Lepiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=22eb344213118281d23de74102ba475ca7f33b20.1698907813.git.julien@lepiller.eu \
    --to=julien@lepiller.eu \
    --cc=66879@debbugs.gnu.org \
    --cc=bjoern.hoefling@bjoernhoefling.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).