Permalink
Browse files

Upgrade scala to 2.12.0 and sbt to 0.13.13

  • Loading branch information...
TimothyKlim committed Oct 29, 2016
1 parent b05f97d commit f83fb1c02fa2a1f843b96dd6414ef6522c447f60
Showing with 99 additions and 85 deletions.
  1. +1 −1 appveyor.yml
  2. +11 −1 circle.yml
  3. +86 −82 project/Build.scala
  4. +1 −1 project/build.properties
View
@@ -4,7 +4,7 @@ install:
Add-Type -AssemblyName System.IO.Compression.FileSystem
if (!(Test-Path -Path "C:\sbt" )) {
(new-object System.Net.WebClient).DownloadFile(
'https://dl.bintray.com/sbt/native-packages/sbt/0.13.9/sbt-0.13.9.zip',
'https://dl.bintray.com/sbt/native-packages/sbt/0.13.13/sbt-0.13.13.zip',
'C:\sbt-bin.zip'
)
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\sbt-bin.zip", "C:\sbt")
View
@@ -1,4 +1,7 @@
machine:
environment:
SBT_VERSION: 0.13.13
_JAVA_OPTIONS: "-Xms1g -Xmx2g"
services:
- postgresql
- mysql
@@ -7,9 +10,16 @@ machine:
dependencies:
pre:
- wget --output-document=$HOME/bin/sbt-launch.jar
https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/"$SBT_VERSION"/sbt-launch.jar
- echo "java $SBT_OPTS -jar \`dirname \$0\`/sbt-launch.jar \"\$@\""
> $HOME/bin/sbt
- chmod u+x $HOME/bin/sbt
- which sbt
- sbt sbt-version
- sudo apt-get update -qq
- sudo apt-get install -y python-sphinx
test:
override:
- sbt +testAll
- sbt +testAll
View
@@ -14,7 +14,7 @@ object SlickBuild extends Build {
val slickVersion = "3.2.0-SNAPSHOT"
val binaryCompatSlickVersion = "3.2.0" // Slick base version for binary compatibility checks
val scalaVersions = Seq("2.11.8", "2.12.0-M5")
val scalaVersions = Seq("2.11.8", "2.12.0")
/** Dependencies for reuse in different parts of the build */
object Dependencies {
@@ -23,7 +23,7 @@ object SlickBuild extends Build {
"com.novocode" % "junit-interface" % "0.11"
)
def scalaTestFor(scalaVersion: String) = {
val v = "3.0.0-RC4"
val v = "3.0.0"
"org.scalatest" %% "scalatest" % v
}
val slf4j = "org.slf4j" % "slf4j-api" % "1.7.18"
@@ -69,10 +69,10 @@ object SlickBuild extends Build {
crossVersion := CrossVersion.Disabled,
scalaHome := Some(file(path)),
autoScalaLibrary := false,
unmanagedJars <<= scalaInstance.map( _.jars.classpath),
unmanagedJars in config("compile") <<= scalaInstance.map( _.jars.classpath),
unmanagedJars in config("test") <<= scalaInstance.map( _.jars.classpath),
unmanagedJars in config("macro") <<= scalaInstance.map( _.jars.classpath)
unmanagedJars := scalaInstance.map( _.jars.classpath).value,
unmanagedJars in config("compile") := scalaInstance.map( _.jars.classpath).value,
unmanagedJars in config("test") := scalaInstance.map( _.jars.classpath).value,
unmanagedJars in config("macro") := scalaInstance.map( _.jars.classpath).value
)
val scalaSettings = {
@@ -100,22 +100,22 @@ object SlickBuild extends Build {
organization := "com.typesafe.slick",
resolvers += Resolver.sonatypeRepo("snapshots"),
scalacOptions ++= List("-deprecation", "-feature", "-unchecked"),
scalacOptions in (Compile, doc) <++= (version,sourceDirectory in Compile,name).map((v,src,n) => Seq(
"-doc-title", n,
"-doc-version", v,
scalacOptions in (Compile, doc) ++= Seq(
"-doc-title", name.value,
"-doc-version", version.value,
"-doc-footer", "Slick is developed by Typesafe and EPFL Lausanne.",
"-sourcepath", src.getPath, // needed for scaladoc to strip the location of the linked source path
"-doc-source-url", "https://github.com/slick/slick/blob/"+v+"/slick/src/main€{FILE_PATH}.scala",
"-sourcepath", (sourceDirectory in Compile).value.getPath, // needed for scaladoc to strip the location of the linked source path
"-doc-source-url", s"https://github.com/slick/slick/blob/${version.value}/slick/src/main€{FILE_PATH}.scala",
"-implicits",
"-diagrams", // requires graphviz
"-groups"
)),
),
logBuffered := false,
repoKind <<= (version)(v => if(v.trim.endsWith("SNAPSHOT")) "snapshots" else "releases"),
publishTo <<= (repoKind){
repoKind := (if (version.value.trim.endsWith("SNAPSHOT")) "snapshots" else "releases"),
publishTo := (repoKind.value match {
case "snapshots" => Some("snapshots" at "https://oss.sonatype.org/content/repositories/snapshots")
case "releases" => Some("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2")
},
}),
publishMavenStyle := true,
publishArtifact in Test := false,
pomIncludeRepository := { _ => false },
@@ -147,7 +147,7 @@ object SlickBuild extends Build {
def commonSdlcSettings = Seq(
sdlcBase := (projectID.value.name + "-api/").replaceFirst("^slick-", ""),
sdlcCheckDir := (target in (slickProject, com.typesafe.sbt.SbtSite.SiteKeys.makeSite)).value,
sdlc <<= sdlc dependsOn (doc in Compile, com.typesafe.sbt.SbtSite.SiteKeys.makeSite in slickProject)
sdlc := (sdlc dependsOn (doc in Compile, com.typesafe.sbt.SbtSite.SiteKeys.makeSite in slickProject)).value
)
def runTasksSequentially(tasks: List[TaskKey[_]])(state: State): State = tasks match {
@@ -187,23 +187,23 @@ object SlickBuild extends Build {
test := (), testOnly := (), // suppress test status output
commands += testAll,
sdlc := (),
sdlc <<= sdlc dependsOn (sdlc in slickProject, sdlc in slickCodegenProject, sdlc in slickHikariCPProject)
sdlc := (sdlc dependsOn (sdlc in slickProject, sdlc in slickCodegenProject, sdlc in slickHikariCPProject)).value
)).aggregate(slickProject, slickCodegenProject, slickHikariCPProject, slickTestkitProject)
lazy val slickProject: Project = Project(id = "slick", base = file("slick"),
settings = Defaults.coreDefaultSettings ++ sdlcSettings ++ inConfig(config("macro"))(Defaults.configSettings) ++ sharedSettings ++ fmppSettings ++ site.settings ++ site.sphinxSupport() ++ mimaDefaultSettings ++ extTarget("slick") ++ commonSdlcSettings ++ osgiSettings ++ Seq(
name := "Slick",
description := "Scala Language-Integrated Connection Kit",
libraryDependencies ++= Dependencies.mainDependencies,
scalacOptions in (Compile, doc) <++= version.map(v => Seq(
"-doc-source-url", "https://github.com/slick/slick/blob/"+v+"/slick/src/main€{FILE_PATH}.scala",
scalacOptions in (Compile, doc) ++= Seq(
"-doc-source-url", s"https://github.com/slick/slick/blob/${version.value}/slick/src/main€{FILE_PATH}.scala",
"-doc-root-content", "scaladoc-root.txt"
)),
),
(sphinxEnv in Sphinx) := (sphinxEnv in Sphinx).value +
("version" -> version.value.replaceFirst("""(\d*.\d*).*""", """$1""")) +
("release" -> version.value),
(sphinxProperties in Sphinx) := Map.empty,
makeSite <<= makeSite dependsOn (buildCapabilitiesTable in slickTestkitProject),
makeSite := (makeSite dependsOn (buildCapabilitiesTable in slickTestkitProject)).value,
site.addMappingsToSiteDir(mappings in packageDoc in Compile in slickProject, "api"),
site.addMappingsToSiteDir(mappings in packageDoc in Compile in slickCodegenProject, "codegen-api"),
site.addMappingsToSiteDir(mappings in packageDoc in Compile in slickHikariCPProject, "hikaricp-api"),
@@ -215,18 +215,18 @@ object SlickBuild extends Build {
ProblemFilters.exclude[MissingClassProblem]("slick.util.MacroSupportInterpolationImpl")
),
ivyConfigurations += config("macro").hide.extend(Compile),
unmanagedClasspath in Compile <++= products in config("macro"),
libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-compiler" % _ % "provided"),
mappings in (Compile, packageSrc) <++= mappings in (config("macro"), packageSrc),
mappings in (Compile, packageBin) <++= mappings in (config("macro"), packageBin),
unmanagedClasspath in Compile ++= (products in config("macro")).value,
libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value % "provided",
mappings in (Compile, packageSrc) ++= (mappings in (config("macro"), packageSrc)).value,
mappings in (Compile, packageBin) ++= (mappings in (config("macro"), packageBin)).value,
OsgiKeys.exportPackage := Seq("slick", "slick.*", "scala.slick", "scala.slick.*"),
OsgiKeys.importPackage := Seq(
osgiImport("scala*", scalaVersion.value),
"*"
),
OsgiKeys.privatePackage := Nil
) ++ ifPublished(Seq(
libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-compiler" % _ % "macro")
libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value % "macro"
)))
/** Create an OSGi version range for standard Scala / Typesafe versioning
@@ -246,9 +246,9 @@ object SlickBuild extends Build {
settings = Defaults.coreDefaultSettings ++ typeProvidersSettings ++ sharedSettings ++ extTarget("testkit") ++ Seq(
name := "Slick-TestKit",
description := "Test Kit for Slick (Scala Language-Integrated Connection Kit)",
scalacOptions in (Compile, doc) <++= version.map(v => Seq(
"-doc-source-url", "https://github.com/slick/slick/blob/"+v+"/slick-testkit/src/main€{FILE_PATH}.scala"
)),
scalacOptions in (Compile, doc) ++= Seq(
"-doc-source-url", s"https://github.com/slick/slick/blob/${version.value}/slick-testkit/src/main€{FILE_PATH}.scala"
),
testOptions += Tests.Argument(TestFrameworks.JUnit, "-q", "-v", "-s", "-a", "-Djava.awt.headless=true"),
//scalacOptions in Compile += "-Yreify-copypaste",
libraryDependencies ++=
@@ -277,7 +277,7 @@ object SlickBuild extends Build {
logger)(runner.value)
}
) ++ ifPublished(Seq(
libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-compiler" % _% "provided")
libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value % "provided"
))
).configs(DocTest).settings(inConfig(DocTest)(Defaults.testSettings): _*).settings(
unmanagedSourceDirectories in DocTest += (baseDirectory in slickProject).value / "src/sphinx/code",
@@ -288,9 +288,9 @@ object SlickBuild extends Build {
settings = Defaults.coreDefaultSettings ++ sdlcSettings ++ sharedSettings ++ extTarget("codegen") ++ commonSdlcSettings ++ Seq(
name := "Slick-CodeGen",
description := "Code Generator for Slick (Scala Language-Integrated Connection Kit)",
scalacOptions in (Compile, doc) <++= version.map(v => Seq(
"-doc-source-url", "https://github.com/slick/slick/blob/"+v+"/slick-codegen/src/main€{FILE_PATH}.scala"
)),
scalacOptions in (Compile, doc) ++= Seq(
"-doc-source-url", s"https://github.com/slick/slick/blob/${version.value}/slick-codegen/src/main€{FILE_PATH}.scala"
),
unmanagedResourceDirectories in Test += (baseDirectory in aRootProject).value / "common-test-resources",
test := (), testOnly := () // suppress test status output
)
@@ -300,9 +300,9 @@ object SlickBuild extends Build {
settings = Defaults.coreDefaultSettings ++ sdlcSettings ++ sharedSettings ++ extTarget("hikaricp") ++ commonSdlcSettings ++ osgiSettings ++ Seq(
name := "Slick-HikariCP",
description := "HikariCP integration for Slick (Scala Language-Integrated Connection Kit)",
scalacOptions in (Compile, doc) <++= version.map(v => Seq(
"-doc-source-url", "https://github.com/slick/slick/blob/"+v+"/slick-hikaricp/src/main€{FILE_PATH}.scala"
)),
scalacOptions in (Compile, doc) ++= Seq(
"-doc-source-url", s"https://github.com/slick/slick/blob/${version.value}/slick-hikaricp/src/main€{FILE_PATH}.scala"
),
libraryDependencies += Dependencies.hikariCP,
test := (), testOnly := (), // suppress test status output
OsgiKeys.exportPackage := Seq("slick.jdbc.hikaricp"),
@@ -359,7 +359,7 @@ object SlickBuild extends Build {
/* FMPP Task */
lazy val fmpp = TaskKey[Seq[File]]("fmpp")
lazy val fmppConfig = config("fmpp").hide
lazy val fmppSettings = inConfig(Compile)(Seq(sourceGenerators <+= fmpp, fmpp <<= fmppTask)) ++ Seq(
lazy val fmppSettings = inConfig(Compile)(Seq(sourceGenerators += fmpp.taskValue, fmpp := fmppTask.value)) ++ Seq(
libraryDependencies ++= Seq(
("net.sourceforge.fmpp" % "fmpp" % "0.9.15" % fmppConfig.name).intransitive,
"org.freemarker" % "freemarker" % "2.3.23" % fmppConfig.name,
@@ -368,62 +368,66 @@ object SlickBuild extends Build {
"xml-resolver" % "xml-resolver" % "1.2" % fmppConfig.name
),
ivyConfigurations += fmppConfig,
fullClasspath in fmppConfig <<= update map { _ select configurationFilter(fmppConfig.name) map Attributed.blank },
mappings in (Compile, packageSrc) <++=
(sourceManaged in Compile, managedSources in Compile, sourceDirectory in Compile) map { (base, srcs, srcDir) =>
val fmppSrc = srcDir / "scala"
val inFiles = fmppSrc ** "*.fm"
(srcs pair (Path.relativeTo(base) | Path.flat)) ++ // Add generated sources to sources JAR
(inFiles pair (Path.relativeTo(fmppSrc) | Path.flat)) // Add *.fm files to sources JAR
}
fullClasspath in fmppConfig := update.map { _ select configurationFilter(fmppConfig.name) map Attributed.blank }.value,
mappings in (Compile, packageSrc) ++= {
val fmppSrc = (sourceDirectory in Compile).value / "scala"
val inFiles = fmppSrc ** "*.fm"
((managedSources in Compile).value.pair(Path.relativeTo((sourceManaged in Compile).value) | Path.flat)) ++ // Add generated sources to sources JAR
(inFiles pair (Path.relativeTo(fmppSrc) | Path.flat)) // Add *.fm files to sources JAR
}
)
lazy val fmppTask =
(fullClasspath in fmppConfig, runner in fmpp, sourceManaged, streams, sourceDirectory) map { (cp, r, output, s, srcDir) =>
val fmppSrc = srcDir / "scala"
val inFiles = (fmppSrc ** "*.fm").get.toSet
val cachedFun = FileFunction.cached(s.cacheDirectory / "fmpp", outStyle = FilesInfo.exists) { (in: Set[File]) =>
IO.delete((output ** "*.scala").get)
val args = "--expert" :: "-q" :: "-S" :: fmppSrc.getPath :: "-O" :: output.getPath ::
"--replace-extensions=fm, scala" :: "-M" :: "execute(**/*.fm), ignore(**/*)" :: Nil
toError(r.run("fmpp.tools.CommandLine", cp.files, args, s.log))
(output ** "*.scala").get.toSet
}
cachedFun(inFiles).toSeq
lazy val fmppTask = Def.task {
val s = streams.value
val output = sourceManaged.value
val fmppSrc = sourceDirectory.value / "scala"
val inFiles = (fmppSrc ** "*.fm").get.toSet
val cachedFun = FileFunction.cached(s.cacheDirectory / "fmpp", outStyle = FilesInfo.exists) { (in: Set[File]) =>
IO.delete((output ** "*.scala").get)
val args = "--expert" :: "-q" :: "-S" :: fmppSrc.getPath :: "-O" :: output.getPath ::
"--replace-extensions=fm, scala" :: "-M" :: "execute(**/*.fm), ignore(**/*)" :: Nil
toError((runner in fmpp).value.run("fmpp.tools.CommandLine", (fullClasspath in fmppConfig).value.files, args, s.log))
(output ** "*.scala").get.toSet
}
cachedFun(inFiles).toSeq
}
/** Slick type provider code gen */
lazy val typeProviders = taskKey[Seq[File]]("Type provider code generation")
lazy val typeProvidersConfig = config("codegen").hide
lazy val typeProvidersSettings = {
inConfig(typeProvidersConfig)(Defaults.configSettings) ++
Seq(
sourceGenerators in Test <+= typeProviders,
typeProviders <<= typeProvidersTask,
sourceGenerators in Test += typeProviders.taskValue,
typeProviders := typeProvidersTask.value,
ivyConfigurations += typeProvidersConfig.extend(Compile),
(compile in Test) <<= (compile in Test) dependsOn (compile in typeProvidersConfig),
unmanagedClasspath in typeProvidersConfig <++= fullClasspath in config("compile"),
unmanagedClasspath in typeProvidersConfig <++= fullClasspath in (slickCodegenProject, Test),
unmanagedClasspath in Test <++= fullClasspath in typeProvidersConfig,
mappings in (Test, packageSrc) <++=
(sourceManaged in Test, managedSources in Test, sourceDirectory in Test) map { (base, srcs, srcDir) =>
val src = srcDir / "codegen"
val inFiles = src ** "*.scala"
(srcs pair (Path.relativeTo(base) | Path.flat)) ++ // Add generated sources to sources JAR
(inFiles pair (Path.relativeTo(src) | Path.flat)) // Add *.fm files to sources JAR
}
(compile in Test) := ((compile in Test) dependsOn (compile in typeProvidersConfig)).value,
unmanagedClasspath in typeProvidersConfig ++= (fullClasspath in config("compile")).value,
unmanagedClasspath in typeProvidersConfig ++= (fullClasspath in (slickCodegenProject, Test)).value,
unmanagedClasspath in Test ++= (fullClasspath in typeProvidersConfig).value,
mappings in (Test, packageSrc) ++= {
val src = (sourceDirectory in Test).value / "codegen"
val inFiles = src ** "*.scala"
((managedSources in Test).value.pair(Path.relativeTo((sourceManaged in Test).value) | Path.flat)) ++ // Add generated sources to sources JAR
(inFiles pair (Path.relativeTo(src) | Path.flat)) // Add *.fm files to sources JAR
}
)
}
lazy val typeProvidersTask =
(fullClasspath in typeProvidersConfig, runner in typeProviders, sourceManaged in Test, streams, sourceDirectory, sourceDirectory in slickProject) map { (cp, r, output, s, srcDir, slickSrc) =>
val src = srcDir / "codegen"
val outDir = (output/"slick-codegen").getPath
val inFiles = (src ** "*.scala").get.toSet ++ (slickSrc / "main/scala/slick/codegen" ** "*.scala").get.toSet ++ (slickSrc / "main/scala/slick/jdbc/meta" ** "*.scala").get.toSet
val cachedFun = FileFunction.cached(s.cacheDirectory / "type-providers", outStyle = FilesInfo.exists) { (in: Set[File]) =>
IO.delete((output ** "*.scala").get)
toError(r.run("slick.test.codegen.GenerateMainSources", cp.files, Array(outDir), s.log))
toError(r.run("slick.test.codegen.GenerateRoundtripSources", cp.files, Array(outDir), s.log))
(output ** "*.scala").get.toSet
}
cachedFun(inFiles).toSeq
lazy val typeProvidersTask = Def.task {
val cp = (fullClasspath in typeProvidersConfig).value
val r = (runner in typeProviders).value
val output = (sourceManaged in Test).value
val s = streams.value
val srcDir = sourceDirectory.value
val slickSrc = (sourceDirectory in slickProject).value
val src = srcDir / "codegen"
val outDir = (output/"slick-codegen").getPath
val inFiles = (src ** "*.scala").get.toSet ++ (slickSrc / "main/scala/slick/codegen" ** "*.scala").get.toSet ++ (slickSrc / "main/scala/slick/jdbc/meta" ** "*.scala").get.toSet
val cachedFun = FileFunction.cached(s.cacheDirectory / "type-providers", outStyle = FilesInfo.exists) { (in: Set[File]) =>
IO.delete((output ** "*.scala").get)
toError(r.run("slick.test.codegen.GenerateMainSources", cp.files, Array(outDir), s.log))
toError(r.run("slick.test.codegen.GenerateRoundtripSources", cp.files, Array(outDir), s.log))
(output ** "*.scala").get.toSet
}
cachedFun(inFiles).toSeq
}
}
View
@@ -1 +1 @@
sbt.version=0.13.9
sbt.version=0.13.13

0 comments on commit f83fb1c

Please sign in to comment.