Skip to content

Commit

Permalink
Merge pull request #139 from eed3si9n/wip/bump
Browse files Browse the repository at this point in the history
sbt 1.2.8
  • Loading branch information
eed3si9n authored Jul 14, 2019
2 parents 90d79e2 + ea25966 commit 1336c66
Show file tree
Hide file tree
Showing 24 changed files with 80 additions and 147 deletions.
43 changes: 28 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,40 @@
language: scala
jdk: oraclejdk8
script:
- sbt "++${TRAVIS_SCALA_VERSION}" "^^${SBT_VERSION}" test scripted

env: ADOPTOPENJDK=11

matrix:
include:
- env: SBT_VERSION="0.13.18"
- env: SBT_VERSION="0.13.18" ADOPTOPENJDK=8
scala: 2.10.7
- env: SBT_VERSION="1.2.8"
- env: SBT_VERSION="1.2.8" ADOPTOPENJDK=11
scala: 2.12.8
- scala: 2.13.0
script: "sbt \"++${TRAVIS_SCALA_VERSION}\" library/test"
script: "sbt \"++${TRAVIS_SCALA_VERSION}!\" library/test"
- scala: 2.11.12
script: "sbt \"++${TRAVIS_SCALA_VERSION}\" library/test"
script: "sbt \"++${TRAVIS_SCALA_VERSION}!\" library/test"

before_install:
# adding $HOME/.sdkman to cache would create an empty directory, which interferes with the initial installation
- "[[ -d $HOME/.sdkman/bin/ ]] || rm -rf $HOME/.sdkman/"
- curl -sL https://get.sdkman.io | bash
- echo sdkman_auto_answer=true > $HOME/.sdkman/etc/config
- source "$HOME/.sdkman/bin/sdkman-init.sh"

install:
- sdk install java $(sdk list java | grep -o "$ADOPTOPENJDK\.[0-9\.]*hs-adpt" | head -1)
- unset JAVA_HOME
- java -Xmx32m -version
- javac -J-Xmx32m -version

script:
- sbt "++${TRAVIS_SCALA_VERSION}!" "^^${SBT_VERSION}" test scripted

before_cache:
- find $HOME/.ivy2 -name "ivydata-*.properties" -delete
- find $HOME/.sbt -name "*.lock" -delete

cache:
directories:
- $HOME/.ivy2/cache
- $HOME/.coursier
- $HOME/.sbt

before_cache:
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete
- find $HOME/.sbt -name "*.lock" -print -delete

notifications:
email:
on_success: never
69 changes: 31 additions & 38 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,41 +1,36 @@
import Dependencies._

