-
Notifications
You must be signed in to change notification settings - Fork 56
Lean compilation
Lein-droid supports lean compilation mode via Project Skummet. This gives much faster load time and smaller APK size/memory footprint for your Clojure-Android applications.
Insert the following profile into :profiles
map of your project.clj
:
:lean
[:release
{:dependencies ^:replace [[org.skummet/clojure "1.7.0-r1"]
[neko/neko "4.0.0-alpha5"]]
:exclusions [[org.clojure/clojure]
[org.clojure-android/clojure]]
:jvm-opts ["-Dclojure.compile.ignore-lean-classes=true"]
:global-vars ^:replace {clojure.core/*warn-on-reflection* true}
:android {:lean-compile true
:proguard-execute true
:proguard-conf-path "build/proguard-minify.cfg"}}]
Latest Skummet version:
Here we define a new profile called :lean
that inherits from :release
profile. It replaces the dependency list with the one having a special
Skummet dependency. The following :exclusions
make sure that regular
Clojure does not get included from dependencies. :jvm-opts
line is just
necessary. :globar-vars
is added here because *warn-on-reflection*
Var
has to be namespace-qualified with Skummet. :lean-compile
parameter is also
just necessary. :proguard-...
options enable Proguard which reduces the APK
size and memory footprint.
NB: To use Proguard you must have exactly JDK7 installed. JDK8 is not supported by Proguard.
After you include and customize this profile, you can build your application with:
lein with-profile lean do clean, droid doall
There is an example of Skummet usage in the sample project.
Tutorial
- Installation
- Creating a new project
- Quick start
- Libraries and dependencies
- Editors and IDEs
- Troubleshooting
Profiles
Lean compilation
Multi-DEX project
Creating AAR libraries
Hacking the plugin
project.clj options
-
:android
- :aot
- :aot-exclude-ns
- :assets-paths
- :build-tools-version
- :build-type
- :dex-opts
- :external-classes-paths
- :external-res-paths
- :force-dex-optimize
- :ignore-log-priority
- :key-alias
- :keypass
- :keystore-path
- :lean-compile
- :library
- :manifest-options
- :manifest-template-path
- :multi-dex
- :multi-dex-proguard-conf-path
- :native-libraries-paths
- :proguard-execute
- :proguard-conf-path
- :rename-manifest-package
- :repl-device-port
- :repl-local-port
- :res-path
- :resource-jars-paths
- :sdk-path
- :sigalg
- :skummet-skip-vars
- :start-nrepl-server
- :storepass
- :target-version
- :use-debug-keystore
- :dependencies
- :java-only
- :profiles
- *warn-on-reflection*