From 70d335369dabe4dd0220d23244fff8e2e38623a0 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Sat, 14 Feb 2015 20:21:57 -0500 Subject: [PATCH] "com.typesafe.sbt" % "sbt-git" % "0.6.1" --- LICENSE | 15 +++++++++++++ README.md | 4 ++++ build.sbt | 7 ++++-- .../sbt/houserules/GitVersionPlugin.scala | 22 +++++++++++++++++++ 4 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 LICENSE create mode 100644 README.md create mode 100644 src/main/scala/sbt/houserules/GitVersionPlugin.scala diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c30ec46 --- /dev/null +++ b/LICENSE @@ -0,0 +1,15 @@ +This software is licensed under the Apache 2 license, quoted below. + +Copyright 2012-2013 Typesafe Inc. [http://www.typesafe.com] + +Licensed under the Apache License, Version 2.0 (the "License"); you may not +use this file except in compliance with the License. You may obtain a copy of +the License at + + [http://www.apache.org/licenses/LICENSE-2.0] + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..a2ae515 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +sbt-houserules +============== + +sbt-houserules is a house rules plugin for sbt modules. diff --git a/build.sbt b/build.sbt index 96f0a60..2b65c49 100644 --- a/build.sbt +++ b/build.sbt @@ -4,8 +4,11 @@ lazy val commonSettings = Seq( ) lazy val root = (project in file(".")). - settings(commonSettings: _*). - settings(addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0"): _*). + settings( + commonSettings ++ + addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0") ++ + addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.6.1") + : _*). settings( sbtPlugin := true, name := "sbt-houserules" diff --git a/src/main/scala/sbt/houserules/GitVersionPlugin.scala b/src/main/scala/sbt/houserules/GitVersionPlugin.scala new file mode 100644 index 0000000..a281d0a --- /dev/null +++ b/src/main/scala/sbt/houserules/GitVersionPlugin.scala @@ -0,0 +1,22 @@ +package sbt +package houserules + +import sbt._ +import Keys._ +import com.typesafe.sbt.SbtGit._ + +object GitVersionPlugin extends AutoPlugin { + override def requires = plugins.JvmPlugin + override def trigger = allRequirements + + override def buildSettings: Seq[Def.Setting[_]] = baseBuildSettings + + lazy val baseBuildSettings: Seq[Setting[_]] = versionWithGit ++ Seq( + isSnapshot := true, + version := { + val old = version.value + if (isSnapshot.value) old + else git.baseVersion.value + } + ) +}