lazy val pluginSettings = Seq(
bintrayPackage := "sbt-contraband",
sbtPlugin := true
ThisBuild / version := "0.4.4-SNAPSHOT"
ThisBuild / organization := "org.scala-sbt"
ThisBuild / crossScalaVersions := Seq(scala213, scala212, scala211, scala210)
ThisBuild / scalaVersion := "2.12.8"
ThisBuild / organizationName := "sbt"
ThisBuild / organizationHomepage := Some(url("http://scala-sbt.org/"))
ThisBuild / homepage := Some(url("http://scala-sbt.org/contraband"))
ThisBuild / licenses += ("Apache-2.0", url("https://github.com/sbt/contraband/blob/master/LICENSE"))
ThisBuild / bintrayVcsUrl := Some("git@github.com:sbt/contraband.git")
ThisBuild / scmInfo := Some(ScmInfo(url("https://github.com/sbt/contraband"), "git@github.com:sbt/contraband.git"))
ThisBuild / developers := List(
Developer("eed3si9n", "Eugene Yokota", "@eed3si9n", url("https://github.com/eed3si9n")),
Developer("dwijnand", "Dale Wijnand", "@dwijnand", url("https://github.com/dwijnand")),
Developer("Duhemm", "Martin Duhem", "@Duhemm", url("https://github.com/Duhemm"))
)
ThisBuild / description := "Contraband is a description language for your datatypes and APIs, currently targeting Java and Scala."

lazy val root = (project in file(".")).
enablePlugins(NoPublish, TravisSitePlugin).
aggregate(library, plugin).
settings(
inThisBuild(List(
version := "0.4.4-SNAPSHOT",
organization := "org.scala-sbt",
crossScalaVersions := Seq("2.13.0", "2.12.8", "2.11.12", "2.10.7"),
scalaVersion := "2.10.7",
organizationName := "sbt",
organizationHomepage := Some(url("http://scala-sbt.org/")),
homepage := Some(url("http://scala-sbt.org/contraband")),
licenses += ("Apache-2.0", url("https://github.com/sbt/contraband/blob/master/LICENSE")),
bintrayVcsUrl := Some("git@github.com:sbt/contraband.git"),
scmInfo := Some(ScmInfo(url("https://github.com/sbt/contraband"), "git@github.com:sbt/contraband.git")),
developers := List(
Developer("eed3si9n", "Eugene Yokota", "@eed3si9n", url("https://github.com/eed3si9n")),
Developer("dwijnand", "Dale Wijnand", "@dwijnand", url("https://github.com/dwijnand")),
Developer("Duhemm", "Martin Duhem", "@Duhemm", url("https://github.com/Duhemm"))
),
description := "Contraband is a description language for your datatypes and APIs, currently targeting Java and Scala."
)),
lazy val root = (project in file("."))
.enablePlugins(TravisSitePlugin)
.aggregate(library, plugin)
.settings(
name := "contraband root",
siteGithubRepo := "sbt/contraband",
siteEmail := { "eed3si9n" + "@" + "gmail.com" }
siteEmail := { "eed3si9n" + "@" + "gmail.com" },
publish / skip := true,
)

lazy val library = (project in file("library")).
enablePlugins(KeywordPlugin, SonatypePublish).
disablePlugins(BintrayPlugin).
settings(
lazy val library = (project in file("library"))
.enablePlugins(KeywordPlugin, SonatypePublish)
.disablePlugins(BintrayPlugin)
.settings(
name := "contraband",
unmanagedSourceDirectories in Compile += {
CrossVersion.partialVersion(scalaVersion.value) match {
Expand All @@ -48,17 +43,15 @@ lazy val library = (project in file("library")).
libraryDependencies ++= Seq(parboiled.value) ++ jsonDependencies.value ++ Seq(scalaTest % Test, diffutils % Test)
)

lazy val plugin = (project in file("plugin")).
enablePlugins(BintrayPublish).
settings(
// crossBuildingSettings,
pluginSettings,
lazy val plugin = (project in file("plugin"))
.enablePlugins(BintrayPublish, SbtPlugin)
.dependsOn(library)
.settings(
name := "sbt-contraband",
bintrayPackage := "sbt-contraband",
description := "sbt plugin to generate growable datatypes.",
scriptedSettings,
scriptedLaunchOpts := { scriptedLaunchOpts.value ++
Seq("-Xmx1024M", "-Dplugin.version=" + version.value)
},
publishLocal := (publishLocal dependsOn (publishLocal in library)).value
).
dependsOn(library)
)
4 changes: 2 additions & 2 deletions library/src/main/scala/sbt/contraband/CodeGen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ abstract class CodeGenerator {

case Some(existing) =>
// Remove `package blah` from what we want to add
val content = v.lines.toList.tail mkString EOL
val content = v.linesIterator.toList.tail mkString EOL
acc + (k -> (existing + EOL + EOL + content))
}
}
Expand All @@ -38,7 +38,7 @@ abstract class CodeGenerator {

final def indentWith(config: IndentationConfiguration): String = {
val buffer = new IndentationAwareBuffer(config)
code.lines foreach buffer .+=
code.linesIterator foreach buffer .+=
buffer.toString
}
}
Expand Down
2 changes: 1 addition & 1 deletion library/src/main/scala/sbt/contraband/Indentation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class IndentationAwareBuffer(val config: IndentationConfiguration, private var l
/** Add all the lines of `it` to the buffer. */
def +=(it: Iterator[String]): Unit = it foreach append
/** Add `s` to the buffer */
def +=(s: String): Unit = s.lines foreach append
def +=(s: String): Unit = s.linesIterator foreach append

override def toString: String = buffer.mkString

Expand Down
4 changes: 2 additions & 2 deletions library/src/test/scala/EqualLines.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ trait EqualLines {
private val emptyLines = Lines(Vector.empty)

implicit class CleanedString(s: String) {
def unindent: Lines = Lines(s.lines.map(_.trim).filterNot(_.isEmpty).toVector)
def withoutEmptyLines: Lines = Lines(s.lines.filterNot(_.trim.isEmpty).toVector)
def unindent: Lines = Lines(s.linesIterator.map(_.trim).filterNot(_.isEmpty).toVector)
def withoutEmptyLines: Lines = Lines(s.linesIterator.filterNot(_.trim.isEmpty).toVector)
}

final class EqualLines(right: Lines) extends Matcher[Lines] {
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/main/scala/ContrabandPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ object ContrabandPlugin extends AutoPlugin {
)

override def globalSettings = Seq(
contrabandSjsonNewVersion := "0.8.2"
contrabandSjsonNewVersion := "0.8.3"
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ lazy val root = (project in file(".")).
enablePlugins(ContrabandPlugin, JsonCodecPlugin).
settings(
name := "example",
scalaVersion := "2.10.6",
scalaVersion := "2.13.0",
contrabandFormatsForType in generateContrabands in Compile := { tpe =>
val substitutions = Map("java.io.File" -> "com.foo.FileFormats")
val name = tpe.removeTypeParameters.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

> compile

$ exists target/scala-2.10/src_managed/main/generated/CustomProtocol.scala
$ exists target/scala-2.13/src_managed/main/generated/CustomProtocol.scala

> run
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ lazy val root = (project in file(".")).
enablePlugins(ContrabandPlugin, JsonCodecPlugin).
settings(
name := "example",
scalaVersion := "2.10.6",
scalaVersion := "2.13.0",
contrabandFormatsForType in generateContrabands in Compile := { tpe =>
val substitutions = Map("java.io.File" -> "com.foo.FileFormats")
val name = tpe.removeTypeParameters.name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

> compile

$ exists target/scala-2.10/src_managed/main/generated/CustomProtocol.scala
$ exists target/scala-2.13/src_managed/main/generated/CustomProtocol.scala

> run
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ lazy val root = (project in file(".")).
enablePlugins(ContrabandPlugin, JsonCodecPlugin).
settings(
name := "example",
scalaVersion := "2.10.6",
scalaVersion := "2.13.0",
libraryDependencies += "com.eed3si9n" %% "sjson-new-scalajson" % contrabandSjsonNewVersion.value
// scalacOptions += "-Xlog-implicits"
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

> compile

$ exists target/scala-2.10/src_managed/main/com/example/codec/CustomJsonProtocol.scala
$ exists target/scala-2.13/src_managed/main/com/example/codec/CustomJsonProtocol.scala

> run
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
scalaVersion := "2.13.0"
name := "example"

enablePlugins(ContrabandPlugin, JsonCodecPlugin)
7 changes: 0 additions & 7 deletions plugin/src/sbt-test/sbt-contraband/simple/build.sbt

This file was deleted.

1 change: 0 additions & 1 deletion plugin/src/sbt-test/sbt-contraband/simple/pending

This file was deleted.

43 changes: 0 additions & 43 deletions plugin/src/sbt-test/sbt-contraband/simple/project/Build.scala

This file was deleted.

7 changes: 0 additions & 7 deletions plugin/src/sbt-test/sbt-contraband/simple/project/plugins.sbt

This file was deleted.

This file was deleted.

5 changes: 5 additions & 0 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import sbt._
import Keys._

object Dependencies {
val scala210 = "2.10.7"
val scala211 = "2.11.12"
val scala212 = "2.12.8"
val scala213 = "2.13.0"

val jsonDependencies =
Def.setting {
val json4sVersion = scalaBinaryVersion.value match {
Expand Down
13 changes: 0 additions & 13 deletions project/Publish.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,3 @@ object SonatypePublish extends AutoPlugin {
}
)
}

/**
* For projects that are not published.
*/
object NoPublish extends AutoPlugin {
override def requires = plugins.JvmPlugin && BintrayPublish

override def projectSettings = Seq(
publishArtifact := false,
publish := (),
publishLocal := ()
)
}
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.18
sbt.version=1.2.8
2 changes: 2 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.1")
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.5")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.3.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
1 change: 0 additions & 1 deletion project/scripted.sbt

This file was deleted.

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

This file was deleted.

0 comments on commit 1336c66

Please sign in to comment.