当前位置: 首页>>代码示例>>Java>>正文


Java ConfigurationContainer.findByName方法代码示例

本文整理汇总了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));
        });
    }
}
 
开发者ID:jochenseeber,项目名称:gradle-project-config,代码行数:32,代码来源:MavenConfigPlugin.java

示例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);
  }
}
 
开发者ID:r-murphy,项目名称:nw-gradle,代码行数:24,代码来源:DependenciesUtil.java

示例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);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:SigningExtension.java

示例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;
}
 
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:33,代码来源:RuntimeClassLoaderFactory.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:BaseComponentModelPlugin.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:AndroidConfigHelper.java


注:本文中的org.gradle.api.artifacts.ConfigurationContainer.findByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。