From 7d22d3adef1ddd4b54ca306140cdec72600458ab Mon Sep 17 00:00:00 2001 From: vlad Date: Mon, 8 Aug 2016 15:47:14 -0700 Subject: Start using sbt plugin for all settings --- project/DriverConfigurations.scala | 105 ------------------------------------- project/plugins.sbt | 12 +---- 2 files changed, 1 insertion(+), 116 deletions(-) delete mode 100644 project/DriverConfigurations.scala (limited to 'project') diff --git a/project/DriverConfigurations.scala b/project/DriverConfigurations.scala deleted file mode 100644 index 4044f34..0000000 --- a/project/DriverConfigurations.scala +++ /dev/null @@ -1,105 +0,0 @@ -import com.typesafe.sbt.SbtGit.git -import com.typesafe.sbt.{GitBranchPrompt, GitVersioning} -import org.scalafmt.sbt.ScalaFmtPlugin.autoImport._ -import sbt.Keys._ -import sbt._ -import sbtrelease.{Version, _} -import wartremover.WartRemover.autoImport._ -// we hide the existing definition for setReleaseVersion to replace it with our own -import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._ -import sbtrelease.ReleasePlugin.autoImport._ -import sbtrelease.ReleaseStateTransformations.{setReleaseVersion => _} - - -object DriverConfigurations { - - lazy val wartRemoverSettings = Seq( - wartremoverErrors in (Compile, compile) ++= Warts.allBut( - Wart.AsInstanceOf, Wart.Nothing, Wart.Overloading, Wart.DefaultArguments, Wart.Any, - Wart.Option2Iterable, Wart.ExplicitImplicitTypes, Wart.Throw, Wart.ToString, Wart.NoNeedForMonad - ) - ) - - lazy val acyclicSettings = Seq( - autoCompilerPlugins := true, - addCompilerPlugin("com.lihaoyi" %% "acyclic" % "0.1.4") - ) - - lazy val scalafmtSettings = Seq( - scalafmtConfig in ThisBuild := Some(file(".scalafmt")), - testExecution in (Test, test) <<= - (testExecution in (Test, test)) dependsOn (scalafmtTest in Compile, scalafmtTest in Test) - ) - - lazy val compileScalastyle = taskKey[Unit]("compileScalastyle") - - def publicationSettings() = Seq( - publishTo := Some(Resolver.file("file", new File("releases"))) - // publishTo := { // TODO: For actual Driver jar repo - // val nexus = "https://my.artifact.repo.net/" - // if (isSnapshot.value) - // Some("snapshots" at nexus + "content/repositories/snapshots") - // else - // Some("releases" at nexus + "service/local/staging/deploy/maven2") - // } - ) - - def releaseSettings() = { - def setVersionOnly(selectVersion: Versions => String): ReleaseStep = { st: State => - val vs = st.get(ReleaseKeys.versions).getOrElse( - sys.error("No versions are set! Was this release part executed before inquireVersions?")) - val selected = selectVersion(vs) - - st.log.info("Setting version to '%s'." format selected) - val useGlobal = Project.extract(st).get(releaseUseGlobalVersion) - - reapply(Seq( - if (useGlobal) version in ThisBuild := selected else version := selected - ), st) - } - - lazy val setReleaseVersion: ReleaseStep = setVersionOnly(_._1) - - Seq( - releaseIgnoreUntrackedFiles := true, - // Check http://blog.byjean.eu/2015/07/10/painless-release-with-sbt.html for details - releaseVersionBump := sbtrelease.Version.Bump.Minor, - releaseVersion <<= releaseVersionBump(bumper => { - ver => Version(ver) - .map(_.withoutQualifier) - .map(_.bump(bumper).string).getOrElse(versionFormatError) - }), - releaseProcess := Seq[ReleaseStep]( - checkSnapshotDependencies, - inquireVersions, - runTest, // probably, runTest after setReleaseVersion, if tests depend on version - setReleaseVersion, - commitReleaseVersion, // performs the initial git checks - tagRelease, - publishArtifacts, - setNextVersion, - commitNextVersion, - pushChanges // also checks that an upstream branch is properly configured - ) - ) - } - - implicit class driverConfigurations(project: Project) { - - def gitPluginConfiguration: Project = { - val VersionRegex = "v([0-9]+.[0-9]+.[0-9]+)-?(.*)?".r - - project - .enablePlugins(GitVersioning, GitBranchPrompt) - .settings( - git.useGitDescribe := true, - git.baseVersion := "0.0.0", - git.gitTagToVersionNumber := { - case VersionRegex(v, "SNAPSHOT") => Some(s"$v-SNAPSHOT") - case VersionRegex(v, "") => Some(v) - case VersionRegex(v, s) => Some(s"$v-$s-SNAPSHOT") - case _ => None - }) - } - } -} \ No newline at end of file diff --git a/project/plugins.sbt b/project/plugins.sbt index a3a7fb7..d8c77e4 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,11 +1 @@ -// Code style plugins -addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "0.2.10") -addSbtPlugin("org.wartremover" % "sbt-wartremover" % "1.0.1") -addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.8.0") - -// Launch and deploy/release plugins -addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.8.5") -addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.3") - -// This plugin represents functionality that is to be added to sbt in the future -addSbtPlugin("org.scala-sbt" % "sbt-core-next" % "0.1.1") \ No newline at end of file +addSbtPlugin("com.drivergrp" % "sbt-settings" % "0.1.0") -- cgit v1.2.3