Skip to content
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

scala-xml dependency should be provided #5689

Closed
wants to merge 3 commits into from

Conversation

ashawley
Copy link
Member

Nothing should transitively depend on the scala-xml module except for
scaladoc and library-all.

Compiler needs scala-xml as a build dependency, but not at runtime.

The user is supposed to provide scala-xml as a dependency at runtime.
This fixes an issue where the classpath in SBT shadows the scala-xml
module, see scala/scala-module-dependency-sample#14.

Unfortunately, scaladoc needs to be pulled out of the compiler. This
is a first attempt at mangling the build so that scaladoc is a
separate jar. Following on, SBT will need to know how to run scaladoc
as a separate jar.

Previously #5609 for 2.11. For 2.13 is tracked at scala/scala-dev#291

Nothing should transitively depend on the scala-xml module except for
scaladoc and library-all.

Compiler needs scala-xml as a build dependency, but not at runtime.

The user is supposed to provide scala-xml as a dependency at runtime.
This fixes an issue where the classpath in SBT shadows the scala-xml
module, see scala/scala-module-dependency-sample#14.

Unfortunately, scaladoc needs to be pulled out of the compiler.  This
is a first attempt at mangling the build so that scaladoc is a
separate jar.  Following on, SBT will need to know how to run scaladoc
as a separate jar.
@scala-jenkins scala-jenkins added this to the 2.13.0-M1 milestone Feb 13, 2017
@lrytz
Copy link
Member

lrytz commented Feb 13, 2017

sbt's compiler-interface needs scaladoc on the classpath:

[info] 'compiler-interface' not yet compiled for Scala 2.13.0-20170212-224828-034ccfd. Compiling...
/home/jenkins/tmp/sbt_60a1acc5/xsbt/ScaladocInterface.scala:13: error: object doc is not a member of package scala.tools.nsc
  import scala.tools.nsc.{ doc, Global, reporters }

Not sure if there's a way to make this work without requiring a new, patched version of sbt.

@ashawley
Copy link
Member Author

Not sure if there's a way to make this work without requiring a new, patched version of sbt.

Not in my opinion there isn't

scala/scala-module-dependency-sample#14 (comment)

@lrytz
Copy link
Member

lrytz commented Feb 21, 2017

Thanks, @ashawley. Since this requires a coordinated effort with sbt, I'm closing this for now to keep our PR queue in shape. We keep track of the issue at scala/scala-dev#291.

@lrytz lrytz closed this Feb 21, 2017
(unmanagedResourceDirectories in Compile in LocalProject("repl")).value
base ** ((includeFilter in unmanagedResources in Compile).value || "*.scala" || "*.psd" || "*.ai" || "*.java") pair relativeTo(base)
},
// Include the additional projects in the scaladoc JAR:
// Include the additional projects in the compiler JAR:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was correct the way it was btw, it means the jar of scaladocs of the compiler

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I see, now. You're right. I had misunderstood. Thanks for reviewing that.

@ashawley
Copy link
Member Author

I looked in to how sbt needed to be patched, but I didn't get far.

First, I tried to provide the separate scaladoc dependency to sbt's compiler interface. It failed because sbt is still compiling itself with 2.10

(compileInterfaceProj/*:update) sbt.ResolveException: unresolved dependency:
 org.scala-lang#scala-compiler-doc;2.10.6: not found

My naive attempt is ashawley/sbt@255b228

So that suggests fixing the scala-xml dependency with scala-compiler-doc in 2.13 would actually require a new 2.10 release with a separate scala-compiler-doc jar just for sbt. sbt would use that release of Scala 2.10 and the separate jar going forward.

In addition to making the separate jar, the new scala 2.10 release would still, for compatibility sake, provide a scala-compiler with the scala-compiler-doc code in it.

Will there be another 2.10 release of Scala to include this kind of a build change?

If there is, I can try to research making the 2.10 Ant build change and then look in to whether patching sbt is possible.

@dwijnand
Copy link
Member

I don't think there would be a need for a new release of 2.10/2.11. The compiler bridge is compiled at runtime of using sbt (you might've seen before "compiling the compiler-interface for scala 2.11.8..."). So the place to add scala-compiler-doc is somewhere in the vicinity of compile/ivy/src/main/scala/sbt/compiler/ComponentCompiler.scala.

See sbt/sbt@90a8423#diff-a1981f84fdd4c348d65e4a883adb3137

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants