julianpeeters / sbt-buildlevel   0.1.0

Apache License 2.0 GitHub

Which build is currently loaded, meta-build or proper build?

Scala versions: 2.12
sbt plugins: 1.0

sbt-buildlevel Maven Central

Which build is currently loaded, meta-build or proper build?

This is a library for sbt plugins, particularly global sbt plugins:

  • load different settings and tasks, according to build level
  • load the same settings and tasks, regardless of build level

Install the library

Add the dependency to $BASE_DIR/build.sbt of a plugin:

lazy val myplugin = (project in file("."))
  .enablePlugins(SbtPlugin)
  .settings(
    addSbtPlugin("com.julianpeeters" % "sbt-buildlevel" % SbtBuildLevelV),
    ...

Use the library

Import the setting key in a plugin:

import sbt._
import sbtbuildlevel.Key.autoImport.buildLevel 
import sbtbuildlevel.ProperBuild

object MyPlugin extends AutoPlugin {
  if (buildlevel.value == ProperBuild) ...
  else ...