Skip to content

Latest commit

 

History

History
104 lines (69 loc) · 3.18 KB

README.md

File metadata and controls

104 lines (69 loc) · 3.18 KB

Build Status Maven Central

Partial-sbt

The goal is simple: Apply some sbt tasks/commands on only the modules/sub-modules changed between two git commits or two git branches, including their reverse dependencies.

The main purpose behind, is to reduce build, test & integration test times.

For example:

  • Test and deploy only modules (and their reverse dependencies) that have been changed between develop branch and feature x branch
  • Package only modules (and their reverse dependencies) that have been changed between two git commits.

Project example:

Requirements

  • SBT
  • Git managed repository.

Setup

Using Published Plugin

Maven Central

Add sbt-assembly as a dependency in project/plugins.sbt:

addSbtPlugin("com.elarib" % "partial-sbt" % "0.1")

Usage

Applying the plugin in your build.sbt

enablePlugins(com.elarib.PartialSbtPlugin)

changedProjects task

Now you have the changedProjects task, that list you all the modules (and their reverse dependencies) changed. You have the possibility to get the changed projects :

  • Between two git branches using:
    > changedProjects gitBranch sourceLocalBranch targetLocalBranch
  • Between two git commits using:
    > changedProjects gitCommit oldCommitId newCommitId

metaBuildChangedFiles task

List you all the changed meta build files :

  • Between two git branches using:
    > metaBuildChangedFiles gitBranch sourceLocalBranch targetLocalBranch
  • Between two git commits using:
    > metaBuildChangedFiles gitCommit oldCommitId newCommitId

How it works

1. Get changed files

jgit is used to list the diff between two branches or two commits.

2. Check if there is some main metabuild file changed

If yes, the whole project was changed, and they will be a need to reload (or build/test ...) If no, continue to next step.

3. List all modules impacted

List all modules impacted based on the changed files (step1) with all their reverse dependencies.

And finally list them, or apply the command or task need (not implemented yet).

TODO

  • Apply commands to changed modules.
  • Deploy to some maven repo manager.

License

Copyright (c) 2019 Abdelhamide EL ARIB

Published under The MIT License.