org.gradle.api.internal.ClosureBackedAction Java Examples

The following examples show how to use org.gradle.api.internal.ClosureBackedAction. 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: NonTransformedModelDslBacking.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void registerConfigurationAction(final Closure<?> action) {
    modelRegistry.mutate(new ModelMutator<Object>() {
        public ModelReference<Object> getSubject() {
            return ModelReference.untyped(modelPath);
        }

        public void mutate(Object object, Inputs inputs) {
            new ClosureBackedAction<Object>(action).execute(object);
        }

        public ModelRuleDescriptor getDescriptor() {
            return new SimpleModelRuleDescriptor("model." + modelPath);
        }

        public List<ModelReference<?>> getInputs() {
            return Collections.emptyList();
        }
    });
}
 
Example #2
Source File: NonTransformedModelDslBacking.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void registerConfigurationAction(final Closure<?> action) {
    modelRegistry.mutate(new ModelMutator<Object>() {
        public ModelReference<Object> getSubject() {
            return ModelReference.untyped(modelPath);
        }

        public void mutate(Object object, Inputs inputs) {
            new ClosureBackedAction<Object>(action).execute(object);
        }

        public ModelRuleDescriptor getDescriptor() {
            return new SimpleModelRuleDescriptor("model." + modelPath);
        }

        public List<ModelReference<?>> getInputs() {
            return Collections.emptyList();
        }
    });
}
 
Example #3
Source File: NonTransformedModelDslBacking.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void configure(Closure<?> action) {
    executingDsl.set(true);
    try {
        new ClosureBackedAction<Object>(action).execute(this);
    } finally {
        executingDsl.set(false);
    }
}
 
Example #4
Source File: ClosureBackedModelMutator.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void mutate(final Object object, Inputs inputs) {
    RuleInputAccessBacking.runWithContext(inputs, new Runnable() {
        public void run() {
            new ClosureBackedAction<Object>(action).execute(object);
        }
    });
}
 
Example #5
Source File: GroovyModelDsl.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void configure(Closure<?> action) {
    executingDsl.set(true);
    try {
        new ClosureBackedAction<Object>(action).execute(this);
    } finally {
        executingDsl.set(false);
    }
}
 
Example #6
Source File: GroovyModelDsl.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void configure(Closure<?> action) {
    executingDsl.set(true);
    try {
        new ClosureBackedAction<Object>(action).execute(this);
    } finally {
        executingDsl.set(false);
    }
}
 
Example #7
Source File: NonTransformedModelDslBacking.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void configure(Closure<?> action) {
    executingDsl.set(true);
    try {
        new ClosureBackedAction<Object>(action).execute(this);
    } finally {
        executingDsl.set(false);
    }
}
 
Example #8
Source File: ClosureBackedModelMutator.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void mutate(final Object object, Inputs inputs) {
    RuleInputAccessBacking.runWithContext(inputs, new Runnable() {
        public void run() {
            new ClosureBackedAction<Object>(action).execute(object);
        }
    });
}
 
Example #9
Source File: DefaultMavenPom.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultMavenPom whenConfigured(final Closure closure) {
    whenConfiguredActions.add(new ClosureBackedAction<MavenPom>(closure));
    return this;
}
 
Example #10
Source File: DefaultCopySpec.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public CopySpec eachFile(Closure closure) {
    copyActions.add(new ClosureBackedAction<FileCopyDetails>(closure));
    return this;
}
 
Example #11
Source File: DefaultMavenRepositoryHandlerConvention.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public GroovyMavenDeployer mavenDeployer(Closure configureClosure) {
    return container.addRepository(createMavenDeployer(), DEFAULT_MAVEN_DEPLOYER_NAME, new ClosureBackedAction<GroovyMavenDeployer>(configureClosure));
}
 
Example #12
Source File: DefaultProjectConfigurationActionContainer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void add(Closure action) {
    add(new ClosureBackedAction<ProjectInternal>(action));
}
 
Example #13
Source File: AbstractMavenResolver.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void beforeDeployment(Closure action) {
    beforeDeploymentActions.add(new ClosureBackedAction<MavenDeployment>(action));
}
 
Example #14
Source File: DefaultMavenRepositoryHandlerConvention.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public GroovyMavenDeployer mavenDeployer(Map<String, ?> args, Closure configureClosure) {
    //noinspection unchecked
    return container.addRepository(createMavenDeployer(), DEFAULT_MAVEN_DEPLOYER_NAME, Actions.<GroovyMavenDeployer>composite(
            new ConfigureByMapAction<GroovyMavenDeployer>(args), new ClosureBackedAction<GroovyMavenDeployer>(configureClosure)
    ));
}
 
