[bug#53765,09/17] gnu: Add clojure-tools-analyzer-jvm.

Message ID 87leyr32c8.fsf@reilysiegel.com
State New
Headers
Series Remove limitations on clojure-tools |

Commit Message

Reily Siegel Feb. 4, 2022, 12:25 a.m. UTC
  * gnu/packages/clojure.scm (clojure-tools-analyzer-jvm): New variable.
---
 gnu/packages/clojure.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
  

Comments

Maxime Devos Feb. 6, 2022, 10:46 a.m. UTC | #1
Reily Siegel schreef op do 03-02-2022 om 19:25 [-0500]:
> +    (synopsis "Additional jvm-specific passes for @code{tools.analyzer}")

Is it jvm-specific, or Java-specific?  Also, isn't Clojure based on
Java, so Java-specific seems a tautology here?

Greeting,
Maxime.
  
Reily Siegel Feb. 7, 2022, 6:04 p.m. UTC | #2
Maxime Devos <maximedevos@telenet.be> writes:


> Is it jvm-specific, or Java-specific?
This is JVM-specific, as clojure compiles directly to JVM bytecode,
without an intermediary Java state.

>  Also, isn't Clojure based on Java, so Java-specific seems a tautology
> here?
There are also other implementations of Clojure that run on other
platforms, such as the CLR, JavaScript, and BEAM, and one under
development for Flutter.
  
Maxime Devos Feb. 7, 2022, 7:01 p.m. UTC | #3
Reily Siegel schreef op ma 07-02-2022 om 13:04 [-0500]:
> > Is it jvm-specific, or Java-specific?
> This is JVM-specific, as clojure compiles directly to JVM bytecode,
> without an intermediary Java state.

Compiling to Java bytecode does not imply the JVM -- for example,
GCJ can compile Java bytecode to native code, according to
<https://gcc.gnu.org/wiki/GCJ_FAQ>.  There is no JVM involved in this
situation.

Greetings,
Maxime.
  
Reily Siegel Feb. 7, 2022, 7:18 p.m. UTC | #4
Maxime Devos <maximedevos@telenet.be> writes:

> Compiling to Java bytecode does not imply the JVM -- for example,
> GCJ can compile Java bytecode to native code, according to
> <https://gcc.gnu.org/wiki/GCJ_FAQ>.  There is no JVM involved in this
> situation.
Yes. However, here "Java Bytecode" has nothing to do with the Java
programming language. It could have been produced by any programming
language that executes on the JVM. The Java, as well as Clojure
compilers produce bytecode that is designed to run on the Java Virtual
Machine. The fact that other programs can analyze that bytecode and do
something else with it doesn't seem super relevant to me. We wouldn't
call x86 assembly "C bytecode" because you could theoretically run it in
an emulator and not on an x86 processor. I really don't think this is
worth a huge debate, but my concern is that changing this to Java
implies that it only works with the Java programming language, and not
any other programming language or tool that respects JVM bytecode, of
which there are several (Scala, Groovy, Kotlin, etc.).
  

Patch

diff --git a/gnu/packages/clojure.scm b/gnu/packages/clojure.scm
index 7e188b99b6..4cd50483e3 100644
--- a/gnu/packages/clojure.scm
+++ b/gnu/packages/clojure.scm
@@ -670,6 +670,34 @@  (define-public clojure-tools-analyzer
 @code{tools.analyzer.jvm}, @code{tools.analyzer.js}")
     (license license:epl1.0)))
 
+(define-public clojure-tools-analyzer-jvm
+  (package
+    (name "clojure-tools-analyzer-jvm")
+    (version "1.2.2")
+    (home-page "https://github.com/clojure/tools.analyzer.jvm")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url home-page)
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1ibvgvfa4618l5d0pff9gjar1s0fwagi029v4allk7z3swb93ibr"))))
+    (build-system clojure-build-system)
+    (arguments
+     '(#:source-dirs '("src/main/clojure")
+       #:test-dirs '("src/test/clojure")
+       #:doc-dirs '("doc")))
+    (propagated-inputs (list clojure-core-memoize
+                             clojure-tools-reader
+                             clojure-tools-analyzer
+                             java-asm))
+    (synopsis "Additional jvm-specific passes for @code{tools.analyzer}")
+    (description "An analyzer for Clojure code, written on top of
+@code{tools.analyzer}, providing additional jvm-specific passes.")
+    (license license:epl1.0)))
+
 (define-public clojure-tools-cli
   (package
     (name "clojure-tools-cli")