guix-more/more/packages/intellij.scm

intellij.scm

1
;;; GNU Guix --- Functional package management for GNU
2
;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu>
3
;;;
4
;;; This file is part of GNU Guix.
5
;;;
6
;;; GNU Guix is free software; you can redistribute it and/or modify it
7
;;; under the terms of the GNU General Public License as published by
8
;;; the Free Software Foundation; either version 3 of the License, or (at
9
;;; your option) any later version.
10
;;;
11
;;; GNU Guix is distributed in the hope that it will be useful, but
12
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
;;; GNU General Public License for more details.
15
;;;
16
;;; You should have received a copy of the GNU General Public License
17
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
18
19
(define-module (more packages intellij)
20
  #:use-module (ice-9 match)
21
  #:use-module (srfi srfi-1)
22
  #:use-module ((guix licenses) #:prefix license:)
23
  #:use-module (gnu packages)
24
  #:use-module (guix packages)
25
  #:use-module (guix download)
26
  #:use-module (guix git-download)
27
  #:use-module (guix svn-download)
28
  #:use-module (guix cvs-download)
29
  #:use-module (guix utils)
30
  #:use-module (guix build-system ant)
31
  #:use-module (guix build-system gnu)
32
  #:use-module (guix build-system trivial)
33
  #:use-module (gnu packages autotools)
34
  #:use-module (gnu packages base)
35
  #:use-module (gnu packages batik)
36
  #:use-module (gnu packages compression)
37
  #:use-module (gnu packages docbook)
38
  #:use-module (gnu packages java)
39
  #:use-module (gnu packages java-compression)
40
  #:use-module (gnu packages maven)
41
  #:use-module (gnu packages perl)
42
  #:use-module (gnu packages web)
43
  #:use-module (gnu packages xml)
44
  #:use-module (more packages java))
45
46
(define intellij-community-2013-commit "8bc091c3131a888b5400c63a9e51eb0bc7fbe0fb")
47
(define intellij-community-2013-version (git-version "0.0.0" "0"
48
                                                     intellij-community-2013-commit))
49
50
;; The release page on github is a mess
51
(define intellij-community-version "182.5262.8")
52
(define intellij-community-commit "e2a5d9273ec0b3b656c0dad0c9b07e5f85bbd61a")
53
(define (get-intellij-community-source commit version hash)
54
  (origin
55
    (method git-fetch)
56
    (uri (git-reference
57
           (url "https://github.com/JetBrains/intellij-community")
58
           (commit commit)))
59
    (file-name (git-file-name "intellij" version))
60
    (sha256 (base32 hash))
61
    (modules '((guix build utils)))
62
    (snippet
63
      `(begin
64
         (for-each
65
           (lambda (file)
66
             (if (file-exists? file)
67
               (delete-file-recursively file)))
68
           (append (find-files "." "^lib$" #:directories? #t)
69
                   (find-files "." "^bin$" #:directories? #t)))
70
         (delete-file "build.xml")
71
         (for-each delete-file (find-files "." ".*.jar$"))
72
         #t))))
73
74
(define intellij-community-source (get-intellij-community-source
75
                                    intellij-community-commit
76
                                    intellij-community-version
77
                                    "17qzhh2kw6sxwkyj7ng7hrpbcf2rjs2xjbsrg1bgkg90r5kb8sm4"))
78
(define intellij-community-2013-source (get-intellij-community-source
79
                                        intellij-community-2013-commit
80
                                        intellij-community-2013-version
81
                                        "0z5rq713lf7q2x0c0sb0r1ha2pszcyygddh7r12wyzf5p0iiy1im"))
82
83
(define (strip-intellij-variant variant-property base)
84
  (package
85
    (inherit base)
86
    (properties (alist-delete variant-property (package-properties base)))))
87
88
(define (package-intellij-for-explicit-version version source variant-property base)
89
  (define variant
90
    (assq-ref (package-properties base) variant-property))
91
92
  (define (map-inputs inputs)
93
    (map (lambda (input)
94
           (match input
95
             ((name input)
96
              (if (and
97
                    (> (string-length name) 13)
98
                    (equal? (substring name 0 13) "java-intellij"))
99
                  `(,name ,(package-intellij-for-explicit-version
100
                             version source variant-property input))
101
                  `(,name ,input)))))
102
         inputs))
103
104
  (cond
105
    (variant => force)
106
    (else
107
      (package
108
        (inherit base)
109
        (version version)
110
        (source source)
111
        (propagated-inputs (map-inputs (package-propagated-inputs base)))
112
        (inputs (map-inputs (package-inputs base)))))))
113
114
(define-public (intellij-2013-package base)
115
  (package-intellij-for-explicit-version intellij-community-2013-version
116
                                         intellij-community-2013-source
117
                                         'intellij-2013-variant
118
                                         base))
119
(define-public (strip-2013-variant base)
120
  (strip-intellij-variant 'intellij-2013-variant base))
121
122
(define-public java-intellij-compiler-instrumentation-util
123
  (package
124
    (name "java-intellij-compiler-instrumentation-util")
125
    (version intellij-community-version)
126
    (source intellij-community-source)
127
    (build-system ant-build-system)
128
    (arguments
129
     `(#:source-dir "java/compiler/instrumentation-util/src"
130
       #:jar-name "instrumentation-util.jar"
131
       ;; No test
132
       #:tests? #f
133
       #:phases
134
       (modify-phases %standard-phases
135
         (add-before 'build 'fix-imports
136
           (lambda _
137
             (substitute* (find-files "java/compiler/instrumentation-util/src" ".*.java")
138
               (("org.jetbrains.org.objectweb") "org.objectweb")
139
                ;; As in build/asm/3_api_version.patch
140
               (("API_VERSION") "ASM6")))))))
141
    (inputs
142
     `(("java-asm" ,java-asm)))
143
    (home-page "https://github.com/JetBrains/intellij-community")
144
    (synopsis "")
145
    (description "")
146
    (license license:asl2.0)))
147
148
(define-public java-intellij-compiler-javac2
149
  (package
150
    (name "java-intellij-compiler-javac2")
151
    (version intellij-community-version)
152
    (source intellij-community-source)
153
    (build-system ant-build-system)
154
    (arguments
155
     `(#:source-dir "java/compiler/javac2/src"
156
       #:jar-name "javac2.jar"
157
       ;; No test
158
       #:tests? #f))
159
    (inputs
160
     `(("java-intellij-compiler-instrumentation-util" ,java-intellij-compiler-instrumentation-util)))
161
    (home-page "https://github.com/JetBrains/intellij-community")
162
    (synopsis "")
163
    (description "")
164
    (license license:asl2.0)))
165
166
(define-public java-intellij-platform-forms-rt
167
  (package
168
    (name "java-intellij-platform-forms-rt")
169
    (version intellij-community-version)
170
    (source intellij-community-source)
171
    (build-system ant-build-system)
172
    (arguments
173
     `(#:source-dir "platform/forms_rt/src"
174
       #:jar-name "forms_rt.jar"
175
       ;; No test
176
       #:tests? #f))
177
    (home-page "https://github.com/JetBrains/intellij-community")
178
    (synopsis "")
179
    (description "")
180
    (license license:asl2.0)))
181
182
(define-public java-intellij-platform-util-rt
183
  (package
184
    (name "java-intellij-platform-util-rt")
185
    (version intellij-community-version)
186
    (source intellij-community-source)
187
    (build-system ant-build-system)
188
    (arguments
189
     `(#:source-dir "platform/util-rt/src"
190
       #:jar-name "intellij.platform.util-rt.jar"
191
       #:jdk ,icedtea-7
192
       ;; No test
193
       #:tests? #f))
194
    (inputs
195
     `(("java-jetbrains-annotations" ,java-jetbrains-annotations)))
196
    (home-page "https://github.com/JetBrains/intellij-community")
197
    (synopsis "")
198
    (description "")
199
    (license license:asl2.0)))
200
201
(define-public java-intellij-platform-util
202
  (package
203
    (name "java-intellij-platform-util")
204
    (version intellij-community-version)
205
    (source intellij-community-source)
206
    (build-system ant-build-system)
207
    (arguments
208
     `(#:source-dir "platform/util/src"
209
       #:jar-name "intellij.platform.util.jar"
210
       ;; No test
211
       #:tests? #f
212
       #:phases
213
       (modify-phases %standard-phases
214
         (add-before 'build 'copy-resources
215
           (lambda _
216
             (copy-recursively "platform/util/resources" "build/classes")
217
             #t))
218
         (add-before 'build 'remove-apple
219
           (lambda _
220
             (delete-file "platform/util/src/com/intellij/util/AppleHiDPIScaledImage.java")
221
             (delete-file "platform/util/src/com/intellij/util/ui/IsRetina.java")
222
             #t)))))
223
    (propagated-inputs
224
     `(("java-batik-1.7" ,java-batik-1.7)
225
       ("java-commons-compress" ,java-commons-compress)
226
       ("java-imagescalr" ,java-imagescalr)
227
       ("java-intellij-platform-util-rt" ,java-intellij-platform-util-rt)
228
       ("java-jakarta-oro" ,java-jakarta-oro)
229
       ("java-jdom-for-intellij" ,java-jdom-for-intellij)
230
       ("java-jetbrains-annotations" ,java-jetbrains-annotations)
231
       ("java-log4j-api" ,java-log4j-api)
232
       ("java-log4j-1.2-api" ,java-log4j-1.2-api)
233
       ("java-lz4" ,java-lz4)
234
       ("java-native-access" ,java-native-access)
235
       ("java-native-access-platform" ,java-native-access-platform)
236
       ("java-trove4j-intellij" ,java-trove4j-intellij)
237
       ("java-w3c-svg" ,java-w3c-svg)))
238
    (properties
239
     `((intellij-2013-variant . ,(delay java-intellij-platform-util-2013))))
240
    (home-page "https://github.com/JetBrains/intellij-community")
241
    (synopsis "")
242
    (description "")
243
    (license license:asl2.0)))
244
245
(define-public java-intellij-platform-util-2013
246
  (let ((base (intellij-2013-package (strip-2013-variant java-intellij-platform-util))))
247
    (package
248
      (inherit base)
249
      (propagated-inputs
250
       (append (alist-delete "java-jdom-for-intellij" (package-propagated-inputs base))
251
               `(("java-batik" ,java-batik)
252
                 ("java-iq80-snappy" ,java-iq80-snappy)
253
                 ("java-jdom1-for-intellij" ,java-jdom1-for-intellij))))
254
      (arguments
255
        (substitute-keyword-arguments (package-arguments base)
256
          ((#:phases phases)
257
           `(modify-phases ,phases
258
              (add-before 'build 'fix-implicit-conversions
259
                (lambda _
260
                  (substitute* "build.xml"
261
                    (("<javac") "<javac source=\"1.6\""))))
262
              (delete 'remove-apple))))))))
263
                ;(lambda _
264
                ;  (delete-file "platform/util/src/com/intellij/util/AppleHiDPIScaledImage.java")
265
                ;  (delete-file "platform/util/src/com/intellij/util/ui/IsRetina.java")
266
                ;  (delete-file "platform/util/src/com/intellij/util/RetinaImage.java")
267
                ;  (substitute* "platform/util/src/com/intellij/util/ui/UIUtil.java"
268
                ;    (("IsRetina.isRetina\\(\\)") "false"))
269
                ;  #t)))))))))
270
271
(define-public java-intellij-platform-extensions
272
  (package
273
    (name "java-intellij-platform-extensions")
274
    (version intellij-community-version)
275
    (source intellij-community-source)
276
    (build-system ant-build-system)
277
    (arguments
278
     `(#:source-dir "platform/extensions/src"
279
       #:jar-name "intellij.platform.extensions.jar"
280
       ;; No test
281
       #:tests? #f))
282
    (propagated-inputs
283
     `(("java-intellij-platform-util" ,java-intellij-platform-util)
284
       ("java-jetbrains-annotations" ,java-jetbrains-annotations)
285
       ("java-picocontainer-1" ,java-picocontainer-1)))
286
    (home-page "https://github.com/JetBrains/intellij-community")
287
    (synopsis "")
288
    (description "")
289
    (license license:asl2.0)))
290
291
(define-public java-intellij-platform-core-api
292
  (package
293
    (name "java-intellij-platform-core-api")
294
    (version intellij-community-version)
295
    (source intellij-community-source)
296
    (build-system ant-build-system)
297
    (arguments
298
     `(#:source-dir "platform/core-api/src"
299
       #:jar-name "intellij.platform.core-api.jar"
300
       ;; No test
301
       #:tests? #f))
302
    (propagated-inputs
303
     `(("java-automaton" ,java-automaton)
304
       ("java-intellij-platform-extensions" ,java-intellij-platform-extensions)
305
       ("java-intellij-platform-resources" ,java-intellij-platform-resources)
306
       ("java-intellij-platform-util" ,java-intellij-platform-util)
307
       ("java-intellij-resources" ,java-intellij-resources)
308
       ("java-jetbrains-annotations" ,java-jetbrains-annotations)
309
       ("java-trove4j-intellij" ,java-trove4j-intellij)))
310
    (home-page "https://github.com/JetBrains/intellij-community")
311
    (synopsis "")
312
    (description "")
313
    (license license:asl2.0)))
314
315
(define-public java-intellij-platform-core-impl
316
  (package
317
    (name "java-intellij-platform-core-impl")
318
    (version intellij-community-version)
319
    (source intellij-community-source)
320
    (build-system ant-build-system)
321
    (arguments
322
     `(#:source-dir "platform/core-impl/src"
323
       #:jar-name "intellij.platform.core-impl.jar"
324
       ;; No test
325
       #:tests? #f))
326
    (propagated-inputs
327
     `(("java-guava" ,java-guava)
328
       ("java-intellij-platform-core-api" ,java-intellij-platform-core-api)))
329
    (home-page "https://github.com/JetBrains/intellij-community")
330
    (synopsis "")
331
    (description "")
332
    (license license:asl2.0)))
333
334
(define-public java-intellij-java-psi-api
335
  (package
336
    (name "java-intellij-java-psi-api")
337
    (version intellij-community-version)
338
    (source intellij-community-source)
339
    (build-system ant-build-system)
340
    (arguments
341
     `(#:source-dir "java/java-psi-api/src"
342
       #:jar-name "intellij.java.psi-api.jar"
343
       ;; No test
344
       #:tests? #f
345
       #:phases
346
       (modify-phases %standard-phases
347
         (add-before 'build 'copy-resources
348
           (lambda _
349
             (copy-recursively "java/java-psi-api/src/messages"
350
                               "build/classes/messages")
351
             #t)))))
352
    (propagated-inputs
353
     `(("java-intellij-platform-core-api" ,java-intellij-platform-core-api)
354
       ("java-intellij-platform-util" ,java-intellij-platform-util)
355
       ("java-jetbrains-annotations" ,java-jetbrains-annotations)))
356
    (home-page "https://github.com/JetBrains/intellij-community")
357
    (synopsis "")
358
    (description "")
359
    (license license:asl2.0)))
360
361
(define-public java-intellij-java-psi-impl
362
  (package
363
    (name "java-intellij-java-psi-impl")
364
    (version intellij-community-version)
365
    (source intellij-community-source)
366
    (build-system ant-build-system)
367
    (arguments
368
      ;; TODO: remove these auto-generated files and generate them with
369
      ;; java-flex from the same-named file in src, with .flex extension
370
      ;; (_JavaLexer, _JavaDocLexer)
371
     `(#:source-dir "java/java-psi-impl/src:java/java-psi-impl/gen"
372
       #:jar-name "intellij.java.psi-impl.jar"
373
       ;; No test
374
       #:tests? #f
375
       #:phases
376
       (modify-phases %standard-phases
377
         (add-before 'build 'fix-asm
378
           (lambda _
379
             (with-fluids ((%default-port-encoding "ISO-8859-1"))
380
               (substitute* (find-files "java/java-psi-impl/src" ".*\\.java$")
381
                 (("org.jetbrains.org.objectweb") "org.objectweb")
382
                 ;; As in build/asm/3_api_version.patch
383
                 (("API_VERSION") "ASM6")))
384
             #t))
385
         (add-before 'build 'copy-resources
386
           (lambda _
387
             (copy-recursively "java/java-psi-impl/src/META-INF"
388
                               "build/classes/META-INF")
389
             (copy-recursively "java/java-psi-impl/src/messages"
390
                               "build/classes/intellij/java/resources/en")
391
             #t)))))
392
    (propagated-inputs
393
     `(("java-asm" ,java-asm)
394
       ("java-intellij-java-psi-api" ,java-intellij-java-psi-api)
395
       ("java-intellij-platform-core-impl" ,java-intellij-platform-core-impl)
396
       ("java-jetbrains-annotations" ,java-jetbrains-annotations)
397
       ("java-streamex" ,java-streamex)))
398
    (home-page "https://github.com/JetBrains/intellij-community")
399
    (synopsis "")
400
    (description "")
401
    (license license:asl2.0)))
402
403
(define-public java-intellij-platform-resources
404
  (package
405
    (name "java-intellij-platform-resources")
406
    (version intellij-community-version)
407
    (source intellij-community-source)
408
    (build-system ant-build-system)
409
    (arguments
410
      ;; TODO: remove these auto-generated files and generate them with
411
      ;; java-flex from the same-named file in src, with .flex extension
412
      ;; (_JavaLexer, _JavaDocLexer)
413
     `(#:source-dir "platform/platform-resources"
414
       #:jar-name "intellij.platform.resources.jar"
415
       ;; No test
416
       #:tests? #f
417
       #:phases
418
       (modify-phases %standard-phases
419
         (add-before 'build 'copy-resources
420
           (lambda _
421
             (copy-recursively "platform/platform-resources/src"
422
                               "build/classes")
423
             #t)))))
424
    (propagated-inputs '())
425
    (native-inputs '())
426
    (inputs '())
427
    (home-page "https://github.com/JetBrains/intellij-community")
428
    (synopsis "")
429
    (description "")
430
    (license license:asl2.0)))
431
432
(define-public java-intellij-resources
433
  (package
434
    (name "java-intellij-resources")
435
    (version intellij-community-version)
436
    (source intellij-community-source)
437
    (build-system ant-build-system)
438
    (arguments
439
      ;; TODO: remove these auto-generated files and generate them with
440
      ;; java-flex from the same-named file in src, with .flex extension
441
      ;; (_JavaLexer, _JavaDocLexer)
442
     `(#:source-dir "resources"
443
       #:jar-name "intellij.resources.jar"
444
       ;; No test
445
       #:tests? #f
446
       #:phases
447
       (modify-phases %standard-phases
448
         (add-before 'build 'copy-resources
449
           (lambda _
450
             (copy-recursively "resources/src" "build/classes")
451
             #t)))))
452
    (propagated-inputs '())
453
    (native-inputs '())
454
    (inputs '())
455
    (home-page "https://github.com/JetBrains/intellij-community")
456
    (synopsis "")
457
    (description "")
458
    (license license:asl2.0)))
459
460
;; Newer versions are not free software anymore
461
;; latest free versions are 1.8.1 and 1.8.0. We require something older for
462
;; intellij though.
463
(define-public java-jgoodies-common
464
  (package
465
    (name "java-jgoodies-common")
466
    (version "1.8.1")
467
    (source (origin
468
              (method url-fetch)
469
              (uri "http://www.jgoodies.com/download/libraries/common/jgoodies-common-1_8_1.zip")
470
              (sha256
471
               (base32
472
                "1canj4zalrp668c55ji58rk90w005q44lnwzliffsr8mlrgxgaiw"))))
473
    (build-system ant-build-system)
474
    (arguments
475
     `(#:jar-name "jgoodies-common.jar"
476
       #:source-dir "."
477
       #:tests? #f; no tests
478
       #:phases
479
       (modify-phases %standard-phases
480
         (add-before 'build 'extract-source
481
           (lambda _
482
             (invoke "jar" "xf" "jgoodies-common-1.8.1-sources.jar")
483
             #t)))))
484
    (native-inputs
485
     `(("unzip" ,unzip)))
486
    (home-page "http://www.jgoodies.com")
487
    (synopsis "")
488
    (description "")
489
    (license license:bsd-3)))
490
491
(define-public java-jgoodies-forms
492
  (package
493
    (name "java-jgoodies-forms")
494
    (version "1.8.0")
495
    (source (origin
496
              (method url-fetch)
497
              (uri "http://www.jgoodies.com/download/libraries/forms/jgoodies-forms-1_8_0.zip")
498
              (sha256
499
               (base32
500
                "1av4w1px1jxmv19mljyicbv657sw5nqhkfx6s7nc5ckzf9ay945h"))))
501
    (build-system ant-build-system)
502
    (arguments
503
     `(#:jar-name "jgoodies-forms.jar"
504
       #:source-dir "."
505
       #:tests? #f; no tests
506
       #:phases
507
       (modify-phases %standard-phases
508
         (add-before 'build 'extract-source
509
           (lambda _
510
             (invoke "jar" "xf" "jgoodies-forms-1.8.0-sources.jar")
511
             #t)))))
512
    (native-inputs
513
     `(("unzip" ,unzip)))
514
    (inputs
515
     `(("java-jgoodies-common" ,java-jgoodies-common)))
516
    (home-page "http://www.jgoodies.com")
517
    (synopsis "")
518
    (description "")
519
    (license license:bsd-3)))
520
521
;; Requires JGoodies Forms: http://www.jgoodies.com
522
(define-public java-intellij-compiler-forms-compiler
523
  (package
524
    (name "java-intellij-compiler-forms-compiler")
525
    (version intellij-community-version)
526
    (source intellij-community-source)
527
    (build-system ant-build-system)
528
    (arguments
529
     `(#:source-dir "java/compiler/forms-compiler/src"
530
       #:jar-name "forms-compiler.jar"
531
       ;; No test
532
       #:tests? #f
533
       #:phases
534
       (modify-phases %standard-phases
535
         (add-before 'build 'fix-imports
536
           (lambda _
537
             (substitute* (find-files "java/compiler/forms-compiler/src" ".*.java")
538
               (("org.jetbrains.org.objectweb") "org.objectweb")
539
                ;; As in build/asm/3_api_version.patch
540
               (("API_VERSION") "ASM6"))))
541
         (add-before 'build 'fix-old-jgoodies
542
           (lambda _
543
             (substitute* "java/compiler/forms-compiler/src/com/intellij/uiDesigner/lw/FormLayoutSerializer.java"
544
               (("new ColumnSpec\\(spec\\)") "ColumnSpec.parse(spec)")))))))
545
    (inputs
546
     `(("java-intellij-platform-forms-rt" ,java-intellij-platform-forms-rt)
547
       ("java-intellij-compiler-instrumentation-util" ,java-intellij-compiler-instrumentation-util)
548
       ("java-asm" ,java-asm)
549
       ("java-jdom" ,java-jdom)
550
       ("java-jgoodies-forms" ,java-jgoodies-forms)))
551
    (home-page "https://github.com/JetBrains/intellij-community")
552
    (synopsis "")
553
    (description "")
554
    (license license:asl2.0)))
555