Example #15
Source File: DefaultMavenRepositoryHandlerConvention.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public GroovyMavenDeployer mavenDeployer(Closure configureClosure) {
    return container.addRepository(createMavenDeployer(), DEFAULT_MAVEN_DEPLOYER_NAME, new ClosureBackedAction<GroovyMavenDeployer>(configureClosure));
}
 
Example #16
Source File: ExtensionsStorage.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public <T> T configureExtension(String methodName, Object ... arguments) {
    Closure closure = (Closure) arguments[0];
    ClosureBackedAction<T> action = new ClosureBackedAction<T>(closure);
    ExtensionHolder<T> extensionHolder = extensions.get(methodName);
    return extensionHolder.configure(action);
}
 
Example #17
Source File: DefaultRepositoryHandler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public MavenArtifactRepository maven(Closure closure) {
    return maven(new ClosureBackedAction<MavenArtifactRepository>(closure));
}
 
Example #18
Source File: ExtensionsStorage.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public <T> T configureExtension(String methodName, Object ... arguments) {
    Closure closure = (Closure) arguments[0];
    ClosureBackedAction<T> action = new ClosureBackedAction<T>(closure);
    ExtensionHolder<T> extensionHolder = extensions.get(methodName);
    return extensionHolder.configure(action);
}
 
Example #19
Source File: MapFileTree.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * Adds an element to this tree. The given closure is passed an OutputStream which it can use to write the content
 * of the element to.
 */
public void add(String path, Closure contentClosure) {
    Action<OutputStream> action = new ClosureBackedAction<OutputStream>(contentClosure);
    add(path, action);
}
 
Example #20
Source File: ConfigureUtil.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private static <T> T configure(Closure configureClosure, T delegate, int resolveStrategy, boolean configureableAware) {
    ClosureBackedAction<T> action = new ClosureBackedAction<T>(configureClosure, resolveStrategy, configureableAware);
    action.execute(delegate);
    return delegate;
}
 
Example #21
Source File: DefaultManifestMergeSpec.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ManifestMergeSpec eachEntry(Closure mergeAction) {
    return eachEntry(new ClosureBackedAction<ManifestMergeDetails>(mergeAction));
}
 
Example #22
Source File: ConfigureUtil.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private static <T> T configure(Closure configureClosure, T delegate, int resolveStrategy, boolean configureableAware) {
    ClosureBackedAction<T> action = new ClosureBackedAction<T>(configureClosure, resolveStrategy, configureableAware);
    action.execute(delegate);
    return delegate;
}
 
Example #23
Source File: DefaultManifestMergeSpec.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ManifestMergeSpec eachEntry(Closure mergeAction) {
    return eachEntry(new ClosureBackedAction<ManifestMergeDetails>(mergeAction));
}
 
Example #24
Source File: DefaultRepositoryHandler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public FlatDirectoryArtifactRepository flatDir(Closure configureClosure) {
    return flatDir(new ClosureBackedAction<FlatDirectoryArtifactRepository>(configureClosure));
}
 
Example #25
Source File: ExtensionsStorage.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public T configure(Closure configuration) {
    return configure(new ClosureBackedAction<T>(configuration));
}
 
Example #26
Source File: ExtensionsStorage.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public <T> T configureExtension(String methodName, Object ... arguments) {
    Closure closure = (Closure) arguments[0];
    ClosureBackedAction<T> action = new ClosureBackedAction<T>(closure);
    ExtensionHolder<T> extensionHolder = extensions.get(methodName);
    return extensionHolder.configure(action);
}
 
Example #27
Source File: ConfigureUtil.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private static <T> T configure(Closure configureClosure, T delegate, int resolveStrategy, boolean configureableAware) {
    ClosureBackedAction<T> action = new ClosureBackedAction<T>(configureClosure, resolveStrategy, configureableAware);
    action.execute(delegate);
    return delegate;
}
 
Example #28
Source File: AbstractGradleExecuter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void afterExecute(Closure action) {
    afterExecute.add(new ClosureBackedAction<GradleExecuter>(action));
}
 
Example #29
Source File: DefaultCopySpec.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public CopySpec eachFile(Closure closure) {
    actions.add(new ClosureBackedAction<FileCopyDetails>(closure));
    return this;
}
 
Example #30
Source File: DefaultRepositoryHandler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public IvyArtifactRepository ivy(Closure closure) {
    return ivy(new ClosureBackedAction<IvyArtifactRepository>(closure));
}