aboutsummaryrefslogtreecommitdiff
path: root/project/plugins.sbt
diff options
context:
space:
mode:
authorJakob Odersky <jakob@driver.xyz>2018-06-11 17:54:44 -0700
committerJakob Odersky <jakob@driver.xyz>2018-06-12 22:12:08 -0700
commitbe29a4964284f94d624ba25e4078fc382e80ac9a (patch)
tree958939d487aeb5bdb2e83c75349995b79ea06c93 /project/plugins.sbt
parentd511f3c109becb8a8e52e20826f9cb991d46bf9c (diff)
downloadsbt-settings-jo/plugins.tar.gz
sbt-settings-jo/plugins.tar.bz2
sbt-settings-jo/plugins.zip
Refactor settings to use autopluginsv2.0.0-RC1jo/plugins
**Overview and motivation** This consolidates settings that were previously implemented as functions and/or implicit conversions into a suite of sbt autoplugins. The rationale is that this is well-defined pattern by sbt and allows easy build introspection with standard sbt functionality (for example, `sbt plugins` will list all active plugins in a build). Furthermore, it makes it very easy to disable certain features when required, such as removing linting during development. **Migration from current version** All features from the previous version should still be provided by the changes proposed here. The migration path is quite straight-forward: - Replace `project.driverService(name)` with `project.enablePlugins(Service)` (same goes for libraries) and make sure the project's name corresponds to the service's name - Linting, which was previously enabled by adding `lintingSettings` and `formatSettings` to a project, is automatically enabled. It may be removed by disabling the plugin: `project.dsiablePlugin(Linting)` All tasks and settings provided by sbt-settings should remain the same. **Additional features** An additional feature is that versioning is now handled the same way between libraries and services; that is, the version is derived from the latest git tag. Since services may be deployed from the same tag mutliple times, it is required that versions can be explicitly set to include additional information, such as a build number from a CI system. This was previously done interactively, using sbt's `set` command: ``` export TAG="$(sbt -no-colors version | tail -1 | awk '{ print $2 }').$TRAVIS_BUILD_NUMBER" sbt "set version := \"$TAG\"" docker:publishLocal ``` While this approach works, it has the downsides of requiring mutliple sbt invocations. The changes proposed in this PR will read the version from a VERSION environment variable first, defaulting to git if unavailable. Therefore, the additional sbt invocation can be removed with a CI script similar to the following: ``` export VERSION="$(git describe).$TRAVIS_BUILD_NUMBER"" sbt docker:publishLocal // use version in other steps ``` Using an autoplugin-based approach may also make it easier to cross-compile projects to ScalaJS and Native in the future, as support for them is built into sbt-crossproject.
Diffstat (limited to 'project/plugins.sbt')
-rw-r--r--project/plugins.sbt1
1 files changed, 1 insertions, 0 deletions
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 4da7bd5..a769906 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1 +1,2 @@
addSbtPlugin("com.lucidchart" %% "sbt-scalafmt" % "1.14")
+libraryDependencies += { "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value }