LUCENE-10306: set up module configurations to consume full JARs for test projects.

This commit is contained in:
Dawid Weiss 2021-12-10 14:15:39 +01:00
parent 328b3cc55f
commit 600d8345f8
1 changed files with 7 additions and 2 deletions

View File

@ -89,11 +89,16 @@ allprojects {
Configuration conventionConfiguration = configurations.maybeCreate(configurationName)
Configuration moduleConfiguration = configurations.maybeCreate(
moduleConfigurationNameFor(conventionConfiguration.name))
// Make these configurations resolvable, prefer classes folder over JARs.
moduleConfiguration.canBeConsumed(false)
moduleConfiguration.canBeResolved(true)
moduleConfiguration.attributes {
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements, LibraryElements.CLASSES))
// Prefer class folders over JARs. The exception is made for tests projects which require a composition
// of classes and resources, otherwise split into two folders.
if (project.name.endsWith(".tests")) {
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements, LibraryElements.JAR))
} else {
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, objects.named(LibraryElements, LibraryElements.CLASSES))
}
}
project.logger.info("Created resolvable module configuration for '${conventionConfiguration.name}': ${moduleConfiguration.name}")