From patchwork Thu Nov 2 06:50:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Lepiller X-Patchwork-Id: 55817 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9239827BBEA; Thu, 2 Nov 2023 06:52:09 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 8435227BBE9 for ; Thu, 2 Nov 2023 06:52:08 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qyRYG-0005Ck-D2; Thu, 02 Nov 2023 02:51:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qyRYA-0005AR-I0 for guix-patches@gnu.org; Thu, 02 Nov 2023 02:51:30 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qyRYA-0001PB-9X for guix-patches@gnu.org; Thu, 02 Nov 2023 02:51:30 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qyRYg-0004rh-S6; Thu, 02 Nov 2023 02:52:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66879] [PATCH v2 2/5] guix: ant: Optionally build with java modules. Resent-From: Julien Lepiller Original-Sender: "Debbugs-submit" Resent-CC: bjoern.hoefling@bjoernhoefling.de, julien@lepiller.eu, guix-patches@gnu.org Resent-Date: Thu, 02 Nov 2023 06:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66879 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 66879@debbugs.gnu.org Cc: =?utf-8?b?QmrDtnJuIEjDtmZsaW5n?= , Julien Lepiller X-Debbugs-Original-Xcc: =?utf-8?b?QmrDtnJuIEjDtmZsaW5n?= , Julien Lepiller Received: via spool by 66879-submit@debbugs.gnu.org id=B66879.169890788518612 (code B ref 66879); Thu, 02 Nov 2023 06:52:02 +0000 Received: (at 66879) by debbugs.gnu.org; 2 Nov 2023 06:51:25 +0000 Received: from localhost ([127.0.0.1]:53784 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qyRY0-0004px-Uu for submit@debbugs.gnu.org; Thu, 02 Nov 2023 02:51:25 -0400 Received: from lepiller.eu ([2a00:5884:8208::1]:44222 helo=hermes.lepiller.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qyRXr-0004pD-KG for 66879@debbugs.gnu.org; Thu, 02 Nov 2023 02:51:15 -0400 Received: from hermes.lepiller.eu (localhost [127.0.0.1]) by hermes.lepiller.eu (OpenSMTPD) with ESMTP id 406e33c1 for <66879@debbugs.gnu.org>; Thu, 2 Nov 2023 06:50:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=from:to :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=dkim; bh=4z51zshDp9ll2plgeopuz24ND meOJlB72NJ5nPE43oE=; b=IOOKA0YbG9QZKqhOamEJ42jYN2fnwQ3JKm5X3YpfL DLPoxKu6pH7VBSUsPOHk6MNZqpyKWfeFqoADgFH/0/tJC6yPZnCnM/UId+UHDJC7 wIawxzWMJBZLd8/SS0UB/ndWaEZE1LS6t0L6QGsBiKMLB68dEesRjsnsvkcOpz2O W4LJKqQgK/m4d1vmujAu+NbmjN8fOs/AspDhbkOyqC729hawqXNe84vp/2Uwwj3A d0aOLMk6LNsWRDDEtBmENS+Ib/wTkel5QQUGGQGuLlywf9Bw3t5a865ORPiDvTjo uIPWc2iAKadacpJGocKAxfJXvQ5ppy23aMVLjCQzwkqHg== Received: by hermes.lepiller.eu (OpenSMTPD) with ESMTPSA id 8d6b222d (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <66879@debbugs.gnu.org>; Thu, 2 Nov 2023 06:50:32 +0000 (UTC) From: Julien Lepiller Date: Thu, 2 Nov 2023 07:50:10 +0100 Message-ID: <22eb344213118281d23de74102ba475ca7f33b20.1698907813.git.julien@lepiller.eu> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches 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)