Merge pull request #2098 from pdalpra/fix-build-warnings

Fix most SBT's build warnings
This commit is contained in:
Josh Suereth 2015-07-10 14:21:53 -04:00
commit 90cfcb4543
7 changed files with 23 additions and 22 deletions

View File

@ -108,8 +108,7 @@ lazy val interfaceProj = (project in file("interface")).
watchSources <++= apiDefinitions, watchSources <++= apiDefinitions,
resourceGenerators in Compile <+= (version, resourceManaged, streams, compile in Compile) map generateVersionFile, resourceGenerators in Compile <+= (version, resourceManaged, streams, compile in Compile) map generateVersionFile,
apiDefinitions <<= baseDirectory map { base => (base / "definition") :: (base / "other") :: (base / "type") :: Nil }, apiDefinitions <<= baseDirectory map { base => (base / "definition") :: (base / "other") :: (base / "type") :: Nil },
sourceGenerators in Compile <+= (cacheDirectory, sourceGenerators in Compile <+= (apiDefinitions,
apiDefinitions,
fullClasspath in Compile in datatypeProj, fullClasspath in Compile in datatypeProj,
sourceManaged in Compile, sourceManaged in Compile,
mainClass in datatypeProj in Compile, mainClass in datatypeProj in Compile,
@ -459,14 +458,14 @@ lazy val mavenResolverPluginProj = (project in file("sbt-maven-resolver")).
sbtPlugin := true sbtPlugin := true
) )
def scriptedTask: Initialize[InputTask[Unit]] = Def.inputTask { def scriptedTask: Def.Initialize[InputTask[Unit]] = Def.inputTask {
val result = scriptedSource(dir => (s: State) => scriptedParser(dir)).parsed val result = scriptedSource(dir => (s: State) => scriptedParser(dir)).parsed
publishAll.value publishAll.value
doScripted((sbtLaunchJar in bundledLauncherProj).value, (fullClasspath in scriptedSbtProj in Test).value, doScripted((sbtLaunchJar in bundledLauncherProj).value, (fullClasspath in scriptedSbtProj in Test).value,
(scalaInstance in scriptedSbtProj).value, scriptedSource.value, result, scriptedPrescripted.value) (scalaInstance in scriptedSbtProj).value, scriptedSource.value, result, scriptedPrescripted.value)
} }
def scriptedUnpublishedTask: Initialize[InputTask[Unit]] = Def.inputTask { def scriptedUnpublishedTask: Def.Initialize[InputTask[Unit]] = Def.inputTask {
val result = scriptedSource(dir => (s: State) => scriptedParser(dir)).parsed val result = scriptedSource(dir => (s: State) => scriptedParser(dir)).parsed
doScripted((sbtLaunchJar in bundledLauncherProj).value, (fullClasspath in scriptedSbtProj in Test).value, doScripted((sbtLaunchJar in bundledLauncherProj).value, (fullClasspath in scriptedSbtProj in Test).value,
(scalaInstance in scriptedSbtProj).value, scriptedSource.value, result, scriptedPrescripted.value) (scalaInstance in scriptedSbtProj).value, scriptedSource.value, result, scriptedPrescripted.value)
@ -496,7 +495,7 @@ def otherRootSettings = Seq(
Scripted.scriptedPrescripted := { _ => }, Scripted.scriptedPrescripted := { _ => },
Scripted.scripted <<= scriptedTask, Scripted.scripted <<= scriptedTask,
Scripted.scriptedUnpublished <<= scriptedUnpublishedTask, Scripted.scriptedUnpublished <<= scriptedUnpublishedTask,
Scripted.scriptedSource <<= (sourceDirectory in sbtProj) / "sbt-test", Scripted.scriptedSource := (sourceDirectory in sbtProj).value / "sbt-test",
publishAll := { publishAll := {
val _ = (publishLocal).all(ScopeFilter(inAnyProject)).value val _ = (publishLocal).all(ScopeFilter(inAnyProject)).value
}, },

View File

@ -35,9 +35,8 @@ object Docs {
} }
def siteIncludeSxr(prefix: String) = Seq( def siteIncludeSxr(prefix: String) = Seq(
mappings in sxr <<= sxr.map(dir => Path.allSubpaths(dir).toSeq), mappings in sxr <<= sxr.map(dir => Path.allSubpaths(dir).toSeq)
site.addMappingsToSiteDir(mappings in sxr, prefix) ) ++ site.addMappingsToSiteDir(mappings in sxr, prefix)
)
def synchLocalImpl = (ghkeys.privateMappings, ghkeys.updatedRepository, version, streams) map { def synchLocalImpl = (ghkeys.privateMappings, ghkeys.updatedRepository, version, streams) map {
(mappings, repo, v, s) => (mappings, repo, v, s) =>

View File

@ -42,9 +42,9 @@ object SbtLauncherPlugin extends AutoPlugin {
IO.unzip(jar, dir) IO.unzip(jar, dir)
IO.copy(overrides.map({ case (n, f) => (f, dir / n)}), overwrite = true) IO.copy(overrides.map({ case (n, f) => (f, dir / n)}), overwrite = true)
// TODO - is the ok for creating a jar? // TODO - is the ok for creating a jar?
IO.zip((dir.*** --- dir) x relativeTo(dir), target) IO.zip((dir.*** --- dir) pair relativeTo(dir), target)
} }
target target
} }
} }

