scala-cli icon indicating copy to clipboard operation
scala-cli copied to clipboard

Add support for compile-only dependencies (aka "provided" dependencies)

Open alexarchambault opened this issue 2 years ago • 1 comments

We should allow users to add "compile-only" dependencies, added to the class path only at compile-time:

//> using compile-library "com.github.plokhotnyuk.jsoniter-scala::jsoniter-scala-macros:2.13.8"

There's already some support for compile-only class path internally (see Artifacts.compileClassPath). It should be a matter of adding JARs coming from dependency resolution there.

Implementation-wise, note that we should probably run two dependency resolutions when users add compile-only dependencies: one compile resolution with both compile-only and standard dependencies, and a second one with just standard dependencies.

alexarchambault avatar Mar 29 '22 10:03 alexarchambault

Hey, upon reviewing documents and online discussions, I ended up here. Just as described above, I needed to use this to add jsoniter-scala's compile-time macros. It's not the only example requiring "compile-internal" or "provided" scopes. This functionality is greatly needed.

baldram avatar Aug 18 '22 21:08 baldram

Maybe just using provided at the end as that is the term and syntax used now for dependencies?

ekrich avatar Feb 10 '23 15:02 ekrich

+1 to this feature. Also I like the proposed more mill syntax than SBT's provided syntax. Maybe compileLib and compile-lib for consistency.

Thanks

joan38 avatar Feb 10 '23 15:02 joan38