Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suggestion: use clojure aot similar mechanism to reduce jar size. #955

Open
clojurians-org opened this issue Apr 3, 2019 · 3 comments
Open

Comments

@clojurians-org
Copy link

haskell compile too much class file, it led to its big jar size.

clojure has a simple solution for this situation for reference.

it has pomegranate library(just like haskell hint library), it can be used to load clojure file in runtime to generate class dynamically. it also publish clj file as maven repository directrly.

in case we need the same physical class sometimes, it offer the aot mechanism to compile only little needed class file before script interpretion procecure.
the situation is:

export physical jar class implement used by java project
some library use refletion mechanism to load class, so the physical class file must exist.
the reference doc is:
https://clojure.org/reference/compilation

@clojurians-org
Copy link
Author

a simple example, it offer aot entry for needed module for project configuration

(defproject clj-java-compile "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.8.0"]]
  :aot [core, xxx.yyy, ...]
  :source-paths ["src/main/clojure"]
  :java-source-paths ["src/main/java"])

@clojurians-org
Copy link
Author

as you can see from maven repository:
http://central.maven.org/maven2/org/clojure/core.async/0.4.490/

the maven repository container only clj file without java.

@jneira
Copy link
Collaborator

jneira commented Apr 3, 2019

Hi, the tool to minimize the jar that has been used so far is proguard , you can use it directly or including the appropiate gradle plugin if you are already are using gradle to build the eta project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants