Skip to content

Commit

Permalink
sbt 1
Browse files Browse the repository at this point in the history
  • Loading branch information
tek committed Apr 27, 2018
1 parent d38dca7 commit 93117c6
Show file tree
Hide file tree
Showing 51 changed files with 67 additions and 107 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ additional info for implicit resolution errors.
# Usage

```sbt
addCompilerPlugin("io.tryp" % "splain" % "0.2.9" cross CrossVersion.patch)
addCompilerPlugin("io.tryp" % "splain" % "0.3.0" cross CrossVersion.patch)
```

# Configuration
Expand Down
44 changes: 44 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
scalaVersion := "2.12.5"
crossScalaVersions ++= List("2.10.6", "2.11.11", "2.11.12", "2.12.1", "2.12.2", "2.12.3", "2.12.4")
crossVersion := CrossVersion.full
organization := "io.tryp"
name := "splain"
fork := true
libraryDependencies ++= List(
scalaOrganization.value % "scala-compiler" % scalaVersion.value % "provided",
"org.specs2" %% "specs2-core" % "3.8.6" % "test",
"com.chuusai" %% "shapeless" % "2.3.2" % "test",
)

addSourceDir { case (2, minor, _) if minor >= 11 => "2.11+" }
addSourceDir { case (2, 12, patch) if patch >= 4 => "2.12.4+" case _ => "2.12.3-" }
javaOptions in Test ++= {
val jar = (Keys.`package` in Compile).value.getAbsolutePath
val tests = baseDirectory.value / "tests"
List(s"-Dsplain.jar=$jar", s"-Dsplain.tests=$tests")
}

publishMavenStyle := true
publishTo := Some(
if (isSnapshot.value) Opts.resolver.sonatypeSnapshots
else Resolver.url("sonatype staging", url("https://oss.sonatype.org/service/local/staging/deploy/maven2"))
)
licenses := List("MIT" -> url("http://opensource.org/licenses/MIT"))
homepage := Some(url(repo))
scmInfo := Some(ScmInfo(url(repo), "scm:git@github.com:tek/splain"))
developers := List(Developer(id="tryp", name="Torsten Schmits", email="torstenschmits@gmail.com", url=url(github)))

import ReleaseTransformations._
releaseCrossBuild := true
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
setReleaseVersion,
releaseStepCommandAndRemaining("+publishSigned"),
releaseStepCommand("sonatypeReleaseAll"),
commitReleaseVersion,
tagRelease,
setNextVersion,
commitNextVersion
)
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.16
sbt.version=1.1.1
103 changes: 20 additions & 83 deletions project/build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,90 +2,27 @@ package tryp

import sbt._, Keys._

import sbtrelease.ReleasePlugin.autoImport.{ReleaseTransformations, releaseProcess, ReleaseStep}
import ReleaseTransformations._

object SplainLibs
extends Libs
object P
extends AutoPlugin
{
val splain = ids(
scalaOrganization.value % "scala-compiler" % scalaVersion.value % "provided",
"org.specs2" %% "specs2-core" % "3.8.6" % "test",
"com.chuusai" %% "shapeless" % "2.3.2" % "test"
)
}

object Build
extends MultiBuild("splain")
{
override def defaultBuilder =
super.defaultBuilder(_)
.settingsV(
scalaVersion := "2.12.5",
crossScalaVersions ++= List("2.10.6", "2.11.11", "2.11.12", "2.12.1", "2.12.2", "2.12.3", "2.12.4"),
crossVersion := CrossVersion.full,
TrypBuildKeys.libs := SplainLibs
)

val versionRex = raw"(\d+)\.(\d+).(\d+).*".r

def addSourceDir(f: PartialFunction[(Int, Int, Int), String]) =
(unmanagedSourceDirectories in Compile) ++= {
val add = for {
a <- scalaVersion.value match {
case versionRex(ma, mi, pa) => Some(ma.toInt, mi.toInt, pa.toInt)
case _ => None
}
(ma, mi, pa) = a
b <- f.lift(ma, mi, pa)
} yield List(baseDirectory.value / s"src-$b")
add.getOrElse(Nil)
}

lazy val splain = "splain"
.bintray
.settings(publishSettings)
.settings(releaseSettings)
.settingsV(
organization := "io.tryp",
name := "splain",
addSourceDir { case (2, minor, _) if minor >= 11 => "2.11+" },
addSourceDir { case (2, 12, patch) if patch >= 4 => "2.12.4+" case _ => "2.12.3-" },
fork := true,
javaOptions in Test ++= {
val jar = (Keys.`package` in Compile).value.getAbsolutePath
val tests = baseDirectory.value / "tests"
List(s"-Dsplain.jar=$jar", s"-Dsplain.tests=$tests")
object autoImport
{
val versionRex = raw"(\d+)\.(\d+).(\d+).*".r

def addSourceDir(f: PartialFunction[(Int, Int, Int), String]) =
(unmanagedSourceDirectories in Compile) ++= {
val add = for {
a <- scalaVersion.value match {
case versionRex(ma, mi, pa) => Some(ma.toInt, mi.toInt, pa.toInt)
case _ => None
}
(ma, mi, pa) = a
b <- f.lift(ma, mi, pa)
} yield List(sourceDirectory.value / "main" / s"scala-$b")
add.getOrElse(Nil)
}
)

val github = "https://github.com/tek"
val repo = s"$github/splain"

def publishSettings = List(
publishMavenStyle := true,
publishTo := Some(
if (isSnapshot.value) Opts.resolver.sonatypeSnapshots
else Resolver.url("sonatype staging", url("https://oss.sonatype.org/service/local/staging/deploy/maven2"))
),
licenses := List("MIT" -> url("http://opensource.org/licenses/MIT")),
homepage := Some(url(repo)),
scmInfo := Some(ScmInfo(url(repo), "scm:git@github.com:tek/splain")),
developers := List(Developer(id="tryp", name="Torsten Schmits", email="torstenschmits@gmail.com", url=url(github)))
)

def releaseSettings = List(
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
setReleaseVersion,
ReleaseStep(action = Command.process("publishSigned", _), enableCrossBuild = true),
commitReleaseVersion,
tagRelease,
setNextVersion,
commitNextVersion,
ReleaseStep(action = Command.process("sonatypeReleaseAll", _), enableCrossBuild = true)
)
)
val github = "https://github.com/tek"
val repo = s"$github/splain"
}
}
1 change: 0 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
addSbtPlugin("net.virtual-void" % "sbt-optimizer" % "0.1.2")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.8")
7 changes: 0 additions & 7 deletions project/project/project/build.scala

This file was deleted.

9 changes: 0 additions & 9 deletions project/project/tryp.sbt

This file was deleted.

1 change: 0 additions & 1 deletion project/project/trypVersion.sbt

This file was deleted.

2 changes: 0 additions & 2 deletions project/tryp.sbt

This file was deleted.

1 change: 0 additions & 1 deletion project/trypVersion.sbt

This file was deleted.

1 change: 0 additions & 1 deletion splain/version.sbt

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions version.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version in ThisBuild := "0.3.0-SNAPSHOT"

0 comments on commit 93117c6

Please sign in to comment.