mirror of https://github.com/apache/lucene.git
35 lines
987 B
Plaintext
35 lines
987 B
Plaintext
|
Forbidden API rules
|
||
|
===================
|
||
|
|
||
|
Uwe's excellent forbidden API checker is applied as part of 'check'
|
||
|
task. The rules for each project are sourced dynamically based on the
|
||
|
actual set of dependencies.
|
||
|
|
||
|
If a given project has a dependency on an artifact called "foo.bar:baz"
|
||
|
then all of these rule files will be applied (all paths relative
|
||
|
to: gradle/validation/forbidden-apis/).
|
||
|
|
||
|
defaults.all.txt
|
||
|
defaults.[project].txt
|
||
|
foo.bar.baz.all.txt
|
||
|
foo.bar.baz.[project].txt
|
||
|
|
||
|
Note that the "defaults" can't reference any JARs other than Java's
|
||
|
runtime.
|
||
|
|
||
|
Example
|
||
|
-------
|
||
|
|
||
|
We'd like to prevent people from using Guava's
|
||
|
com.google.common.base.Charsets class. The rule would be:
|
||
|
|
||
|
@defaultMessage Use java.nio.charset.StandardCharsets instead
|
||
|
com.google.common.base.Charsets
|
||
|
|
||
|
and we would place this rule in this file:
|
||
|
|
||
|
gradle/validation/forbidden-apis/com.google.guava.guava.all.txt
|
||
|
|
||
|
From now on, if *any* module depends on this library, it will
|
||
|
automatically pick up the rule and enforce it.
|