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