本文整理汇总了Java中org.gradle.api.specs.Specs类的典型用法代码示例。如果您正苦于以下问题:Java Specs类的具体用法?Java Specs怎么用?Java Specs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Specs类属于org.gradle.api.specs包,在下文中一共展示了Specs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: create
import org.gradle.api.specs.Specs; //导入依赖的package包/类
@Override
public void create(final Action<? super T> action) {
state.assertCanMutate();
String name = String.valueOf(modelNode.getLinkCount(ModelNodes.withType(elementType)));
ModelPath childPath = modelNode.getPath().child(name);
final ModelRuleDescriptor descriptor = this.descriptor.append("create()");
NodeInitializer nodeInitializer = creatorStrategy.initializer(elementType, Specs.<ModelType<?>>satisfyAll());
ModelRegistration registration = ModelRegistrations.of(childPath, nodeInitializer)
.descriptor(descriptor)
.action(ModelActionRole.Initialize, NoInputsModelAction.of(ModelReference.of(childPath, elementType), descriptor, action))
.build();
modelNode.addLink(registration);
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:17,代码来源:NodeBackedModelSet.java
示例2: resolvePluginDependencies
import org.gradle.api.specs.Specs; //导入依赖的package包/类
private ClassPath resolvePluginDependencies(final PluginUseMetaData metadata) {
DependencyResolutionServices resolution = dependencyResolutionServicesFactory.create();
RepositoryHandler repositories = resolution.getResolveRepositoryHandler();
final String repoUrl = metadata.implementation.get("repo");
repositories.maven(new Action<MavenArtifactRepository>() {
public void execute(MavenArtifactRepository mavenArtifactRepository) {
mavenArtifactRepository.setUrl(repoUrl);
}
});
Dependency dependency = resolution.getDependencyHandler().create(metadata.implementation.get("gav"));
ConfigurationContainerInternal configurations = (ConfigurationContainerInternal) resolution.getConfigurationContainer();
ConfigurationInternal configuration = configurations.detachedConfiguration(dependency);
try {
Set<File> files = configuration.getResolvedConfiguration().getFiles(Specs.satisfyAll());
return new DefaultClassPath(files);
} catch (ResolveException e) {
throw new DependencyResolutionException("Failed to resolve all plugin dependencies from " + repoUrl, e.getCause());
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:24,代码来源:PluginResolutionServiceResolver.java
示例3: createExcludeSpec
import org.gradle.api.specs.Specs; //导入依赖的package包/类
public Spec<FileTreeElement> createExcludeSpec(PatternSet patternSet) {
List<Spec<FileTreeElement>> allExcludeSpecs = new ArrayList<Spec<FileTreeElement>>(2 + patternSet.getExcludeSpecs().size());
if (!patternSet.getExcludes().isEmpty()) {
allExcludeSpecs.add(createSpec(patternSet.getExcludes(), false, patternSet.isCaseSensitive()));
}
List<String> defaultExcludes = Arrays.asList(DirectoryScanner.getDefaultExcludes());
if (!defaultExcludes.isEmpty()) {
allExcludeSpecs.add(createSpec(defaultExcludes, false, patternSet.isCaseSensitive()));
}
allExcludeSpecs.addAll(patternSet.getExcludeSpecs());
if (allExcludeSpecs.isEmpty()) {
return Specs.satisfyNone();
} else {
return Specs.union(allExcludeSpecs);
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:21,代码来源:PatternSpecFactory.java
示例4: collectArtifacts
import org.gradle.api.specs.Specs; //导入依赖的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
示例5: copyFileDependencies
import org.gradle.api.specs.Specs; //导入依赖的package包/类
private void copyFileDependencies(Configuration configuration, String toPrint, Project project, boolean isPackagerJarToBeAdded, final File libDir, Set<String> foundLibs) {
project.getLogger().info("Copying defined " + toPrint + "-dependency-files...");
// inside "getFiles" all non-maven dependencies (like packager.jar) will be available
configuration.getResolvedConfiguration().getFiles(Specs.SATISFIES_ALL).forEach(someFile -> {
try{
Path artifactPath = someFile.toPath();
String artifactFileName = artifactPath.getFileName().toString();
if( "packager.jar".equals(artifactFileName) && !isPackagerJarToBeAdded ){
project.getLogger().info("Skipped adding packager.jar.");
return;
}
// add this lib only, when not already present (could happen on file-dependencies ... which behaves different from maven-model)
if( !foundLibs.contains(artifactFileName) ){
Files.copy(artifactPath, libDir.toPath().resolve(artifactFileName), StandardCopyOption.REPLACE_EXISTING);
foundLibs.add(artifactFileName);
}
} catch(IOException ex){
project.getLogger().warn("Couldn't copy dependency " + someFile.getName(), ex);
}
});
}
开发者ID:FibreFoX,项目名称:javafx-gradle-plugin,代码行数:23,代码来源:JfxJarWorker.java
示例6: getAllArtifacts
import org.gradle.api.specs.Specs; //导入依赖的package包/类
/**
* Recursive, includes unsuccessfully resolved artifacts
*
* @param dependencySpec dependency spec
*/
public Set<ResolvedArtifact> getAllArtifacts(Spec<? super Dependency> dependencySpec) {
//this is not very nice might be good enough until we get rid of ResolvedConfiguration and friends
//avoid traversing the graph causing the full ResolvedDependency graph to be loaded for the most typical scenario
if (dependencySpec == Specs.SATISFIES_ALL) {
return results.getArtifacts();
}
CachingDirectedGraphWalker<ResolvedDependency, ResolvedArtifact> walker
= new CachingDirectedGraphWalker<ResolvedDependency, ResolvedArtifact>(new ResolvedDependencyArtifactsGraph());
Set<ResolvedDependency> firstLevelModuleDependencies = getFirstLevelModuleDependencies(dependencySpec);
Set<ResolvedArtifact> artifacts = new LinkedHashSet<ResolvedArtifact>();
for (ResolvedDependency resolvedDependency : firstLevelModuleDependencies) {
artifacts.addAll(resolvedDependency.getParentArtifacts(results.more().getRoot()));
walker.add(resolvedDependency);
}
artifacts.addAll(walker.findValues());
return artifacts;
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:28,代码来源:DefaultLenientConfiguration.java
示例7: configureTestTasks
import org.gradle.api.specs.Specs; //导入依赖的package包/类
private void configureTestTasks(Set<Test> allTestTasksToRun) {
for (Test task : allTestTasksToRun) {
task.setIgnoreFailures(true);
task.getFilter().setFailOnNoMatchingTests(false);
task.getOutputs().upToDateWhen(Specs.SATISFIES_NONE);
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:TestExecutionBuildConfigurationAction.java
示例8: visitArtifacts
import org.gradle.api.specs.Specs; //导入依赖的package包/类
/**
* Recursive, includes unsuccessfully resolved artifacts
*
* @param dependencySpec dependency spec
*/
private void visitArtifacts(Spec<? super Dependency> dependencySpec, AttributeContainerInternal requestedAttributes, SelectedArtifactResults artifactResults, SelectedFileDependencyResults fileDependencyResults, ArtifactVisitor visitor) {
ArtifactVisitor transformingVisitor = artifactTransformer.visitor(visitor, requestedAttributes);
//this is not very nice might be good enough until we get rid of ResolvedConfiguration and friends
//avoid traversing the graph causing the full ResolvedDependency graph to be loaded for the most typical scenario
if (dependencySpec == Specs.SATISFIES_ALL) {
if (transformingVisitor.includeFiles()) {
fileDependencyResults.getFiles().visit(transformingVisitor);
}
artifactResults.getArtifacts().visit(transformingVisitor);
return;
}
if (transformingVisitor.includeFiles()) {
for (Map.Entry<FileCollectionDependency, ResolvedArtifactSet> entry: fileDependencyResults.getFirstLevelFiles().entrySet()) {
if (dependencySpec.isSatisfiedBy(entry.getKey())) {
entry.getValue().visit(transformingVisitor);
}
}
}
CachingDirectedGraphWalker<DependencyGraphNodeResult, ResolvedArtifact> walker = new CachingDirectedGraphWalker<DependencyGraphNodeResult, ResolvedArtifact>(new ResolvedDependencyArtifactsGraph(transformingVisitor, fileDependencyResults));
DependencyGraphNodeResult rootNode = loadTransientGraphResults(artifactResults).getRootNode();
for (DependencyGraphNodeResult node : getFirstLevelNodes(dependencySpec)) {
node.getArtifactsForIncomingEdge(rootNode).visit(transformingVisitor);
walker.add(node);
}
walker.findValues();
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:36,代码来源:DefaultLenientConfiguration.java
示例9: resolveGraph
import org.gradle.api.specs.Specs; //导入依赖的package包/类
public void resolveGraph(ConfigurationInternal configuration, ResolverResults results) {
List<ResolutionAwareRepository> resolutionAwareRepositories = CollectionUtils.collect(repositories, Transformers.cast(ResolutionAwareRepository.class));
StoreSet stores = storeFactory.createStoreSet();
BinaryStore oldModelStore = stores.nextBinaryStore();
Store<TransientConfigurationResults> oldModelCache = stores.oldModelCache();
TransientConfigurationResultsBuilder oldTransientModelBuilder = new TransientConfigurationResultsBuilder(oldModelStore, oldModelCache);
DefaultResolvedConfigurationBuilder oldModelBuilder = new DefaultResolvedConfigurationBuilder(oldTransientModelBuilder);
ResolvedConfigurationDependencyGraphVisitor oldModelVisitor = new ResolvedConfigurationDependencyGraphVisitor(oldModelBuilder);
BinaryStore newModelStore = stores.nextBinaryStore();
Store<ResolvedComponentResult> newModelCache = stores.newModelCache();
StreamingResolutionResultBuilder newModelBuilder = new StreamingResolutionResultBuilder(newModelStore, newModelCache);
ResolvedLocalComponentsResultGraphVisitor localComponentsVisitor = new ResolvedLocalComponentsResultGraphVisitor();
DefaultResolvedArtifactsBuilder artifactsBuilder = new DefaultResolvedArtifactsBuilder(buildProjectDependencies);
FileDependencyCollectingGraphVisitor fileDependencyVisitor = new FileDependencyCollectingGraphVisitor();
DependencyGraphVisitor graphVisitor = new CompositeDependencyGraphVisitor(oldModelVisitor, newModelBuilder, localComponentsVisitor, fileDependencyVisitor);
DependencyArtifactsVisitor artifactsVisitor = new CompositeDependencyArtifactsVisitor(oldModelVisitor, artifactsBuilder);
resolver.resolve(configuration, resolutionAwareRepositories, metadataHandler, Specs.<DependencyMetadata>satisfyAll(), graphVisitor, artifactsVisitor, attributesSchema);
ArtifactTransformer transformer = new ArtifactTransformer(configuration.getResolutionStrategy(), attributesSchema);
VisitedArtifactsResults artifactsResults = artifactsBuilder.complete();
results.graphResolved(newModelBuilder.complete(), localComponentsVisitor, new BuildDependenciesOnlyVisitedArtifactSet(artifactsResults, fileDependencyVisitor, transformer));
results.retainState(new ArtifactResolveState(oldModelBuilder.complete(), artifactsResults, fileDependencyVisitor, oldTransientModelBuilder));
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:31,代码来源:DefaultConfigurationResolver.java
示例10: createIncludeSpec
import org.gradle.api.specs.Specs; //导入依赖的package包/类
public Spec<FileTreeElement> createIncludeSpec(PatternSet patternSet) {
List<Spec<FileTreeElement>> allIncludeSpecs = new ArrayList<Spec<FileTreeElement>>(1 + patternSet.getIncludeSpecs().size());
if (!patternSet.getIncludes().isEmpty()) {
allIncludeSpecs.add(createSpec(patternSet.getIncludes(), true, patternSet.isCaseSensitive()));
}
allIncludeSpecs.addAll(patternSet.getIncludeSpecs());
return Specs.union(allIncludeSpecs);
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:12,代码来源:PatternSpecFactory.java
示例11: createSpec
import org.gradle.api.specs.Specs; //导入依赖的package包/类
protected Spec<FileTreeElement> createSpec(Collection<String> patterns, boolean include, boolean caseSensitive) {
if (patterns.isEmpty()) {
return include ? Specs.<FileTreeElement>satisfyAll() : Specs.<FileTreeElement>satisfyNone();
}
List<Spec<RelativePath>> matchers = new ArrayList<Spec<RelativePath>>(patterns.size());
for (String pattern : patterns) {
Spec<RelativePath> patternMatcher = PatternMatcherFactory.getPatternMatcher(include, caseSensitive, pattern);
matchers.add(patternMatcher);
}
return new RelativePathSpec(Specs.union(matchers));
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:14,代码来源:PatternSpecFactory.java
示例12: process
import org.gradle.api.specs.Specs; //导入依赖的package包/类
private <S extends TaskInternal> S process(S task) {
TaskClassInfo taskClassInfo = taskClassInfoStore.getTaskClassInfo(task.getClass());
if (taskClassInfo.isIncremental()) {
// Add a dummy upToDateWhen spec: this will force TaskOutputs.hasOutputs() to be true.
task.getOutputs().upToDateWhen(new Spec<Task>() {
public boolean isSatisfiedBy(Task element) {
return true;
}
});
}
for (Factory<Action<Task>> actionFactory : taskClassInfo.getTaskActions()) {
task.prependParallelSafeAction(actionFactory.create());
}
TaskClassValidator validator = taskClassInfo.getValidator();
if (validator.hasAnythingToValidate()) {
task.prependParallelSafeAction(validator);
validator.addInputsAndOutputs(task);
}
// Enabled caching if task type is annotated with @CacheableTask
if (taskClassInfo.isCacheable()) {
task.getOutputs().cacheIf(Specs.SATISFIES_ALL);
}
return task;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:30,代码来源:AnnotationProcessingTaskFactory.java
示例13: filesMatching
import org.gradle.api.specs.Specs; //导入依赖的package包/类
public CopySpec filesMatching(Iterable<String> patterns, Action<? super FileCopyDetails> action) {
if (!patterns.iterator().hasNext()) {
throw new InvalidUserDataException("must provide at least one pattern to match");
}
List<Spec> matchers = new ArrayList<Spec>();
for (String pattern : patterns) {
matchers.add(PatternMatcherFactory.getPatternMatcher(true, isCaseSensitive(), pattern));
}
Spec unionMatcher = Specs.union(matchers.toArray(new Spec[matchers.size()]));
return eachFile(new MatchingCopyAction(unionMatcher, action));
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:12,代码来源:DefaultCopySpec.java
示例14: filesNotMatching
import org.gradle.api.specs.Specs; //导入依赖的package包/类
public CopySpec filesNotMatching(Iterable<String> patterns, Action<? super FileCopyDetails> action) {
if (!patterns.iterator().hasNext()) {
throw new InvalidUserDataException("must provide at least one pattern to not match");
}
List<Spec> matchers = new ArrayList<Spec>();
for (String pattern : patterns) {
matchers.add(PatternMatcherFactory.getPatternMatcher(true, isCaseSensitive(), pattern));
}
Spec unionMatcher = Specs.union(matchers.toArray(new Spec[matchers.size()]));
return eachFile(new MatchingCopyAction(Specs.<RelativePath>negate(unionMatcher), action));
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:12,代码来源:DefaultCopySpec.java
示例15: configure
import org.gradle.api.specs.Specs; //导入依赖的package包/类
public void configure(BuildExecutionContext context) {
GradleInternal gradle = context.getGradle();
Set<String> excludedTaskNames = gradle.getStartParameter().getExcludedTaskNames();
if (!excludedTaskNames.isEmpty()) {
final Set<Spec<Task>> filters = new HashSet<Spec<Task>>();
for (String taskName : excludedTaskNames) {
filters.add(taskSelector.getFilter(taskName));
}
gradle.getTaskGraph().useFilter(Specs.intersect(filters));
}
context.proceed();
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:14,代码来源:ExcludedTaskFilteringBuildConfigurationAction.java
示例16: collectArtifacts
import org.gradle.api.specs.Specs; //导入依赖的package包/类
private void collectArtifacts(
Configuration configuration,
Map<ModuleVersionIdentifier,
List<ResolvedArtifact>> artifacts) {
Set<ResolvedArtifact> allArtifacts;
if (extraModelInfo.getMode() != 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:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:DependencyManager.java
示例17: getAsExcludeSpec
import org.gradle.api.specs.Specs; //导入依赖的package包/类
private Spec<RelativePath> getAsExcludeSpec(boolean caseSensitive) {
Collection<String> allExcludes = new LinkedHashSet<String>(myFilePattern.excludes);
List<Spec<RelativePath>> matchers = new ArrayList<Spec<RelativePath>>();
for (String exclude : allExcludes) {
Spec<RelativePath> patternMatcher = PatternMatcherFactory.getPatternMatcher(false, caseSensitive, exclude);
matchers.add(patternMatcher);
}
return Specs.or(false, matchers);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:GradleResourceFileFilter.java
示例18: getAsIncludeSpec
import org.gradle.api.specs.Specs; //导入依赖的package包/类
private Spec<RelativePath> getAsIncludeSpec(boolean caseSensitive) {
List<Spec<RelativePath>> matchers = new ArrayList<Spec<RelativePath>>();
for (String include : myFilePattern.includes) {
Spec<RelativePath> patternMatcher = PatternMatcherFactory.getPatternMatcher(true, caseSensitive, include);
matchers.add(patternMatcher);
}
return Specs.or(true, matchers);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:GradleResourceFileFilter.java
示例19: configure
import org.gradle.api.specs.Specs; //导入依赖的package包/类
public void configure(BuildExecutionContext context) {
GradleInternal gradle = context.getGradle();
Set<String> excludedTaskNames = gradle.getStartParameter().getExcludedTaskNames();
if (!excludedTaskNames.isEmpty()) {
final Set<Spec<Task>> filters = new HashSet<Spec<Task>>();
for (String taskName : excludedTaskNames) {
filters.add(taskSelector.getFilter(taskName));
}
gradle.getTaskGraph().useFilter(Specs.and(filters));
}
context.proceed();
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:14,代码来源:ExcludedTaskFilteringBuildConfigurationAction.java
示例20: GenerateMavenPom
import org.gradle.api.specs.Specs; //导入依赖的package包/类
@Inject
public GenerateMavenPom(FileResolver fileResolver) {
this.fileResolver = fileResolver;
// Never up to date; we don't understand the data structures.
getOutputs().upToDateWhen(Specs.satisfyNone());
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:8,代码来源:GenerateMavenPom.java
注:本文中的org.gradle.api.specs.Specs类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论