HHH-6937 - Process database profiles just once per build
This commit is contained in:
parent
76a3ad2021
commit
959e048fd0
|
@ -75,7 +75,7 @@ public class DatabaseProfilePlugin implements Plugin<Project> {
|
|||
}
|
||||
|
||||
private void processStandardProfiles(Map<String, DatabaseProfile> profileMap) {
|
||||
final File standardDatabasesDirectory = getRootProject( project ).file( STANDARD_DATABASES_DIRECTORY );
|
||||
final File standardDatabasesDirectory = project.file( STANDARD_DATABASES_DIRECTORY );
|
||||
if ( standardDatabasesDirectory == null || ! standardDatabasesDirectory.exists() ) {
|
||||
log.debug( "Standard databases directory [{}] did not exist", STANDARD_DATABASES_DIRECTORY );
|
||||
return;
|
||||
|
@ -89,10 +89,6 @@ public class DatabaseProfilePlugin implements Plugin<Project> {
|
|||
processProfiles( standardDatabasesDirectory, profileMap );
|
||||
}
|
||||
|
||||
private Project getRootProject(Project project) {
|
||||
return project.getParent() != null ? getRootProject( project.getParent() ) : project;
|
||||
}
|
||||
|
||||
private void processProfiles(File directory, Map<String, DatabaseProfile> profileMap) {
|
||||
// the directory itself is a "database directory" if it contains either:
|
||||
// 1) a file named 'matrix.gradle'
|
||||
|
@ -124,11 +120,15 @@ public class DatabaseProfilePlugin implements Plugin<Project> {
|
|||
return;
|
||||
}
|
||||
|
||||
if ( profileMap.containsKey( databaseProfile.getName() ) ) {
|
||||
throw new DuplicateDatabaseProfileException( "There is already a profile named " + profileName );
|
||||
DatabaseProfile previousEntry = profileMap.put( profileName, databaseProfile );
|
||||
if ( previousEntry != null ) {
|
||||
log.lifecycle(
|
||||
"Found duplicate profile definitions [name={}], [{}] taking precedence over [{}]",
|
||||
profileName,
|
||||
databaseProfile.getDirectory().getAbsolutePath(),
|
||||
previousEntry.getDirectory().getAbsolutePath()
|
||||
);
|
||||
}
|
||||
|
||||
profileMap.put( profileName, databaseProfile );
|
||||
}
|
||||
|
||||
private Set<String> ignored;
|
||||
|
|
|
@ -71,7 +71,7 @@ public class MatrixTestingPlugin implements Plugin<Project> {
|
|||
public void apply(Project project) {
|
||||
this.project = project;
|
||||
|
||||
project.plugins.apply( DatabaseProfilePlugin );
|
||||
project.rootProject.plugins.apply( DatabaseProfilePlugin );
|
||||
List<MatrixNode> matrixNodes = locateMatrixNodes();
|
||||
if ( matrixNodes == null || matrixNodes.isEmpty() ) {
|
||||
// no db profiles defined
|
||||
|
|
Loading…
Reference in New Issue