本文整理汇总了Java中org.gradle.api.artifacts.ConfigurationContainer.findByName方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurationContainer.findByName方法的具体用法?Java ConfigurationContainer.findByName怎么用?Java ConfigurationContainer.findByName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gradle.api.artifacts.ConfigurationContainer
的用法示例。
在下文中一共展示了ConfigurationContainer.findByName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeMavenConfig
import org.gradle.api.artifacts.ConfigurationContainer; //导入方法依赖的package包/类
/**
* Initialize the Maven configuration
*
* @param mavenConfig Maven configuration to initialize
* @param projectContext Project context
* @param configurations Configuration container
*/
@Defaults
public void initializeMavenConfig(MavenConfig mavenConfig, ProjectContext projectContext,
ConfigurationContainer configurations) {
mavenConfig.getPublications().create(SourceSet.MAIN_SOURCE_SET_NAME, p -> {
p.setArtifactId(projectContext.getName());
p.setArchivesConfiguration(Dependency.ARCHIVES_CONFIGURATION);
p.setAddProjectArtifacts(false);
p.setCompileConfigurations(Collections.singletonList(JavaPlugin.COMPILE_CONFIGURATION_NAME));
p.setRuntimeConfigurations(Collections.singletonList(JavaPlugin.RUNTIME_CONFIGURATION_NAME));
});
if (configurations.findByName("testArchives") != null) {
mavenConfig.getPublications().create(SourceSet.TEST_SOURCE_SET_NAME, p -> {
p.setArtifactId(projectContext.getName() + "-" + SourceSet.TEST_SOURCE_SET_NAME);
p.setArchivesConfiguration(Names.formatName("", Dependency.ARCHIVES_CONFIGURATION,
SourceSet.TEST_SOURCE_SET_NAME));
p.setAddProjectArtifacts(true);
p.setCompileConfigurations(
Collections.singletonList(JavaPlugin.TEST_COMPILE_CONFIGURATION_NAME));
p.setRuntimeConfigurations(
Collections.singletonList(JavaPlugin.TEST_RUNTIME_CONFIGURATION_NAME));
});
}
}
示例2: configureProvidedConfigurations
import org.gradle.api.artifacts.ConfigurationContainer; //导入方法依赖的package包/类
/**
* Setup the the 'providedCompile' and 'providedRuntime' configurations, just like War.
* TODO See if we can recursively get all the dependent projects and apply it to them too.
* But it would have to be a future action.
*/
public static void configureProvidedConfigurations(final Project project) {
ConfigurationContainer configurationContainer = project.getConfigurations();
Configuration provideCompileConfiguration = configurationContainer.findByName(WarPlugin.PROVIDED_COMPILE_CONFIGURATION_NAME);
if (provideCompileConfiguration==null) {
provideCompileConfiguration = configurationContainer.create(WarPlugin.PROVIDED_COMPILE_CONFIGURATION_NAME)
.setVisible(false)
.setDescription("Additional compile classpath for libraries that should not be part of the archive.");
configurationContainer.getByName(JavaPlugin.COMPILE_CONFIGURATION_NAME).extendsFrom(provideCompileConfiguration);
}
Configuration provideRuntimeConfiguration = configurationContainer.findByName(WarPlugin.PROVIDED_RUNTIME_CONFIGURATION_NAME);
if (provideRuntimeConfiguration==null) {
provideRuntimeConfiguration = configurationContainer.create(WarPlugin.PROVIDED_RUNTIME_CONFIGURATION_NAME)
.setVisible(false)
.extendsFrom(provideCompileConfiguration)
.setDescription("Additional runtime classpath for libraries that should not be part of the archive.");
configurationContainer.getByName(JavaPlugin.RUNTIME_CONFIGURATION_NAME).extendsFrom(provideRuntimeConfiguration);
}
}
示例3: getDefaultConfiguration
import org.gradle.api.artifacts.ConfigurationContainer; //导入方法依赖的package包/类
/**
* Provides the configuration that signature artifacts are added to. Called once during construction.
*/
protected Configuration getDefaultConfiguration() {
ConfigurationContainer configurations = project.getConfigurations();
Configuration configuration = configurations.findByName(DEFAULT_CONFIGURATION_NAME);
return configuration != null
? configuration
: configurations.create(DEFAULT_CONFIGURATION_NAME);
}
示例4: getProjectLibraries
import org.gradle.api.artifacts.ConfigurationContainer; //导入方法依赖的package包/类
public Set<File> getProjectLibraries() {
Set<File> classpath = new HashSet<>();
SourceSetContainer sourceSets = (SourceSetContainer) project.getProperties().get("sourceSets");
if (sourceSets != null) {
SortedSet<String> availableSourceSetNames = sourceSets.getNames();
for (String sourceSetName : Arrays.asList("main", "test", "integrationTest")) {
if (availableSourceSetNames.contains(sourceSetName)) {
SourceSet sourceSet = sourceSets.getByName(sourceSetName);
classpath.add(sourceSet.getOutput().getClassesDir());
}
}
}
// add dependencies from configured gradle configuration to url (usually test or integrationTest)
TSGeneratorConfig generatorConfiguration = project.getExtensions().getByType(TSGeneratorConfig.class);
String configurationName = generatorConfiguration.getRuntime().getConfiguration();
ConfigurationContainer configurations = project.getConfigurations();
Configuration runtimeConfiguration = configurations.findByName(configurationName + "Runtime");
if (runtimeConfiguration == null) {
runtimeConfiguration = configurations.getByName(configurationName);
}
classpath.addAll(runtimeConfiguration.getFiles());
for (File file : classpath) {
LOGGER.debug("classpath entry: {}", file);
}
return classpath;
}
示例5: createConfiguration
import org.gradle.api.artifacts.ConfigurationContainer; //导入方法依赖的package包/类
private static void createConfiguration(@NonNull ConfigurationContainer configurations,
@NonNull String configurationName, @NonNull String configurationDescription) {
Configuration configuration = configurations.findByName(configurationName);
if (configuration == null) {
configuration = configurations.create(configurationName);
}
configuration.setVisible(false);
configuration.setDescription(configurationDescription);
}
示例6: createConfiguration
import org.gradle.api.artifacts.ConfigurationContainer; //导入方法依赖的package包/类
private static void createConfiguration(
@NonNull ConfigurationContainer configurations,
@NonNull String configurationName,
@NonNull String configurationDescription) {
Configuration configuration = configurations.findByName(configurationName);
if (configuration == null) {
configuration = configurations.create(configurationName);
}
// Disable modification to configurations as this causes issues when accessed through the
// tooling-api. Check that it works with Studio's ImportProjectAction before re-enabling
// them.
//configuration.setVisible(false);
//configuration.setDescription(configurationDescription);
}