coursier / sbt-shading

Apache License 2.0
32 stars 10 forks source link

ShadingPlugin should not try to shade the src, and doc artifact #11

Closed adpi2 closed 1 year ago

adpi2 commented 1 year ago

In coursier/sbt-coursier, if I try to publish lm-coursier-shaded against a local version of coursier, it tries to shade the src and doc artifacts of coursier.

This is because the update report of sbt contains the src and doc artifacts of the dependencies resolved locally:

sbt:sbt-coursier-root> show lm-coursier-shaded / report
...
[info]          io.get-coursier:coursier-core_2.12:2.1.0-RC3-1-9a1d896f8-SNAPSHOT:compile: 
[info]                  (Artifact(coursier-core_2.12, jar, jar, None, Vector(), Some(file:/home/piquerez/.ivy2/local/io.get-coursier/coursier-core_2.12/2.1.0-RC3-1-9a1d896f8-SNAPSHOT/jars/coursier-core_2.12.jar), Map(), None, false),/home/piquerez/.ivy2/local/io.get-coursier/coursier-core_2.12/2.1.0-RC3-1-9a1d896f8-SNAPSHOT/jars/coursier-core_2.12.jar)
[info]                  (Artifact(coursier-core_2.12, src, jar, Some(sources), Vector(), Some(file:/home/piquerez/.ivy2/local/io.get-coursier/coursier-core_2.12/2.1.0-RC3-1-9a1d896f8-SNAPSHOT/srcs/coursier-core_2.12-sources.jar), Map(), None, false),/home/piquerez/.ivy2/local/io.get-coursier/coursier-core_2.12/2.1.0-RC3-1-9a1d896f8-SNAPSHOT/srcs/coursier-core_2.12-sources.jar)
[info]                  (Artifact(coursier-core_2.12, doc, jar, Some(javadoc), Vector(), Some(file:/home/piquerez/.ivy2/local/io.get-coursier/coursier-core_2.12/2.1.0-RC3-1-9a1d896f8-SNAPSHOT/docs/coursier-core_2.12-javadoc.jar), Map(), None, false),/home/piquerez/.ivy2/local/io.get-coursier/coursier-core_2.12/2.1.0-RC3-1-9a1d896f8-SNAPSHOT/docs/coursier-core_2.12-javadoc.jar)
...

And ShadingPlugin shades all the artifacts of a ModuleReport: https://github.com/coursier/sbt-shading/blob/c7998672f8cb75e9480fc541085ca41a5215beb5/src/main/scala/coursier/ShadingPlugin.scala#L191-L196

Should we filter on the artifacts whose type is jar?