fix scaladoc resolution without JCenter

This commit is contained in:
Adrien Piquerez 2021-02-23 16:24:49 +01:00
parent ab2b396543
commit ff12c87367
5 changed files with 30 additions and 18 deletions

View File

@ -2087,18 +2087,17 @@ object Defaults extends BuildCommon {
val runDoc = Doc.scaladoc(label, s.cacheStoreFactory sub "scala", cs.scalac match {
case ac: AnalyzingCompiler => ac.onArgs(exported(s, "scaladoc"))
}, fiOpts)
val isScala3 = ScalaArtifacts.isScala3(sv)
def isScala3Doc(module: ModuleID): Boolean = {
module.configurations.exists(_.startsWith(Configurations.ScalaDocTool.name)) &&
module.name == ScalaArtifacts.Scala3DocID
}
if (isScala3 && !allDeps.exists(isScala3Doc)) {
if (ScalaArtifacts.isScala3M123(sv) && !allDeps.exists(isScala3Doc)) {
Array(
"Unresolved scala3doc artifact",
"add 'ThisBuild / resolvers += Resolver.JCenterRepository'"
).foreach(m => s.log.error(m))
}
val docSrcs = if (isScala3) tFiles else srcs
val docSrcs = if (ScalaArtifacts.isScala3(sv)) tFiles else srcs
runDoc(docSrcs, cp, out, options, maxErrors.value, s.log)
case (_, true) =>
val javadoc =
@ -3188,10 +3187,11 @@ object Classpaths {
val sbtOrg = scalaOrganization.value
val version = scalaVersion.value
val extResolvers = externalResolvers.value
val isScala3M123 = ScalaArtifacts.isScala3M123(version)
val allToolDeps =
if (scalaHome.value.isDefined || scalaModuleInfo.value.isEmpty || !managedScalaInstance.value)
Nil
else if (extResolvers.contains(Resolver.JCenterRepository)) {
else if (!isScala3M123 || extResolvers.contains(Resolver.JCenterRepository)) {
ScalaArtifacts.toolDependencies(sbtOrg, version) ++
ScalaArtifacts.docToolDependencies(sbtOrg, version)
} else ScalaArtifacts.toolDependencies(sbtOrg, version)

View File

@ -1,7 +1,11 @@
ThisBuild / scalaVersion := "3.0.0-M4-bin-20210212-0273336-NIGHTLY"
// ThisBuild / scalaVersion := "3.0.0-M3",
lazy val root = (project in file("."))
lazy val m3 = (project in file("m3"))
.settings(
scalaVersion := "3.0.0-M3",
resolvers += Resolver.JCenterRepository
)
lazy val rc1 = (project in file("rc1"))
.settings(
scalaVersion := "3.0.0-RC1"
)

View File

@ -0,0 +1,10 @@
package foo
final val foo="Foo"
object A:
/**
* @param i An argument
*/
def x(i:Int)=3

View File

@ -1,17 +1,15 @@
> doc
> rc1 / doc
# there shouldn't be two api/ directories
# see https://github.com/lampepfl/dotty/issues/11412
$ exists target/scala-3.0.0-M4/api/api/index.html
$ exists target/scala-3.0.0-M4/api/api/foo/A$.html
$ exists target/scala-3.0.0-M4/api/api/foo.html
$ exists rc1/target/scala-3.0.0-RC1/api/api/index.html
$ exists rc1/target/scala-3.0.0-RC1/api/api/foo/A$.html
$ exists rc1/target/scala-3.0.0-RC1/api/api/foo.html
> ++3.0.0-M3!
> clean
> doc
> m3 / doc
# there shouldn't be two api/ directories
# see https://github.com/lampepfl/dotty/issues/11412
$ exists target/scala-3.0.0-M3/api/index.html
$ exists target/scala-3.0.0-M3/api/api/foo/A$.html
$ exists target/scala-3.0.0-M3/api/api/foo.html
$ exists m3/target/scala-3.0.0-M3/api/index.html
$ exists m3/target/scala-3.0.0-M3/api/api/foo/A$.html
$ exists m3/target/scala-3.0.0-M3/api/api/foo.html