A Leiningen plugin for Parallel Universe's Capsule
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/main/clojure/leiningen
test_projects/lein-capsule-test
.gitignore
.travis.yml
CHANGELOG.md
COPYING
COPYING.LESSER
LICENSE
NOTICE
README.md
epl-1.0.txt
project.clj

README.md

lein-capsule
A Leiningen plugin for Parallel Universe's Capsule.

Build Status Dependency Status Version License License

A Leiningen plugin for Parallel Universe's Capsule.

Please report any issues. Very first release, partially tested (see lein-capsule-test/project.clj), so expect some bumpiness and spec format changes until major release 1.0.

Getting started

Add [lein-capsule "0.2.1"] to :plugins in your project.clj.

The plugin is configured through the :capsule project section and currently supports no command line arguments. Minimal project.clj sample:

(defproject lein-capsule-test "0.1.1"
 :plugins [
   [lein-capsule "0.2.1"] ]

 :dependencies [
   [org.clojure/clojure "1.7.0"] ]

 :jvm-opts ["-client"]

 ;;; Needed for executable jars as well as for capsules, if not present an artifact executable will be assumed
 :main lein-capsule-test.core
  
 ;;; Leinengen 3 will remove implicit AOT-compilation of :main
 :aot [lein-capsule-test.core]
  
 ;;; Capsule plugin configuration section, optional
 :capsule {
   :types {
     ;; Optional, can override anything, will trigger building a thin capsule
     :thin {} } } )

Then from project root:

$ lein capsule

...Will build capsules in target/capsules (unless differently configured).

Features

Full reference: lein-capsule-test/project.clj

  • Common :capsule section supporting (hopefully) every capsule manifest entry. Sensible defaults are based on project-level configuration and Capsule defaults themselves but they can be adjusted and overridden.
  • Main namespace, dependencies and repositories are inherited from project's configuration but can be adjusted for capsule builds
  • Support for building many capsules of different :types, currently :fat, :thin, :fat-except-clojure, :thin-except-clojure, :mixed; the latter lets you specify base type (fat or thin) and exceptions (i.e. dependencies to download or embed respectively)
  • Specific capsule builds can override any settings in the toplevel :capsule section
  • Support for capsule modes
  • Specific capsule modes can override any settings in the toplevel :capsule section (except :types and :application)
  • It will automatically use minimal Capsule embedding (i.e. only the Capsule class) whenever possible (i.e. no artifacts to get)

(Some) TODOs

  • More manual tests but most importantly a comprehensive (eventually) testsuite including more (smaller) examples
  • Support "Really Executable" Capsules and trampolines
  • Support embedded Caplets
  • Reference docs, look into Codox, Marginalia and lein-html5-docs
  • Consider using core.typed
  • Spot, reshape and publish generally useful logic (right now everything except main plugin's function is either private or marked as :internal)
  • Various TODOs in code
  • Possibly refactor configuration to make it smarter, shorter and more readable; especially remove repetitions
  • Uberjar-style dedicated profile?

License

lein-capsule is free software published under the following license:

Copyright © 2014-2016 Fabio Tudone

This program and the accompanying materials are dual-licensed under
either the terms of the Eclipse Public License v1.0 as published by
the Eclipse Foundation

  or (per the licensee's choosing)

under the terms of the GNU Lesser General Public License version 3.0
as published by the Free Software Foundation.