;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2019 Julien Lepiller ;;; ;;; 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 . (define-module (more packages intellij) #:use-module (ice-9 match) #:use-module (srfi srfi-1) #:use-module ((guix licenses) #:prefix license:) #:use-module (gnu packages) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix svn-download) #:use-module (guix cvs-download) #:use-module (guix utils) #:use-module (guix build-system ant) #:use-module (guix build-system gnu) #:use-module (guix build-system trivial) #:use-module (gnu packages autotools) #:use-module (gnu packages base) #:use-module (gnu packages batik) #:use-module (gnu packages compression) #:use-module (gnu packages docbook) #:use-module (gnu packages java) #:use-module (gnu packages java-compression) #:use-module (gnu packages maven) #:use-module (gnu packages perl) #:use-module (gnu packages web) #:use-module (gnu packages xml) #:use-module (more packages java)) (define intellij-community-2013-commit "8bc091c3131a888b5400c63a9e51eb0bc7fbe0fb") (define intellij-community-2013-version (git-version "0.0.0" "0" intellij-community-2013-commit)) ;; The release page on github is a mess (define intellij-community-version "182.5262.8") (define intellij-community-commit "e2a5d9273ec0b3b656c0dad0c9b07e5f85bbd61a") (define (get-intellij-community-source commit version hash) (origin (method git-fetch) (uri (git-reference (url "https://github.com/JetBrains/intellij-community") (commit commit))) (file-name (git-file-name "intellij" version)) (sha256 (base32 hash)) (modules '((guix build utils))) (snippet `(begin (for-each (lambda (file) (if (file-exists? file) (delete-file-recursively file))) (append (find-files "." "^lib$" #:directories? #t) (find-files "." "^bin$" #:directories? #t))) (delete-file "build.xml") (for-each delete-file (find-files "." ".*.jar$")) #t)))) (define intellij-community-source (get-intellij-community-source intellij-community-commit intellij-community-version "17qzhh2kw6sxwkyj7ng7hrpbcf2rjs2xjbsrg1bgkg90r5kb8sm4")) (define intellij-community-2013-source (get-intellij-community-source intellij-community-2013-commit intellij-community-2013-version "0z5rq713lf7q2x0c0sb0r1ha2pszcyygddh7r12wyzf5p0iiy1im")) (define (strip-intellij-variant variant-property base) (package (inherit base) (properties (alist-delete variant-property (package-properties base))))) (define (package-intellij-for-explicit-version version source variant-property base) (define variant (assq-ref (package-properties base) variant-property)) (define (map-inputs inputs) (map (lambda (input) (match input ((name input) (if (and (> (string-length name) 13) (equal? (substring name 0 13) "java-intellij")) `(,name ,(package-intellij-for-explicit-version version source variant-property input)) `(,name ,input))))) inputs)) (cond (variant => force) (else (package (inherit base) (version version) (source source) (propagated-inputs (map-inputs (package-propagated-inputs base))) (inputs (map-inputs (package-inputs base))))))) (define-public (intellij-2013-package base) (package-intellij-for-explicit-version intellij-community-2013-version intellij-community-2013-source 'intellij-2013-variant base)) (define-public (strip-2013-variant base) (strip-intellij-variant 'intellij-2013-variant base)) (define-public java-intellij-compiler-instrumentation-util (package (name "java-intellij-compiler-instrumentation-util") (version intellij-community-version) (source intellij-community-source) (build-system ant-build-system) (arguments `(#:source-dir "java/compiler/instrumentation-util/src" #:jar-name "instrumentation-util.jar" ;; No test #:tests? #f #:phases (modify-phases %standard-phases (add-before 'build 'fix-imports (lambda _ (substitute* (find-files "java/compiler/instrumentation-util/src" ".*.java") (("org.jetbrains.org.objectweb") "org.objectweb") ;; As in build/asm/3_api_version.patch (("API_VERSION") "ASM6"))))))) (inputs `(("java-asm" ,java-asm))) (home-page "https://github.com/JetBrains/intellij-community") (synopsis "") (description "") (license license:asl2.0))) (define-public java-intellij-compiler-javac2 (package (name "java-intellij-compiler-javac2") (version intellij-community-version) (source intellij-community-source) (build-system ant-build-system) (arguments `(#:source-dir "java/compiler/javac2/src" #:jar-name "javac2.jar" ;; No test #:tests? #f)) (inputs `(("java-intellij-compiler-instrumentation-util" ,java-intellij-compiler-instrumentation-util))) (home-page "https://github.com/JetBrains/intellij-community") (synopsis "") (description "") (license license:asl2.0))) (define-public java-intellij-platform-forms-rt (package (name "java-intellij-platform-forms-rt") (version intellij-community-version) (source intellij-community-source) (build-system ant-build-system) (arguments `(#:source-dir "platform/forms_rt/src" #:jar-name "forms_rt.jar" ;; No test #:tests? #f)) (home-page "https://github.com/JetBrains/intellij-community") (synopsis "") (description "") (license license:asl2.0))) (define-public java-intellij-platform-util-rt (package (name "java-intellij-platform-util-rt") (version intellij-community-version) (source intellij-community-source) (build-system ant-build-system) (arguments `(#:source-dir "platform/util-rt/src" #:jar-name "intellij.platform.util-rt.jar" #:jdk ,icedtea-7 ;; No test #:tests? #f)) (inputs `(("java-jetbrains-annotations" ,java-jetbrains-annotations))) (home-page "https://github.com/JetBrains/intellij-community") (synopsis "") (description "") (license license:asl2.0))) (define-public java-intellij-platform-util (package (name "java-intellij-platform-util") (version intellij-community-version) (source intellij-community-source) (build-system ant-build-system) (arguments `(#:source-dir "platform/util/src" #:jar-name "intellij.platform.util.jar" ;; No test #:tests? #f #:phases (modify-phases %standard-phases (add-before 'build 'copy-resources (lambda _ (copy-recursively "platform/util/resources" "build/classes") #t)) (add-before 'build 'remove-apple (lambda _ (delete-file "platform/util/src/com/intellij/util/AppleHiDPIScaledImage.java") (delete-file "platform/util/src/com/intellij/util/ui/IsRetina.java") #t))))) (propagated-inputs `(("java-batik-1.7" ,java-batik-1.7) ("java-commons-compress" ,java-commons-compress) ("java-imagescalr" ,java-imagescalr) ("java-intellij-platform-util-rt" ,java-intellij-platform-util-rt) ("java-jakarta-oro" ,java-jakarta-oro) ("java-jdom-for-intellij" ,java-jdom-for-intellij) ("java-jetbrains-annotations" ,java-jetbrains-annotations) ("java-log4j-api" ,java-log4j-api) ("java-log4j-1.2-api" ,java-log4j-1.2-api) ("java-lz4" ,java-lz4) ("java-native-access" ,java-native-access) ("java-native-access-platform" ,java-native-access-platform) ("java-trove4j-intellij" ,java-trove4j-intellij) ("java-w3c-svg" ,java-w3c-svg))) (properties `((intellij-2013-variant . ,(delay java-intellij-platform-util-2013)))) (home-page "https://github.com/JetBrains/intellij-community") (synopsis "") (description "") (license license:asl2.0))) (define-public java-intellij-platform-util-2013 (let ((base (intellij-2013-package (strip-2013-variant java-intellij-platform-util)))) (package (inherit base) (propagated-inputs (append (alist-delete "java-jdom-for-intellij" (package-propagated-inputs base)) `(("java-batik" ,java-batik) ("java-iq80-snappy" ,java-iq80-snappy) ("java-jdom1-for-intellij" ,java-jdom1-for-intellij)))) (arguments (substitute-keyword-arguments (package-arguments base) ((#:phases phases) `(modify-phases ,phases (add-before 'build 'fix-implicit-conversions (lambda _ (substitute* "build.xml" (("