From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dzHt6-0003Kt-M5 for guix-patches@gnu.org; Tue, 03 Oct 2017 03:45:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dzHt2-0007Tt-NG for guix-patches@gnu.org; Tue, 03 Oct 2017 03:45:08 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:36374) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dzHt2-0007Te-Jp for guix-patches@gnu.org; Tue, 03 Oct 2017 03:45:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dzHt0-00068D-AQ for guix-patches@gnu.org; Tue, 03 Oct 2017 03:45:04 -0400 Subject: [bug#28663] [PATCH 01/22] guix: ant-build-system: Add main-class support. Resent-Message-ID: References: <20171001194418.67936d4e@lepiller.eu> <20171001175334.2694-1-julien@lepiller.eu> From: Roel Janssen Message-ID: <87tvzgsmla.fsf@gnu.org> In-reply-to: <20171001175334.2694-1-julien@lepiller.eu> Date: Tue, 03 Oct 2017 09:44:22 +0200 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: julien@lepiller.eu Cc: 28663@debbugs.gnu.org Hi Julien, Thanks for these patches! I will try to look all of them. julien@lepiller.eu writes: > From: Julien Lepiller > > * guix/build-system/ant.scm: New #:main-class argument > * guix/build/ant-build-system.scm: Generate a manifest file with > additional properties. > --- > guix/build-system/ant.scm | 2 ++ > guix/build/ant-build-system.scm | 27 ++++++++++++++++++++++----- > 2 files changed, 24 insertions(+), 5 deletions(-) > > diff --git a/guix/build-system/ant.scm b/guix/build-system/ant.scm > index e0870a605..a700230ec 100644 > --- a/guix/build-system/ant.scm > +++ b/guix/build-system/ant.scm > @@ -99,6 +99,7 @@ > (make-flags ''()) > (build-target "jar") > (jar-name #f) > + (main-class #f) > (source-dir "src") > (test-dir "src/test") > (phases '(@ (guix build ant-build-system) > @@ -130,6 +131,7 @@ > #:test-target ,test-target > #:build-target ,build-target > #:jar-name ,jar-name > + #:main-class ,main-class > #:source-dir ,source-dir > #:test-dir ,test-dir > #:phases ,phases > diff --git a/guix/build/ant-build-system.scm b/guix/build/ant-build-system.scm > index 4042630a1..727d3a3b2 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}") > + "") > + ""))))) I think this ----------------------------------> ^^ is not needed. Otherwise LGTM. > (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))) LGTM! Kind regards, Roel Janssen