Skip to content

New features: automatic dependency order and resumable builds #14

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
target/
pom.xml
.idea
*.iml
9 changes: 9 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changes and TODO

## UNRELEASED / 0.4.0

lein-sub will now automatically determine the optimum execution order.

Sub-modules may be specified as `--submodules` or `-s`.
Previously, only `-s` was supported.

Builds are now resumable using the `--resume` (or `-r`).

## 2013-Sep-22 / 0.3.0

* Add `-s <subprojects>` option support (Shantanu Kumar)
Expand Down
52 changes: 43 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
# lein-sub

Leiningen plugin to execute tasks on sub-projects
Leiningen plugin to execute tasks on sub-projects.

Should you need recursive behavior, consider Leiningen aliases or
[lein-cascade](https://github.com/kumarshantanu/lein-cascade).


## Installation

### Lein 2 users

Either install as a plugin in `~/.lein/profiles.clj`:

{:user {:plugins [[lein-sub "0.3.0"]]}}
{:user {:plugins [[lein-sub "0.4.0"]]}}

Or, specify as a plugin in `project.clj`:

:plugins [[lein-sub "0.3.0"]]
:plugins [[lein-sub "0.4.0"]]

### Leiningen 1.x users

Expand All @@ -28,16 +27,18 @@ Or, include as a dev-dependency in `project.clj`:

:dev-dependencies [[lein-sub "0.1.2"]]


## Usage

Your project may have sub-projects (each having its own project.clj file) -
you can specify them as follows:
Your project may have sub-projects -
you can specify the sub-projects as follows in the top level `project.clj`:

```clojure
:sub ["module/foo-common" "module/dep-vendor-xyz"]
```

These values are the _directory_ names of the sub-projects.
Each sub-project must have its own `project.clj`.

Execute the plugin:

```bash
Expand All @@ -47,12 +48,44 @@ $ lein sub jar # runs "lein jar" on both
$ lein sub install # install both sub-project artifacts to local Maven repo
```

You can pass subproject directory locations via command line (overrides `:sub`):
Starting in 0.4.0, lein-sub will automatically determine the
correct execution order for the sub-projects based on
inter-project dependencies.

Alternately, you may pass sub-project directories via the command line, using the
`--submodules` (or `-s`) option:

```bash
$ lein sub -s "module/foo-common:module/dep-vendor-xyz" jar
```

The `:` character is used to separate the directory names.

When `--submodules` is not specified, your top-level project *must*
have a :sub key.
When `--submodules` *is* specified, the :sub key is ignored.

## Build Continuation

It can be annoying to get part way through a large build only to hit
a minor failure in a particular module, and have to start over, even when
it's just a matter of a tiny typo.

The `--resume` (or `-r`) option instructs lein-sub to pick up where it left
off.

## Notes

lein-sub will create a file, `target/sub-cache.edn`, to store
project information between executions, including the
execution order.
This cache file will be recreated if deleted, or any time
any `project.clj` file is changed.
Even on a large project (over 40 modules), it takes less than a second
to rebuild.

It also creates a `target/sub-state.edn` file, to store what module it
is currently building.

## Getting in touch

Expand All @@ -69,11 +102,12 @@ On Leiningen mailing list: [http://groups.google.com/group/leiningen](http://gro
* Phil Hagelberg (https://github.com/technomancy)
* Hugo Duncan (https://github.com/hugoduncan)
* Creighton Kirkendall (https://github.com/ckirkendall)
* Howard M. Lewis Ship (https://github.com/hlship)


## License

Copyright © 2011-2013 Shantanu Kumar and contributors
Copyright © 2011-2017 Shantanu Kumar and contributors

Adapted from Phil Hagelberg's example: http://j.mp/oC9TTo

Expand Down
3 changes: 2 additions & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(defproject lein-sub "0.3.0"
(defproject lein-sub "0.4.0"
:description "Leiningen Subprojects plugin"
:url "https://github.com/kumarshantanu/lein-sub"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[com.stuartsierra/dependency "0.2.0"]]
:eval-in-leiningen true)
Loading