use of org.gradle.api.distribution.internal.DefaultDistributionContainer in project gradle by gradle.
the class JavaLibraryDistributionPlugin method apply.
@Override
public void apply(final ProjectInternal project) {
this.project = project;
project.getPluginManager().apply(JavaPlugin.class);
project.getPluginManager().apply(DistributionPlugin.class);
DefaultDistributionContainer defaultDistributionContainer = (DefaultDistributionContainer) project.getExtensions().findByName("distributions");
CopySpec contentSpec = defaultDistributionContainer.getByName(DistributionPlugin.MAIN_DISTRIBUTION_NAME).getContents();
Jar jar = (Jar) project.getTasks().getByName(JavaPlugin.JAR_TASK_NAME);
CopySpec childSpec = project.copySpec();
childSpec.from(jar);
childSpec.from(project.file("src/dist"));
CopySpec libSpec = project.copySpec();
libSpec.into("lib");
libSpec.from(project.getConfigurations().getByName("runtime"));
childSpec.with(libSpec);
contentSpec.with(childSpec);
}
Aggregations