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,
resourceGenerators in Compile <+= (version, resourceManaged, streams, compile in Compile) map generateVersionFile,
apiDefinitions <<= baseDirectory map { base => (base / "definition") :: (base / "other") :: (base / "type") :: Nil },
sourceGenerators in Compile <+= (cacheDirectory,
apiDefinitions,
sourceGenerators in Compile <+= (apiDefinitions,
fullClasspath in Compile in datatypeProj,
sourceManaged in Compile,
mainClass in datatypeProj in Compile,
@ -459,14 +458,14 @@ lazy val mavenResolverPluginProj = (project in file("sbt-maven-resolver")).
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
publishAll.value
doScripted((sbtLaunchJar in bundledLauncherProj).value, (fullClasspath in scriptedSbtProj in Test).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
doScripted((sbtLaunchJar in bundledLauncherProj).value, (fullClasspath in scriptedSbtProj in Test).value,
(scalaInstance in scriptedSbtProj).value, scriptedSource.value, result, scriptedPrescripted.value)
@ -496,7 +495,7 @@ def otherRootSettings = Seq(
Scripted.scriptedPrescripted := { _ => },
Scripted.scripted <<= scriptedTask,
Scripted.scriptedUnpublished <<= scriptedUnpublishedTask,
Scripted.scriptedSource <<= (sourceDirectory in sbtProj) / "sbt-test",
Scripted.scriptedSource := (sourceDirectory in sbtProj).value / "sbt-test",
publishAll := {
val _ = (publishLocal).all(ScopeFilter(inAnyProject)).value
},

View File

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

View File

@ -42,7 +42,7 @@ object SbtLauncherPlugin extends AutoPlugin {
IO.unzip(jar, dir)
IO.copy(overrides.map({ case (n, f) => (f, dir / n)}), overwrite = true)
// 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
}

View File

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

View File

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

View File

@ -42,11 +42,11 @@ object Transform {
IO.writeLines(target, IO.readLines(source) map subMain)
}
def crossGenSettings = transSourceSettings ++ seq(
def crossGenSettings = transSourceSettings ++ Seq(
sourceProperties := Map("cross.package0" -> "sbt", "cross.package1" -> "cross")
)
def transSourceSettings = seq(
inputSourceDirectory <<= sourceDirectory / "input_sources",
def transSourceSettings = Seq(
inputSourceDirectory := sourceDirectory.value / "input_sources",
inputSourceDirectories <<= Seq(inputSourceDirectory).join,
inputSources <<= inputSourceDirectories.map(dirs => (dirs ** (-DirectoryFilter)).get),
fileMappings in transformSources <<= transformSourceMappings,
@ -56,15 +56,15 @@ object Transform {
sourceGenerators <+= transformSources
)
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) =>
Map("org" -> org, "sbt.version" -> v, "scala.version" -> sv, "repositories" -> repositories(isSnapshot).mkString(IO.Newline))
}
)
def transResourceSettings = seq(
inputResourceDirectory <<= sourceDirectory / "input_resources",
def transResourceSettings = Seq(
inputResourceDirectory := sourceDirectory.value / "input_resources",
inputResourceDirectories <<= Seq(inputResourceDirectory).join,
inputResources <<= inputResourceDirectories.map(dirs => (dirs ** (-DirectoryFilter)).get),
fileMappings in transformResources <<= transformResourceMappings,
@ -74,7 +74,7 @@ object Transform {
resourceGenerators <+= transformResources
)
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 =

View File

@ -37,10 +37,10 @@ object Util {
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)
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
}
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 @ _*) =>
NodeSeq.Empty
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
}
cleanNodes(pomNode.theSeq)(0)