當前位置: 首頁>>代碼示例>>Java>>正文


Java Configuration類代碼示例

本文整理匯總了Java中org.gradle.api.artifacts.Configuration的典型用法代碼示例。如果您正苦於以下問題:Java Configuration類的具體用法?Java Configuration怎麽用?Java Configuration使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Configuration類屬於org.gradle.api.artifacts包,在下文中一共展示了Configuration類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isMappedToIdeaScope

import org.gradle.api.artifacts.Configuration; //導入依賴的package包/類
private boolean isMappedToIdeaScope(final Configuration configuration, IdeaModule ideaModule) {
    Iterable<IdeaScopeMappingRule> rules = Iterables.concat(scopeMappings.values());
    boolean matchesRule = Iterables.any(rules, new Predicate<IdeaScopeMappingRule>() {
        @Override
        public boolean apply(IdeaScopeMappingRule ideaScopeMappingRule) {
            return ideaScopeMappingRule.configurationNames.contains(configuration.getName());
        }
    });
    if (matchesRule) {
        return true;
    }
    for (Map<String, Collection<Configuration>> scopeMap : ideaModule.getScopes().values()) {
        Iterable<Configuration> configurations = Iterables.concat(scopeMap.values());
        if (Iterables.any(configurations, Predicates.equalTo(configuration))) {
            return true;
        }
    }
    return false;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:20,代碼來源:IdeaDependenciesProvider.java

示例2: getUnresolvedIdeRepoFileDependencies

import org.gradle.api.artifacts.Configuration; //導入依賴的package包/類
/**
 * Gets unresolved IDE repository file dependencies.
 *
 * @param configuration Configuration
 * @return Unresolved IDE repositoru file dependencies
 */
public List<UnresolvedIdeRepoFileDependency> getUnresolvedIdeRepoFileDependencies(Configuration configuration) {
    ResolutionResult result = getIncomingResolutionResult(configuration);
    List<UnresolvedDependencyResult> unresolvedDependencies = findAllUnresolvedDependencyResults(result.getRoot().getDependencies());
    List<UnresolvedIdeRepoFileDependency> unresolvedIdeRepoFileDependencies = new ArrayList<UnresolvedIdeRepoFileDependency>();

    for (UnresolvedDependencyResult unresolvedDependencyResult : unresolvedDependencies) {
        Throwable failure = unresolvedDependencyResult.getFailure();
        ComponentSelector componentSelector = unresolvedDependencyResult.getAttempted();

        String displayName = componentSelector.getDisplayName();
        File file = new File(unresolvedFileName(componentSelector));
        unresolvedIdeRepoFileDependencies.add(new UnresolvedIdeRepoFileDependency(file, failure, displayName));
    }

    return unresolvedIdeRepoFileDependencies;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:23,代碼來源:DefaultIdeDependencyResolver.java

示例3: getIdeLocalFileDependencies

import org.gradle.api.artifacts.Configuration; //導入依賴的package包/類
/**
 * Gets IDE local file dependencies.
 *
 * @param configuration Configuration
 * @return IDE local file dependencies
 */
public List<IdeLocalFileDependency> getIdeLocalFileDependencies(Configuration configuration) {
    List<SelfResolvingDependency> externalDependencies = new ArrayList<SelfResolvingDependency>();
    findAllExternalDependencies(externalDependencies, new ArrayList<Dependency>(), configuration);
    List<IdeLocalFileDependency> ideLocalFileDependencies = new ArrayList<IdeLocalFileDependency>();

    for (SelfResolvingDependency externalDependency : externalDependencies) {
        Set<File> resolvedFiles = externalDependency.resolve();

        for (File resolvedFile : resolvedFiles) {
            IdeLocalFileDependency ideLocalFileDependency = new IdeLocalFileDependency(resolvedFile);
            ideLocalFileDependencies.add(ideLocalFileDependency);
        }
    }

    return ideLocalFileDependencies;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:23,代碼來源:DefaultIdeDependencyResolver.java

示例4: getIdeRepoFileDependencies

import org.gradle.api.artifacts.Configuration; //導入依賴的package包/類
/**
 * Gets IDE repository file dependencies.
 *
 * @param configuration Configuration
 * @return IDE repository file dependencies
 */
public List<IdeExtendedRepoFileDependency> getIdeRepoFileDependencies(Configuration configuration) {
    ResolutionResult result = getIncomingResolutionResult(configuration);
    final Set<ResolvedComponentResult> resolvedRepoFileComponents = CollectionUtils.filter(result.getAllComponents(), new Spec<ResolvedComponentResult>() {
        @Override
        public boolean isSatisfiedBy(ResolvedComponentResult element) {
            return element.getId() instanceof ModuleComponentIdentifier;
        }
    });
    Set<ModuleVersionIdentifier> mappedResolvedDependencies = mapResolvedDependencies(resolvedRepoFileComponents);
    Set<ResolvedArtifact> artifacts = getExternalArtifacts(configuration);
    List<IdeExtendedRepoFileDependency> externalDependencies = new ArrayList<IdeExtendedRepoFileDependency>();
    for (ResolvedArtifact artifact : artifacts) {
        if (mappedResolvedDependencies.contains(artifact.getModuleVersion().getId())) {
            IdeExtendedRepoFileDependency ideRepoFileDependency = new IdeExtendedRepoFileDependency(artifact.getFile());
            ideRepoFileDependency.setId(artifact.getModuleVersion().getId());
            externalDependencies.add(ideRepoFileDependency);
        }
    }

    return externalDependencies;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:28,代碼來源:DefaultIdeDependencyResolver.java

示例5: getBaseApFile

import org.gradle.api.artifacts.Configuration; //導入依賴的package包/類
private File getBaseApFile(Project project, TBuildType tBuildType) {
    File apBaseFile;
    File buildTypeBaseApFile = tBuildType.getBaseApFile();
    if (null != buildTypeBaseApFile && buildTypeBaseApFile.exists()) {
        apBaseFile = buildTypeBaseApFile;
    } else if (!isNullOrEmpty(tBuildType.getBaseApDependency())) {
        String apDependency = tBuildType.getBaseApDependency();
        // Preconditions.checkNotNull(apDependency,
        //                            "You have to specify the baseApFile property or the baseApDependency
        // dependency");
        Dependency dependency = project.getDependencies().create(apDependency);
        Configuration configuration = project.getConfigurations().detachedConfiguration(dependency);
        configuration.setTransitive(false);
        apBaseFile = Iterables.getOnlyElement(Collections2.filter(configuration.getFiles(), new Predicate<File>() {
            @Override
            public boolean apply(@Nullable File file) {
                return file.getName().endsWith(".ap");
            }
        }));
    } else {
        throw new IllegalStateException("AP is missing");
    }
    return apBaseFile;
}
 
開發者ID:alibaba,項目名稱:atlas,代碼行數:25,代碼來源:ApDependencies.java

示例6: ideaConfigurations

import org.gradle.api.artifacts.Configuration; //導入依賴的package包/類
private Iterable<Configuration> ideaConfigurations(final IdeaModule ideaModule) {
    Set<Configuration> configurations = Sets.newLinkedHashSet(ideaModule.getProject().getConfigurations());
    for (Map<String, Collection<Configuration>> scopeMap : ideaModule.getScopes().values()) {
        for (Configuration cfg : Iterables.concat(scopeMap.values())) {
            configurations.add(cfg);
        }
    }
    return Iterables.filter(
            configurations,
            new Predicate<Configuration>() {
                @Override
                public boolean apply(Configuration input) {
                    return isMappedToIdeaScope(input, ideaModule);
                }
            });
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:17,代碼來源:IdeaDependenciesProvider.java

示例7: triggerWhenEmptyActionsIfNecessary

import org.gradle.api.artifacts.Configuration; //導入依賴的package包/類
@Override
public void triggerWhenEmptyActionsIfNecessary() {
    if (!defaultDependencyActions.isEmpty()) {
        for (Action<? super DependencySet> action : defaultDependencyActions) {
            if (!dependencies.isEmpty()) {
                break;
            }
            action.execute(dependencies);
        }
    }
    // Discard actions
    defaultDependencyActions.clear();
    for (Configuration superConfig : extendsFrom) {
        ((ConfigurationInternal) superConfig).triggerWhenEmptyActionsIfNecessary();
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:17,代碼來源:DefaultConfiguration.java

示例8: defineConfigurationsForSourceSet

import org.gradle.api.artifacts.Configuration; //導入依賴的package包/類
private void defineConfigurationsForSourceSet(SourceSet sourceSet, ConfigurationContainer configurations) {
    Configuration compileConfiguration = configurations.maybeCreate(sourceSet.getCompileConfigurationName());
    compileConfiguration.setVisible(false);
    compileConfiguration.setDescription("Dependencies for " + sourceSet + ".");

    Configuration runtimeConfiguration = configurations.maybeCreate(sourceSet.getRuntimeConfigurationName());
    runtimeConfiguration.setVisible(false);
    runtimeConfiguration.extendsFrom(compileConfiguration);
    runtimeConfiguration.setDescription("Runtime dependencies for " + sourceSet + ".");

    Configuration compileOnlyConfiguration = configurations.maybeCreate(sourceSet.getCompileOnlyConfigurationName());
    compileOnlyConfiguration.setVisible(false);
    compileOnlyConfiguration.extendsFrom(compileConfiguration);
    compileOnlyConfiguration.setDescription("Compile dependencies for " + sourceSet + ".");

    Configuration compileClasspathConfiguration = configurations.maybeCreate(sourceSet.getCompileClasspathConfigurationName());
    compileClasspathConfiguration.setVisible(false);
    compileClasspathConfiguration.extendsFrom(compileOnlyConfiguration);
    compileClasspathConfiguration.setDescription("Compile classpath for " + sourceSet + ".");

    sourceSet.setCompileClasspath(compileClasspathConfiguration);
    sourceSet.setRuntimeClasspath(sourceSet.getOutput().plus(runtimeConfiguration));
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:24,代碼來源:JavaBasePlugin.java

示例9: addStandardJavaTestDependencies

import org.gradle.api.artifacts.Configuration; //導入依賴的package包/類
private static void addStandardJavaTestDependencies(Project project) {
  Configuration testConfiguration =
      project.getPlugins().hasPlugin(JavaLibraryPlugin.class)
          ? project
              .getConfigurations()
              .getByName(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME)
          : project.getConfigurations().getByName(JavaPlugin.TEST_COMPILE_CONFIGURATION_NAME);
  DependencyHandler dependencies = project.getDependencies();

  dependencies.add(JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, "com.google.code.findbugs:jsr305");
  dependencies.add(testConfiguration.getName(), "org.curioswitch.curiostack:curio-testing-framework");
  dependencies.add(testConfiguration.getName(), "org.assertj:assertj-core");
  dependencies.add(testConfiguration.getName(), "org.awaitility:awaitility");
  dependencies.add(testConfiguration.getName(), "junit:junit");
  dependencies.add(testConfiguration.getName(), "org.mockito:mockito-core");
  dependencies.add(testConfiguration.getName(), "info.solidsoft.mockito:mockito-java8");
}
 
開發者ID:curioswitch,項目名稱:curiostack,代碼行數:18,代碼來源:CuriostackPlugin.java

示例10: getBundleDependencies

import org.gradle.api.artifacts.Configuration; //導入依賴的package包/類
private Set<String> getBundleDependencies(Configuration compileClasspath,
                                          Set<? extends DependencyResult> bundleDependencies) {
    Set<String> bundleSets = new HashSet<>();
    for (DependencyResult dependencyResult : bundleDependencies) {
        bundleSets.add(dependencyResult.toString());
    }
    for (Dependency dependency : compileClasspath.getAllDependencies()) {
        if (dependency instanceof DefaultExternalModuleDependency) {
            DefaultExternalModuleDependency externalModuleDependency = (DefaultExternalModuleDependency)dependency;
            if (!((DefaultExternalModuleDependency)dependency).getArtifacts().isEmpty()) {
                if (StringUtils.equalsIgnoreCase("awb", ((DefaultExternalModuleDependency)dependency).getArtifacts()
                    .iterator().next().getType())) {
                    bundleSets.add(
                        dependency.getGroup() + ":" + dependency.getName() + ":" + dependency.getVersion());
                }
            }
        }
    }
    return bundleSets;
}
 
開發者ID:alibaba,項目名稱:atlas,代碼行數:21,代碼來源:DependencyGroup.java

示例11: createInsightDependencyChildren

import org.gradle.api.artifacts.Configuration; //導入依賴的package包/類
private List createInsightDependencyChildren(RenderableDependency dependency, final Set<Object> visited, final Configuration configuration) {
    Iterable<? extends RenderableDependency> children = dependency.getChildren();
    return CollectionUtils.collect(children, new Transformer<Object, RenderableDependency>() {
        @Override
        public Object transform(RenderableDependency childDependency) {
            boolean alreadyVisited = !visited.add(childDependency.getId());
            boolean leaf = childDependency.getChildren().isEmpty();
            boolean alreadyRendered = alreadyVisited && !leaf;
            String childName = replaceArrow(childDependency.getName());
            boolean hasConflict = !childName.equals(childDependency.getName());
            String name = leaf ? configuration.getName() : childName;

            LinkedHashMap<String, Object> map = new LinkedHashMap<String, Object>(6);
            map.put("name", name);
            map.put("resolvable", childDependency.getResolutionState());
            map.put("hasConflict", hasConflict);
            map.put("alreadyRendered", alreadyRendered);
            map.put("isLeaf", leaf);
            map.put("children", Collections.emptyList());
            if (!alreadyRendered) {
                map.put("children", createInsightDependencyChildren(childDependency, visited, configuration));
            }
            return map;
        }
    });
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:27,代碼來源:JsonProjectDependencyRenderer.java

示例12: generate

import org.gradle.api.artifacts.Configuration; //導入依賴的package包/類
@TaskAction
public void generate() {
    ProjectReportGenerator projectReportGenerator = new ProjectReportGenerator() {
        @Override
        public void generateReport(Project project) throws IOException {
            Configuration configuration = getProject().getBuildscript().getConfigurations().getByName(ScriptHandler.CLASSPATH_CONFIGURATION);
            renderer.startConfiguration(configuration);
            renderer.render(configuration);
            renderer.completeConfiguration(configuration);
        }
    };

    ReportGenerator reportGenerator = new ReportGenerator(renderer, getClientMetaData(), null,
        getTextOutputFactory(), projectReportGenerator);
    reportGenerator.generateReport(Collections.singleton(getProject()));
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:17,代碼來源:BuildEnvironmentReportTask.java

示例13: collectArtifacts

import org.gradle.api.artifacts.Configuration; //導入依賴的package包/類
private void collectArtifacts(Configuration configuration,
                              Map<ModuleVersionIdentifier, List<ResolvedArtifact>> artifacts) {

    Set<ResolvedArtifact> allArtifacts;
    if (!extraModelInfo.getMode().equals(STANDARD)) {
        allArtifacts = configuration.getResolvedConfiguration().getLenientConfiguration().getArtifacts(
            Specs.satisfyAll());
    } else {
        allArtifacts = configuration.getResolvedConfiguration().getResolvedArtifacts();
    }

    for (ResolvedArtifact artifact : allArtifacts) {
        ModuleVersionIdentifier id = artifact.getModuleVersion().getId();
        List<ResolvedArtifact> moduleArtifacts = artifacts.get(id);

        if (moduleArtifacts == null) {
            moduleArtifacts = Lists.newArrayList();
            artifacts.put(id, moduleArtifacts);
        }

        if (!moduleArtifacts.contains(artifact)) {
            moduleArtifacts.add(artifact);
        }
    }
}
 
開發者ID:alibaba,項目名稱:atlas,代碼行數:26,代碼來源:AtlasDepTreeParser.java

示例14: apply

import org.gradle.api.artifacts.Configuration; //導入依賴的package包/類
public void apply(String taskName) {
    if (taskName.startsWith(PREFIX)) {
        for (Configuration configuration : project.getConfigurations()) {
            if (taskName.equals(configuration.getUploadTaskName())) {
                createUploadTask(configuration.getUploadTaskName(), configuration, project);
            }
        }
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:10,代碼來源:UploadRule.java

示例15: configureArchivesAndComponent

import org.gradle.api.artifacts.Configuration; //導入依賴的package包/類
private void configureArchivesAndComponent(final Project project, final JavaPluginConvention pluginConvention) {
    Jar jar = project.getTasks().create(JAR_TASK_NAME, Jar.class);
    jar.setDescription("Assembles a jar archive containing the main classes.");
    jar.setGroup(BasePlugin.BUILD_GROUP);
    jar.from(pluginConvention.getSourceSets().getByName(SourceSet.MAIN_SOURCE_SET_NAME).getOutput());

    ArchivePublishArtifact jarArtifact = new ArchivePublishArtifact(jar);
    Configuration runtimeConfiguration = project.getConfigurations().getByName(RUNTIME_CONFIGURATION_NAME);

    runtimeConfiguration.getArtifacts().add(jarArtifact);
    project.getExtensions().getByType(DefaultArtifactPublicationSet.class).addCandidate(jarArtifact);
    project.getComponents().add(new JavaLibrary(jarArtifact, runtimeConfiguration.getAllDependencies()));
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:14,代碼來源:JavaPlugin.java


注:本文中的org.gradle.api.artifacts.Configuration類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。