Java Code Examples for org.gradle.api.Action#execute()

The following examples show how to use org.gradle.api.Action#execute() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public static <T, I> T inject(T target, Iterable<? extends I> items, Action<InjectionStep<T, I>> action) {
    if (target == null) {
        throw new NullPointerException("The 'target' cannot be null");
    }
    if (items == null) {
        throw new NullPointerException("The 'items' cannot be null");
    }
    if (action == null) {
        throw new NullPointerException("The 'action' cannot be null");
    }

    for (I item : items) {
        action.execute(new InjectionStep<T, I>(target, item));
    }
    return target;
}
 
Example 2
public LocallyAvailableResource add(K key, Action<File> addAction) {
    //We cannot just delegate to the add method as we need the file content for checksum calculation here
    //and reexecuting the action isn't acceptable
    final File tempFile = getTempFile();
    addAction.execute(tempFile);
    final String groupedAndNamedKey = toPath(key, getChecksum(tempFile));
    return delegate.move(groupedAndNamedKey, tempFile);
}
 
Example 3
public boolean mustRefreshArtifact(ArtifactIdentifier artifactIdentifier, File cachedArtifactFile, long ageMillis, boolean belongsToChangingModule, boolean moduleDescriptorInSync) {
    CachedArtifactResolutionControl artifactResolutionControl = new CachedArtifactResolutionControl(artifactIdentifier, cachedArtifactFile, ageMillis, belongsToChangingModule);
    if(belongsToChangingModule && !moduleDescriptorInSync){
        return true;
    }
    for (Action<? super ArtifactResolutionControl> rule : artifactCacheRules) {
        rule.execute(artifactResolutionControl);
        if (artifactResolutionControl.ruleMatch()) {
            return artifactResolutionControl.mustCheck();
        }
    }
    return false;
}
 
Example 4
public static <R, I> Transformer<R, I> toTransformer(final Action<? super I> action) {
    return new Transformer<R, I>() {
        public R transform(I original) {
            action.execute(original);
            return null;
        }
    };
}
 
Example 5
@Override
protected void doOutOfDate(final Action<? super InputFileDetails> outOfDateAction) {
    for (TaskStateChange change : inputFilesState) {
        InputFileDetails fileChange = (InputFileDetails) change;
        if (fileChange.isRemoved()) {
            removedFiles.add(fileChange);
        } else {
            outOfDateAction.execute(fileChange);
        }
    }
}
 
Example 6
private void readResults(Decoder decoder, Action<? super TestClassResult> visitor) throws ClassNotFoundException, IOException {
    int classCount = decoder.readSmallInt();
    for (int i = 0; i < classCount; i++) {
        TestClassResult classResult = readClassResult(decoder);
        visitor.execute(classResult);
    }
}
 
Example 7
public void all(Action<? super T> action) {
    action = whenObjectAdded(action);

    // copy in case any actions mutate the store
    // linked list because the underlying store may preserve order
    Collection<T> copied = new LinkedList<T>(this);

    for (T t : copied) {
        action.execute(t);
    }
}
 
Example 8
private void processFile(FileVisitDetails visitDetails) {
    DefaultFileCopyDetails details = createDefaultFileCopyDetails(visitDetails);
    for (Action<? super FileCopyDetails> action : copySpecResolver.getAllCopyActions()) {
        action.execute(details);
        if (details.isExcluded()) {
            return;
        }
    }
    action.processFile(details);
}
 
Example 9
public List<String> getArgs() {
    List<String> transformedArgs = Lists.newArrayList(args);
    for (Action<List<String>> postArgsAction : postArgsActions) {
        postArgsAction.execute(transformedArgs);
    }
    return transformedArgs;
}
 
Example 10
/**
 * Visits a node in the graph.
 */
public void visit(Action<? super StyledTextOutput> node, boolean lastChild) {
    if (seenRootChildren) {
        output.withStyle(Info).text(prefix + (lastChild ? "\\--- " : "+--- "));
    }
    this.lastChild = lastChild;
    node.execute(output);
    output.println();
}
 
Example 11
public void configurations(Action<? super IvyConfigurationContainer> config) {
    config.execute(configurations);
}
 
Example 12
public void tools(Action<? super ToolsExtension> action) {
  action.execute(tools);
}
 
Example 13
Source Project: gradle-plugins   File: DefaultAspectjSourceSet.java    License: MIT License 4 votes vote down vote up
@Override
public AspectjSourceSet aspectj(Action<? super SourceDirectorySet> configureAction) {
    configureAction.execute(getAspectj());
    return this;
}
 
Example 14
@Override
public JavaScriptSourceSet javaScript(Action<? super SourceDirectorySet> configureAction) {
    configureAction.execute(getJavaScript());
    return this;
}
 
Example 15
/**
 * Adds services to this container using the given action.
 */
public void register(Action<? super ServiceRegistration> action) {
    action.execute(newRegistration());
}
 
Example 16
Source Project: atlas   File: AtlasExtension.java    License: Apache License 2.0 4 votes vote down vote up
public void atlasChannelConfigs(Action<? super NamedDomainObjectContainer<DefaultChannelConfig>> action) {
    action.execute(atlasChannelConfigs);
}
 
Example 17
public void execute(T item) {
    for (Action<? super T> action : actions) {
        action.execute(item);
    }
}
 
Example 18
Source Project: gradle-cpd-plugin   File: Cpd.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public CpdReports reports(Action<? super CpdReports> action) {
    action.execute(this.reports);
    return this.reports;
}
 
Example 19
public void transform(Writer destination, Action<? super Writer> generator) {
    StringWriter stringWriter = new StringWriter();
    generator.execute(stringWriter);
    transform(stringWriter.toString(), destination);
}
 
Example 20
public T configure(Action<? super T> action) {
    action.execute(extension);
    return extension;
}