Merge pull request #19620 from vpavic

* gh-19620:
  Reuse optional configuration name constant

Closes gh-19620
pull/19621/head
Andy Wilkinson 5 years ago
commit 88f7f8cca0

@ -44,7 +44,7 @@ public class OptionalDependenciesPlugin implements Plugin<Project> {
@Override @Override
public void apply(Project project) { public void apply(Project project) {
Configuration optional = project.getConfigurations().create("optional"); Configuration optional = project.getConfigurations().create(OPTIONAL_CONFIGURATION_NAME);
optional.attributes((attributes) -> attributes.attribute(Usage.USAGE_ATTRIBUTE, optional.attributes((attributes) -> attributes.attribute(Usage.USAGE_ATTRIBUTE,
project.getObjects().named(Usage.class, Usage.JAVA_RUNTIME))); project.getObjects().named(Usage.class, Usage.JAVA_RUNTIME)));
project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> { project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> {

@ -57,7 +57,7 @@ public class OptionalDependenciesPluginIntegrationTests {
out.println("}"); out.println("}");
} }
BuildResult buildResult = runGradle("printConfigurations"); BuildResult buildResult = runGradle("printConfigurations");
assertThat(buildResult.getOutput()).contains("optional"); assertThat(buildResult.getOutput()).contains(OptionalDependenciesPlugin.OPTIONAL_CONFIGURATION_NAME);
} }
@Test @Test

Loading…
Cancel
Save