bazel-deps icon indicating copy to clipboard operation
bazel-deps copied to clipboard

Questions: scala/unmangled and options meaning

Open jmendiara opened this issue 6 years ago • 4 comments

First of all, I'm pretty new to scala and bazel, and maybe those questions seems obvious, but by reading the readme, I dont get the point about scala/unmangled ¯_(ツ)_/¯

Language is always required and may be one of java, scala, scala/unmangled

later on dependencies.yml

replacements:
  org.scala-lang:
    scala-library:
      lang: scala/unmangled # scala-library is not mangled like sbt does with other jars

What does it mean scala/unmangled and what are the differences with scala?

I understand the examples about replacements but i miss something about unmangled


In https://github.com/johnynek/bazel-deps#options you say

languages: java and scala

But setting scala as options does not work. in your dependencies.yml there is scala:2.11.8 https://github.com/johnynek/bazel-deps/blob/master/dependencies.yaml#L3

What is the purpose of languages option what does it do?

transitivity: runtime_deps or exports

What are the differences between transitivity values?

Thanks guys, this project simplifies a lot the bazel usage!

jmendiara avatar Jun 18 '18 21:06 jmendiara

scala users typically suffix the scala major and minor version to their jar before publishing to maven:

e.g. https://mvnrepository.com/artifact/org.typelevel/cats-core_2.12/1.1.0 note that _2.12 is appended to the artifact id.

Not all scala libraries do this, notably, the scala-library does not do this since it is kind of special and would be redundant with the version.

The only time scala/unmangled would thus be useful is for scala artifacts potentially published from mvn without the scala versioning mangling, or for standard library artifacts that don't follow this pattern.

transitivity is a detail about bazel: runtime_deps means all the transitive dependencies is placed as a runtime only dependency of your code. This forces targets that depend on a particular jar to also add the transitive deps you need if you access it at compile time. This is in contrast to tools like mvn or sbt which put the full transitive path on the compile time classpath. If you prefer to work similar to mvn or sbt (which will tend to make your build less precise and cause you issues when upstream dependencies change), you can use exports for transitivity, meaning that transitive deps are put on the compile time classpath.

johnynek avatar Jun 19 '18 00:06 johnynek

Does this help?

If so, could you send a PR to reword and improve the README so we can help the next person have a clearer picture?

johnynek avatar Jun 19 '18 00:06 johnynek

Nice explanation! I'll try to clarify this in the newbies README.

One last clarification... I tried scala:2.12 in options.languages. I guess this is used for building scala artifacts ids when downloading deps from repos. Is this correct?

jmendiara avatar Jun 19 '18 07:06 jmendiara

@jmendiara yes that should work. Open an issue if not.

johnynek avatar Jun 21 '18 16:06 johnynek