Allow customizing defaultConfMapping in InlineConfiguration #30
+24
−16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The defaultConfMapping in ivy is currently hard-coded to
*->default(compile)
. This works well for most purposes, but I have a use case where it falls short.Say I want to have a flag that, when enabled, requires users to list all their
compile
dependencies explicitly. Everything they depend on + their transitive dependencies will end up in theruntime
scope, butcompile
will only contain packages explicitly listed as dependencies.This is what some call the include-what-you-use principle, and it's useful to prevent you from using code from a transitive dependency B, in case your dependency A that depended on B stops depending on B later on, and subsequently causes your code to not compile anymore, even though you haven't made any changes to it.
Let's say I build all my packages to export an
only-me
configuration, that contains only the artifacts published, but no dependencies. Now, when I activate this flag, it would be a pain to have to change all the dependencies in that project fromcompile
to
compile->only-me(default)
.But if we can modify the
defaultConfMapping
, we'd just set that to*->only-me(default)
, and this would do what you want without having to parse the configuration mapping of each dependency and mangle it programmatically.