Build: Fix dependency licenses check to correctly skip projects without dependencies
This commit is contained in:
parent
3d8c32008e
commit
f8026ed8fd
|
@ -106,16 +106,15 @@ public class DependencyLicensesTask extends DefaultTask {
|
|||
|
||||
@TaskAction
|
||||
public void checkDependencies() {
|
||||
// TODO REMOVE THIS DIRTY FIX FOR #15168
|
||||
if (licensesDir.exists() == false) {
|
||||
return
|
||||
}
|
||||
if (licensesDir.exists() == false && dependencies.isEmpty() == false) {
|
||||
if (dependencies.isEmpty()) {
|
||||
if (licensesDir.exists()) {
|
||||
throw new GradleException("Licenses dir ${licensesDir} exists, but there are no dependencies")
|
||||
}
|
||||
return // no dependencies to check
|
||||
} else if (licensesDir.exists() == false) {
|
||||
throw new GradleException("Licences dir ${licensesDir} does not exist, but there are dependencies")
|
||||
}
|
||||
if (licensesDir.exists() && dependencies.isEmpty()) {
|
||||
throw new GradleException("Licenses dir ${licensesDir} exists, but there are no dependencies")
|
||||
}
|
||||
|
||||
|
||||
// order is the same for keys and values iteration since we use a linked hashmap
|
||||
List<String> mapped = new ArrayList<>(mappings.values())
|
||||
|
|
|
@ -43,3 +43,7 @@ forbiddenApisMain {
|
|||
signaturesURLs = [PrecommitTasks.getResource('/forbidden/all-signatures.txt'),
|
||||
PrecommitTasks.getResource('/forbidden/test-signatures.txt')]
|
||||
}
|
||||
|
||||
// TODO: should we have licenses for our test deps?
|
||||
dependencyLicenses.enabled = false
|
||||
|
||||
|
|
Loading…
Reference in New Issue