all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Julien Lepiller <julien@lepiller.eu>
To: 31333@debbugs.gnu.org
Subject: [bug#31333] [PATCH 01/22] gnu: Add groovy-java-bootstrap.
Date: Tue,  1 May 2018 17:44:28 +0200	[thread overview]
Message-ID: <20180501154449.3531-1-julien@lepiller.eu> (raw)
In-Reply-To: <20180501174136.1c411b1a@lepiller.eu>

* gnu/packages/groovy.scm: New file.
* gnu/packages/patches/groovy-Add-exceptionutilsgenerator.patch: New
file.
* gnu/local.mk (GNU_SYSTEM_MODULES, dist_patch_DATA): Add them.
---
 gnu/local.mk                                  |  2 +
 gnu/packages/groovy.scm                       | 95 ++++++++++++++++++
 .../groovy-Add-exceptionutilsgenerator.patch  | 96 +++++++++++++++++++
 3 files changed, 193 insertions(+)
 create mode 100644 gnu/packages/groovy.scm
 create mode 100644 gnu/packages/patches/groovy-Add-exceptionutilsgenerator.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index d425828bb..1b7f988b0 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -202,6 +202,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/graphics.scm			\
   %D%/packages/graphviz.scm			\
   %D%/packages/groff.scm			\
+  %D%/packages/groovy.scm			\
   %D%/packages/gsasl.scm			\
   %D%/packages/gstreamer.scm			\
   %D%/packages/gtk.scm				\
@@ -743,6 +744,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/graphite2-ffloat-store.patch		\
   %D%/packages/patches/grep-timing-sensitive-test.patch		\
   %D%/packages/patches/groff-source-date-epoch.patch		\
+  %D%/packages/patches/groovy-Add-exceptionutilsgenerator.patch	\
   %D%/packages/patches/gsl-test-i686.patch			\
   %D%/packages/patches/gspell-dash-test.patch			\
   %D%/packages/patches/guile-1.8-cpp-4.5.patch			\
diff --git a/gnu/packages/groovy.scm b/gnu/packages/groovy.scm
new file mode 100644
index 000000000..ee2894e30
--- /dev/null
+++ b/gnu/packages/groovy.scm
@@ -0,0 +1,95 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages groovy)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix utils)
+  #:use-module (guix build-system ant)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages java)
+  #:use-module (gnu packages xml))
+
+(define groovy-java-bootstrap
+  (package
+    (name "groovy-java-bootstrap")
+    (version "2.4.15")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/apache/groovy/archive/GROOVY_"
+                                  (string-map (lambda (x) (if (eq? x #\.) #\_ x)) version)
+                                  ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "19f3yd2z6jmz1xhwi5kkg1wmgbqkfs7qvd3rzb43xr3nffz8cisv"))
+              (patches
+                (search-patches
+                  "groovy-Add-exceptionutilsgenerator.patch"))))
+    (build-system ant-build-system)
+    (arguments
+     `(#:jar-name "groovy.jar"
+       #:source-dir "src/main:subprojects/groovy-test/src/main/java"
+       #:test-dir "src/test"
+       #:tests? #f
+       #:jdk ,icedtea-8
+       #:main-class "groovy.ui.GroovyMain"
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'fix-java8
+           ;; Fix "Reference to plus is ambiguous"
+           (lambda _
+             (substitute* "src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java"
+               (("toList\\(left\\)")
+                "(List<T>)toList(left)"))))
+         (add-before 'build 'generate-parsers
+           (lambda _
+             (with-directory-excursion "src/main/org/codehaus/groovy/antlr/java"
+               (zero? (system* "antlr" "java.g")))
+             (with-directory-excursion "src/main/org/codehaus/groovy/antlr"
+               (mkdir "parser")
+               (with-directory-excursion "parser"
+                 (zero? (system* "antlr" "../groovy.g"))))))
+         (add-before 'build 'generate-exception-utils
+           (lambda _
+             (system* "javac" "-cp" (getenv "CLASSPATH")
+                      "config/ant/src/org/codehaus/groovy/ExceptionUtilsGenerator.java")
+             (zero? (system* "java" "-cp" (string-append (getenv "CLASSPATH")
+                                                         ":config/ant/src")
+                             "org.codehaus.groovy.ExceptionUtilsGenerator"
+                             "build/classes/org/codehaus/groovy/runtime/ExceptionUtils.class")))))))
+    (native-inputs
+     `(("java-junit" ,java-junit)
+       ("java-hamcrest-core" ,java-hamcrest-core)
+       ("antlr2" ,antlr2)
+       ("java-jmock-1" ,java-jmock-1)
+       ("java-xmlunit-legacy" ,java-xmlunit-legacy)))
+    (inputs
+     `(("java-commons-cli" ,java-commons-cli)
+       ("java-asm" ,java-asm)
+       ("java-classpathx-servletapi" ,java-classpathx-servletapi)
+       ("java-xstream" ,java-xstream)
+       ("java-jansi" ,java-jansi)
+       ("java-jline-2" ,java-jline-2)))
+    (home-page "http://groovy-lang.org/")
+    (synopsis "Groovy's java bootstrap")
+    (description "This package contains the java bootstrap that is used to build
+groovy submodules.")
+    (license (list license:gpl2
+                   license:cddl1.1))))
diff --git a/gnu/packages/patches/groovy-Add-exceptionutilsgenerator.patch b/gnu/packages/patches/groovy-Add-exceptionutilsgenerator.patch
new file mode 100644
index 000000000..3c81f28cf
--- /dev/null
+++ b/gnu/packages/patches/groovy-Add-exceptionutilsgenerator.patch
@@ -0,0 +1,96 @@
+From 3dbdc68093e90f0ef9b77b70490d8e0b1dcfbf8f Mon Sep 17 00:00:00 2001
+From: Julien Lepiller <julien@lepiller.eu>
+Date: Sun, 17 Sep 2017 21:08:45 +0200
+Subject: [PATCH] Add ExceptionUtilsGenerator.java from previous versions
+
+This is replaced by a gradle task, but gradle depends on groovy, so we
+need so way to generate the file without gradle.
+---
+ .../codehaus/groovy/ExceptionUtilsGenerator.java   | 75 ++++++++++++++++++++++
+ 1 file changed, 75 insertions(+)
+ create mode 100644 config/ant/src/org/codehaus/groovy/ExceptionUtilsGenerator.java
+
+diff --git a/config/ant/src/org/codehaus/groovy/ExceptionUtilsGenerator.java b/config/ant/src/org/codehaus/groovy/ExceptionUtilsGenerator.java
+new file mode 100644
+index 0000000..41f006d
+--- /dev/null
++++ b/config/ant/src/org/codehaus/groovy/ExceptionUtilsGenerator.java
+@@ -0,0 +1,75 @@
++package org.codehaus.groovy;
++
++import org.objectweb.asm.*;
++
++import java.io.BufferedOutputStream;
++import java.io.File;
++import java.io.FileOutputStream;
++import java.io.IOException;
++import java.util.logging.Logger;
++
++public class ExceptionUtilsGenerator implements Opcodes {
++    private final static Logger LOGGER = Logger.getLogger(ExceptionUtilsGenerator.class.getName());
++
++	public static void main(String... args) {
++        if (args==null || args.length==0) {
++            throw new IllegalArgumentException("You must specify at least one file");
++        }
++
++		ClassWriter cw = new ClassWriter(0);
++        MethodVisitor mv;
++
++        cw.visit(V1_5, ACC_PUBLIC + ACC_SUPER, "org/codehaus/groovy/runtime/ExceptionUtils", null, "java/lang/Object", null);
++
++        cw.visitSource("ExceptionUtils.java", null);
++
++        mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
++        mv.visitCode();
++        Label l0 = new Label();
++        mv.visitLabel(l0);
++        mv.visitLineNumber(18, l0);
++        mv.visitVarInsn(ALOAD, 0);
++        mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
++        mv.visitInsn(RETURN);
++        Label l1 = new Label();
++        mv.visitLabel(l1);
++        mv.visitLocalVariable("this", "Lorg/codehaus/groovy/runtime/ExceptionUtils;", null, l0, l1, 0);
++        mv.visitMaxs(1, 1);
++        mv.visitEnd();
++
++        mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "sneakyThrow", "(Ljava/lang/Throwable;)V", null, null);
++        mv.visitCode();
++        Label l2 = new Label();
++        mv.visitLabel(l2);
++        mv.visitLineNumber(20, l2);
++        mv.visitVarInsn(ALOAD, 0);
++        mv.visitInsn(ATHROW);
++        Label l3 = new Label();
++        mv.visitLabel(l3);
++        mv.visitLocalVariable("e", "Ljava/lang/Throwable;", null, l2, l3, 0);
++        mv.visitMaxs(1, 1);
++        mv.visitEnd();
++
++        cw.visitEnd();
++
++        LOGGER.info("Generating ExceptionUtils");
++        byte[] bytes = cw.toByteArray();
++        for (String classFilePath : args) {
++            File classFile = new File(classFilePath);
++            if (classFile.getParentFile().exists() || classFile.getParentFile().mkdirs()) {
++                try {
++                    if (classFile.exists()) {
++                        classFile.delete();
++                    }
++                    BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(classFile));
++                    bos.write(bytes);
++                    bos.close();
++                } catch (IOException e) {
++                    LOGGER.warning("Unable to write file "+classFile);
++                }
++            } else {
++                LOGGER.warning("Unable to create directory "+classFile.getParentFile());
++            }
++        }
++	}
++}
+-- 
+2.14.1
+
-- 
2.17.0

  reply	other threads:[~2018-05-01 15:46 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-01 15:41 [bug#31333] [PATCH] Add groovy Julien Lepiller
2018-05-01 15:44 ` Julien Lepiller [this message]
2018-05-01 15:44   ` [bug#31333] [PATCH 02/22] gnu: Add groovy-bootstrap Julien Lepiller
2018-05-06 17:48     ` Danny Milosavljevic
2018-05-06 18:12       ` Julien Lepiller
2018-05-01 15:44   ` [bug#31333] [PATCH 03/22] gnu: Add groovy-tests-bootstrap Julien Lepiller
2018-05-07 18:01     ` Danny Milosavljevic
2018-05-01 15:44   ` [bug#31333] [PATCH 04/22] gnu: Add groovy-test Julien Lepiller
2018-05-07 18:01     ` Danny Milosavljevic
2018-05-01 15:44   ` [bug#31333] [PATCH 05/22] gnu: Add groovy-xml Julien Lepiller
2018-05-07 18:03     ` Danny Milosavljevic
2018-05-01 15:44   ` [bug#31333] [PATCH 06/22] gnu: Add groovy-templates Julien Lepiller
2018-05-07 18:03     ` Danny Milosavljevic
2018-05-01 15:44   ` [bug#31333] [PATCH 07/22] gnu: Add groovy-groovydoc Julien Lepiller
2018-05-07 18:04     ` Danny Milosavljevic
2018-05-01 15:44   ` [bug#31333] [PATCH 08/22] gnu: Add groovy-ant Julien Lepiller
2018-05-07 18:05     ` Danny Milosavljevic
2018-05-07 19:04       ` Julien Lepiller
2018-05-01 15:44   ` [bug#31333] [PATCH 09/22] gnu: Add groovy-bsf Julien Lepiller
2018-05-07 18:07     ` Danny Milosavljevic
2018-05-01 15:44   ` [bug#31333] [PATCH 10/22] gnu: Add groovy-swing Julien Lepiller
2018-05-07 18:09     ` Danny Milosavljevic
2018-05-01 15:44   ` [bug#31333] [PATCH 11/22] gnu: Add groovy-console Julien Lepiller
2018-05-07 18:10     ` Danny Milosavljevic
2018-05-01 15:44   ` [bug#31333] [PATCH 12/22] gnu: Add groovy-docgenerator Julien Lepiller
2018-05-07 18:10     ` Danny Milosavljevic
2018-05-01 15:44   ` [bug#31333] [PATCH 13/22] gnu: Add groovy-groovysh Julien Lepiller
2018-05-07 18:11     ` Danny Milosavljevic
2018-05-01 15:44   ` [bug#31333] [PATCH 14/22] gnu: Add groovy-jmx Julien Lepiller
2018-05-07 18:13     ` Danny Milosavljevic
2018-05-01 15:44   ` [bug#31333] [PATCH 15/22] gnu: Add groovy-json Julien Lepiller
2018-05-07 18:13     ` Danny Milosavljevic
2018-05-01 15:44   ` [bug#31333] [PATCH 16/22] gnu: Add groovy-jsr223 Julien Lepiller
2018-05-07 18:14     ` Danny Milosavljevic
2018-05-01 15:44   ` [bug#31333] [PATCH 17/22] gnu: Add groovy-nio Julien Lepiller
2018-05-07 18:15     ` Danny Milosavljevic
2018-05-01 15:44   ` [bug#31333] [PATCH 18/22] gnu: Add groovy-servlet Julien Lepiller
2018-05-07 18:15     ` Danny Milosavljevic
2018-05-01 15:44   ` [bug#31333] [PATCH 19/22] gnu: Add groovy-sql Julien Lepiller
2018-05-07 18:16     ` Danny Milosavljevic
2018-05-01 15:44   ` [bug#31333] [PATCH 20/22] gnu: Add groovy-testng Julien Lepiller
2018-05-07 18:16     ` Danny Milosavljevic
2018-05-01 15:44   ` [bug#31333] [PATCH 21/22] gnu: Add groovy-macro Julien Lepiller
2018-05-07 18:17     ` Danny Milosavljevic
2018-05-01 15:44   ` [bug#31333] [PATCH 22/22] gnu: Add groovy Julien Lepiller
2018-05-07 19:23     ` Danny Milosavljevic
2018-05-07 17:58   ` [bug#31333] [PATCH 01/22] gnu: Add groovy-java-bootstrap Danny Milosavljevic
2018-05-07 19:25   ` Björn Höfling
2018-05-09 11:40 ` bug#31333: [PATCH] Add groovy 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

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

  git send-email \
    --in-reply-to=20180501154449.3531-1-julien@lepiller.eu \
    --to=julien@lepiller.eu \
    --cc=31333@debbugs.gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.