org.gradle.api.artifacts.Configuration.getName()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(222)

本文整理了Java中org.gradle.api.artifacts.Configuration.getName()方法的一些代码示例,展示了Configuration.getName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getName()方法的具体详情如下:
包路径:org.gradle.api.artifacts.Configuration
类名称:Configuration
方法名:getName

Configuration.getName介绍

暂无

代码示例

代码示例来源:origin: uber/okbuck

public Scope build() {
  Configuration useful = DependencyUtils.useful(configuration);
  String key = useful != null ? useful.getName() : "--none--";
  return ProjectCache.getScopeCache(project)
    .computeIfAbsent(
      key,
      t ->
        new Scope(
          project, useful, sourceDirs, javaResourceDirs, compilerOptions, depCache));
 }
}

代码示例来源:origin: uber/okbuck

public void download() {
 ImmutableSet.Builder<Configuration> runtimeDeps = ImmutableSet.builder();
 Set<API> apisToDownload;
 Set<String> configuredApis =
   ProjectUtil.getOkBuckExtension(rootProject).getTestExtension().robolectricApis;
 if (configuredApis != null) {
  apisToDownload = configuredApis.stream().map(API::from).collect(Collectors.toSet());
 } else {
  apisToDownload = EnumSet.allOf(API.class);
 }
 for (API api : apisToDownload) {
  Configuration runtimeApi =
    rootProject.getConfigurations().maybeCreate(ROBOLECTRIC_RUNTIME + "_" + api.name());
  rootProject.getDependencies().add(runtimeApi.getName(), api.getCoordinates());
  runtimeDeps.add(runtimeApi);
 }
 DependencyCache dependencyCache =
   new DependencyCache(rootProject, ProjectUtil.getDependencyManager(rootProject));
 dependencies =
   runtimeDeps
     .build()
     .stream()
     .map(dependencyCache::build)
     .flatMap(Set::stream)
     .collect(com.uber.okbuck.core.util.MoreCollectors.toImmutableSet());
}

代码示例来源:origin: spring-gradle-plugins/dependency-management-plugin

@Override
    public int compare(Configuration one, Configuration two) {
      return one.getName().compareTo(two.getName());
    }
}

代码示例来源:origin: gradle.plugin.com.twcable.gradle/gradle-plugin-cq-package

@Input
@SuppressWarnings("unused") // lets Gradle know when to not skip the task
public String getConfigurationName() {
  return getConfiguration().getName();
}

代码示例来源:origin: me.seeber.gradle/gradle-workspace-plugin

/**
 * Get the properties as a map
 *
 * @return Map containing the properties
 */
public Map<String, ?> getProperties() {
  Map<String, ?> properties = ImmutableMap.of("path", this.project.getPath(), "configuration",
      this.configuration.getName());
  return properties;
}

代码示例来源:origin: gradle.plugin.com.twcable.gradle/gradle-plugin-cq-package

private static void createCqPackageConf(Project project) {
  LOG.debug("Creating configuration: {}", CqPackagePlugin.CQ_PACKAGE);
  val cqPackageConf = project.getConfigurations().create(CqPackagePlugin.CQ_PACKAGE);
  // attach to "runtime", but don't insist that it have to be there first (or will ever be there)
  project.getConfigurations().withType(Configuration.class, conf -> {
    if (conf.getName().equals("runtime")) {
      LOG.debug("Making {} extend from {}", CqPackagePlugin.CQ_PACKAGE, conf.getName());
      cqPackageConf.extendsFrom(conf);
    }
  });
}

代码示例来源:origin: gradle.plugin.org.hibernate.build.gradle/hibernate-matrix-testing

@SuppressWarnings( {"UnusedDeclaration"})
  public void jdbcDependency(Object dependencyNotation) {
    project.getDependencies().add( jdbcDependencies.getName(), dependencyNotation );
  }
}

代码示例来源:origin: gradle.plugin.org.hibernate.build/database-profile-plugin

@SuppressWarnings( {"UnusedDeclaration"})
  public void jdbcDependency(Object dependencyNotation) {
    project.getDependencies().add( jdbcDependencies.getName(), dependencyNotation );
  }
}

代码示例来源:origin: me.seeber.gradle/gradle-workspace-plugin

/**
 * @see java.lang.Object#hashCode()
 */
@Override
public int hashCode() {
  int hash = 0;
  hash = (31 * hash) + getProject().getPath().hashCode();
  hash = (31 * hash) + getConfiguration().getName().hashCode();
  return hash;
}

代码示例来源:origin: spring-gradle-plugins/dependency-management-plugin

private String findManagedVersion(Configuration source, String group, String name) {
  for (Configuration configuration : source.getHierarchy()) {
    String managedVersion = dependencyManagementForConfiguration(configuration)
        .getManagedVersion(group, name);
    if (managedVersion != null) {
      logger.debug("Found managed version '{}' for dependency '{}:{}' in dependency management for " +
          "configuration '{}'", managedVersion, group, name, configuration.getName());
      return managedVersion;
    }
  }
  return null;
}

代码示例来源:origin: javafxports/javafxmobile-plugin

