Skip to content
This repository was archived by the owner on Apr 25, 2024. It is now read-only.

Profiles

Alexander Yakushev edited this page Jun 22, 2015 · 7 revisions
Leiningen profiles are used by lein-droid to customize the build type of the project (debug or release) and conditionally inject certain options into the project map. The example of using different profiles is shown in [[https://github.com/clojure-android/lein-droid/blob/master/sample/project.clj][sample project.clj]]. ** Omitting default profiles It is discouraged to apply =:base= and =:user= profiles to your Android project, because =:user= profile usually contains plenty of tooling dependencies that, at best, wouldn't work on Android, and at worst would crash your application. To avoid this put the following line into the =:profiles= map of =project.clj=: #+BEGIN_SRC clojure :default [:dev] #+END_SRC This will override the default profile vector that contains =:base= and =:user=. ** Lein-droid's proposed profiles Lein-droid doesn't explicitly tamper with project's profiles, doesn't rely on them having specific names, but instead uses Leiningen's already powerful profile inheritance capabilities. So you are free to devise any hierarchy of profiles that suits your project. Nevertheless, both the sample project and the template offer a simple profile hierarchy to get you started. *** :dev Like in any Leiningen project, =:dev= is a default profile that is used while the application is developed. This profile contains development dependencies (like nREPL) and compiles all namespaces on the classpath (including the ones that are not used yet). *** :release Profile to be used when building the final version of the application. =:release= doesn't include extra dependencies, compiles only what's necessary and uses a separate keystore for signing your application ([[http://developer.android.com/tools/publishing/app-signing.html][read more]]). *** :android-user This profile acts as a substitution for =:user= profile which we don't use. You can define it in =profiles.clj= and put in there options that you would like to use across all =:dev= profiles of your Clojure/Android projects. For example, it can contain [[https://github.com/clojure-android/lein-droid/wiki/Tutorial#setting-up-cider][CIDER-related configuration]]. *** :android-common Similar to =:android-user=, this is a system-wide profile that contains global settings common for both =:dev= and =:release= profiles. For instance, it can contain the path to Android SDK on your computer: #+BEGIN_SRC clojure :android-common {:android {:sdk-path "/home/user/path/to/android-sdk"}} #+END_SRC So the difference between this profile and the previous one is that both =:dev= and =:release= can inherit this profile, but only =:dev= should inherit =:android-user=. ** Using the profiles If you follow the architecture from template or sample project, =:dev= profile will be enabled by default and you won't have to do anything extra to execute commands with this profile. : lein droid doall To build the release version use the following command: : lein with-profile release droid doall The =with-profile= modifier allows you to chain subtasks using =do=: : lein with-profile release do droid build, droid apk
*Tutorial* - [[https://github.com/clojure-android/lein-droid/wiki/Tutorial#wiki-installation][Installation]] - [[https://github.com/clojure-android/lein-droid/wiki/Tutorial#wiki-creating-a-new-project][Creating a new project]] - [[https://github.com/clojure-android/lein-droid/wiki/Tutorial#wiki-quick-start][Quick start]] - [[https://github.com/clojure-android/lein-droid/wiki/Tutorial#libraries-and-dependencies][Libraries and dependencies]] - [[https://github.com/clojure-android/lein-droid/wiki/Tutorial#editors-and-ides][Editors and IDEs]] - [[https://github.com/clojure-android/lein-droid/wiki/Tutorial#wiki-troubleshooting][Troubleshooting]] *Profiles* - [[https://github.com/clojure-android/lein-droid/wiki/Profiles#lein-droids-proposed-profiles][Lein-droid’s proposed profiles]] - [[https://github.com/clojure-android/lein-droid/wiki/Profiles#dev][:dev]] - [[https://github.com/clojure-android/lein-droid/wiki/Profiles#release][:release]] - [[https://github.com/clojure-android/lein-droid/wiki/Profiles#android-user][:android-user]] - [[https://github.com/clojure-android/lein-droid/wiki/Profiles#android-common][:android-common]] - [[https://github.com/clojure-android/lein-droid/wiki/Profiles#using-the-profiles][Using the profiles]] *Lean compilation* - [[https://github.com/clojure-android/lein-droid/wiki/Lean-compilation#howto][Howto]] - [[https://github.com/clojure-android/lein-droid/wiki/Lean-compilation#example][Example]] *Multi-DEX project* - [[https://github.com/clojure-android/lein-droid/wiki/MultiDEX-project][Overcome DEX method limit]] *Creating AAR libraries* - [[https://github.com/clojure-android/lein-droid/wiki/Creating-AAR-libraries#creating-a-new-library-project][New project]] - [[https://github.com/clojure-android/lein-droid/wiki/Creating-AAR-libraries#converting-an-existing-library-project][Existing project]] *Hacking the plugin* - [[https://github.com/clojure-android/lein-droid/wiki/Hacking-the-plugin#code-layout][Code layout]] - [[https://github.com/clojure-android/lein-droid/wiki/Hacking-the-plugin#dev-environment][Dev environment]] *project.clj options* - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-android][:android]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-aot][:aot]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-aot-exclude-ns][:aot-exclude-ns]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-assets-paths][:assets-paths]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#build-tools-version][:build-tools-version]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#build-type][:build-type]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-dex-opts][:dex-opts]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-external-classes-paths][:external-classes-paths]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-external-res-paths][:external-res-paths]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-force-dex-optimize][:force-dex-optimize]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-ignore-log-priority][:ignore-log-priority]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-key-alias][:key-alias]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-keypass][:keypass]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-keystore-path][:keystore-path]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#lean-compile][:lean-compile]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-library][:library]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#manifest-options][:manifest-options]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#manifest-template-path][:manifest-template-path]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#multi-dex][:multi-dex]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#multi-dex-proguard-conf-path][:multi-dex-proguard-conf-path]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-native-libraries-paths][:native-libraries-paths]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#proguard-execute][:proguard-execute]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#proguard-conf-path][:proguard-conf-path]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#rename-manifest-package][:rename-manifest-package]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-repl-device-port][:repl-device-port]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-repl-local-port][:repl-local-port]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-res-path][:res-path]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-resource-jars-paths][:resource-jars-paths]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-sdk-path][:sdk-path]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-sigalg][:sigalg]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#skummet-skip-vars][:skummet-skip-vars]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-start-nrepl-server][:start-nrepl-server]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-storepass][:storepass]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-target-version][:target-version]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#use-debug-keystore][:use-debug-keystore]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-dependencies][:dependencies]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-java-only][:java-only]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#wiki-profiles][:profiles]] - [[https://github.com/clojure-android/lein-droid/wiki/project.clj-options#warn-on-reflection][*warn-on-reflection*]]

Clone this wiki locally