use of org.gradle.internal.deprecation.DeprecatableConfiguration in project gradle by gradle.
the class AbstractCodeQualityPlugin method createConfigurations.
protected void createConfigurations() {
Configuration configuration = project.getConfigurations().create(getConfigurationName());
configuration.setVisible(false);
configuration.setTransitive(true);
configuration.setDescription("The " + getToolName() + " libraries to be used for this project.");
((DeprecatableConfiguration) configuration).deprecateForConsumption(deprecation -> deprecation.willBecomeAnErrorInGradle8().withUpgradeGuideSection(7, "plugin_configuration_consumption"));
// Don't need these things, they're provided by the runtime
configuration.exclude(excludeProperties("ant", "ant"));
configuration.exclude(excludeProperties("org.apache.ant", "ant"));
configuration.exclude(excludeProperties("org.apache.ant", "ant-launcher"));
configuration.exclude(excludeProperties("org.slf4j", "slf4j-api"));
configuration.exclude(excludeProperties("org.slf4j", "jcl-over-slf4j"));
configuration.exclude(excludeProperties("org.slf4j", "log4j-over-slf4j"));
configuration.exclude(excludeProperties("commons-logging", "commons-logging"));
configuration.exclude(excludeProperties("log4j", "log4j"));
configureConfiguration(configuration);
}
use of org.gradle.internal.deprecation.DeprecatableConfiguration in project gradle by gradle.
the class JavaPlugin method configureConfigurations.
private void configureConfigurations(Project project, JavaPluginExtension extension, SourceSet mainSourceSet) {
ConfigurationContainer configurations = project.getConfigurations();
Configuration defaultConfiguration = configurations.getByName(Dependency.DEFAULT_CONFIGURATION);
Configuration implementationConfiguration = configurations.getByName(IMPLEMENTATION_CONFIGURATION_NAME);
Configuration runtimeOnlyConfiguration = configurations.getByName(RUNTIME_ONLY_CONFIGURATION_NAME);
Configuration testImplementationConfiguration = configurations.getByName(TEST_IMPLEMENTATION_CONFIGURATION_NAME);
Configuration testRuntimeOnlyConfiguration = configurations.getByName(TEST_RUNTIME_ONLY_CONFIGURATION_NAME);
testImplementationConfiguration.extendsFrom(implementationConfiguration);
testRuntimeOnlyConfiguration.extendsFrom(runtimeOnlyConfiguration);
final DeprecatableConfiguration apiElementsConfiguration = (DeprecatableConfiguration) jvmServices.createOutgoingElements(API_ELEMENTS_CONFIGURATION_NAME, builder -> builder.fromSourceSet(mainSourceSet).providesApi().withDescription("API elements for main."));
final DeprecatableConfiguration runtimeElementsConfiguration = (DeprecatableConfiguration) jvmServices.createOutgoingElements(RUNTIME_ELEMENTS_CONFIGURATION_NAME, builder -> builder.fromSourceSet(mainSourceSet).providesRuntime().withDescription("Elements of runtime for main.").extendsFrom(implementationConfiguration, runtimeOnlyConfiguration));
defaultConfiguration.extendsFrom(runtimeElementsConfiguration);
apiElementsConfiguration.deprecateForDeclaration(IMPLEMENTATION_CONFIGURATION_NAME, COMPILE_ONLY_CONFIGURATION_NAME);
runtimeElementsConfiguration.deprecateForDeclaration(IMPLEMENTATION_CONFIGURATION_NAME, COMPILE_ONLY_CONFIGURATION_NAME, RUNTIME_ONLY_CONFIGURATION_NAME);
createSourcesVariant(project, extension, mainSourceSet);
}
use of org.gradle.internal.deprecation.DeprecatableConfiguration in project gradle by gradle.
the class BasePlugin method configureConfigurations.
private void configureConfigurations(final Project project) {
ConfigurationContainer configurations = project.getConfigurations();
((ProjectInternal) project).getInternalStatus().convention("integration");
final DeprecatableConfiguration archivesConfiguration = (DeprecatableConfiguration) configurations.maybeCreate(Dependency.ARCHIVES_CONFIGURATION).setDescription("Configuration for archive artifacts.");
final DeprecatableConfiguration defaultConfiguration = (DeprecatableConfiguration) configurations.maybeCreate(Dependency.DEFAULT_CONFIGURATION).setDescription("Configuration for default artifacts.");
final DefaultArtifactPublicationSet defaultArtifacts = project.getExtensions().create("defaultArtifacts", DefaultArtifactPublicationSet.class, archivesConfiguration.getArtifacts());
archivesConfiguration.deprecateForResolution(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME, JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME);
defaultConfiguration.deprecateForResolution(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME, JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME);
archivesConfiguration.deprecateForDeclaration(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME, JavaPlugin.API_CONFIGURATION_NAME);
defaultConfiguration.deprecateForDeclaration(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME, JavaPlugin.API_CONFIGURATION_NAME);
configurations.all(configuration -> {
if (!configuration.equals(archivesConfiguration)) {
configuration.getArtifacts().configureEach(artifact -> {
if (configuration.isVisible()) {
defaultArtifacts.addCandidate(artifact);
}
});
}
});
}
use of org.gradle.internal.deprecation.DeprecatableConfiguration in project gradle by gradle.
the class JavaBasePlugin method defineConfigurationsForSourceSet.
private void defineConfigurationsForSourceSet(SourceSet sourceSet, ConfigurationContainer configurations) {
String implementationConfigurationName = sourceSet.getImplementationConfigurationName();
String runtimeOnlyConfigurationName = sourceSet.getRuntimeOnlyConfigurationName();
String compileOnlyConfigurationName = sourceSet.getCompileOnlyConfigurationName();
String compileClasspathConfigurationName = sourceSet.getCompileClasspathConfigurationName();
String annotationProcessorConfigurationName = sourceSet.getAnnotationProcessorConfigurationName();
String runtimeClasspathConfigurationName = sourceSet.getRuntimeClasspathConfigurationName();
String sourceSetName = sourceSet.toString();
Configuration implementationConfiguration = configurations.maybeCreate(implementationConfigurationName);
implementationConfiguration.setVisible(false);
implementationConfiguration.setDescription("Implementation only dependencies for " + sourceSetName + ".");
implementationConfiguration.setCanBeConsumed(false);
implementationConfiguration.setCanBeResolved(false);
DeprecatableConfiguration compileOnlyConfiguration = (DeprecatableConfiguration) configurations.maybeCreate(compileOnlyConfigurationName);
compileOnlyConfiguration.setVisible(false);
compileOnlyConfiguration.setCanBeConsumed(false);
compileOnlyConfiguration.setCanBeResolved(false);
compileOnlyConfiguration.setDescription("Compile only dependencies for " + sourceSetName + ".");
ConfigurationInternal compileClasspathConfiguration = (ConfigurationInternal) configurations.maybeCreate(compileClasspathConfigurationName);
compileClasspathConfiguration.setVisible(false);
compileClasspathConfiguration.extendsFrom(compileOnlyConfiguration, implementationConfiguration);
compileClasspathConfiguration.setDescription("Compile classpath for " + sourceSetName + ".");
compileClasspathConfiguration.setCanBeConsumed(false);
jvmPluginServices.configureAsCompileClasspath(compileClasspathConfiguration);
ConfigurationInternal annotationProcessorConfiguration = (ConfigurationInternal) configurations.maybeCreate(annotationProcessorConfigurationName);
annotationProcessorConfiguration.setVisible(false);
annotationProcessorConfiguration.setDescription("Annotation processors and their dependencies for " + sourceSetName + ".");
annotationProcessorConfiguration.setCanBeConsumed(false);
annotationProcessorConfiguration.setCanBeResolved(true);
jvmPluginServices.configureAsRuntimeClasspath(annotationProcessorConfiguration);
Configuration runtimeOnlyConfiguration = configurations.maybeCreate(runtimeOnlyConfigurationName);
runtimeOnlyConfiguration.setVisible(false);
runtimeOnlyConfiguration.setCanBeConsumed(false);
runtimeOnlyConfiguration.setCanBeResolved(false);
runtimeOnlyConfiguration.setDescription("Runtime only dependencies for " + sourceSetName + ".");
ConfigurationInternal runtimeClasspathConfiguration = (ConfigurationInternal) configurations.maybeCreate(runtimeClasspathConfigurationName);
runtimeClasspathConfiguration.setVisible(false);
runtimeClasspathConfiguration.setCanBeConsumed(false);
runtimeClasspathConfiguration.setCanBeResolved(true);
runtimeClasspathConfiguration.setDescription("Runtime classpath of " + sourceSetName + ".");
runtimeClasspathConfiguration.extendsFrom(runtimeOnlyConfiguration, implementationConfiguration);
jvmPluginServices.configureAsRuntimeClasspath(runtimeClasspathConfiguration);
sourceSet.setCompileClasspath(compileClasspathConfiguration);
sourceSet.setRuntimeClasspath(sourceSet.getOutput().plus(runtimeClasspathConfiguration));
sourceSet.setAnnotationProcessorPath(annotationProcessorConfiguration);
compileClasspathConfiguration.deprecateForDeclaration(implementationConfigurationName, compileOnlyConfigurationName);
runtimeClasspathConfiguration.deprecateForDeclaration(implementationConfigurationName, compileOnlyConfigurationName, runtimeOnlyConfigurationName);
}
use of org.gradle.internal.deprecation.DeprecatableConfiguration in project gradle by gradle.
the class JavaLibraryPlugin method deprecateConfigurationsForDeclaration.
private void deprecateConfigurationsForDeclaration(SourceSetContainer sourceSets, ConfigurationContainer configurations) {
SourceSet sourceSet = sourceSets.getByName("main");
DeprecatableConfiguration apiElementsConfiguration = (DeprecatableConfiguration) configurations.getByName(sourceSet.getApiElementsConfigurationName());
DeprecatableConfiguration runtimeElementsConfiguration = (DeprecatableConfiguration) configurations.getByName(sourceSet.getRuntimeElementsConfigurationName());
DeprecatableConfiguration compileClasspathConfiguration = (DeprecatableConfiguration) configurations.getByName(sourceSet.getCompileClasspathConfigurationName());
DeprecatableConfiguration runtimeClasspathConfiguration = (DeprecatableConfiguration) configurations.getByName(sourceSet.getRuntimeClasspathConfigurationName());
String implementationConfigurationName = sourceSet.getImplementationConfigurationName();
String compileOnlyConfigurationName = sourceSet.getCompileOnlyConfigurationName();
String runtimeOnlyConfigurationName = sourceSet.getRuntimeOnlyConfigurationName();
String apiConfigurationName = sourceSet.getApiConfigurationName();
apiElementsConfiguration.deprecateForDeclaration(implementationConfigurationName, apiConfigurationName, compileOnlyConfigurationName);
runtimeElementsConfiguration.deprecateForDeclaration(implementationConfigurationName, apiConfigurationName, compileOnlyConfigurationName, runtimeOnlyConfigurationName);
compileClasspathConfiguration.deprecateForDeclaration(implementationConfigurationName, apiConfigurationName, compileOnlyConfigurationName);
runtimeClasspathConfiguration.deprecateForDeclaration(implementationConfigurationName, apiConfigurationName, compileOnlyConfigurationName, runtimeOnlyConfigurationName);
}
Aggregations