mirror of https://github.com/sbt/sbt.git
Merge pull request #497 from coursier/topic/fix-unidoc
Ensure unidoc generation works fine with sbt-coursier
This commit is contained in:
commit
e9aec8c511
|
|
@ -8,16 +8,16 @@ import sbt._
|
||||||
|
|
||||||
object ToSbt {
|
object ToSbt {
|
||||||
|
|
||||||
def moduleId(dependency: Dependency): sbt.ModuleID =
|
def moduleId(dependency: Dependency, extraProperties: Seq[(String, String)]): sbt.ModuleID =
|
||||||
sbt.ModuleID(
|
sbt.ModuleID(
|
||||||
dependency.module.organization,
|
dependency.module.organization,
|
||||||
dependency.module.name,
|
dependency.module.name,
|
||||||
dependency.version,
|
dependency.version,
|
||||||
configurations = Some(dependency.configuration),
|
configurations = Some(dependency.configuration),
|
||||||
extraAttributes = dependency.module.attributes
|
extraAttributes = dependency.module.attributes ++ extraProperties
|
||||||
)
|
)
|
||||||
|
|
||||||
def artifact(module: Module, artifact: Artifact): sbt.Artifact =
|
def artifact(module: Module, artifact: Artifact, extraProperties: Seq[(String, String)]): sbt.Artifact =
|
||||||
sbt.Artifact(
|
sbt.Artifact(
|
||||||
module.name,
|
module.name,
|
||||||
// FIXME Get these two from publications
|
// FIXME Get these two from publications
|
||||||
|
|
@ -28,7 +28,7 @@ object ToSbt {
|
||||||
.orElse(MavenSource.typeDefaultClassifierOpt(artifact.attributes.`type`)),
|
.orElse(MavenSource.typeDefaultClassifierOpt(artifact.attributes.`type`)),
|
||||||
Nil,
|
Nil,
|
||||||
Some(url(artifact.url)),
|
Some(url(artifact.url)),
|
||||||
Map.empty
|
module.attributes ++ extraProperties
|
||||||
)
|
)
|
||||||
|
|
||||||
def moduleReport(
|
def moduleReport(
|
||||||
|
|
@ -40,11 +40,11 @@ object ToSbt {
|
||||||
|
|
||||||
val sbtArtifacts = artifacts.collect {
|
val sbtArtifacts = artifacts.collect {
|
||||||
case (artifact, Some(file)) =>
|
case (artifact, Some(file)) =>
|
||||||
(ToSbt.artifact(dependency.module, artifact), file)
|
(ToSbt.artifact(dependency.module, artifact, project.properties), file)
|
||||||
}
|
}
|
||||||
val sbtMissingArtifacts = artifacts.collect {
|
val sbtMissingArtifacts = artifacts.collect {
|
||||||
case (artifact, None) =>
|
case (artifact, None) =>
|
||||||
ToSbt.artifact(dependency.module, artifact)
|
ToSbt.artifact(dependency.module, artifact, project.properties)
|
||||||
}
|
}
|
||||||
|
|
||||||
val publicationDate = project.info.publication.map { dt =>
|
val publicationDate = project.info.publication.map { dt =>
|
||||||
|
|
@ -54,7 +54,7 @@ object ToSbt {
|
||||||
val callers = dependees.map {
|
val callers = dependees.map {
|
||||||
case (dependee, dependeeProj) =>
|
case (dependee, dependeeProj) =>
|
||||||
new Caller(
|
new Caller(
|
||||||
ToSbt.moduleId(dependee),
|
ToSbt.moduleId(dependee, dependeeProj.properties),
|
||||||
dependeeProj.configurations.keys.toVector,
|
dependeeProj.configurations.keys.toVector,
|
||||||
dependee.module.attributes ++ dependeeProj.properties,
|
dependee.module.attributes ++ dependeeProj.properties,
|
||||||
// FIXME Set better values here
|
// FIXME Set better values here
|
||||||
|
|
@ -66,7 +66,7 @@ object ToSbt {
|
||||||
}
|
}
|
||||||
|
|
||||||
new sbt.ModuleReport(
|
new sbt.ModuleReport(
|
||||||
module = ToSbt.moduleId(dependency),
|
module = ToSbt.moduleId(dependency, project.properties),
|
||||||
artifacts = sbtArtifacts,
|
artifacts = sbtArtifacts,
|
||||||
missingArtifacts = sbtMissingArtifacts,
|
missingArtifacts = sbtMissingArtifacts,
|
||||||
status = None,
|
status = None,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
scalaVersion := "2.12.1"
|
||||||
|
scalacOptions += "-Xfatal-warnings" // required for the test
|
||||||
|
|
||||||
|
enablePlugins(ScalaUnidocPlugin)
|
||||||
|
autoAPIMappings := true
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
val pluginVersion = sys.props.getOrElse(
|
||||||
|
"plugin.version",
|
||||||
|
throw new RuntimeException(
|
||||||
|
"""|The system property 'plugin.version' is not defined.
|
||||||
|
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
addSbtPlugin("io.get-coursier" % "sbt-coursier" % pluginVersion)
|
||||||
|
}
|
||||||
|
|
||||||
|
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.0")
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
/** Default instances for Scala's [[scala.concurrent.Future Future]]. */
|
||||||
|
class Foo
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
> unidoc
|
||||||
Loading…
Reference in New Issue