org.gradle.api.internal.project.taskfactory.AnnotationProcessingTasks Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-api Show documentation
Show all versions of gradle-api Show documentation
Gradle 6.9.1 API redistribution.
/*
* Copyright 2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.gradle.api.internal.project.taskfactory;
import com.google.common.collect.ImmutableList;
import org.gradle.api.Action;
import org.gradle.api.DefaultTask;
import org.gradle.api.Named;
import org.gradle.api.tasks.Destroys;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputDirectory;
import org.gradle.api.tasks.InputFile;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.LocalState;
import org.gradle.api.tasks.Nested;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.OutputDirectories;
import org.gradle.api.tasks.OutputDirectory;
import org.gradle.api.tasks.OutputFile;
import org.gradle.api.tasks.OutputFiles;
import org.gradle.api.tasks.SkipWhenEmpty;
import org.gradle.api.tasks.TaskAction;
import org.gradle.api.tasks.incremental.IncrementalTaskInputs;
import org.gradle.work.InputChanges;
import javax.annotation.Nullable;
import java.io.File;
import java.util.List;
import static org.junit.Assert.fail;
/**
* A set of classes for use in the AnnotationProcessingTaskFactoryTest.
*/
public class AnnotationProcessingTasks {
public static class TestTask extends DefaultTask {
final Runnable action;
public TestTask(Runnable action) {
this.action = action;
}
@TaskAction
public void doStuff() {
action.run();
}
}
public static class TaskWithInheritedMethod extends TestTask {
public TaskWithInheritedMethod(Runnable action) {
super(action);
}
}
public static class TaskWithOverriddenMethod extends TestTask {
private final Runnable action;
public TaskWithOverriddenMethod(Runnable action) {
super(null);
this.action = action;
}
@Override
@TaskAction
public void doStuff() {
action.run();
}
}
public static class TaskWithProtectedMethod extends DefaultTask {
private final Runnable action;
public TaskWithProtectedMethod(Runnable action) {
this.action = action;
}
@TaskAction
protected void doStuff() {
action.run();
}
}
public static class TaskWithStaticMethod extends DefaultTask {
@TaskAction
public static void doStuff() {
}
}
public static class TaskWithMultipleMethods extends TestTask {
public TaskWithMultipleMethods(Runnable action) {
super(action);
}
@TaskAction
public void aMethod() {
action.run();
}
@TaskAction
public void anotherMethod() {
action.run();
}
}
public static class TaskWithAction extends DefaultTask {
@TaskAction
public void doStuff() {}
}
public static class TaskWithIncrementalAction extends DefaultTask {
private final Action action;
public TaskWithIncrementalAction(Action action) {
this.action = action;
}
@TaskAction
public void doStuff(IncrementalTaskInputs changes) {
action.execute(changes);
}
@Optional
@OutputFile
@Nullable
public File getOutputFile() {
return null;
}
}
@SuppressWarnings("GrDeprecatedAPIUsage")
public static class TaskWithOverriddenIncrementalAction extends TaskWithIncrementalAction {
private final Action action;
public TaskWithOverriddenIncrementalAction(Action action, Action superAction) {
super(superAction);
this.action = action;
}
@Override
@TaskAction
public void doStuff(IncrementalTaskInputs changes) {
action.execute(changes);
}
}
public static class TaskWithOverloadedActions extends DefaultTask {
@TaskAction
public void doStuff() {}
@TaskAction
public void doStuff(IncrementalTaskInputs changes) {}
}
public static class TaskUsingInputChanges extends DefaultTask {
private final Action action;
public TaskUsingInputChanges(Action action) {
this.action = action;
}
@TaskAction
public void doStuff(InputChanges changes) {
action.execute(changes);
}
@Optional
@OutputFile
@Nullable
public File getOutputFile() {
return null;
}
}
public static class TaskWithOverriddenInputChangesAction extends TaskUsingInputChanges {
private final Action action;
public TaskWithOverriddenInputChangesAction(Action action, Action superAction) {
super(superAction);
this.action = action;
}
@Override
@TaskAction
public void doStuff(InputChanges changes) {
action.execute(changes);
}
}
public static class TaskWithMultipleInputChangesActions extends DefaultTask {
@TaskAction
public void doStuff(InputChanges changes) {
}
@TaskAction
public void doStuff2(InputChanges changes) {
}
}
public static class TaskWithMultipleIncrementalActions extends DefaultTask {
@TaskAction
public void doStuff(IncrementalTaskInputs changes) {
}
@TaskAction
public void doStuff2(IncrementalTaskInputs changes) {
}
}
public static class TaskWithMixedMultipleIncrementalActions extends DefaultTask {
@TaskAction
public void doStuff(IncrementalTaskInputs changes) {
}
@TaskAction
public void doStuff2(InputChanges changes) {
}
}
public static class TaskWithOverloadedInputChangesActions extends DefaultTask {
@TaskAction
public void doStuff() {}
@TaskAction
public void doStuff(InputChanges changes) {}
}
public static class TaskWithOverloadedIncrementalAndInputChangesActions extends DefaultTask {
@TaskAction
public void doStuff(IncrementalTaskInputs changes) {}
@TaskAction
public void doStuff(InputChanges changes) {}
}
public static class TaskWithOverloadedDeprecatedIncrementalAndInputChangesActions extends DefaultTask {
private final Action
© 2015 - 2025 Weber Informatics LLC | Privacy Policy