Skip to content

Conversation

@Duhemm
Copy link
Contributor

@Duhemm Duhemm commented Aug 16, 2018

Fix #4965.

@Duhemm
Copy link
Contributor Author

Duhemm commented Aug 16, 2018

This is only about supporting running doc from source in sbt, it doesn't work with the doc from TASTY yet.

dependencyResolution.update(descriptor, updateConfiguration, warningConfiguration, log) match {
case Left(uw) =>
throw new MessageOnlyException(
s"Couldn't retrieve `${scalaOrganization.value} %% $moduleName %% {scalaVersion.value}`.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing $ before {scalaVersion.value}?

> run
> doc
> 'set initialCommands := "1 + 1" '
# FIXME: does not work on the CI
Copy link
Contributor

Choose a reason for hiding this comment

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

What's preventing this from being run on the CI? It would be nice to also check that this generates what it's supposed to.

Copy link
Contributor

Choose a reason for hiding this comment

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

The REPL doesn't work in the CI. JLine doesn't work outside of a "real terminal"

Copy link
Contributor

Choose a reason for hiding this comment

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

There might be a way via some JLine option to support dumb or virtual terminals
(https://github.com/jline/jline3/wiki/Terminals) or sth. else... do we have an issue to investigate?

Copy link
Contributor

Choose a reason for hiding this comment

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

By default JLine spawns a "dumb" terminal if not able to create a terminal. But you can't do anything with it, not sure we can even use it for test purpose. So i disabled it:
https://github.com/lampepfl/dotty/blob/0d7826c8a77bfa0da727ac21213475739faa9428/compiler/src/dotty/tools/repl/JLineTerminal.scala#L21

Blaisorblade added a commit to dotty-staging/dotty that referenced this pull request Aug 25, 2018
Blaisorblade added a commit to dotty-staging/dotty that referenced this pull request Aug 25, 2018
@allanrenucci allanrenucci self-assigned this Sep 3, 2018
compilerJar = jars.find(_.getName.startsWith("dotty-compiler_2.12")).get
}

// All compiler dependencies except the library
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment needs to be updated?

.map(_.data)
val otherDependencies = {
val excluded = Set("dotty-library", "dotty-compiler")
fullClasspath.in(`dotty-doc`, Compile).value
Copy link
Contributor

Choose a reason for hiding this comment

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

We're still interested in the compiler dependencies. Does this work because dotty-doc depends on dotty-compiler? Maybe add a comment

@@ -1,4 +1,5 @@
> run
> doc
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not run on PRs. Did you run it locally? I'll take your words for it 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Works fine on my machine at least.

}
},

scalaInstance := Def.taskDyn {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this a taskDyn? Is it to only evaluate fetchArtifactsOf if isDotty is true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

import sbt.Keys._
import sbt.librarymanagement.DependencyResolution
import sbt.internal.inc.ScalaInstance
// import sbt.inc.{ ClassfileManager, IncOptions }
Copy link
Contributor

@allanrenucci allanrenucci Sep 3, 2018

Choose a reason for hiding this comment

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

Can you remove this while you're at it

)
}

private def fetchArtifactsOf(moduleName: String) = Def.task {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment:

/** Fetch artefacts for scalaOrganization.value %% moduleName % scalaVersion.value */

@Duhemm Duhemm force-pushed the topic/sbt-support-dottydoc branch from 17db5ac to d52071f Compare September 4, 2018 08:39
Copy link
Contributor

@allanrenucci allanrenucci left a comment

Choose a reason for hiding this comment

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

LGTM. Please squash your commits

val descriptor = dependencyResolution.wrapDependencyInModule(moduleID, scalaInfo)

dependencyResolution.update(descriptor, updateConfiguration, warningConfiguration, log) match {
case Left(uw) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: since uw is unused I would rewrite as:

... match {
  case Right(report) =>
    report.allFiles
  case _ =>
    throw new MessageOnlyException(...

@Duhemm Duhemm force-pushed the topic/sbt-support-dottydoc branch from d52071f to 288d9b4 Compare September 4, 2018 13:34
@Duhemm Duhemm merged commit fe99358 into scala:master Sep 4, 2018
@Duhemm Duhemm deleted the topic/sbt-support-dottydoc branch September 4, 2018 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants