Permalink
Browse files

Clean up the build file

  • Loading branch information...
szeiger committed Aug 12, 2015
1 parent 9e28dec commit b651a62ee31cc9a7dc65c2ee918926abd1f9e637
Showing with 11 additions and 40 deletions.
  1. +11 −40 project/Build.scala
View
@@ -100,7 +100,6 @@ object SlickBuild extends Build {
organizationName := "Typesafe",
organization := "com.typesafe.slick",
resolvers += Resolver.sonatypeRepo("snapshots"),
//resolvers += Resolver.mavenLocal,
scalacOptions ++= List("-deprecation", "-feature"),
scalacOptions in (Compile, doc) <++= (version,sourceDirectory in Compile,name).map((v,src,n) => Seq(
"-doc-title", n,
@@ -115,7 +114,6 @@ object SlickBuild extends Build {
libraryDependencies ++= Dependencies.mainDependencies,
logBuffered := false,
repoKind <<= (version)(v => if(v.trim.endsWith("SNAPSHOT")) "snapshots" else "releases"),
//publishTo <<= (repoKind)(r => Some(Resolver.file("test", file("c:/temp/repo/"+r)))),
publishTo <<= (repoKind){
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")
@@ -148,6 +146,12 @@ object SlickBuild extends Build {
</scm>
) ++ scalaSettings
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)
)
def runTasksSequentially(tasks: List[TaskKey[_]])(state: State): State = tasks match {
case t :: ts =>
Project.runTask(t.asInstanceOf[TaskKey[Any]], state) match {
@@ -162,7 +166,7 @@ object SlickBuild extends Build {
def testAll = Command.command("testAll")(runTasksSequentially(List(
test in (slickTestkitProject, Test),
test in (slickTestkitProject, DocTest),
test in (osgiTestProject, Test), // Temporarily disabled until we get Reactive Streams OSGi bundles
test in (osgiTestProject, Test),
test in (reactiveStreamsTestProject, Test),
packageDoc in Compile in slickProject,
packageDoc in Compile in slickCodegenProject,
@@ -182,7 +186,7 @@ object SlickBuild extends Build {
)).aggregate(slickProject, slickCodegenProject, 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") ++ osgiSettings ++ Seq(
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",
scalacOptions in (Compile, doc) <++= version.map(v => Seq(
@@ -197,9 +201,6 @@ object SlickBuild extends Build {
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 slickTestkitProject, "testkit-api"),
sdlcBase := "api/",
sdlcCheckDir := (target in com.typesafe.sbt.SbtSite.SiteKeys.makeSite).value,
sdlc <<= sdlc dependsOn (doc in Compile, com.typesafe.sbt.SbtSite.SiteKeys.makeSite),
test := (), testOnly := (), // suppress test status output
previousArtifact := Some("com.typesafe.slick" % ("slick_" + scalaBinaryVersion.value) % binaryCompatSlickVersion),
binaryIssueFilters ++= Seq(
@@ -248,12 +249,6 @@ object SlickBuild extends Build {
(Dependencies.reactiveStreamsTCK % "test") +:
(Dependencies.logback +: Dependencies.testDBs).map(_ % "test") ++:
(Dependencies.logback +: Dependencies.testDBs).map(_ % "codegen"),
// Run the Queryable tests (which need macros) on a forked JVM
// to avoid classloader problems with reification
testGrouping <<= definedTests in Test map partitionTests,
// Workaround for sbt bug: Without a testGrouping for all test configs,
// the wrong tests are run
testGrouping in DocTest <<= definedTests in DocTest map partitionTests,
parallelExecution in Test := false,
fork in run := true,
javaOptions in run += "-Dslick.ansiDump=true",
@@ -279,24 +274,17 @@ object SlickBuild extends Build {
unmanagedSourceDirectories in DocTest += (baseDirectory in slickProject).value / "src/sphinx/code",
unmanagedResourceDirectories in DocTest += (baseDirectory in slickProject).value / "src/sphinx/resources",
libraryDependencies ++= Dependencies.pools.map(_ % "test")
//resourceDirectory in DocTest <<= baseDirectory { _ / "src/test/resources" }
//test <<= Seq(test in Test, test in DocTest).dependOn,
//concurrentRestrictions += Tags.limitSum(1, Tags.Test, Tags.ForkedTestGroup),
//concurrentRestrictions in Global += Tags.limit(Tags.Test, 1),
) dependsOn(slickProject, slickCodegenProject % "compile->compile")
lazy val slickCodegenProject = Project(id = "codegen", base = file("slick-codegen"),
settings = Defaults.coreDefaultSettings ++ sdlcSettings ++ sharedSettings ++ extTarget("codegen") ++ Seq(
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"
)),
unmanagedResourceDirectories in Test += (baseDirectory in aRootProject).value / "common-test-resources",
test := (), testOnly := (), // suppress test status output
sdlcBase := "codegen-api/",
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)
test := (), testOnly := () // suppress test status output
)
) dependsOn(slickProject)
@@ -328,7 +316,6 @@ object SlickBuild extends Build {
"-Dslick.osgi.bundlepath=" + osgiBundleFiles.value.map(_.getCanonicalPath).mkString(":"),
"-Dorg.ops4j.pax.logging.DefaultServiceLog.level=WARN"
),
testGrouping <<= definedTests in Test map partitionTests,
osgiBundleFiles := Seq((OsgiKeys.bundle in slickProject).value),
osgiBundleFiles ++= (dependencyClasspath in Compile in slickProject).value.map(_.data).filterNot(_.isDirectory),
osgiBundleFiles ++= (dependencyClasspath in Test).value.map(_.data).filter(f => f.name.contains("logback-") || f.name.contains("h2") || f.name.contains("reactive-streams")),
@@ -340,15 +327,6 @@ object SlickBuild extends Build {
/* Test Configuration for running tests on doc sources */
lazy val DocTest = config("doctest") extend(Test)
/* Split tests into a group that needs to be forked and another one that can run in-process */
def partitionTests(tests: Seq[TestDefinition]) = {
val (fork, notFork) = tests partition (_.name contains ".queryable.")
Seq(
new Group("fork", fork, SubProcess(ForkOptions())),
new Group("inProcess", notFork, InProcess)
)
}
lazy val buildCapabilitiesTable = taskKey[Unit]("Build the capabilities.csv table for the documentation")
/* FMPP Task */
@@ -364,8 +342,6 @@ object SlickBuild extends Build {
),
ivyConfigurations += fmppConfig,
fullClasspath in fmppConfig <<= update map { _ select configurationFilter(fmppConfig.name) map Attributed.blank },
//mappings in (Compile, packageSrc) <++= // Add generated sources to sources JAR
// (sourceManaged in Compile, managedSources in Compile) map { (b, s) => s x (Path.relativeTo(b) | Path.flat) }
mappings in (Compile, packageSrc) <++=
(sourceManaged in Compile, managedSources in Compile, sourceDirectory in Compile) map { (base, srcs, srcDir) =>
val fmppSrc = srcDir / "scala"
@@ -396,16 +372,11 @@ object SlickBuild extends Build {
Seq(
sourceGenerators in Test <+= typeProviders,
typeProviders <<= typeProvidersTask,
ivyConfigurations += typeProvidersConfig.extend(Compile),
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) <++= mappings in (typeProvidersConfig, packageSrc),
//mappings in (Test, packageBin) <++= mappings in (typeProvidersConfig, packageBin),
mappings in (Test, packageSrc) <++=
(sourceManaged in Test, managedSources in Test, sourceDirectory in Test) map { (base, srcs, srcDir) =>
val src = srcDir / "codegen"

0 comments on commit b651a62

Please sign in to comment.