private Object generateDependencyNotation(Configuration configuration, DownPluginDefinition pluginDefinition) {
  Map<String, String> dependencyNotationMap = new HashMap<>();
  dependencyNotationMap.put("group", DEPENDENCY_GROUP);
  dependencyNotationMap.put("name", getDependencyName(configuration, pluginDefinition));
  dependencyNotationMap.put("version", getDependencyVersion(pluginDefinition));
  project.getLogger().info("Adding dependency for {} in configuration {}: {}", pluginDefinition.getPlugin().getPluginName(), configuration.getName(), dependencyNotationMap);
  return dependencyNotationMap;
}

代码示例来源:origin: apache/meecrowave

private ClassLoader createLoader(final ClassLoader parent) {
  final Collection<URL> urls = new LinkedHashSet<>(64);
  addFiles(modules, urls);
  for (final Configuration cc : getProject().getConfigurations()) {
    if (applicationScopes.contains(cc.getName())) {
      addFiles(cc.getFiles(), urls);
    }
  }
  addFiles(classpath.getFiles(), urls);
  // use JVM loader to avoid the noise of gradle and its plugins
  return new URLClassLoader(urls.toArray(new URL[urls.size()]), new FilterGradleClassLoader(parent, classloaderFilteredPackages));
}

代码示例来源:origin: google/play-services-plugins

@Test
public void testIsTest_fromHierarchy() {
 Configuration configuration = mock(Configuration.class);
 when(configuration.getName()).thenReturn("random");
 Configuration parent = mock(Configuration.class);
 when(parent.getName()).thenReturn("testCompile");
 Set<Configuration> hierarchy = new HashSet<>();
 hierarchy.add(parent);
 when(configuration.getHierarchy()).thenReturn(hierarchy);
 assertTrue(dependencyTask.isTest(configuration));
}

代码示例来源:origin: google/play-services-plugins

@Test
public void testIsTest_isTestCompile() {
 Configuration configuration = mock(Configuration.class);
 when(configuration.getName()).thenReturn("testCompile");
 assertTrue(dependencyTask.isTest(configuration));
}

代码示例来源:origin: google/play-services-plugins

@Test
public void testIsTest_isNotTest() {
 Configuration configuration = mock(Configuration.class);
 when(configuration.getName()).thenReturn("random");
 assertFalse(dependencyTask.isTest(configuration));
}

代码示例来源:origin: google/play-services-plugins

@Test
public void testAddArtifacts() {
 ResolvedConfiguration resolvedConfiguration = spy(ResolvedConfiguration.class);
 Set<ResolvedArtifact> artifacts = preppareArtifactSet(3);
 when(resolvedConfiguration.getResolvedArtifacts()).thenReturn(artifacts);
 Configuration configuration = mock(Configuration.class);
 when(configuration.isCanBeResolved()).thenReturn(true);
 when(configuration.getName()).thenReturn("compile");
 when(configuration.getResolvedConfiguration()).thenReturn(resolvedConfiguration);
 dependencyTask.addArtifacts(artifacts);
 assertThat(dependencyTask.artifactInfos.size(), is(3));
}

代码示例来源:origin: com.amazon.device.tools.build/gradle-core

@Override
public void execute(Task packageTask) {
  project.getArtifacts().add(
      variantData.getVariantDependency().getPublishConfiguration().getName(),
      new ApkPublishArtifact(
          projectBaseName,
          null,
          (FileSupplier) packageTask));
}

代码示例来源:origin: google/play-services-plugins

@Test
public void testGetResolvedArtifacts_ResolveException() {
 ResolvedConfiguration resolvedConfiguration = mock(ResolvedConfiguration.class);
 when(resolvedConfiguration.getResolvedArtifacts()).thenThrow(ResolveException.class);
 Configuration configuration = mock(Configuration.class);
 when(configuration.getName()).thenReturn("compile");
 when(configuration.isCanBeResolved()).thenReturn(true);
 when(configuration.getResolvedConfiguration()).thenReturn(resolvedConfiguration);
 assertThat(dependencyTask.getResolvedArtifacts(configuration), is(nullValue()));
}

代码示例来源:origin: google/play-services-plugins

@Test
public void testGetResolvedArtifacts_isTest() {
 Configuration configuration = mock(Configuration.class);
 when(configuration.getName()).thenReturn("testCompile");
 when(configuration.isCanBeResolved()).thenReturn(true);
 assertThat(dependencyTask.getResolvedArtifacts(configuration), is(nullValue()));
}

代码示例来源:origin: org.gradle/gradle-core

@Override
public Configuration findProjectConfiguration() {
  ConfigurationContainer dependencyConfigurations = getDependencyProject().getConfigurations();
  String declaredConfiguration = getTargetConfiguration();
  Configuration selectedConfiguration = dependencyConfigurations.getByName(GUtil.elvis(declaredConfiguration, Dependency.DEFAULT_CONFIGURATION));
  if (!selectedConfiguration.isCanBeConsumed()) {
    throw new ConfigurationNotConsumableException(dependencyProject.getDisplayName(), selectedConfiguration.getName());
  }
  return selectedConfiguration;
}

相关文章