guix-more/more/packages/kotlin.scm

kotlin.scm

1
;;; GNU Guix --- Functional package management for GNU
2
;;; Copyright © 2018 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 kotlin)
20
  #:use-module ((guix licenses) #:prefix license:)
21
  #:use-module (gnu packages)
22
  #:use-module (guix packages)
23
  #:use-module (guix download)
24
  #:use-module (guix git-download)
25
  #:use-module (guix svn-download)
26
  #:use-module (guix cvs-download)
27
  #:use-module (guix utils)
28
  #:use-module (guix build-system ant)
29
  #:use-module (guix build-system gnu)
30
  #:use-module (guix build-system trivial)
31
  #:use-module (gnu packages autotools)
32
  #:use-module (gnu packages base)
33
  #:use-module (gnu packages compression)
34
  #:use-module (gnu packages docbook)
35
  #:use-module (gnu packages java)
36
  #:use-module (gnu packages maven)
37
  #:use-module (gnu packages perl)
38
  #:use-module (gnu packages web)
39
  #:use-module (gnu packages xml)
40
  #:use-module (more packages java))
41
42
;; Needs maven-core
43
(define-public kotlin-1.2
44
  (package
45
    (name "kotlin")
46
    ;; last version with a build.xml file
47
    ;; TODO: check if version 1.2.32-1.2.39 exist. 1.2.40 doesn't have build.xml.
48
    (version "1.2.31")
49
    (source (origin
50
              (method url-fetch)
51
              (uri (string-append "https://github.com/JetBrains/kotlin/archive/v"
52
                                  version ".tar.gz"))
53
              (file-name (string-append name "-" version ".tar.gz"))
54
              (sha256
55
               (base32
56
                "1lm1rvj1vf4z8nzpffqcdwcydnlf24ls07z0r0nc4by3hjxzs3sv"))))
57
    (build-system ant-build-system)
58
    (arguments
59
     `(#:phases
60
       (modify-phases %standard-phases
61
         (add-before 'build 'fix-build.xml
62
           (lambda _
63
             (substitute* "build.xml"
64
               (("org/jetbrains/kotlin/ant/antlib.xml")
65
                "ant/src/org/jetbrains/kotlin/ant/antlib.xml")))))))
66
    (native-inputs
67
     `(("java-intellij-compiler-javac2" ,java-intellij-compiler-javac2)))
68
    (home-page "https://kotlinlang.org/")
69
    (synopsis "Programming language targetting the JVM")
70
    (description "")
71
    (license license:asl2.0)))
72
73
(define-public kotlin
74
  (package
75
    (name "kotlin")
76
    (version "1.3.11")
77
    (source (origin
78
              (method git-fetch)
79
              (uri (git-reference
80
                     (url "https://github.com/JetBrains/kotlin")
81
                     (commit (string-append "v" version))))
82
              (file-name (git-file-name name version))
83
              (sha256
84
               (base32
85
                "123gfr72p0715n925kivl3khlqzk11qpyv65jwlhcplgfvw8rl73"))))
86
    (build-system ant-build-system)
87
    (home-page "https://kotlinlang.org/")
88
    (synopsis "Programming language targetting the JVM")
89
    (description "")
90
    (license license:asl2.0)))
