Reputation: 21644
In an ivy dependency,
Q1. What is the difference between
conf="runtime->compile"
vs
conf="runtime->compile(*)"
What does the extra bracketed wildcard do?
Q2.
What does the following do?
conf="compile->compile(*)"
Isn't it a cyclical/self dependency? What is the point of mapping a conf back to itself?
Upvotes: 4
Views: 1108
Reputation: 18704
The brackets are a fallback:
since 1.3 a fallback mechanism can be used when you are not sure that the dependency will have the required conf. You can indicate to ivy that you want one configuration, but if it isn't present, use another one. The syntax for specifying this adds the fallback conf between parenthesis right after the required conf. For instance,
test->runtime(default)
means that in thetest
configuration of the module the
runtime
conf of the dependency is required, but if doesn't exist, it will use the
default
conf instead. If default conf doesn't exist then it will be considered as an error. Note that the * wildcard can be used as fallback conf.
For Question2: a conf is always read like:
ConfFromThisFile -> ConfFromDependency
So
compile->compile
will map the compile
configuration of the dependency to the compile
configuration of this file. It is no cycle. The bracket says: If compile
does not exist in the dependency then use *
.
See the Configuration Mapping Section of the ivy documentation for dependencies.
Upvotes: 3
Reputation: 6229
This syntax is for dependency fallback. runtime->compile
means that the runtime configuration depends on the compile config. The compile config must be present or Ivy will report an error. However, runtime->compile(*)
will try the compile configuration first to satisfy dependencies. But if compile doesn't exist, it will try all the other configurations. See the Configurations mapping section of the Ivy docs for more info.
Based on that, compile->compile(*)
would indicate that compile needs any (all?) configurations. I am guessing that compile->(*)
isn't valid syntax so the extra compile
guarantees the fallback is used since compile
isn't defined until after the configuration XML stanza is complete.
Note that it's not clear from the documentation if (*)
means 'any' or 'all' configurations. So, I am not sure if Ivy will stop at the first configuration that matches all dependencies (if there is one) or if it brings in all the other configurations in a union.
Upvotes: 1