Merge pull request #1793 from sbt/wip/aether-resolver

Use Aether for resolving maven dependencies
This commit is contained in:
eugene yokota 2015-01-14 15:17:50 -05:00
commit 11729e0122
1 changed files with 32 additions and 9 deletions

View File

@ -412,15 +412,26 @@ lazy val sbtProj = (project in sbtPath).
normalizedName := "sbt" normalizedName := "sbt"
) )
def scriptedTask: Initialize[InputTask[Unit]] = InputTask(scriptedSource(dir => (s: State) => scriptedParser(dir))) { result => lazy val mavenResolverPluginProj = (project in file("sbt-maven-resolver")).
(proguard in Proguard, fullClasspath in scriptedSbtProj in Test, scalaInstance in scriptedSbtProj, publishAll, scriptedSource, result) map { dependsOn(sbtProj, ivyProj % "test->test").
(launcher, scriptedSbtClasspath, scriptedSbtInstance, _, sourcePath, args) => settings(baseSettings: _*).
doScripted(launcher, scriptedSbtClasspath, scriptedSbtInstance, sourcePath, args) settings(
} name := "sbt-maven-resolver",
libraryDependencies ++= aetherLibs,
sbtPlugin := true
)
def scriptedTask: Initialize[InputTask[Unit]] = Def.inputTask {
val result = scriptedSource(dir => (s: State) => scriptedParser(dir)).parsed
publishAll.value
doScripted((proguard in Proguard).value, (fullClasspath in scriptedSbtProj in Test).value,
(scalaInstance in scriptedSbtProj).value, scriptedSource.value, result, scriptedPrescripted.value)
} }
def scriptedUnpublishedTask: Initialize[InputTask[Unit]] = InputTask(scriptedSource(dir => (s: State) => scriptedParser(dir))) { result => def scriptedUnpublishedTask: Initialize[InputTask[Unit]] = Def.inputTask {
(proguard in Proguard, fullClasspath in scriptedSbtProj in Test, scalaInstance in scriptedSbtProj, scriptedSource, result) map doScripted val result = scriptedSource(dir => (s: State) => scriptedParser(dir)).parsed
doScripted((proguard in Proguard).value, (fullClasspath in scriptedSbtProj in Test).value,
(scalaInstance in scriptedSbtProj).value, scriptedSource.value, result, scriptedPrescripted.value)
} }
lazy val publishAll = TaskKey[Unit]("publish-all") lazy val publishAll = TaskKey[Unit]("publish-all")
@ -435,7 +446,7 @@ def allProjects = Seq(launchInterfaceProj, launchProj, testSamples, interfacePro
compileInterfaceProj, compileIncrementalProj, compilePersistProj, compilerProj, compileInterfaceProj, compileIncrementalProj, compilePersistProj, compilerProj,
compilerIntegrationProj, compilerIvyProj, compilerIntegrationProj, compilerIvyProj,
scriptedBaseProj, scriptedSbtProj, scriptedPluginProj, scriptedBaseProj, scriptedSbtProj, scriptedPluginProj,
actionsProj, commandProj, mainSettingsProj, mainProj, sbtProj) actionsProj, commandProj, mainSettingsProj, mainProj, sbtProj, mavenResolverPluginProj)
def projectsWithMyProvided = allProjects.map(p => p.copy(configurations = (p.configurations.filter(_ != Provided)) :+ myProvided)) def projectsWithMyProvided = allProjects.map(p => p.copy(configurations = (p.configurations.filter(_ != Provided)) :+ myProvided))
lazy val nonRoots = projectsWithMyProvided.map(p => LocalProject(p.id)) lazy val nonRoots = projectsWithMyProvided.map(p => LocalProject(p.id))
@ -444,13 +455,25 @@ def rootSettings = releaseSettings ++ fullDocSettings ++ LaunchProguard.settings
Util.publishPomSettings ++ otherRootSettings ++ proguardedLauncherSettings ++ Formatting.sbtFilesSettings ++ Util.publishPomSettings ++ otherRootSettings ++ proguardedLauncherSettings ++ Formatting.sbtFilesSettings ++
Transform.conscriptSettings(launchProj) Transform.conscriptSettings(launchProj)
def otherRootSettings = Seq( def otherRootSettings = Seq(
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) / "sbt-test",
publishAll := { publishAll := {
(publishLocal).all(ScopeFilter(inAnyProject)).value (publishLocal).all(ScopeFilter(inAnyProject)).value
} }
) ) ++ inConfig(Scripted.MavenResolverPluginTest)(Seq(
Scripted.scripted <<= scriptedTask,
Scripted.scriptedUnpublished <<= scriptedUnpublishedTask,
Scripted.scriptedPrescripted := { f =>
val inj = f / "project" / "maven.sbt"
if (!inj.exists) {
IO.write(inj, """libraryDependencies += Defaults.sbtPluginExtra("org.scala-sbt" % "sbt-maven-resolver" % sbtVersion.value,
|sbtBinaryVersion.value, scalaBinaryVersion.value)""".stripMargin)
// sLog.value.info(s"""Injected project/maven.sbt to $f""")
}
}
))
lazy val docProjects: ScopeFilter = ScopeFilter( lazy val docProjects: ScopeFilter = ScopeFilter(
inAnyProject -- inProjects(root, sbtProj, scriptedBaseProj, scriptedSbtProj, scriptedPluginProj), inAnyProject -- inProjects(root, sbtProj, scriptedBaseProj, scriptedSbtProj, scriptedPluginProj),
inConfigurations(Compile) inConfigurations(Compile)