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

The following examples show how to use org.gradle.api.Action#execute() . 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
Source File: CollectionUtils.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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
Source File: ChangesOnlyIncrementalTaskInputs.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@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 3
Source File: GraphRenderer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * 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 4
Source File: DefaultCommandLineToolInvocation.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public List<String> getArgs() {
    List<String> transformedArgs = Lists.newArrayList(args);
    for (Action<List<String>> postArgsAction : postArgsActions) {
        postArgsAction.execute(transformedArgs);
    }
    return transformedArgs;
}
 
Example 5
Source File: CopyFileVisitorImpl.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 6
Source File: DefaultDomainObjectCollection.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 7
Source File: TestResultSerializer.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 8
Source File: Transformers.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 9
Source File: DefaultCachePolicy.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 10
Source File: GroupedAndNamedUniqueFileStore.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 11
Source File: DefaultServiceRegistry.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * Adds services to this container using the given action.
 */
public void register(Action<? super ServiceRegistration> action) {
    action.execute(newRegistration());
}
 
Example 12
Source File: AtlasExtension.java    From atlas with Apache License 2.0 4 votes vote down vote up
public void atlasChannelConfigs(Action<? super NamedDomainObjectContainer<DefaultChannelConfig>> action) {
    action.execute(atlasChannelConfigs);
}
 
Example 13
Source File: DefaultJavaScriptSourceSet.java    From playframework with Apache License 2.0 4 votes vote down vote up
@Override
public JavaScriptSourceSet javaScript(Action<? super SourceDirectorySet> configureAction) {
    configureAction.execute(getJavaScript());
    return this;
}
 
Example 14
Source File: DefaultIvyPublication.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void configurations(Action<? super IvyConfigurationContainer> config) {
    config.execute(configurations);
}
 
Example 15
Source File: Actions.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void execute(T item) {
    for (Action<? super T> action : actions) {
        action.execute(item);
    }
}
 
Example 16
Source File: Cpd.java    From gradle-cpd-plugin with 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 17
Source File: XmlTransformer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void transform(Writer destination, Action<? super Writer> generator) {
    StringWriter stringWriter = new StringWriter();
    generator.execute(stringWriter);
    transform(stringWriter.toString(), destination);
}
 
Example 18
Source File: ExtensionsStorage.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public T configure(Action<? super T> action) {
    action.execute(extension);
    return extension;
}
 
Example 19
Source File: DefaultAspectjSourceSet.java    From gradle-plugins with MIT License 4 votes vote down vote up
@Override
public AspectjSourceSet aspectj(Action<? super SourceDirectorySet> configureAction) {
    configureAction.execute(getAspectj());
    return this;
}
 
Example 20
Source File: AppEngineAppYamlExtension.java    From app-gradle-plugin with Apache License 2.0 4 votes vote down vote up
public void tools(Action<? super ToolsExtension> action) {
  action.execute(tools);
}