Skip to content

Commit

Permalink
Merge pull request quarkusio#20401 from stuartwdouglas/gradle-failures
Browse files Browse the repository at this point in the history
Fix intermittent gradle failures
  • Loading branch information
stuartwdouglas authored Sep 27, 2021
2 parents 0eb23d0 + 874bc64 commit c3c9983
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,19 +242,19 @@ private void registerConditionalDependencies(Project project) {
Set<ExtensionDependency> implementationExtensions = conditionalDependenciesEnabler
.declareConditionalDependencies(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME);
deploymentClasspathBuilder.createBuildClasspath(implementationExtensions,
JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME, true);
JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME);
});
project.getConfigurations().getByName(DEV_MODE_CONFIGURATION_NAME).getIncoming().beforeResolve((devDependencies) -> {
Set<ExtensionDependency> devModeExtensions = conditionalDependenciesEnabler
.declareConditionalDependencies(DEV_MODE_CONFIGURATION_NAME);
deploymentClasspathBuilder.createBuildClasspath(devModeExtensions, DEV_MODE_CONFIGURATION_NAME, false);
deploymentClasspathBuilder.createBuildClasspath(devModeExtensions, DEV_MODE_CONFIGURATION_NAME);
});
project.getConfigurations().getByName(JavaPlugin.TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME).getIncoming()
.beforeResolve((testDependencies) -> {
Set<ExtensionDependency> testExtensions = conditionalDependenciesEnabler
.declareConditionalDependencies(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME);
deploymentClasspathBuilder.createBuildClasspath(testExtensions,
JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, false);
JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ApplicationDeploymentClasspathBuilder {
private static final String DEPLOYMENT_CONFIGURATION_SUFFIX = "Deployment";

private final Project project;
private final Set<ExtensionDependency> commonExtensions = new HashSet<>();
private final Set<ExtensionDependency> alreadyProcessed = new HashSet<>();

public ApplicationDeploymentClasspathBuilder(Project project) {
this.project = project;
Expand All @@ -22,19 +22,18 @@ public static String toDeploymentConfigurationName(String baseConfigurationName)
return baseConfigurationName + DEPLOYMENT_CONFIGURATION_SUFFIX;
}

public void createBuildClasspath(Set<ExtensionDependency> extensions, String baseConfigurationName, boolean common) {
public synchronized void createBuildClasspath(Set<ExtensionDependency> extensions, String baseConfigurationName) {
String deploymentConfigurationName = toDeploymentConfigurationName(baseConfigurationName);
project.getConfigurations().create(deploymentConfigurationName);

DependencyHandler dependencies = project.getDependencies();
for (ExtensionDependency extension : extensions) {
if (common) {
commonExtensions.add(extension);
} else if (commonExtensions.contains(extension)) {
requireDeploymentDependency(deploymentConfigurationName, extension, dependencies);
if (alreadyProcessed.contains(extension)) {
continue;
}
alreadyProcessed.add(extension);
extension.createDeploymentVariant(dependencies);
requireDeploymentDependency(deploymentConfigurationName, extension, dependencies);
}
}

Expand Down

0 comments on commit c3c9983

Please sign in to comment.