use of org.gradle.api.internal.artifacts.configurations.ConfigurationInternal in project gradle by gradle.
the class DefaultConfigurationComponentMetaDataBuilder method addConfigurations.
public void addConfigurations(BuildableLocalComponentMetadata metaData, Collection<? extends ConfigurationInternal> configurations) {
for (ConfigurationInternal configuration : configurations) {
addConfiguration(metaData, configuration);
dependenciesConverter.addDependencyDescriptors(metaData, configuration);
OutgoingVariant outgoingVariant = configuration.convertToOutgoingVariant();
metaData.addArtifacts(configuration.getName(), outgoingVariant.getArtifacts());
for (OutgoingVariant variant : outgoingVariant.getChildren()) {
metaData.addVariant(configuration.getName(), variant);
}
}
}
use of org.gradle.api.internal.artifacts.configurations.ConfigurationInternal in project gradle by gradle.
the class DefaultLocalComponentMetadataBuilder method addConfigurations.
public void addConfigurations(BuildableLocalComponentMetadata metaData, Collection<? extends ConfigurationInternal> configurations) {
for (ConfigurationInternal configuration : configurations) {
addConfiguration(metaData, configuration);
metaData.addDependenciesAndExcludesForConfiguration(configuration, configurationMetadataBuilder);
OutgoingVariant outgoingVariant = configuration.convertToOutgoingVariant();
metaData.addArtifacts(configuration.getName(), outgoingVariant.getArtifacts());
for (OutgoingVariant variant : outgoingVariant.getChildren()) {
metaData.addVariant(configuration.getName(), variant);
}
}
}
use of org.gradle.api.internal.artifacts.configurations.ConfigurationInternal in project gradle by gradle.
the class DefaultLocalComponentMetadataBuilder method addConfiguration.
@Override
public BuildableLocalConfigurationMetadata addConfiguration(BuildableLocalComponentMetadata metaData, ConfigurationInternal configuration) {
BuildableLocalConfigurationMetadata configurationMetadata = createConfiguration(metaData, configuration);
metaData.addDependenciesAndExcludesForConfiguration(configuration, configurationMetadataBuilder);
ComponentConfigurationIdentifier configurationIdentifier = new ComponentConfigurationIdentifier(metaData.getId(), configuration.getName());
configuration.collectVariants(new ConfigurationInternal.VariantVisitor() {
@Override
public void visitArtifacts(Collection<? extends PublishArtifact> artifacts) {
metaData.addArtifacts(configuration.getName(), artifacts);
}
@Override
public void visitOwnVariant(DisplayName displayName, ImmutableAttributes attributes, Collection<? extends Capability> capabilities, Collection<? extends PublishArtifact> artifacts) {
metaData.addVariant(configuration.getName(), configuration.getName(), configurationIdentifier, displayName, attributes, ImmutableCapabilities.of(capabilities), artifacts);
}
@Override
public void visitChildVariant(String name, DisplayName displayName, ImmutableAttributes attributes, Collection<? extends Capability> capabilities, Collection<? extends PublishArtifact> artifacts) {
metaData.addVariant(configuration.getName(), configuration.getName() + "-" + name, new NestedVariantIdentifier(configurationIdentifier, name), displayName, attributes, ImmutableCapabilities.of(capabilities), artifacts);
}
});
return configurationMetadata;
}
use of org.gradle.api.internal.artifacts.configurations.ConfigurationInternal in project gradle by gradle.
the class DefaultJvmPluginServices method useDefaultTargetPlatformInference.
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public <COMPILE extends AbstractCompile & HasCompileOptions> void useDefaultTargetPlatformInference(Configuration configuration, TaskProvider<COMPILE> compileTask) {
ConfigurationInternal configurationInternal = (ConfigurationInternal) configuration;
Set<TaskProvider<?>> compileTasks = configurationToCompileTasks.computeIfAbsent(configurationInternal, key -> {
HashSet<TaskProvider<?>> taskProviders = new HashSet<>();
configurationInternal.beforeLocking(configureDefaultTargetPlatform(configuration.isCanBeConsumed(), (Set) taskProviders));
return taskProviders;
});
compileTasks.add(compileTask);
}
use of org.gradle.api.internal.artifacts.configurations.ConfigurationInternal 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);
}
Aggregations