View File

@ -2,6 +2,8 @@ import sbt._
import Keys._ import Keys._
import Def.Initialize import Def.Initialize
import scala.language.reflectiveCalls
object Scripted { object Scripted {
def scriptedPath = file("scripted") def scriptedPath = file("scripted")
lazy val scripted = InputKey[Unit]("scripted") lazy val scripted = InputKey[Unit]("scripted")

View File

@ -3,7 +3,7 @@ import Keys._
import Scope.ThisScope import Scope.ThisScope
object Sxr { object Sxr {
val sxrConf = config("sxr") hide val sxrConf = config("sxr").hide
val sxr = TaskKey[File]("sxr") val sxr = TaskKey[File]("sxr")
val sourceDirectories = TaskKey[Seq[File]]("sxr-source-directories") val sourceDirectories = TaskKey[Seq[File]]("sxr-source-directories")

View File

@ -42,11 +42,11 @@ object Transform {
IO.writeLines(target, IO.readLines(source) map subMain) IO.writeLines(target, IO.readLines(source) map subMain)
} }
def crossGenSettings = transSourceSettings ++ seq( def crossGenSettings = transSourceSettings ++ Seq(
sourceProperties := Map("cross.package0" -> "sbt", "cross.package1" -> "cross") sourceProperties := Map("cross.package0" -> "sbt", "cross.package1" -> "cross")
) )
def transSourceSettings = seq( def transSourceSettings = Seq(
inputSourceDirectory <<= sourceDirectory / "input_sources", inputSourceDirectory := sourceDirectory.value / "input_sources",
inputSourceDirectories <<= Seq(inputSourceDirectory).join, inputSourceDirectories <<= Seq(inputSourceDirectory).join,
inputSources <<= inputSourceDirectories.map(dirs => (dirs ** (-DirectoryFilter)).get), inputSources <<= inputSourceDirectories.map(dirs => (dirs ** (-DirectoryFilter)).get),
fileMappings in transformSources <<= transformSourceMappings, fileMappings in transformSources <<= transformSourceMappings,
@ -56,15 +56,15 @@ object Transform {
sourceGenerators <+= transformSources sourceGenerators <+= transformSources
) )
def transformSourceMappings = (inputSources, inputSourceDirectories, sourceManaged) map { (ss, sdirs, sm) => def transformSourceMappings = (inputSources, inputSourceDirectories, sourceManaged) map { (ss, sdirs, sm) =>
(ss --- sdirs) x (rebase(sdirs, sm) | flat(sm)) toSeq ((ss --- sdirs) pair (rebase(sdirs, sm) | flat(sm))).toSeq
} }
def configSettings = transResourceSettings ++ seq( def configSettings = transResourceSettings ++ Seq(
resourceProperties <<= (organization, version, scalaVersion, isSnapshot) map { (org, v, sv, isSnapshot) => resourceProperties <<= (organization, version, scalaVersion, isSnapshot) map { (org, v, sv, isSnapshot) =>
Map("org" -> org, "sbt.version" -> v, "scala.version" -> sv, "repositories" -> repositories(isSnapshot).mkString(IO.Newline)) Map("org" -> org, "sbt.version" -> v, "scala.version" -> sv, "repositories" -> repositories(isSnapshot).mkString(IO.Newline))
} }
) )
def transResourceSettings = seq( def transResourceSettings = Seq(
inputResourceDirectory <<= sourceDirectory / "input_resources", inputResourceDirectory := sourceDirectory.value / "input_resources",
inputResourceDirectories <<= Seq(inputResourceDirectory).join, inputResourceDirectories <<= Seq(inputResourceDirectory).join,
inputResources <<= inputResourceDirectories.map(dirs => (dirs ** (-DirectoryFilter)).get), inputResources <<= inputResourceDirectories.map(dirs => (dirs ** (-DirectoryFilter)).get),
fileMappings in transformResources <<= transformResourceMappings, fileMappings in transformResources <<= transformResourceMappings,
@ -74,7 +74,7 @@ object Transform {
resourceGenerators <+= transformResources resourceGenerators <+= transformResources
) )
def transformResourceMappings = (inputResources, inputResourceDirectories, resourceManaged) map { (rs, rdirs, rm) => def transformResourceMappings = (inputResources, inputResourceDirectories, resourceManaged) map { (rs, rdirs, rm) =>
(rs --- rdirs) x (rebase(rdirs, rm) | flat(rm)) toSeq ((rs --- rdirs) pair (rebase(rdirs, rm) | flat(rm))).toSeq
} }
def transform(in: File, out: File, map: Map[String, String]): File = def transform(in: File, out: File, map: Map[String, String]): File =

View File

@ -37,10 +37,10 @@ object Util {
lazy val apiDefinitions = TaskKey[Seq[File]]("api-definitions") lazy val apiDefinitions = TaskKey[Seq[File]]("api-definitions")
def generateAPICached(cache: File, defs: Seq[File], cp: Classpath, out: File, main: Option[String], run: ScalaRun, s: TaskStreams): Seq[File] = def generateAPICached(defs: Seq[File], cp: Classpath, out: File, main: Option[String], run: ScalaRun, s: TaskStreams): Seq[File] =
{ {
def gen() = generateAPI(defs, cp, out, main, run, s) def gen() = generateAPI(defs, cp, out, main, run, s)
val f = FileFunction.cached(cache / "gen-api", FilesInfo.hash) { _ => gen().toSet } // TODO: check if output directory changed val f = FileFunction.cached(s.cacheDirectory / "gen-api", FilesInfo.hash) { _ => gen().toSet } // TODO: check if output directory changed
f(defs.toSet).toSeq f(defs.toSet).toSeq
} }
def generateAPI(defs: Seq[File], cp: Classpath, out: File, main: Option[String], run: ScalaRun, s: TaskStreams): Seq[File] = def generateAPI(defs: Seq[File], cp: Classpath, out: File, main: Option[String], run: ScalaRun, s: TaskStreams): Seq[File] =
@ -91,7 +91,8 @@ object Util {
case Elem(prefix, "classifier", attributes, scope, children @ _*) => case Elem(prefix, "classifier", attributes, scope, children @ _*) =>
NodeSeq.Empty NodeSeq.Empty
case Elem(prefix, label, attributes, scope, children @ _*) => case Elem(prefix, label, attributes, scope, children @ _*) =>
Elem(prefix, label, attributes, scope, cleanNodes(children): _*).theSeq val cleanedNodes = cleanNodes(children)
Elem(prefix, label, attributes, scope, cleanedNodes.isEmpty, cleanedNodes: _*).theSeq
case other => other case other => other
} }
cleanNodes(pomNode.theSeq)(0) cleanNodes(pomNode.theSeq)(0)