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

Refactor forAllProjects to use ScopeFilter #62

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

eed3si9n
Copy link
Collaborator

sbt has a built-in way of aggregating tasks over multiple projects. See ScopeFilter. This is also safer than evaluating tasks off-state.

sbt has a built-in way of aggregating tasks over multiple projects. See [ScopeFilter](https://www.scala-sbt.org/1.x/docs/Tasks.html#Getting+values+from+multiple+scopes). This is also safer than evaluating tasks off-state.
@alexarchambault
Copy link
Member

I have no idea what the issue is with sbt-shading… Seems something must have changed in the scaladoc-related settings, but I'm unsure what…

@alexarchambault
Copy link
Member

@eed3si9n If that can help, I think I ran into a similar issue with sbt-contraband + sbt-shading, from the coursier sources, with just scaladoc generation failing too (because of missing sources rather than missing dependencies). Can be reproduced from the coursier sources with

$ git checkout 65b3a613
$ sbt coreJVM/publishLocal
[error] /Users/alexandre/projects/coursier/modules/core/jvm/src/main/scala/coursier/internal/CredentialFileHelpers.scala:6:8: object Credentials is not a member of package coursier
[error] import coursier.Credentials
[error]        ^
[error] /Users/alexandre/projects/coursier/modules/core/jvm/src/main/scala/coursier/internal/CredentialFileHelpers.scala:15:19: not found: type Credentials
[error]   def read(): Seq[Credentials] = {
[error]                   ^
[error] /Users/alexandre/projects/coursier/modules/core/jvm/src/main/scala/coursier/internal/CredentialFileHelpers.scala:52:9: not found: value Credentials
[error]         Credentials(host, user, password)
[error]         ^
[error] /Users/alexandre/projects/coursier/modules/core/jvm/src/main/scala/coursier/parse/CredentialsParser.scala:4:8: object Credentials is not a member of package coursier
[error] import coursier.Credentials
[error]        ^
[error] /Users/alexandre/projects/coursier/modules/core/jvm/src/main/scala/coursier/parse/CredentialsParser.scala:9:31: not found: type Credentials
[error]   private def parser[_: P]: P[Credentials] = {
[error]                               ^
[error] /Users/alexandre/projects/coursier/modules/core/jvm/src/main/scala/coursier/parse/CredentialsParser.scala:21:9: not found: value Credentials
[error]         Credentials(host0, user0, password0)
[error]         ^
[error] /Users/alexandre/projects/coursier/modules/core/jvm/src/main/scala/coursier/parse/CredentialsParser.scala:26:40: not found: type Credentials
[error]   def parse(s: String): Either[String, Credentials] =
[error]                                        ^
[error] /Users/alexandre/projects/coursier/modules/core/jvm/src/main/scala/coursier/parse/CredentialsParser.scala:34:51: not found: type Credentials
[error]   def parseSeq(input: String): Either[String, Seq[Credentials]] =
[error]                                                   ^
[info] No documentation generated with unsuccessful compiler run
[warn] one warning found
[error] 8 errors found
[info] Done compiling.
[info] Compiling 12 Scala sources to /Users/alexandre/projects/coursier/modules/core/jvm/target/scala-2.12/classes ...
[info] Done compiling.
[info] Packaging /Users/alexandre/projects/coursier/modules/core/jvm/target/scala-2.12/coursier-core_2.12-1.1.0-M13-2+34-65b3a613+20190503-1143-SNAPSHOT.jar ...
[info] Done packaging.
[error] (coreJVM / Shading / doc) Scaladoc generation failed
[error] Total time: 12 s, completed …

@alexarchambault
Copy link
Member

alexarchambault commented May 3, 2019

If that's really a blocker, I could try to replace sbt-shading with sbt-assembly here or there, and stop publishing sbt-shading. It's used in the coursier and sbt-coursier repositories, to shade fastparse in coursier, and coursier in lm-coursier in particular.

@eed3si9n
Copy link
Collaborator Author

eed3si9n commented May 3, 2019

[info] [info] Main Scala API documentation to /tmp/sbt_21663949/transitive-shading/target/api...
[info] [info] Found 1451 class(es) in JAR(s) to be shaded
[info] [error] /tmp/sbt_21663949/transitive-shading/src/main/scala/Main.scala:4:8: not found: object argonaut
[info] [error] import argonaut._
[info] [error]        ^
[info] [error] /tmp/sbt_21663949/transitive-shading/src/main/scala/Main.scala:16:27: not found: type Json
[info] [error]   val className = classOf[Json].getName
[info] [error]                           ^
[info] [error] /tmp/sbt_21663949/transitive-shading/src/main/scala/Main.scala:24:13: not found: value Json
[info] [error]   val msg = Json.obj().nospaces
[info] [error]             ^
[info] [info] No documentation generated with unsuccessful compiler run
[info] [error] three errors found
[info] [error] (shading:doc) Scaladoc generation failed
[info] [error] Total time: 23 s, completed Apr 30, 2019 6:13:21 AM
[error] x sbt-shading / transitive-shading 
[error]  Cause of test exception: {line 7}  Command failed: shading:publishLocal failed

I am not familiar with your method of shading, but Jar Jar Links used by sbt-assembly doesn't handle Scala pickles, so shading only works for leaf application which gets consumed by java, but it won't works for libraries that needs to be consumed by scalac.

@alexarchambault
Copy link
Member

It's the same with sbt-shading, the scala annotations are not changed either. The main point of sbt-shading is that it is given dependencies to shade, and shades those and their transitive dependencies that aren't brought by any other (non shaded) dependency. It also adjusts libraryDependencies in its Shading configuration, so that shading:publish publishes things where the shaded dependencies don't appear (no manual step to remove shaded dependencies from POMs in particular).

@eed3si9n
Copy link
Collaborator Author

eed3si9n commented May 3, 2019

I wonder if you can fake the doc result by passing in the JAR created by non-shaded version.

 Conflicts:
	modules/sbt-coursier-shared/src/main/scala/coursier/sbtcoursiershared/InputsTasks.scala
	modules/sbt-coursier/src/main/scala/coursier/sbtcoursier/InputsTasks.scala
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants