kinoplan / sbt-clean   1.0.0

Apache License 2.0 GitHub

A set of plugins for sbt on advanced clean management

Scala versions: 2.12
sbt plugins: 1.x

sbt-clean

build Mergify Status Maven Central vscode

An sbt plugin that provides various functionality for advanced cleanup of scala projects

Setup

This sbt plugin is available for sbt 1.x

To use the latest version of plugins, include the following in your project/plugins.sbt:

addSbtPlugin("io.kinoplan" % "sbt-clean" % ${version})

where you need to replace ${version} with the version you want to use.

Configuration

  • CleanAllPlugin:
    • 🚀 cleanAll: Task that executes clean all projects in a build
  • CleanTriggerPlugin:
    • 🚀 triggeredClean: Task that executes the clean task based on whether the sources is changed
    • ⚙️ cleanTriggerSources (Default: Nil): Sources used to determine whether clean should be run

Example

CleanAllPlugin

Start by enabling the plugin in your build.sbt file or for specific projects:

enablePlugins(CleanAllPlugin)

after that, to start clearing all projects, run the command in sbt shell:

cleanAll

CleanTriggerPlugin

Start by enabling the plugin for specific project:

enablePlugins(CleanTriggerPlugin)

then configure the sources whose changes will trigger the command to clean the /target folder and compile the project, for example:

lazy val shared = project
  .in(file("shared"))
  .settings(
    ...
  )

lazy val server = project
  .in(file("server"))
  .enablePlugins(CleanTriggerPlugin)
  .settings(
    cleanTriggerSources := Seq(
      (ThisBuild / baseDirectory).value / "shared" / "src" / "main" / "scala" / "api" / "internal",
      (ThisBuild / baseDirectory).value / "shared" / "src" / "main" / "scala" / "api" / "external" / "FooApi.scala"
    )
  )

Contributing

See CONTRIBUTING.md for more details about how to contribute.

License

This project is licensed under the terms of the Apache License, Version 2.0.