Skip to content

Commit

Permalink
Fix default javadoc base for jdk11+ (#394)
Browse files Browse the repository at this point in the history
* Fix default javadoc base for jdk11+

Kind of dodgy that we rely on sys.props.get("java.specification.version")
but ok.

* Specify 'javadoc.java.base_url' explicitly in test

as I think we want to encourage this instead of relying on the
'current java version' anyway

* Default to java.base module for java.*
  • Loading branch information
raboof authored Dec 2, 2019
1 parent 7b45d58 commit 35007de
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,12 @@ object ParadoxPlugin extends AutoPlugin {
val JavaSpecVersion = """\d+\.(\d+)""".r
Map(
"javadoc.java.base_url" -> sys.props.get("java.specification.version").map {
case JavaSpecVersion(v) => v
case v => v
}.map { v => url(s"https://docs.oracle.com/javase/$v/docs/api/") },
case JavaSpecVersion(v) => v.toInt
case v => v.toInt
}.map { v =>
if (v < 11) url(s"https://docs.oracle.com/javase/$v/docs/api/")
else url(s"https://docs.oracle.com/en/java/javase/$v/docs/api/java.base/")
},
"scaladoc.version" -> Some(scalaVersion),
"scaladoc.scala.base_url" -> Some(url(s"http://www.scala-lang.org/api/$scalaVersion")),
"scaladoc.base_url" -> apiURL,
Expand Down
3 changes: 2 additions & 1 deletion plugin/src/sbt-test/paradox/parameterized-links/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ paradoxProperties in Compile ++= Map(
"scaladoc.akka.http.base_url" -> s"http://doc.akka.io/api/akka-http/$akkaHttpVersion",
"javadoc.link_style" -> "frames",
"javadoc.base_url" -> s"https://api.example.com/java",
"javadoc.java.base_url" -> "https://docs.oracle.com/javase/8/docs/api/",
"javadoc.akka.base_url" -> s"http://doc.akka.io/japi/akka/$akkaVersion",
"javadoc.akka.http.base_url" -> s"http://doc.akka.io/japi/akka-http/$akkaHttpVersion"
)
Expand All @@ -33,5 +34,5 @@ TaskKey[Unit]("checkJavadocJavalibContent") := {
assert(file.exists, s"${file.getAbsolutePath} did not exist")
val content = IO.readLines(file).mkString
assert(content.matches(
raw"""<p><a href="https://docs.oracle.com/javase/\d+/docs/api/\?java/io/File\.html#separator" title="java.io.File"><code>File\.separator</code></a></p>"""))
raw"""<p><a href="https://docs.oracle.com/javase/8/docs/api/\?java/io/File\.html#separator" title="java.io.File"><code>File\.separator</code></a></p>"""))
}

0 comments on commit 35007de

Please sign in to comment.