unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Hartmut Goebel <h.goebel@goebel-consult.de>
To: guix-devel@gnu.org
Subject: Re: State of maven build system, gradle and Apache commens
Date: Fri, 2 Sep 2016 12:44:08 +0200	[thread overview]
Message-ID: <57C957F8.1020005@goebel-consult.de> (raw)
In-Reply-To: <idj1t12ivyp.fsf@bimsb-sys02.mdc-berlin.net>


[-- Attachment #1.1.1: Type: text/plain, Size: 1427 bytes --]

Am 02.09.2016 um 09:47 schrieb Ricardo Wurmus:
> This should not be on the CLASSPATH.  The “ant-build-system” sets
> CLASSPATH to the result of running “generate-classpath” on all inputs.
> Currently, all this does it add any and all “.jar” files to the
> CLASSPATH.  To keep “jar” itself out, the regular expression should be
> changed from
>
>    (find-files dir "\\.*jar$")
>
> to something like
>
>    (find-files dir "\\.jar$")

Thanks for this tip, it helped. (Will submit a patch later)

Meantime I managed to build commons-io, commons-cli, commons-lang and
commons-codec.

I found all of these need intervention for building, as there is no
"install" target (maybe I missed something). Echo of the packages
behaves a bit different (e.g. different directory names), while sharing
some common patterns. I'll attach my WIP for your convenience.

I failed building commons-logging, which requires e.g. javax.servelet,
the avalon-frameweork and much more.


-- 
Schönen Gruß
Hartmut Goebel
Dipl.-Informatiker (univ), CISSP, CSSLP, ISO 27001 Lead Implementer
Information Security Management, Security Governance, Secure Software
Development

Goebel Consult, Landshut
http://www.goebel-consult.de

Blog:
http://www.goebel-consult.de/blog/warum-sie-nicht-perl-programmiern-sollten
Kolumne:
http://www.cissp-gefluester.de/2011-08-horrorszenario-bring-your-own-device


[-- Attachment #1.1.2: Type: text/html, Size: 2645 bytes --]

[-- Attachment #1.2: commons-io.txt --]
[-- Type: text/plain, Size: 10863 bytes --]

(use-modules (guix)
             (guix build-system ant)
             (guix licenses)
(gnu packages base)
(gnu packages java))


(define (apache-commons-url projname version)
  ; todo: add option for passing the archive basename (default: projname)
  (let ((basename projname))
    (string-append
     "https://archive.apache.org/dist/commons/" projname "/source/"
     "commons-" basename "-" version "-src.tar.gz")))

; todo: how to use these as a phase, like
;  (replace 'install install-jars)
;  (add-after 'build build-javadoc)

(define* (install-jars #:key outputs #:allow-other-keys)
  (let ((share (string-append (assoc-ref outputs "out")
                              "/share/java")))
    (for-each (λ (f) (install-file f share))
              (find-files "." "\\.jar2$"))))

(define* (build-javadoc #:key (make-flags '()) #:allow-other-keys)
  (zero? (apply system* `("ant" "javadoc" ,@make-flags))))

;(define* (install-javadoc #:key outputs #:allow-other-keys)
;  (let ((docs (string-append (assoc-ref outputs "doc")
;                             "/share/doc/" ,name "-" ,version "/")))
;    (mkdir-p docs)
;    (copy-recursively "target/apidocs" docs)
;    ))

;(define-public java-commons-io-2.5
  (package
    (name "java-commons-io")
    (version "2.5")
    (source (origin
      (method url-fetch)
      (uri (apache-commons-url "io" version))
      (sha256 (base32 "0q5y41jrcjvx9hzs47x5kdhnasdy6rm4bzqd2jxl02w717m7a7v3"))))
    (build-system ant-build-system)
    (outputs '("out" "doc"))
    (arguments
     `(#:test-target "test"
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'symlink-junit.jar
           (lambda* (#:key inputs #:allow-other-keys)
             (let ((junit (assoc-ref inputs "java-junit"))
                   (junit-version "4.12")) ; from build.xml
               (mkdir-p "lib")
	       (symlink (string-append junit "/share/java/junit.jar")
			(string-append "lib/junit-" junit-version ".jar")))
             ))

         (add-after 'build 'build-javadoc ;build-javadoc)
           (lambda* (#:key (make-flags '()) #:allow-other-keys)
             (zero? (apply system* `("ant" "javadoc" ,@make-flags)))))
         (replace 'install ;install-jars)
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((share (string-append (assoc-ref outputs "out") 
                                         "/share/java")))
               (for-each (λ (f) (install-file f share))
                         (find-files "target" "\\.jar$")))))
         ; todo: install poms for maven
         (add-after 'install 'install-doc ;install-javadoc)
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((docs (string-append (assoc-ref outputs "doc")
                                        "/share/doc/" ,name "-" ,version "/")))
               (mkdir-p docs)
               (copy-recursively "target/apidocs" docs)
               )))

)))
    (native-inputs
     `(("java-junit" ,java-junit)
       ("(java-hamcrest-core" ,java-hamcrest-core)))
    (home-page "http://commons.apache.org/io/")
    (synopsis "Common useful IO related classes")
    (description "Commons-IO contains utility classes, stream implementations,
file filters and endian classes.")
    (license asl2.0)
);)

;(define-public java-commons-cli-2.5
  (package
    (name "java-commons-cli")
    (version "1.3.1")
    (source (origin
      (method url-fetch)
      (uri (apache-commons-url "cli" version))
      (sha256 (base32 "1fkjn552i12vp3xxk21ws4p70fi0lyjm004vzxsdaz7gdpgyxxyl"))))
    (build-system ant-build-system)
    ; todo: javadoc
    (arguments
     ; commons-cli does not provida a proper build.xml but seems to require
     ; maven for building
     `(#:jar-name (string-append "commons-cli-" ,version ".jar")
       #:phases
       (modify-phases %standard-phases
         ; todo: install poms for maven
         (delete 'check))))
    (native-inputs
     `(("java-junit" ,java-junit)))
    (home-page "http://commons.apache.org/cli/")
    (synopsis "parsing command line options")
    (description "Commons-CLI library provides an API for parsing command line
options passed to programs.  It's also able to print help messages detailing
the options available for a command line tool.")
    (license asl2.0)
);)

(package
    (name "java-commons-codec")
    (version "1.10")
    (source (origin
      (method url-fetch)
      (uri (apache-commons-url "codec" version))
      (sha256 (base32 "1w9qg30y4s0x8gnmr2fgj4lyplfn788jqxbcz27lf5kbr6n8xr65"))))
    (build-system ant-build-system)
    (outputs '("out" "doc"))
    (arguments
     ; commons-cli does not provida a proper build.xml but seems to require
     ; maven for building
     `(#:test-target "test"
       #:phases
       (modify-phases %standard-phases
         (delete 'check)
         (add-after 'build 'build-javadoc ;build-javadoc)
           (lambda* (#:key (make-flags '()) #:allow-other-keys)
             (zero? (apply system* `("ant" "javadoc" ,@make-flags)))))
         (replace 'install ;install-jars)
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((share (string-append (assoc-ref outputs "out") 
                                         "/share/java")))
               (for-each (λ (f) (install-file f share))
                         (find-files "dist" "\\.jar$")))))
         ; todo: install poms for maven
         (add-after 'install 'install-doc ;install-javadoc)
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((docs (string-append (assoc-ref outputs "doc")
                                        "/share/doc/" ,name "-" ,version "/")))
               (mkdir-p docs)
               (copy-recursively "dist/docs/api" docs)
               )))
)))
    (native-inputs
     `(("java-junit" ,java-junit)))
    (home-page "http://commons.apache.org/codec/")
    (synopsis "Common encoders and decoders such as Base64, Hex, Phonetic and URLs")
    (description "")
    (license asl2.0)
);)



;(define-public java-commons-lang-2.6
  (package
    (name "java-commons-lang")
    ; note: current release is lang3-3.4 (mind the different archive name)
    (version "2.6")
    (source (origin
      (method url-fetch)
      (uri (apache-commons-url "lang" version))
      (sha256 (base32 "1mxwagqadzx1b2al7i0z1v0r235aj2njdyijf02szq0vhmqrfiq5"))))
    (build-system ant-build-system)
    (outputs '("out" "doc"))
    (arguments
     `(#:test-target "test"
       #:phases
       (modify-phases %standard-phases
         (delete 'check) ; todo: make tests work
         (add-after 'unpack 'symlink-junit.jar
           (lambda* (#:key inputs #:allow-other-keys)
             (let ((junit (assoc-ref inputs "java-junit"))
                   (junit-version "4.12")) ; from build.xml
               (mkdir-p "lib")
	       (symlink (string-append junit "/share/java/junit.jar")
			(string-append "lib/junit-" junit-version ".jar")))
             ))
         (add-before 'check 'set-tzdir
           (lambda* (#:key inputs #:allow-other-keys)
             (setenv "TZDIR"
                     (string-append (assoc-ref inputs "tzdata")
                                    "/share/zoneinfo"))
             #t))
         (add-after 'build 'build-javadoc ;build-javadoc)
           (lambda* (#:key (make-flags '()) #:allow-other-keys)
             (zero? (apply system* `("ant" "javadoc" ,@make-flags)))))
         (replace 'install ;install-jars)
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((share (string-append (assoc-ref outputs "out") 
                                         "/share/java")))
               (for-each (λ (f) (install-file f share))
                         (find-files "target" "\\.jar$")))))
         ; todo: install poms for maven
         (add-after 'install 'install-doc ;install-javadoc)
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((docs (string-append (assoc-ref outputs "doc")
                                        "/share/doc/" ,name "-" ,version "/")))
               (mkdir-p docs)
               (copy-recursively "target/apidocs" docs)
               )))

)))
    (native-inputs
     `(("java-junit" ,java-junit)
       ; The test-suite tests some timezone dependant functions,
       ; thus tzdata needs to be installed.
       ("tzdata", tzdata)
       ;("(java-hamcrest-core" ,java-hamcrest-core)
))
    (home-page "http://commons.apache.org/lang/")
    (synopsis "Common useful IO related classes")
    (description "Commons-IO contains utility classes, stream implementations,
file filters and endian classes.")
    (license asl2.0)
);)



;(define-public java-commons-logging-2.6
  (package
    (name "java-commons-logging")
    (version "1.2")
    (source (origin
      (method url-fetch)
      (uri (apache-commons-url "logging" version))
      (sha256 (base32 "10bwcy5w8d7y39n0krlwhnp8ds3kj5zhmzj0zxnkw0qdlsjmsrj9"))))
    (build-system ant-build-system)
    (outputs '("out" "doc"))
    (arguments
     `(#:test-target "test"
       #:build-target "compile"
       #:phases
       (modify-phases %standard-phases
         (delete 'check) ; todo: make tests work
         (add-after 'unpack 'symlink-junit.jar
           (lambda* (#:key inputs #:allow-other-keys)
             (let ((junit (assoc-ref inputs "java-junit"))
                   (junit-version "4.12")) ; from build.xml
               (mkdir-p "lib")
	       (symlink (string-append junit "/share/java/junit.jar")
			(string-append "lib/junit-" junit-version ".jar")))
             ))
         (add-after 'build 'build-javadoc ;build-javadoc)
           (lambda* (#:key (make-flags '()) #:allow-other-keys)
             (zero? (apply system* `("ant" "javadoc" ,@make-flags)))))
         (replace 'install ;install-jars)
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((share (string-append (assoc-ref outputs "out") 
                                         "/share/java")))
               (for-each (λ (f) (install-file f share))
                         (find-files "target" "\\.jar$")))))
         ; todo: install poms for maven
         (add-after 'install 'install-doc ;install-javadoc)
           (lambda* (#:key outputs #:allow-other-keys)
             (let ((docs (string-append (assoc-ref outputs "doc")
                                        "/share/doc/" ,name "-" ,version "/")))
               (mkdir-p docs)
               (copy-recursively "target/apidocs" docs)
               )))

)))
    (native-inputs
     `(("java-junit" ,java-junit)
       ;avalon,
       ;("(java-hamcrest-core" ,java-hamcrest-core)
))
    (home-page "http://commons.apache.org/logging/")
    (synopsis "Common useful IO related classes")
    (description "Commons-IO contains utility classes, stream implementations,
file filters and endian classes.")
    (license asl2.0)
);)

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 2430 bytes --]

  reply	other threads:[~2016-09-02 10:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-01 11:36 State of maven build system, gradle and Apache commens Hartmut Goebel
2016-09-01 12:03 ` Ricardo Wurmus
2016-09-01 16:51   ` Hartmut Goebel
2016-09-02  7:47     ` Ricardo Wurmus
2016-09-02 10:44       ` Hartmut Goebel [this message]
2016-09-02 11:48         ` Ricardo Wurmus
2016-09-02 12:43           ` Hartmut Goebel
2016-09-02 14:24             ` Ricardo Wurmus
2016-09-05 22:15   ` Björn Höfling
2016-09-06  6:54     ` Ricardo Wurmus
2016-09-06  7:32     ` Hartmut Goebel
2016-09-06 20:43       ` Björn Höfling
2016-09-12 11:26       ` Java hand-over (was: State of maven build system, gradle and Apache commens) Hartmut Goebel

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=57C957F8.1020005@goebel-consult.de \
    --to=h.goebel@goebel-consult.de \
    --cc=guix-devel@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 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).