-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7559 from ennru/extenstion-in-doc-source-url
Backport of "Scaladoc: Introduce new variables to create better links to source"
- Loading branch information
Showing
9 changed files
with
115 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Scala (https://www.scala-lang.org) | ||
* | ||
* Copyright EPFL and Lightbend, Inc. | ||
* | ||
* Licensed under Apache License 2.0 | ||
* (http://www.apache.org/licenses/LICENSE-2.0). | ||
* | ||
* See the NOTICE file distributed with this work for | ||
* additional information regarding copyright ownership. | ||
*/ | ||
|
||
public class WithSource {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Scala (https://www.scala-lang.org) | ||
* | ||
* Copyright EPFL and Lightbend, Inc. | ||
* | ||
* Licensed under Apache License 2.0 | ||
* (http://www.apache.org/licenses/LICENSE-2.0). | ||
* | ||
* See the NOTICE file distributed with this work for | ||
* additional information regarding copyright ownership. | ||
*/ | ||
|
||
class WithSource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Done. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Scala (https://www.scala-lang.org) | ||
* | ||
* Copyright EPFL and Lightbend, Inc. | ||
* | ||
* Licensed under Apache License 2.0 | ||
* (http://www.apache.org/licenses/LICENSE-2.0). | ||
* | ||
* See the NOTICE file distributed with this work for | ||
* additional information regarding copyright ownership. | ||
*/ | ||
|
||
import java.net.URL | ||
|
||
import scala.tools.nsc.ScalaDocReporter | ||
import scala.tools.nsc.doc.Universe | ||
import scala.tools.nsc.doc.html.Page | ||
import scala.tools.nsc.doc.html.page.EntityPage | ||
import scala.tools.nsc.doc.html.page.diagram.{DiagramGenerator, DotDiagramGenerator} | ||
import scala.tools.nsc.doc.model._ | ||
import scala.tools.partest.ScaladocModelTest | ||
|
||
object Test extends ScaladocModelTest { | ||
|
||
override def resourceFile = "test/scaladoc/resources/doc-source-url.java" | ||
|
||
override def model: Option[Universe] = newDocFactory.makeUniverse(Left(List(resourceFile))) | ||
|
||
def scaladocSettings = "-doc-source-url file:€{FILE_PATH}||€{FILE_EXT}||€{FILE_PATH_EXT}||€{FILE_LINE}" | ||
|
||
def testModel(rootPackage: Package) = { | ||
import access._ | ||
|
||
val clazz = rootPackage._class("WithSource") | ||
|
||
val expect = s"file:test/scaladoc/resources/doc-source-url||.java||test/scaladoc/resources/doc-source-url.java||13" | ||
assert(clazz.sourceUrl.contains(new URL(expect)), s"got ${clazz.sourceUrl}") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Done. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Scala (https://www.scala-lang.org) | ||
* | ||
* Copyright EPFL and Lightbend, Inc. | ||
* | ||
* Licensed under Apache License 2.0 | ||
* (http://www.apache.org/licenses/LICENSE-2.0). | ||
* | ||
* See the NOTICE file distributed with this work for | ||
* additional information regarding copyright ownership. | ||
*/ | ||
|
||
import java.net.URL | ||
|
||
import scala.tools.nsc.ScalaDocReporter | ||
import scala.tools.nsc.doc.Universe | ||
import scala.tools.nsc.doc.html.Page | ||
import scala.tools.nsc.doc.html.page.EntityPage | ||
import scala.tools.nsc.doc.html.page.diagram.{DiagramGenerator, DotDiagramGenerator} | ||
import scala.tools.nsc.doc.model._ | ||
import scala.tools.partest.ScaladocModelTest | ||
|
||
object Test extends ScaladocModelTest { | ||
|
||
override def resourceFile = "test/scaladoc/resources/doc-source-url.scala" | ||
|
||
override def model: Option[Universe] = newDocFactory.makeUniverse(Left(List(resourceFile))) | ||
|
||
def scaladocSettings = "-doc-source-url file:€{FILE_PATH}||€{FILE_EXT}||€{FILE_PATH_EXT}||€{FILE_LINE}" | ||
|
||
def testModel(rootPackage: Package) = { | ||
import access._ | ||
|
||
val clazz = rootPackage._class("WithSource") | ||
|
||
val expect = s"file:test/scaladoc/resources/doc-source-url||.scala||test/scaladoc/resources/doc-source-url.scala||13" | ||
assert(clazz.sourceUrl.contains(new URL(expect)), s"got ${clazz.sourceUrl}") | ||
} | ||
} |