Scala-dev: make scala-xml a provided dependency for scala-compiler, remove it from scaladoc?

Created on 4 Jan 2017  路  7Comments  路  Source: scala/scala-dev

Most helpful comment

this ticket was supposed to be about a more quick-and-dirty solution that just involves marking scala-compiler's dependency on scala-xml as "provided", to keep scala-xml from getting pulled in when people depend on scala-compiler...?

Eugene fixed this in sbt 1.1.2 with sbt/zinc#505

libraryDependencies ++= List(
  "org.scala-lang.modules" %% "scala-xml" % "1.1.0"
)

sbt 1.1.1:

scala> scala.xml.XML.encoding
res0: String = ISO-8859-1

sbt 1.1.2:

scala> scala.xml.XML.encoding
res0: String = UTF-8

All 7 comments

WIP PR for Scala at https://github.com/scala/scala/pull/5689 - requires coordination with sbt (https://github.com/scala/scala-module-dependency-sample/pull/14#issuecomment-270952028).

If I understand correctly behind the compiler-interface are compiler-bridges. So we would just need to start shipping compiler-bridges for 2.13+ that used the now-publishing scaladoc jar when compiling xsbt.ScaladocInterface.

It would be difficult for me to write an sbt compiler bridge, assuming it's even possible.

Seth mentioned just ripping out scala-xml from scaladoc. I started looking in to doing just that: Converting the XML syntax for case classes:

--- a/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/html/HtmlPage.scala
@@ -91,96 +89,104 @@
-  def blockToHtml(block: Block): NodeSeq = block match {
-    case Title(in, 1) => <h3>{ inlineToHtml(in) }</h3>
-    case Title(in, 2) => <h4>{ inlineToHtml(in) }</h4>
-    case Title(in, 3) => <h5>{ inlineToHtml(in) }</h5>
-    case Paragraph(in) => <p>{ inlineToHtml(in) }</p>
+  def blockToHtml(block: Block): Seq[AnyXml] = block match {
+    case Title(in, 1) => Seq(XmlTag("h3", inlineToHtml(in)))
+    case Title(in, 2) => Seq(XmlTag("h4", inlineToHtml(in)))
+    case Title(in, 3) => Seq(XmlTag("h5", inlineToHtml(in)))
+    case Paragraph(in) => Seq(XmlTag("p", inlineToHtml(in)))

It's turned in to a real slog, though. Keep going or should I abort?

gah, so many tickets on this, hard to follow.

I think this ticket was supposed to be about a more quick-and-dirty solution that just involves marking scala-compiler's dependency on scala-xml as "provided", to keep scala-xml from getting pulled in when people depend on scala-compiler...?

as for the better but more difficult solution of actually ripping the scala-xml usages out of the Scaladoc tool (https://github.com/scala/bug/issues/9560):

It's turned in to a real slog, though. Keep going or should I abort?

yeah I started it too, a month or so ago, and found it a slog as well. I decided to stop and think about whether there some way to make it easier. maybe a two-stage process of swapping in Scalatags instead, make the tests pass, then swap in our own custom-made Scalatags-like thing since we don't want Scalatags in the bootstrap.

if you want to tackle this, I absolutely encourage you, but I can't tell you it won't be real work.

yeah I started it too, a month or so ago, and found it a slog as well.

Ok, good to know.

I decided to stop and think about whether there some way to make it easier.

I guess we made the same conclusion. That's why I've brought this up.

if you want to tackle this, I absolutely encourage you, but I can't tell you it won't be real work.

Yeah, agree. I just wanted to check if ripping scala-xml syntax out of scaladoc would be considered friendly or not before I proceeded any further. I'll hold off for now, but may return to it.

For now, I'll wait a few days to hear if Eugene or Dale have an sbt fix up their sleeve.

WIP on this is scala/scala#6436

this ticket was supposed to be about a more quick-and-dirty solution that just involves marking scala-compiler's dependency on scala-xml as "provided", to keep scala-xml from getting pulled in when people depend on scala-compiler...?

Eugene fixed this in sbt 1.1.2 with sbt/zinc#505

libraryDependencies ++= List(
  "org.scala-lang.modules" %% "scala-xml" % "1.1.0"
)

sbt 1.1.1:

scala> scala.xml.XML.encoding
res0: String = ISO-8859-1

sbt 1.1.2:

scala> scala.xml.XML.encoding
res0: String = UTF-8
Was this page helpful?
0 / 5 - 0 ratings

Related issues

adriaanm picture adriaanm  路  6Comments

retronym picture retronym  路  8Comments

adriaanm picture adriaanm  路  8Comments

lrytz picture lrytz  路  4Comments

adriaanm picture adriaanm  路  5Comments