mirror of https://github.com/sbt/sbt.git
Merge pull request #3055 from dwijnand/build-warnings
Remove warnings in the build setup
This commit is contained in:
commit
4e267e5cb5
|
|
@ -23,7 +23,7 @@ object Docs {
|
|||
def ghPagesSettings = ghpages.settings ++ Seq(
|
||||
git.remoteRepo := "git@github.com:sbt/sbt.github.com.git",
|
||||
localRepoDirectory,
|
||||
ghkeys.synchLocal <<= synchLocalImpl,
|
||||
ghkeys.synchLocal := synchLocalImpl.value,
|
||||
GitKeys.gitBranch in ghkeys.updatedRepository := Some("master")
|
||||
)
|
||||
|
||||
|
|
@ -35,14 +35,15 @@ object Docs {
|
|||
}
|
||||
|
||||
def siteIncludeSxr(prefix: String) = Seq(
|
||||
mappings in sxr <<= sxr.map(dir => Path.allSubpaths(dir).toSeq)
|
||||
mappings in sxr := Path.allSubpaths(sxr.value).toSeq
|
||||
) ++ site.addMappingsToSiteDir(mappings in sxr, prefix)
|
||||
|
||||
def synchLocalImpl = (ghkeys.privateMappings, ghkeys.updatedRepository, version, streams) map {
|
||||
(mappings, repo, v, s) =>
|
||||
val versioned = repo / v
|
||||
def synchLocalImpl = Def task {
|
||||
val repo = ghkeys.updatedRepository.value
|
||||
val versioned = repo / version.value
|
||||
IO.delete(versioned / "sxr")
|
||||
IO.delete(versioned / "api")
|
||||
val mappings = ghkeys.privateMappings.value
|
||||
val toCopy = for ((file, target) <- mappings if siteInclude(file)) yield (file, versioned / target)
|
||||
IO.copy(toCopy)
|
||||
repo
|
||||
|
|
|
|||
|
|
@ -3,22 +3,18 @@ import Keys._
|
|||
import Dependencies._
|
||||
|
||||
object NightlyPlugin extends AutoPlugin {
|
||||
import autoImport._
|
||||
|
||||
override def trigger = allRequirements
|
||||
override def requires = plugins.JvmPlugin
|
||||
object autoImport {
|
||||
lazy val includeTestDependencies = SettingKey[Boolean]("includeTestDependencies", "Doesn't declare test dependencies.")
|
||||
|
||||
def testDependencies = libraryDependencies <++= includeTestDependencies { incl =>
|
||||
if (incl) Seq(
|
||||
scalaCheck % Test,
|
||||
specs2 % Test,
|
||||
junit % Test
|
||||
)
|
||||
object autoImport {
|
||||
val includeTestDependencies = settingKey[Boolean]("Doesn't declare test dependencies.")
|
||||
|
||||
def testDependencies = libraryDependencies ++= (
|
||||
if (includeTestDependencies.value) Seq(scalaCheck % Test, specs2 % Test, junit % Test)
|
||||
else Seq()
|
||||
}
|
||||
)
|
||||
}
|
||||
import autoImport._
|
||||
|
||||
override def buildSettings: Seq[Setting[_]] = Seq(
|
||||
// Avoid 2.12.x nightlies
|
||||
|
|
|
|||
|
|
@ -18,21 +18,21 @@ object Sxr {
|
|||
scalacOptions += "-Xplugin:" + managedClasspath.value.files.filter(_.getName.contains("sxr")).absString,
|
||||
scalacOptions += "-Ystop-after:sxr",
|
||||
target := target.in(taskGlobal).value / "browse",
|
||||
sxr in taskGlobal <<= sxrTask
|
||||
sxr in taskGlobal := sxrTask.value
|
||||
)
|
||||
def taskGlobal = ThisScope.copy(task = Global)
|
||||
def sxrTask = (sources, target, scalacOptions, classpathOptions, scalaInstance, fullClasspath, streams) map { (srcs, out, opts, cpOpts, si, cp, s) =>
|
||||
val cache = s.cacheDirectory
|
||||
def sxrTask = Def task {
|
||||
val out = target.value
|
||||
val outputDir = out.getParentFile / (out.getName + ".sxr")
|
||||
val f = FileFunction.cached(cache / "sxr", FilesInfo.hash) { in =>
|
||||
s.log.info("Generating sxr output in " + outputDir.getAbsolutePath + "...")
|
||||
val f = FileFunction.cached(streams.value.cacheDirectory / "sxr", FilesInfo.hash) { in =>
|
||||
streams.value.log.info("Generating sxr output in " + outputDir.getAbsolutePath + "...")
|
||||
IO.delete(out)
|
||||
IO.createDirectory(out)
|
||||
val comp = new compiler.RawCompiler(si, cpOpts, s.log)
|
||||
comp(in.toSeq.sorted, cp.files, out, opts)
|
||||
val comp = new compiler.RawCompiler(scalaInstance.value, classpathOptions.value, streams.value.log)
|
||||
comp(in.toSeq.sorted, fullClasspath.value.files, out, scalacOptions.value)
|
||||
Set(outputDir)
|
||||
}
|
||||
f(srcs.toSet)
|
||||
f(sources.value.toSet)
|
||||
outputDir
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,12 +17,15 @@ object Transform {
|
|||
lazy val conscriptConfigs = TaskKey[Unit]("conscript-configs")
|
||||
|
||||
def conscriptSettings(launch: Reference) = Seq(
|
||||
conscriptConfigs <<= (managedResources in launch in Compile, sourceDirectory in Compile).map { (res, src) =>
|
||||
conscriptConfigs := {
|
||||
val res = (managedResources in launch in Compile).value
|
||||
val src = (sourceDirectory in Compile).value
|
||||
val source = res.find(_.getName == "sbt.boot.properties") getOrElse sys.error("No managed boot.properties file.")
|
||||
copyConscriptProperties(source, src / "conscript")
|
||||
()
|
||||
}
|
||||
)
|
||||
|
||||
def copyConscriptProperties(source: File, conscriptBase: File): Seq[File] =
|
||||
{
|
||||
IO.delete(conscriptBase)
|
||||
|
|
@ -47,33 +50,42 @@ object Transform {
|
|||
)
|
||||
def transSourceSettings = Seq(
|
||||
inputSourceDirectory := sourceDirectory.value / "input_sources",
|
||||
inputSourceDirectories <<= Seq(inputSourceDirectory).join,
|
||||
inputSources <<= inputSourceDirectories.map(dirs => (dirs ** (-DirectoryFilter)).get),
|
||||
fileMappings in transformSources <<= transformSourceMappings,
|
||||
transformSources <<= (fileMappings in transformSources, sourceProperties) map { (rs, props) =>
|
||||
inputSourceDirectories := Seq(inputSourceDirectory.value),
|
||||
inputSources := (inputSourceDirectories.value ** (-DirectoryFilter)).get,
|
||||
fileMappings in transformSources := transformSourceMappings.value,
|
||||
transformSources := {
|
||||
val rs = (fileMappings in transformSources).value
|
||||
val props = sourceProperties.value
|
||||
rs map { case (in, out) => transform(in, out, props) }
|
||||
},
|
||||
sourceGenerators <+= transformSources
|
||||
sourceGenerators += transformSources.taskValue
|
||||
)
|
||||
def transformSourceMappings = (inputSources, inputSourceDirectories, sourceManaged) map { (ss, sdirs, sm) =>
|
||||
def transformSourceMappings = Def task {
|
||||
val ss = inputSources.value
|
||||
val sdirs = inputSourceDirectories.value
|
||||
val sm = sourceManaged.value
|
||||
((ss --- sdirs) pair (rebase(sdirs, sm) | flat(sm))).toSeq
|
||||
}
|
||||
def configSettings = transResourceSettings ++ Seq(
|
||||
resourceProperties <<= (organization, version, scalaVersion, isSnapshot) map { (org, v, sv, isSnapshot) =>
|
||||
Map("org" -> org, "sbt.version" -> v, "scala.version" -> sv)
|
||||
}
|
||||
resourceProperties :=
|
||||
Map("org" -> organization.value, "sbt.version" -> version.value, "scala.version" -> scalaVersion.value)
|
||||
)
|
||||
def transResourceSettings = Seq(
|
||||
inputResourceDirectory := sourceDirectory.value / "input_resources",
|
||||
inputResourceDirectories <<= Seq(inputResourceDirectory).join,
|
||||
inputResources <<= inputResourceDirectories.map(dirs => (dirs ** (-DirectoryFilter)).get),
|
||||
fileMappings in transformResources <<= transformResourceMappings,
|
||||
transformResources <<= (fileMappings in transformResources, resourceProperties) map { (rs, props) =>
|
||||
inputResourceDirectories := Seq(inputResourceDirectory.value),
|
||||
inputResources := (inputResourceDirectories.value ** (-DirectoryFilter)).get,
|
||||
fileMappings in transformResources := transformResourceMappings.value,
|
||||
transformResources := {
|
||||
val rs = (fileMappings in transformResources).value
|
||||
val props = resourceProperties.value
|
||||
rs map { case (in, out) => transform(in, out, props) }
|
||||
},
|
||||
resourceGenerators <+= transformResources
|
||||
resourceGenerators += transformResources.taskValue
|
||||
)
|
||||
def transformResourceMappings = (inputResources, inputResourceDirectories, resourceManaged) map { (rs, rdirs, rm) =>
|
||||
def transformResourceMappings = Def task {
|
||||
val rs = inputResources.value
|
||||
val rdirs = inputResourceDirectories.value
|
||||
val rm = resourceManaged.value
|
||||
((rs --- rdirs) pair (rebase(rdirs, rm) | flat(rm))).toSeq
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import scala.util.control.NonFatal
|
||||
import sbt._
|
||||
import Keys._
|
||||
import StringUtilities.normalize
|
||||
|
||||
object Util {
|
||||
val ExclusiveTest = Tags.Tag("exclusive-test")
|
||||
lazy val componentID = SettingKey[Option[String]]("component-id")
|
||||
lazy val scalaKeywords = TaskKey[Set[String]]("scala-keywords")
|
||||
lazy val generateKeywords = TaskKey[File]("generateKeywords")
|
||||
val ExclusiveTest: Tags.Tag = Tags.Tag("exclusive-test")
|
||||
|
||||
val componentID: SettingKey[Option[String]] = settingKey[Option[String]]("")
|
||||
val scalaKeywords: TaskKey[Set[String]] = taskKey[Set[String]]("")
|
||||
val generateKeywords: TaskKey[File] = taskKey[File]("")
|
||||
|
||||
def noPublishSettings: Seq[Setting[_]] = Seq(publish := {})
|
||||
|
||||
|
|
@ -19,10 +19,15 @@ object Util {
|
|||
})
|
||||
)
|
||||
|
||||
lazy val javaOnlySettings = Seq[Setting[_]]( /*crossPaths := false, */ compileOrder := CompileOrder.JavaThenScala, unmanagedSourceDirectories in Compile <<= Seq(javaSource in Compile).join)
|
||||
lazy val javaOnlySettings: Seq[Setting[_]] = Seq(
|
||||
// crossPaths := false,
|
||||
compileOrder := CompileOrder.JavaThenScala,
|
||||
unmanagedSourceDirectories in Compile := Seq((javaSource in Compile).value)
|
||||
)
|
||||
|
||||
lazy val baseScalacOptions = Seq(
|
||||
scalacOptions ++= Seq("-Xelide-below", "0"),
|
||||
scalacOptions <++= scalaVersion map CrossVersion.partialVersion map {
|
||||
scalacOptions ++= (CrossVersion partialVersion scalaVersion.value match {
|
||||
case Some((2, 9)) | Some((2, 8)) => Nil // support 2.9 for some subprojects for the Scala Eclipse IDE
|
||||
case _ => Seq(
|
||||
"-encoding", "utf8",
|
||||
|
|
@ -38,16 +43,17 @@ object Util {
|
|||
"-Ywarn-unused",
|
||||
"-Ywarn-unused-import"
|
||||
)
|
||||
},
|
||||
scalacOptions <++= scalaVersion map CrossVersion.partialVersion map {
|
||||
}),
|
||||
scalacOptions ++= (CrossVersion partialVersion scalaVersion.value match {
|
||||
case Some((2, 10)) => Seq("-deprecation", "-Xlint")
|
||||
case _ => Seq()
|
||||
}
|
||||
})
|
||||
)
|
||||
|
||||
def projectComponent = projectID <<= (projectID, componentID) { (pid, cid) =>
|
||||
cid match { case Some(id) => pid extra ("e:component" -> id); case None => pid }
|
||||
}
|
||||
def projectComponent: Setting[_] = projectID := (componentID.value match {
|
||||
case Some(id) => projectID.value extra ("e:component" -> id)
|
||||
case None => projectID.value
|
||||
})
|
||||
|
||||
lazy val apiDefinitions = TaskKey[Seq[File]]("api-definitions")
|
||||
|
||||
|
|
@ -129,6 +135,7 @@ object Util {
|
|||
val g = new scala.tools.nsc.Global(new scala.tools.nsc.Settings)
|
||||
g.nme.keywords.map(_.toString)
|
||||
}
|
||||
|
||||
def writeScalaKeywords(base: File, keywords: Set[String]): File =
|
||||
{
|
||||
val init = keywords.map(tn => '"' + tn + '"').mkString("Set(", ", ", ")")
|
||||
|
|
@ -143,10 +150,11 @@ object %s {
|
|||
IO.write(out, keywordsSrc)
|
||||
out
|
||||
}
|
||||
|
||||
def keywordsSettings: Seq[Setting[_]] = inConfig(Compile)(Seq(
|
||||
scalaKeywords := getScalaKeywords,
|
||||
generateKeywords <<= (sourceManaged, scalaKeywords) map writeScalaKeywords,
|
||||
sourceGenerators <+= generateKeywords map (x => Seq(x))
|
||||
generateKeywords := writeScalaKeywords(sourceManaged.value, scalaKeywords.value),
|
||||
sourceGenerators += Def.task(Seq(generateKeywords.value)).taskValue
|
||||
))
|
||||
}
|
||||
|
||||
|
|
@ -159,9 +167,9 @@ object Licensed {
|
|||
def seePaths(base: File, noticeString: String): Seq[File] = seeRegex.findAllIn(noticeString).matchData.map(d => licensePath(base, d.group(1))).toList
|
||||
|
||||
def settings: Seq[Setting[_]] = Seq(
|
||||
notice <<= baseDirectory(_ / "NOTICE"),
|
||||
unmanagedResources in Compile <++= (notice, extractLicenses) map { _ +: _ },
|
||||
extractLicenses <<= (baseDirectory in ThisBuild, notice, streams) map extractLicenses0
|
||||
notice := (baseDirectory.value / "NOTICE"),
|
||||
unmanagedResources in Compile ++= notice.value +: extractLicenses.value,
|
||||
extractLicenses := extractLicenses0((baseDirectory in ThisBuild).value, notice.value, streams.value)
|
||||
)
|
||||
def extractLicenses0(base: File, note: File, s: TaskStreams): Seq[File] =
|
||||
if (!note.exists) Nil else
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
scalaVersion := "2.10.6"
|
||||
scalacOptions ++= Seq("-feature", "-language:postfixOps")
|
||||
|
||||
addSbtPlugin("com.eed3si9n" % "sbt-doge" % "0.1.5")
|
||||
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.11")
|
||||
|
|
|
|||
Loading…
Reference in New Issue