Skip to content

Commit 4c2efde

Browse files
easelsrowen
authored andcommitted
[SPARK-22855][BUILD] Add -no-java-comments to sbt docs/scalacOptions
Prevents Scala 2.12 scaladoc from blowing up attempting to parse java comments. ## What changes were proposed in this pull request? Adds -no-java-comments to docs/scalacOptions under Scala 2.12. Also moves scaladoc configs out of the TestSettings and into the standard sharedSettings section in SparkBuild.scala. ## How was this patch tested? SBT_OPTS=-Dscala-2.12 sbt ++2.12.4 tags/publishLocal Author: Erik LaBianca <[email protected]> Closes #20042 from easel/scaladoc-212.
1 parent 0abaf31 commit 4c2efde

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

project/SparkBuild.scala

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,21 @@ object SparkBuild extends PomBuild {
254254
"-sourcepath", (baseDirectory in ThisBuild).value.getAbsolutePath // Required for relative source links in scaladoc
255255
),
256256

257+
// Remove certain packages from Scaladoc
258+
scalacOptions in (Compile, doc) := Seq(
259+
"-groups",
260+
"-skip-packages", Seq(
261+
"org.apache.spark.api.python",
262+
"org.apache.spark.network",
263+
"org.apache.spark.deploy",
264+
"org.apache.spark.util.collection"
265+
).mkString(":"),
266+
"-doc-title", "Spark " + version.value.replaceAll("-SNAPSHOT", "") + " ScalaDoc"
267+
) ++ {
268+
// Do not attempt to scaladoc javadoc comments under 2.12 since it can't handle inner classes
269+
if (scalaBinaryVersion.value == "2.12") Seq("-no-java-comments") else Seq.empty
270+
},
271+
257272
// Implements -Xfatal-warnings, ignoring deprecation warnings.
258273
// Code snippet taken from https://issues.scala-lang.org/browse/SI-8410.
259274
compile in Compile := {
@@ -828,18 +843,7 @@ object TestSettings {
828843
}
829844
Seq.empty[File]
830845
}).value,
831-
concurrentRestrictions in Global += Tags.limit(Tags.Test, 1),
832-
// Remove certain packages from Scaladoc
833-
scalacOptions in (Compile, doc) := Seq(
834-
"-groups",
835-
"-skip-packages", Seq(
836-
"org.apache.spark.api.python",
837-
"org.apache.spark.network",
838-
"org.apache.spark.deploy",
839-
"org.apache.spark.util.collection"
840-
).mkString(":"),
841-
"-doc-title", "Spark " + version.value.replaceAll("-SNAPSHOT", "") + " ScalaDoc"
842-
)
846+
concurrentRestrictions in Global += Tags.limit(Tags.Test, 1)
843847
)
844848

845849
}

0 commit comments

Comments
 (0)