91
92
;; The release page on github is a mess
93
(define intellij-community-version "0.182.2256")
94
(define (intellij-community-source version)
95
  (origin
96
    (method url-fetch)
97
    (uri (string-append "https://github.com/JetBrains/intellij-community/"
98
                        "archive/appcode/" (substring version 2) ".tar.gz"))
99
    (file-name (string-append "intellij-community-" version ".tar.gz"))
100
    (sha256
101
     (base32
102
      "1b9csd0vs6m41q4jhlwl3rlfb596vcnjhch75pcwk8999zrvqf0f"))
103
    (modules '((guix build utils)))
104
    (snippet
105
      `(begin
106
         (for-each
107
           (lambda (file)
108
             (if (file-exists? file)
109
               (delete-file-recursively file)))
110
           (append (find-files "." "^lib$" #:directories? #t)
111
                   (find-files "." "^bin$" #:directories? #t)))
112
         (for-each delete-file (find-files "." ".*.jar$"))))))
113
114
(define-public java-intellij-compiler-instrumentation-util
115
  (package
116
    (name "java-intellij-compiler-instrumentation-util")
117
    (version intellij-community-version)
118
    (source (intellij-community-source version))
119
    (build-system ant-build-system)
120
    (arguments
121
     `(#:source-dir "java/compiler/instrumentation-util/src"
122
       #:jar-name "instrumentation-util.jar"
123
       ;; No test
124
       #:tests? #f
125
       #:phases
126
       (modify-phases %standard-phases
127
         (add-before 'build 'fix-imports
128
           (lambda _
129
             (substitute* (find-files "java/compiler/instrumentation-util/src" ".*.java")
130
               (("org.jetbrains.org.objectweb") "org.objectweb")
131
                ;; As in build/asm/3_api_version.patch
132
               (("API_VERSION") "ASM6")))))))
133
    (inputs
134
     `(("java-asm" ,java-asm)))
135
    (home-page "https://github.com/JetBrains/intellij-community")
136
    (synopsis "")
137
    (description "")
138
    (license license:asl2.0)))
139
140
(define-public java-intellij-compiler-javac2
141
  (package
142
    (name "java-intellij-compiler-javac2")
143
    (version intellij-community-version)
144
    (source (intellij-community-source version))
145
    (build-system ant-build-system)
146
    (arguments
147
     `(#:source-dir "java/compiler/javac2/src"
148
       #:jar-name "javac2.jar"
149
       ;; No test
150
       #:tests? #f))
151
    (inputs
152
     `(("java-intellij-compiler-instrumentation-util" ,java-intellij-compiler-instrumentation-util)))
153
    (home-page "https://github.com/JetBrains/intellij-community")
154
    (synopsis "")
155
    (description "")
156
    (license license:asl2.0)))
157
158
(define-public java-intellij-platform-forms-rt
159
  (package
160
    (name "java-intellij-platform-forms-rt")
161
    (version intellij-community-version)
162
    (source (intellij-community-source version))
163
    (build-system ant-build-system)
164
    (arguments
165
     `(#:source-dir "platform/forms_rt/src"
166
       #:jar-name "forms_rt.jar"
167
       ;; No test
168
       #:tests? #f))
169
    (home-page "https://github.com/JetBrains/intellij-community")
170
    (synopsis "")
171
    (description "")
172
    (license license:asl2.0)))
173
174
;; Newer versions are not free software anymore
175
;; latest free versions are 1.8.1 and 1.8.0. We require something older for
176
;; intellij though.
177
(define-public java-jgoodies-common
178
  (package
179
    (name "java-jgoodies-common")
180
    (version "1.8.1")
181
    (source (origin
182
              (method url-fetch)
183
              (uri "http://www.jgoodies.com/download/libraries/common/jgoodies-common-1_8_1.zip")
184
              (sha256
185
               (base32
186
                "1canj4zalrp668c55ji58rk90w005q44lnwzliffsr8mlrgxgaiw"))))
187
    (build-system ant-build-system)
188
    (arguments
189
     `(#:jar-name "jgoodies-common.jar"
190
       #:source-dir "."
191
       #:tests? #f; no tests
192
       #:phases
193
       (modify-phases %standard-phases
194
         (add-before 'build 'extract-source
195
           (lambda _
196
             (invoke "jar" "xf" "jgoodies-common-1.8.1-sources.jar")
197
             #t)))))
198
    (native-inputs
199
     `(("unzip" ,unzip)))
200
    (home-page "http://www.jgoodies.com")
201
    (synopsis "")
202
    (description "")
203
    (license license:bsd-3)))
204
205
(define-public java-jgoodies-forms
206
  (package
207
    (name "java-jgoodies-forms")
208
    (version "1.8.0")
209
    (source (origin
210
              (method url-fetch)
211
              (uri "http://www.jgoodies.com/download/libraries/forms/jgoodies-forms-1_8_0.zip")
212
              (sha256
213
               (base32
214
                "1av4w1px1jxmv19mljyicbv657sw5nqhkfx6s7nc5ckzf9ay945h"))))
215
    (build-system ant-build-system)
216
    (arguments
217
     `(#:jar-name "jgoodies-forms.jar"
218
       #:source-dir "."
219
       #:tests? #f; no tests
220
       #:phases
221
       (modify-phases %standard-phases
222
         (add-before 'build 'extract-source
223
           (lambda _
224
             (invoke "jar" "xf" "jgoodies-forms-1.8.0-sources.jar")
225
             #t)))))
226
    (native-inputs
227
     `(("unzip" ,unzip)))
228
    (inputs
229
     `(("java-jgoodies-common" ,java-jgoodies-common)))
230
    (home-page "http://www.jgoodies.com")
231
    (synopsis "")
232
    (description "")
233
    (license license:bsd-3)))
234
235
;; Requires JGoodies Forms: http://www.jgoodies.com
236
(define-public java-intellij-compiler-forms-compiler
237
  (package
238
    (name "java-intellij-compiler-forms-compiler")
239
    (version intellij-community-version)
240
    (source (intellij-community-source version))
241
    (build-system ant-build-system)
242
    (arguments
243
     `(#:source-dir "java/compiler/forms-compiler/src"
244
       #:jar-name "forms-compiler.jar"
245
       ;; No test
246
       #:tests? #f
247
       #:phases
248
       (modify-phases %standard-phases
249
         (add-before 'build 'fix-imports
250
           (lambda _
251
             (substitute* (find-files "java/compiler/forms-compiler/src" ".*.java")
252
               (("org.jetbrains.org.objectweb") "org.objectweb")
253
                ;; As in build/asm/3_api_version.patch
254
               (("API_VERSION") "ASM6"))))
255
         (add-before 'build 'fix-old-jgoodies
256
           (lambda _
257
             (substitute* "java/compiler/forms-compiler/src/com/intellij/uiDesigner/lw/FormLayoutSerializer.java"
258
               (("new ColumnSpec\\(spec\\)") "ColumnSpec.parse(spec)")))))))
259
    (inputs
260
     `(("java-intellij-platform-forms-rt" ,java-intellij-platform-forms-rt)
261
       ("java-intellij-compiler-instrumentation-util" ,java-intellij-compiler-instrumentation-util)
262
       ("java-asm" ,java-asm)
263
       ("java-jdom" ,java-jdom)
264
       ("java-jgoodies-forms" ,java-jgoodies-forms)))
265
    (home-page "https://github.com/JetBrains/intellij-community")
266
    (synopsis "")
267
    (description "")
268
    (license license:asl2.0)))
269