Skip to content

Backport add default scaladoc settings to scaladoc artifact publishing #16776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,7 @@ object Build {
"-sourcepath", (Compile / sourceDirectories).value.map(_.getAbsolutePath).distinct.mkString(File.pathSeparator),
"-Yexplicit-nulls",
),
(Compile / doc / scalacOptions) ++= ScaladocConfigs.DefaultGenerationSettings.value.settings
)

lazy val `scala3-library` = project.in(file("library")).asDottyLibrary(NonBootstrapped)
Expand Down Expand Up @@ -1877,8 +1878,7 @@ object ScaladocConfigs {
)
}

lazy val DefaultGenerationConfig = Def.task {
def distLocation = (dist / pack).value
lazy val DefaultGenerationSettings = Def.task {
def projectVersion = version.value
def socialLinks = SocialLinks(List(
"github::https://github.com/lampepfl/dotty",
Expand Down Expand Up @@ -1919,6 +1919,11 @@ object ScaladocConfigs {
)
}

lazy val DefaultGenerationConfig = Def.task {
def distLocation = (dist / pack).value
DefaultGenerationSettings.value
}

lazy val Scaladoc = Def.task {
DefaultGenerationConfig.value
.add(UseJavacp(true))
Expand Down
4 changes: 4 additions & 0 deletions project/ScaladocGeneration.scala
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ object ScaladocGeneration {
def remove[T <: Arg[_]: ClassTag]: GenerationConfig
def withTargets(targets: Seq[String]): GenerationConfig
def serialize: String
def settings: Seq[String]
}

object GenerationConfig {
Expand Down Expand Up @@ -173,6 +174,9 @@ object ScaladocGeneration {
++ targets
).mkString(" ")

override def settings: Seq[String] =
args.map(_.serialize) ++ targets

private def argsWithout[T <: Arg[_]](
implicit tag: ClassTag[T]
): (Option[T], Seq[Arg[_]]) = args.foldLeft[(Option[T], Seq[Arg[_]])]((None, Seq.empty)) {
Expand Down