Clone
Stefan Oehme
committed
on 12 Jan 17
Simplify IDEA scope mapping
The old scope mapping code was hardcoded, hard to understand and exploded in complexity
each time we added a new… Show more
Simplify IDEA scope mapping

The old scope mapping code was hardcoded, hard to understand and exploded in complexity

each time we added a new configuration to the Java plugin. It was doing this hardcoded

mapping in an attempt to minimize the number of dependency declarations in IDEA, e.g.

remove `testRuntime` dependencies from the `TEST` scope if they were already in the `RUNTIME`

scope and not present in `testCompile`. While this slightly reduces the number of false positives

in auto completion, it is hard to follow, as IDEA itself simply does not differentiate between

"test compilation" and "test runtime".

The new implementation accepts IDEA's dependency model and does the simples possible mapping to it:

- no hardcoded mapping rules for the Java plugin

- users can put dependencies into the 4 IDEA scopes (`COMPILE`,`PROVIDED`,`RUNTIME`, `TEST`)

- the IdeaPlugin uses the same API for adding dependencies that the user would use

- those scopes are not postprocessed in any way

The default mapping for the Java plugin is simplified to:

- `COMPILE` is empty

- `PROVIDED` = `compileClasspath`

- `RUNTIME` = `runtimeClasspath`

- `TEST`= `testCompileClasspath + testRuntimeClasspath`

The benefit of this mapping is that we no longer use `minus` configurations, which we might want

to deprecate/remove as well.

Show less

master + 513 more