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