groovy.scm 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
  3. ;;; Copyright © 2019 Tobias Geerinck-Rice <me@tobias.gr>
  4. ;;;
  5. ;;; This file is part of GNU Guix.
  6. ;;;
  7. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  8. ;;; under the terms of the GNU General Public License as published by
  9. ;;; the Free Software Foundation; either version 3 of the License, or (at
  10. ;;; your option) any later version.
  11. ;;;
  12. ;;; GNU Guix is distributed in the hope that it will be useful, but
  13. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ;;; GNU General Public License for more details.
  16. ;;;
  17. ;;; You should have received a copy of the GNU General Public License
  18. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  19. (define-module (gnu packages groovy)
  20. #:use-module ((guix licenses) #:prefix license:)
  21. #:use-module (guix packages)
  22. #:use-module (guix download)
  23. #:use-module (guix git-download)
  24. #:use-module (guix utils)
  25. #:use-module (guix build-system ant)
  26. #:use-module (gnu packages)
  27. #:use-module (gnu packages java)
  28. #:use-module (gnu packages xml))
  29. (define java-groovy-bootstrap
  30. (package
  31. (name "java-groovy-bootstrap")
  32. (version "3.0.5")
  33. (source
  34. (origin
  35. (method git-fetch)
  36. (uri (git-reference
  37. (url "https://github.com/apache/groovy")
  38. (commit (string-append
  39. "GROOVY_"
  40. (string-map (lambda (x) (if (eq? x #\.) #\_ x))
  41. version)))))
  42. (file-name (git-file-name name version))
  43. (sha256
  44. (base32 "00556qxjmcn3a3xhfy6n0zw3d69mnw72vzm2rb6n4ihzkk7579nm"))
  45. (patches
  46. (search-patches "groovy-add-exceptionutilsgenerator.patch"))))
  47. (build-system ant-build-system)
  48. (arguments
  49. `(#:jar-name "groovy.jar"
  50. #:source-dir "src/main/java:src/main/antlr2:subprojects/parser-antlr4/src/main/java:src/antlr"
  51. #:test-dir "src/test"
  52. #:tests? #f
  53. #:jdk ,openjdk9
  54. #:main-class "groovy.ui.GroovyMain"
  55. #:phases
  56. (modify-phases %standard-phases
  57. (add-before 'build 'generate-parsers
  58. (lambda _
  59. (with-directory-excursion "src/main/antlr2/org/codehaus/groovy/antlr/java"
  60. (invoke "antlr" "java.g"))
  61. (with-directory-excursion "src/main/antlr2/org/codehaus/groovy/antlr"
  62. (mkdir "parser")
  63. (with-directory-excursion "parser"
  64. (invoke "antlr" "../groovy.g")))
  65. (invoke "antlr4" "-lib" "src/antlr"
  66. "-package" "org.apache.groovy.parser.antlr4"
  67. "-visitor" "-no-listener" "src/antlr/GroovyLexer.g4")
  68. (invoke "antlr4" "-lib" "src/antlr"
  69. "-package" "org.apache.groovy.parser.antlr4"
  70. "-visitor" "-no-listener" "src/antlr/GroovyParser.g4")
  71. #t))
  72. (add-before 'build 'generate-exception-utils
  73. (lambda _
  74. (invoke "javac" "-cp" (getenv "CLASSPATH")
  75. "-source" "1.8" "-target" "1.8"
  76. "config/ant/src/org/codehaus/groovy/ExceptionUtilsGenerator.java")
  77. (invoke "java" "-cp" (string-append (getenv "CLASSPATH")
  78. ":config/ant/src")
  79. "org.codehaus.groovy.ExceptionUtilsGenerator"
  80. "build/classes/org/codehaus/groovy/runtime/ExceptionUtils.class")
  81. #t))
  82. (add-before 'build 'set-source-level
  83. (lambda _
  84. (substitute* "build.xml"
  85. (("<javac") "<javac source=\"1.8\" target=\"1.8\""))
  86. #t)))))
  87. (native-inputs
  88. `(("antlr2" ,antlr2)
  89. ("antlr4" ,java-tunnelvisionlabs-antlr4)
  90. ("java-jsr305" ,java-jsr305)
  91. ("java-junit" ,java-junit)
  92. ("java-hamcrest-core" ,java-hamcrest-core)
  93. ("java-jmock-1" ,java-jmock-1)
  94. ("java-xmlunit-legacy" ,java-xmlunit-legacy)))
  95. (inputs
  96. `(("java-antlr4-runtime" ,java-tunnelvisionlabs-antlr4-runtime)
  97. ("java-antlr4-runtime-annotations"
  98. ,java-tunnelvisionlabs-antlr4-runtime-annotations)
  99. ("java-asm" ,java-asm-8)
  100. ("java-asm-util" ,java-asm-util-8)
  101. ("java-classpathx-servletapi" ,java-classpathx-servletapi)
  102. ("java-commons-cli" ,java-commons-cli)
  103. ("java-jansi" ,java-jansi)
  104. ("java-jline-2" ,java-jline-2)
  105. ("java-picocli" ,java-picocli)
  106. ("java-xstream" ,java-xstream)))
  107. (home-page "http://groovy-lang.org/")
  108. (synopsis "Groovy's java bootstrap")
  109. (description "This package contains the java bootstrap that is used to build
  110. groovy submodules.")
  111. (license license:asl2.0)))
  112. (define groovy-bootstrap
  113. (package
  114. (inherit java-groovy-bootstrap)
  115. (name "groovy-bootstrap")
  116. (arguments
  117. `(#:jar-name "groovy.jar"
  118. #:jdk ,openjdk9
  119. ;Requires groovy-xml and logback-classic which are circular dependencies
  120. #:tests? #f
  121. #:phases
  122. (modify-phases %standard-phases
  123. (add-before 'build 'generate-parser
  124. (lambda _
  125. (with-directory-excursion "src/main/antlr2/org/codehaus/groovy/antlr/java"
  126. (invoke "antlr" "java.g"))
  127. (with-directory-excursion "src/main/antlr2/org/codehaus/groovy/antlr"
  128. (mkdir "parser")
  129. (with-directory-excursion "parser"
  130. (invoke "antlr" "../groovy.g")))
  131. (invoke "antlr4" "-lib" "src/antlr"
  132. "-package" "org.apache.groovy.parser.antlr4"
  133. "-visitor" "-no-listener" "src/antlr/GroovyLexer.g4")
  134. (invoke "antlr4" "-lib" "src/antlr"
  135. "-package" "org.apache.groovy.parser.antlr4"
  136. "-visitor" "-no-listener" "src/antlr/GroovyParser.g4")
  137. #t))
  138. (add-before 'build 'generate-exception-utils
  139. (lambda _
  140. (invoke "javac" "-cp" (getenv "CLASSPATH")
  141. "config/ant/src/org/codehaus/groovy/ExceptionUtilsGenerator.java")
  142. (invoke "java" "-cp" (string-append (getenv "CLASSPATH")
  143. ":config/ant/src")
  144. "org.codehaus.groovy.ExceptionUtilsGenerator"
  145. "target/classes/org/codehaus/groovy/runtime/ExceptionUtils.class")
  146. #t))
  147. (add-before 'build 'generate-dgminfo
  148. (lambda _
  149. (mkdir-p "target/classes/org/codehaus/groovy/runtime")
  150. (mkdir-p "target/classes/META-INF")
  151. (invoke "javac" "-cp" (getenv "CLASSPATH")
  152. "src/main/java/org/codehaus/groovy/tools/DgmConverter.java")
  153. (invoke "java" "-cp" (string-append (getenv "CLASSPATH")
  154. ":src/main/java")
  155. "org.codehaus.groovy.tools.DgmConverter")
  156. #t))
  157. (add-before 'build 'copy-resources
  158. (lambda _
  159. (with-directory-excursion "src/main/java"
  160. (for-each (lambda (file)
  161. (mkdir-p (string-append "../../../target/classes/"
  162. (dirname file)))
  163. (copy-file file
  164. (string-append "../../../target/classes/"
  165. file)))
  166. (find-files "." ".*.(txt|properties|xml|html)")))
  167. #t))
  168. (replace 'build
  169. (lambda _
  170. (mkdir-p "build/jar")
  171. (apply invoke "java" "-cp" (getenv "CLASSPATH")
  172. "org.codehaus.groovy.tools.FileSystemCompiler"
  173. "-cp" (getenv "CLASSPATH")
  174. "-d" "target/classes"
  175. "-j"; joint compilation
  176. (find-files "src/main"
  177. ".*\\.(groovy|java)$"))
  178. (invoke "jar" "-cf" "build/jar/groovy.jar"
  179. "-C" "target/classes" ".")
  180. #t)))))
  181. (inputs
  182. `(("java-apache-ivy" ,java-apache-ivy)
  183. ,@(package-inputs java-groovy-bootstrap)))
  184. (native-inputs
  185. `(("java-groovy-bootstrap" ,java-groovy-bootstrap)
  186. ,@(package-native-inputs java-groovy-bootstrap)))
  187. (synopsis "Groovy compiler")
  188. (description "This package contains the first version of the Groovy compiler.
  189. Although already usable, it doesn't contain the groovy library yet. This package
  190. is used to build the groovy submodules written in groovy.")))
  191. (define groovy-tests-bootstrap
  192. (package
  193. (inherit groovy-bootstrap)
  194. (name "groovy-tests-bootstrap")
  195. (arguments
  196. `(#:jar-name "groovy-tests-bootstrap.jar"
  197. #:jdk ,openjdk9
  198. #:tests? #f; no tests
  199. #:phases
  200. (modify-phases %standard-phases
  201. (replace 'build
  202. (lambda _
  203. (mkdir-p "build/classes")
  204. (mkdir-p "build/jar")
  205. (apply invoke "java" "-cp" (getenv "CLASSPATH")
  206. "org.codehaus.groovy.tools.FileSystemCompiler"
  207. "-cp" (getenv "CLASSPATH")
  208. "-d" "build/classes"
  209. "-j"; joint compilation
  210. (append
  211. (find-files "src/test" "TestSupport.java")
  212. (find-files "src/test" "HeadlessTestSupport.java")
  213. (find-files "src/test" "AstAssert.groovy")
  214. (find-files "src/test" "XmlAssert.java")))
  215. (invoke "jar" "-cf" "build/jar/groovy-tests-bootstrap.jar"
  216. "-C" "build/classes" ".")
  217. #t)))))
  218. (inputs
  219. `(("groovy-test" ,groovy-test)
  220. ("groovy-parser-antlr4" ,groovy-parser-antlr4)
  221. ,@(package-inputs groovy-bootstrap)))
  222. (native-inputs
  223. `(("groovy-bootstrap" ,groovy-bootstrap)
  224. ,@(package-native-inputs java-groovy-bootstrap)))
  225. (synopsis "Groovy test classes")
  226. (description "This package contains three classes required for testing
  227. other groovy submodules.")))
  228. (define (groovy-subproject name)
  229. (package
  230. (inherit groovy-bootstrap)
  231. (name name)
  232. (arguments
  233. `(#:jar-name ,(string-append name ".jar")
  234. #:test-dir ,(string-append name "/src/test")
  235. #:test-include (list "**/*Test.java" "**/*.groovy")
  236. #:jdk ,openjdk9
  237. #:phases
  238. (modify-phases %standard-phases
  239. (replace 'build
  240. (lambda _
  241. (mkdir-p "build/classes")
  242. (mkdir-p "build/jar")
  243. (apply invoke "java" "-cp" (getenv "CLASSPATH")
  244. "org.codehaus.groovy.tools.FileSystemCompiler"
  245. "-cp" (getenv "CLASSPATH")
  246. "-d" "build/classes" "-j"
  247. (append
  248. (find-files ,(string-append "subprojects/" name "/src/main/java")
  249. ".*\\.(groovy|java)$")
  250. (find-files ,(string-append "subprojects/" name "/src/main/groovy")
  251. ".*\\.(groovy|java)$")))
  252. (invoke "jar" "-cf" ,(string-append "build/jar/" name ".jar")
  253. "-C" "build/classes" ".")
  254. #t))
  255. (add-before 'build 'copy-resources
  256. (lambda _
  257. (let ((resource-dir ,(string-append "subprojects/" name
  258. "/src/main/resources")))
  259. (when (file-exists? resource-dir)
  260. (copy-recursively resource-dir "build/classes")))
  261. #t))
  262. (replace 'check
  263. (lambda* (#:key tests? #:allow-other-keys)
  264. (when tests?
  265. (mkdir-p "build/test-classes")
  266. (substitute* "build.xml"
  267. (("depends=\"compile-tests\"") "depends=\"\"")
  268. (("}/java") "}/"))
  269. (apply invoke "java" "-cp"
  270. (string-append (getenv "CLASSPATH") ":build/classes")
  271. "org.codehaus.groovy.tools.FileSystemCompiler" "-cp"
  272. (string-append (getenv "CLASSPATH") ":build/classes")
  273. "-d" "build/test-classes" "-j"
  274. (append
  275. (find-files ,(string-append "subprojects/" name "/src/test/java")
  276. ".*\\.(groovy|java)$")
  277. (find-files ,(string-append "subprojects/" name "/src/test/groovy")
  278. ".*\\.(groovy|java)$")))
  279. (invoke "ant" "check"))
  280. #t)))))))
  281. (define groovy-parser-antlr4
  282. (let ((base (groovy-subproject "parser-antlr4")))
  283. (package
  284. (inherit base)
  285. (name "groovy-parser-antlr4")
  286. (arguments
  287. `(#:tests? #f
  288. ,@(substitute-keyword-arguments (package-arguments base)
  289. ((#:phases phases)
  290. `(modify-phases ,phases
  291. (add-before 'build 'generate-parser
  292. (lambda _
  293. (invoke "antlr4" "-lib" "src/antlr"
  294. "-package" "org.apache.groovy.parser.antlr4"
  295. "-visitor" "-no-listener" "src/antlr/GroovyLexer.g4")
  296. (invoke "antlr4" "-lib" "src/antlr"
  297. "-package" "org.apache.groovy.parser.antlr4"
  298. "-visitor" "-no-listener" "src/antlr/GroovyParser.g4")
  299. (for-each
  300. (lambda (file)
  301. (install-file file
  302. "subprojects/parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4"))
  303. (find-files "src/antlr" ".*.java$"))
  304. #t)))))))
  305. (native-inputs
  306. `(("groovy-bootstrap" ,groovy-bootstrap)
  307. ,@(package-native-inputs java-groovy-bootstrap)))
  308. (synopsis "Groovy antlr4 parser submodule")
  309. (description "This package contains the new parser Parrot for Groovy, which
  310. is based on Antlr4. The new parser can parse Groovy source code and construct
  311. the related AST, which is almost identical to the one generated by the old
  312. parser. Currently all features of Groovy are available."))))
  313. (define groovy-test
  314. (let ((base (groovy-subproject "groovy-test")))
  315. (package
  316. (inherit base)
  317. (arguments
  318. `(;#:tests? #f
  319. ,@(package-arguments base)))
  320. (synopsis "Groovy test submodule")
  321. (description "This package contains the test submodules used to test
  322. other groovy submodules."))))
  323. (define groovy-xml
  324. (let ((base (groovy-subproject "groovy-xml")))
  325. (package
  326. (inherit base)
  327. (native-inputs
  328. `(("groovy-test" ,groovy-test)
  329. ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
  330. ,@(package-native-inputs base)))
  331. (inputs
  332. `(("groovy-parser-antlr4" ,groovy-parser-antlr4)
  333. ,@(package-inputs base)))
  334. (synopsis "Groovy XML")
  335. (description "This package contains XML-related utilities for groovy."))))
  336. (define groovy-templates
  337. (let ((base (groovy-subproject "groovy-templates")))
  338. (package
  339. (inherit base)
  340. (arguments
  341. `(#:tests? #f;Requires spock-framework which is a circular dependency
  342. ,@(substitute-keyword-arguments (package-arguments base)
  343. ((#:phases phases)
  344. `(modify-phases ,phases
  345. ;; These annotations are used for QA, but do not affect build output.
  346. ;; They require findbugs, which we don't have yet.
  347. (add-before 'build 'remove-annotation
  348. (lambda _
  349. (substitute* '("subprojects/groovy-templates/src/main/groovy/groovy/text/StreamingTemplateEngine.java"
  350. "subprojects/groovy-templates/src/main/groovy/groovy/text/TemplateEngine.java")
  351. (("import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;") "")
  352. (("@SuppressFBWarnings.*") ""))
  353. #t)))))))
  354. (inputs
  355. `(("groovy-xml" ,groovy-xml)
  356. ,@(package-inputs base)))
  357. (native-inputs
  358. `(("groovy-bootstrap" ,groovy-bootstrap)
  359. ("groovy-test" ,groovy-test)
  360. ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
  361. ,@(package-native-inputs base)))
  362. (synopsis "Groovy template engine")
  363. (description "This package contains a template framework which is
  364. well-suited to applications where the text to be generated follows the form of
  365. a static template."))))
  366. (define groovy-groovydoc
  367. (let ((base (groovy-subproject "groovy-groovydoc")))
  368. (package
  369. (inherit base)
  370. (arguments
  371. `(#:tests? #f; Requires groovy-ant which is a circular dependency
  372. ,@(package-arguments base)))
  373. (inputs
  374. `(("groovy-templates" ,groovy-templates)
  375. ("groovy-parser-antlr4" ,groovy-parser-antlr4)
  376. ("java-javaparser" ,java-javaparser)
  377. ,@(package-inputs groovy-bootstrap)))
  378. (native-inputs
  379. `(("groovy-bootstrap" ,groovy-bootstrap)
  380. ("groovy-test" ,groovy-test)
  381. ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
  382. ,@(package-native-inputs java-groovy-bootstrap)))
  383. (synopsis "Groovy documentation generation")
  384. (description "This package contains the groovy documentation generator,
  385. similar to javadoc."))))
  386. (define groovy-ant
  387. (let ((base (groovy-subproject "groovy-ant")))
  388. (package
  389. (inherit base)
  390. (arguments
  391. `(;#:tests? #f;Requires spock-framework which is a circular dependency
  392. #:ant ,ant/java8; ant is actually a dependency of this package, and we need 1.10
  393. ,@(substitute-keyword-arguments (package-arguments base)
  394. ((#:phases phases)
  395. `(modify-phases ,phases
  396. ;; These annotations are used for QA, but do not affect build output.
  397. ;; They require findbugs, which we don't have yet.
  398. (add-before 'build 'remove-annotation
  399. (lambda _
  400. (substitute* (find-files "subprojects/groovy-ant"
  401. ".*.java$")
  402. (("import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;") "")
  403. (("@SuppressFBWarnings.*") ""))
  404. #t)))))))
  405. (inputs
  406. `(("groovy-groovydoc" ,groovy-groovydoc)
  407. ("java-asm-tree" ,java-asm-tree-8)
  408. ("java-asm-analysis" ,java-asm-analysis-8)
  409. ,@(package-inputs base)))
  410. (native-inputs
  411. `(("ant-junit" ,ant-junit)
  412. ("groovy-bootstrap" ,groovy-bootstrap)
  413. ("groovy-xml" ,groovy-xml)
  414. ("groovy-test" ,groovy-test)
  415. ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
  416. ,@(package-native-inputs base)))
  417. (synopsis "Groovy ant tasks")
  418. (description "This package contains groovy-related ant tasks definitions."))))
  419. (define groovy-astbuilder
  420. (let ((base (groovy-subproject "groovy-astbuilder")))
  421. (package
  422. (inherit base)
  423. (arguments
  424. (substitute-keyword-arguments (package-arguments base)
  425. ((#:phases phases)
  426. `(modify-phases ,phases
  427. (delete 'copy-resources)
  428. (add-after 'build 'copy-resources
  429. (lambda _
  430. (copy-recursively
  431. "subprojects/groovy-astbuilder/src/main/resources"
  432. "build/classes")
  433. (substitute* "build.xml"
  434. (("depends=\"compile,") "depends=\""))
  435. (invoke "ant" "jar")
  436. #t))))))
  437. (inputs
  438. `(("groovy-bootstrap" ,groovy-bootstrap)
  439. ,@(package-inputs base)))
  440. (native-inputs
  441. `(("groovy-test" ,groovy-test)
  442. ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
  443. ,@(package-native-inputs base)))
  444. (synopsis "Transformation to capture ASTBuilder from code statements")
  445. (description "This package contains an AST transformation for use with
  446. ASTBuilder when building \"from string\" Groovy statements."))))
  447. (define groovy-bsf
  448. (let ((base (groovy-subproject "groovy-bsf")))
  449. (package
  450. (inherit base)
  451. (arguments
  452. `(#:test-exclude (list
  453. ;; exception from Groovy: org.codehaus.groovy.runtime.InvokerInvocationException:
  454. ;; groovy.lang.MissingMethodException: No signature of method:
  455. ;; java.util.ArrayList.each() is applicable for argument types:
  456. ;; (groovy.script.MapFromList$_doit_closure1) values:
  457. ;; [groovy.script.MapFromList$_doit_closure1@17e554d5]
  458. "**/BSFTest.java")
  459. ,@(package-arguments base)))
  460. (inputs
  461. `(("java-commons-bsf" ,java-commons-bsf)
  462. ,@(package-inputs base)))
  463. (native-inputs
  464. `(("groovy-bootstrap" ,groovy-bootstrap)
  465. ("groovy-test" ,groovy-test)
  466. ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
  467. ("java-commons-logging-minimal" ,java-commons-logging-minimal)
  468. ,@(package-native-inputs base)))
  469. (synopsis "Groovy BSF engine")
  470. (description "This package defines the BSF engine for using Groovy inside
  471. any @dfn{Bean Scripting Framework} (BSF) application."))))
  472. (define groovy-cli-commons
  473. (let ((base (groovy-subproject "groovy-cli-commons")))
  474. (package
  475. (inherit base)
  476. (inputs
  477. `(("groovy-bootstrap" ,groovy-bootstrap)
  478. ,@(package-inputs base)))
  479. (native-inputs
  480. `(("groovy-test" ,groovy-test)
  481. ,@(package-native-inputs base)))
  482. (synopsis "Groovy CLI common classes")
  483. (description "This package defines common classes for dealing with
  484. command-line arguments in Groovy."))))
  485. (define groovy-cli-picocli
  486. (let ((base (groovy-subproject "groovy-cli-picocli")))
  487. (package
  488. (inherit base)
  489. (inputs
  490. `(("groovy-bootstrap" ,groovy-bootstrap)
  491. ("java-picocli" ,java-picocli)
  492. ,@(package-inputs base)))
  493. (native-inputs
  494. `(("groovy-test" ,groovy-test)
  495. ,@(package-native-inputs base)))
  496. (synopsis "Groovy CLI classes that use picocli")
  497. (description "This package defines classes for dealing with command-line
  498. arguments in Groovy using the picocli library."))))
  499. (define groovy-swing
  500. (let ((base (groovy-subproject "groovy-swing")))
  501. (package
  502. (inherit base)
  503. (arguments
  504. (substitute-keyword-arguments (package-arguments base)
  505. ((#:phases phases)
  506. `(modify-phases ,phases
  507. (add-before 'check 'fix-test
  508. (lambda _
  509. (substitute*
  510. "subprojects/groovy-swing/src/test/groovy/groovy/swing/GroovySwingTestCase.groovy"
  511. (("HeadlessTestSupport.headless") "isHeadless()"))
  512. #t))))))
  513. (native-inputs
  514. `(("groovy-bootstrap" ,groovy-bootstrap)
  515. ("groovy-test" ,groovy-test)
  516. ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
  517. ("java-commons-logging-minimal" ,java-commons-logging-minimal)
  518. ,@(package-native-inputs base)))
  519. (synopsis "Groovy graphical library")
  520. (description "This package contains the groovy bindings to Java Swing, a
  521. library used to build graphical interfaces."))))
  522. (define groovy-console
  523. (let ((base (groovy-subproject "groovy-console")))
  524. (package
  525. (inherit base)
  526. (arguments
  527. (substitute-keyword-arguments (package-arguments base)
  528. ((#:phases phases)
  529. `(modify-phases ,phases
  530. (add-before 'check 'build-swing
  531. (lambda _
  532. (substitute*
  533. "subprojects/groovy-swing/src/test/groovy/groovy/swing/GroovySwingTestCase.groovy"
  534. (("HeadlessTestSupport.headless") "isHeadless()"))
  535. (mkdir-p "build/test-classes")
  536. (apply invoke "java" "-cp"
  537. (string-append (getenv "CLASSPATH") ":build/classes")
  538. "org.codehaus.groovy.tools.FileSystemCompiler" "-cp"
  539. (string-append (getenv "CLASSPATH") ":build/classes")
  540. "-d" "build/test-classes" "-j"
  541. (append
  542. (find-files "subprojects/groovy-swing/src/test/java"
  543. ".*\\.(groovy|java)$")
  544. (find-files "subprojects/groovy-swing/src/test/groovy"
  545. ".*\\.(groovy|java)$")))
  546. #t))))))
  547. (inputs
  548. `(("groovy-swing" ,groovy-swing)
  549. ("groovy-templates" ,groovy-templates)
  550. ,@(package-inputs base)))
  551. (native-inputs
  552. `(("groovy-bootstrap" ,groovy-bootstrap)
  553. ("groovy-test" ,groovy-test)
  554. ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
  555. ("java-commons-logging-minimal" ,java-commons-logging-minimal)
  556. ,@(package-native-inputs base)))
  557. (synopsis "Groovy graphical interface")
  558. (description "This package contains a graphical interface to run groovy."))))
  559. (define groovy-datetime
  560. (let ((base (groovy-subproject "groovy-datetime")))
  561. (package
  562. (inherit base)
  563. (native-inputs
  564. `(("groovy-test" ,groovy-test)
  565. ,@(package-native-inputs base)))
  566. (synopsis "Date/Time API for Groovy")
  567. (description "This package defines new Groovy methods which appear on
  568. normal JDK Date/Time API (@code{java.time}) classes inside the Groovy
  569. environment."))))
  570. (define groovy-dateutil
  571. (let ((base (groovy-subproject "groovy-dateutil")))
  572. (package
  573. (inherit base)
  574. (native-inputs
  575. `(("groovy-test" ,groovy-test)
  576. ,@(package-native-inputs base)))
  577. (synopsis "Date and Calendar API for Groovy")
  578. (description "This package defines new groovy methods which appear on
  579. normal JDK Date and Calendar classes inside the Groovy environment."))))
  580. (define groovy-docgenerator
  581. (let ((base (groovy-subproject "groovy-docgenerator")))
  582. (package
  583. (inherit base)
  584. (arguments
  585. `(#:tests? #f; No tests
  586. ,@(package-arguments base)))
  587. (inputs
  588. `(("groovy-templates" ,groovy-templates)
  589. ("groovy-swing" ,groovy-swing)
  590. ("java-qdox-1.12" ,java-qdox-1.12)
  591. ,@(package-inputs base)))
  592. (native-inputs
  593. `(("groovy-bootstrap" ,groovy-bootstrap)
  594. ("groovy-test" ,groovy-test)
  595. ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
  596. ,@(package-native-inputs base)))
  597. (synopsis "Groovy documentation generation")
  598. (description "This package contains a command line tool to generate
  599. documentation for groovy applications."))))
  600. (define groovy-groovysh
  601. (let ((base (groovy-subproject "groovy-groovysh")))
  602. (package
  603. (inherit base)
  604. (inputs
  605. `(("groovy-xml" ,groovy-xml)
  606. ("groovy-console" ,groovy-console)
  607. ,@(package-inputs base)))
  608. (native-inputs
  609. `(("groovy-bootstrap" ,groovy-bootstrap)
  610. ("groovy-test" ,groovy-test)
  611. ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
  612. ,@(package-native-inputs base)))
  613. (synopsis "Groovy REPL")
  614. (description "This package contains the Groovy REPL."))))
  615. (define groovy-jmx
  616. (let ((base (groovy-subproject "groovy-jmx")))
  617. (package
  618. (inherit base)
  619. (native-inputs
  620. `(("groovy-bootstrap" ,groovy-bootstrap)
  621. ("groovy-test" ,groovy-test)
  622. ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
  623. ,@(package-native-inputs base)))
  624. (synopsis "Groovy JMX extension")
  625. (description "This package contains the JMX extension of Groovy, for
  626. management and monitoring of JVM-based solutions."))))
  627. (define groovy-json
  628. (let ((base (groovy-subproject "groovy-json")))
  629. (package
  630. (inherit base)
  631. (native-inputs
  632. `(("groovy-bootstrap" ,groovy-bootstrap)
  633. ("groovy-test" ,groovy-test)
  634. ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
  635. ,@(package-native-inputs base)))
  636. (synopsis "Groovy JSON")
  637. (description "This package contains JSON-related utilities for groovy."))))
  638. (define groovy-jsr223
  639. (let ((base (groovy-subproject "groovy-jsr223")))
  640. (package
  641. (inherit base)
  642. (native-inputs
  643. `(("groovy-bootstrap" ,groovy-bootstrap)
  644. ("groovy-test" ,groovy-test)
  645. ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
  646. ,@(package-native-inputs base)))
  647. (synopsis "Groovy's own JSR223 implementation")
  648. (description "This package contains Groovy's own JSR223 implementation. This
  649. module is used for interaction between Groovy and Java code."))))
  650. (define groovy-nio
  651. (let ((base (groovy-subproject "groovy-nio")))
  652. (package
  653. (inherit base)
  654. (arguments
  655. `(#:tests? #f; Require spock-framework
  656. ,@(package-arguments base)))
  657. (synopsis "Groovy input-output library")
  658. (description "This package implements an input/output library that extends
  659. the functionality of the common library of Java."))))
  660. (define groovy-servlet
  661. (let ((base (groovy-subproject "groovy-servlet")))
  662. (package
  663. (inherit base)
  664. (inputs
  665. `(("groovy-templates" ,groovy-templates)
  666. ("groovy-xml" ,groovy-xml)
  667. ,@(package-inputs base)))
  668. (native-inputs
  669. `(("groovy-bootstrap" ,groovy-bootstrap)
  670. ("groovy-json" ,groovy-json)
  671. ("groovy-test" ,groovy-test)
  672. ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
  673. ,@(package-native-inputs base)))
  674. (synopsis "Groovy's servlet implementation")
  675. (description "This package contains a library to create groovlets, Groovy's
  676. version of Java servlets."))))
  677. (define groovy-sql
  678. (let ((base (groovy-subproject "groovy-sql")))
  679. (package
  680. (inherit base)
  681. (arguments
  682. `(#:tests? #f;TODO: Requires hsqldb
  683. ,@(package-arguments base)))
  684. (synopsis "Groovy SQL library")
  685. (description "This package contains a facade over Java's normal JDBC APIs
  686. providing greatly simplified resource management and result set handling."))))
  687. (define groovy-testng
  688. (let ((base (groovy-subproject "groovy-testng")))
  689. (package
  690. (inherit base)
  691. (native-inputs
  692. `(("groovy-bootstrap" ,groovy-bootstrap)
  693. ("groovy-test" ,groovy-test)
  694. ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
  695. ,@(package-native-inputs base)))
  696. (synopsis "Groovy testing framework")
  697. (description "This package contains integration code for running TestNG
  698. tests in Groovy."))))
  699. (define groovy-macro
  700. (let ((base (groovy-subproject "groovy-macro")))
  701. (package
  702. (inherit base)
  703. (arguments
  704. (substitute-keyword-arguments (package-arguments base)
  705. ((#:phases phases)
  706. `(modify-phases ,phases
  707. (delete 'copy-resources)
  708. (add-after 'build 'copy-resources
  709. (lambda _
  710. (copy-recursively "subprojects/groovy-macro/src/main/resources"
  711. "build/classes")
  712. (substitute* "build.xml"
  713. (("depends=\"compile,") "depends=\""))
  714. (invoke "ant" "jar")
  715. #t))))))
  716. (inputs
  717. `(("groovy-templates" ,groovy-templates)
  718. ("groovy-xml" ,groovy-xml)
  719. ,@(package-inputs base)))
  720. (native-inputs
  721. `(("groovy-bootstrap" ,groovy-bootstrap)
  722. ("groovy-json" ,groovy-json)
  723. ("groovy-test" ,groovy-test)
  724. ("groovy-tests-bootstrap" ,groovy-tests-bootstrap)
  725. ,@(package-native-inputs base)))
  726. (synopsis "Groovy macro processor")
  727. (description "This package contains a high-level library to create macro
  728. and modify groovy's @dfn{Abstract Syntax Tree} (AST)."))))
  729. (define groovy-yaml
  730. (let ((base (groovy-subproject "groovy-yaml")))
  731. (package
  732. (inherit base)
  733. (inputs
  734. `(("groovy-json" ,groovy-json)
  735. ("java-fasterxml-jackson-annotations" ,java-fasterxml-jackson-annotations)
  736. ("java-fasterxml-jackson-core" ,java-fasterxml-jackson-core)
  737. ("java-fasterxml-jackson-databind" ,java-fasterxml-jackson-databind)
  738. ("java-fasterxml-jackson-dataformat-yaml" ,java-fasterxml-jackson-dataformat-yaml)
  739. ,@(package-inputs base)))
  740. (native-inputs
  741. `(("groovy-test" ,groovy-test)
  742. ,@(package-native-inputs base)))
  743. (synopsis "Groovy YAML")
  744. (description "This package contains YAML-related utilities for groovy."))))
  745. (define-public groovy
  746. (package
  747. (inherit groovy-bootstrap)
  748. (name "groovy")
  749. (arguments
  750. `(#:tests? #f; No tests
  751. #:jdk ,openjdk9
  752. #:phases
  753. (modify-phases %standard-phases
  754. (delete 'configure)
  755. (delete 'build)
  756. (replace 'install
  757. (lambda* (#:key outputs inputs #:allow-other-keys)
  758. (let* ((out (assoc-ref outputs "out"))
  759. (out-bin (string-append out "/bin"))
  760. (out-lib (string-append out "/lib")))
  761. (with-directory-excursion "src/bin"
  762. (substitute* "startGroovy"
  763. (("\"\\\\\"") "\"")
  764. (("\\\\\"\"") "\"")
  765. (("\\\\\\$") "$")
  766. (("@GROOVYJAR@") "groovy.jar")
  767. (("MAX_FD=\"maximum\"")
  768. (string-append
  769. "MAX_FD=\"maximum\"\nJAVA_HOME="
  770. (assoc-ref inputs "jdk"))))
  771. ;; Groovy uses class loading. It's not enough to put the class
  772. ;; in the loader's classpath, as it causes breakages:
  773. ;; the compiler would give this error:
  774. ;; "Prohibited package name: java.lang"
  775. ;; So we symlink dependencies in this package's output. The
  776. ;; starter class (in groovy-bootstrap) is where the class loader
  777. ;; will look for dependencies, so we put it there too.
  778. (mkdir-p out-lib)
  779. (for-each
  780. (lambda (input)
  781. (for-each
  782. (lambda (jar)
  783. (symlink jar (string-append out-lib "/" (basename jar))))
  784. (find-files (assoc-ref inputs input) ".*.jar")))
  785. '("groovy-bootstrap" "groovy-ant" "groovy-astbuilder"
  786. "groovy-bsf" "groovy-cli-commons" "groovy-cli-picocli"
  787. "groovy-console" "groovy-datetime" "groovy-dateutil"
  788. "groovy-docgenerator" "groovy-groovydoc" "groovy-groovysh"
  789. "groovy-jmx" "groovy-json" "groovy-jsr223" "groovy-nio"
  790. "groovy-parser-antlr4" "groovy-servlet" "groovy-sql"
  791. "groovy-swing" "groovy-templates" "groovy-testng"
  792. "groovy-xml" "groovy-yaml" "java-commons-cli"
  793. "java-tunnelvisionlabs-antlr4-runtime" "java-asm"
  794. "java-asm-analysis" "java-asm-tree" "java-asm-util"
  795. "java-classpathx-servletapi" "java-xstream" "java-picocli"
  796. "java-jansi" "java-jline-2"))
  797. ;; antlr.jar is present twice in antlr2. Symlink doesn't like
  798. ;; it, so we symlink it here.
  799. (symlink (search-input-file inputs "/lib/antlr.jar")
  800. (string-append out-lib "/antlr.jar"))
  801. (for-each
  802. (lambda (tool)
  803. (install-file tool out-bin)
  804. (chmod (string-append out-bin "/" tool) #o755))
  805. '("grape" "groovy" "groovyc" "groovyConsole" "groovydoc"
  806. "groovysh" "java2groovy" "startGroovy")))
  807. (install-file "src/conf/groovy-starter.conf"
  808. (string-append out "/conf"))
  809. #t))))))
  810. (inputs
  811. `(("groovy-bootstrap" ,groovy-bootstrap)
  812. ("groovy-ant" ,groovy-ant)
  813. ("groovy-astbuilder" ,groovy-astbuilder)
  814. ("groovy-bsf" ,groovy-bsf)
  815. ("groovy-cli-commons" ,groovy-cli-commons)
  816. ("groovy-cli-picocli" ,groovy-cli-picocli)
  817. ("groovy-console" ,groovy-console)
  818. ("groovy-datetime" ,groovy-datetime)
  819. ("groovy-dateutil" ,groovy-dateutil)
  820. ("groovy-docgenerator" ,groovy-docgenerator)
  821. ("groovy-groovydoc" ,groovy-groovydoc)
  822. ("groovy-groovysh" ,groovy-groovysh)
  823. ("groovy-jmx" ,groovy-jmx)
  824. ("groovy-json" ,groovy-json)
  825. ("groovy-jsr223" ,groovy-jsr223)
  826. ("groovy-nio" ,groovy-nio)
  827. ("groovy-parser-antlr4" ,groovy-parser-antlr4)
  828. ("groovy-servlet" ,groovy-servlet)
  829. ("groovy-sql" ,groovy-sql)
  830. ("groovy-swing" ,groovy-swing)
  831. ("groovy-templates" ,groovy-templates)
  832. ("groovy-testng" ,groovy-testng)
  833. ("groovy-xml" ,groovy-xml)
  834. ("groovy-yaml" ,groovy-yaml)
  835. ("java-tunnelvisionlabs-antlr4-runtime"
  836. ,java-tunnelvisionlabs-antlr4-runtime)
  837. ("java-commons-cli" ,java-commons-cli)
  838. ("java-asm" ,java-asm-8)
  839. ("java-asm-analysis" ,java-asm-analysis-8)
  840. ("java-asm-tree" ,java-asm-tree-8)
  841. ("java-asm-util" ,java-asm-util-8)
  842. ("java-classpathx-servletapi" ,java-classpathx-servletapi)
  843. ("java-picocli" ,java-picocli)
  844. ("java-jansi" ,java-jansi)
  845. ("java-jline-2" ,java-jline-2)
  846. ("java-xstream" ,java-xstream)
  847. ("antlr2" ,antlr2)))
  848. (synopsis "Programming language for the JVM")
  849. (description "Apache Groovy is a powerful, optionally typed and dynamic
  850. language, with static-typing and static compilation capabilities, for the Java
  851. platform. It integrates smoothly with any Java program, and immediately
  852. delivers to your application powerful features, including scripting
  853. capabilities, Domain-Specific Language authoring, runtime and compile-time
  854. meta-programming and functional programming.")))