org.gradle.tooling.model.Task Java Examples

The following examples show how to use org.gradle.tooling.model.Task. 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: DefaultBuildLauncher.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public BuildLauncher forLaunchables(Iterable<? extends Launchable> launchables) {
    Set<String> taskPaths = new LinkedHashSet<String>();
    List<InternalLaunchable> launchablesParams = Lists.newArrayList();
    for (Launchable launchable : launchables) {
        if (launchable instanceof Task) {
            taskPaths.add(((Task) launchable).getPath());
        } else if (launchable instanceof TaskListingLaunchable) {
            taskPaths.addAll(((TaskListingLaunchable) launchable).getTaskNames());
        } else if (!(launchable instanceof TaskSelector)) {
            throw new GradleException("Only Task or TaskSelector instances are supported: "
                    + (launchable != null ? launchable.getClass() : "null"));
        }
        maybeAddLaunchableParameter(launchablesParams, launchable);
    }
    operationParamsBuilder.setTasks(new ArrayList<String>(taskPaths));
    operationParamsBuilder.setLaunchables(launchablesParams);
    return this;
}
 
Example #2
Source File: ConsumerOperationParameters.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public Builder setLaunchables(Iterable<? extends Launchable> launchables) {
    Set<String> taskPaths = new LinkedHashSet<String>();
    List<InternalLaunchable> launchablesParams = Lists.newArrayList();
    for (Launchable launchable : launchables) {
        Object original = new ProtocolToModelAdapter().unpack(launchable);
        if (original instanceof InternalLaunchable) {
            // A launchable created by the provider - just hand it back
            launchablesParams.add((InternalLaunchable) original);
        } else if (original instanceof TaskListingLaunchable) {
            // A launchable synthesized by the consumer - unpack it into a set of task names
            taskPaths.addAll(((TaskListingLaunchable) original).getTaskNames());
        } else if (launchable instanceof Task) {
            // A task created by a provider that does not understand launchables
            taskPaths.add(((Task) launchable).getPath());
        } else {
            throw new GradleException("Only Task or TaskSelector instances are supported: "
                    + (launchable != null ? launchable.getClass() : "null"));
        }
    }
    this.launchables = launchablesParams;
    tasks = Lists.newArrayList(taskPaths);
    return this;
}
 
Example #3
Source File: ConsumerOperationParameters.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public Builder setLaunchables(Iterable<? extends Launchable> launchables) {
    Set<String> taskPaths = new LinkedHashSet<String>();
    List<InternalLaunchable> launchablesParams = Lists.newArrayList();
    for (Launchable launchable : launchables) {
        Object original = new ProtocolToModelAdapter().unpack(launchable);
        if (original instanceof InternalLaunchable) {
            // A launchable created by the provider - just hand it back
            launchablesParams.add((InternalLaunchable) original);
        } else if (original instanceof TaskListingLaunchable) {
            // A launchable synthesized by the consumer - unpack it into a set of task names
            taskPaths.addAll(((TaskListingLaunchable) original).getTaskNames());
        } else if (launchable instanceof Task) {
            // A task created by a provider that does not understand launchables
            taskPaths.add(((Task) launchable).getPath());
        } else {
            throw new GradleException("Only Task or TaskSelector instances are supported: "
                    + (launchable != null ? launchable.getClass() : "null"));
        }
    }
    this.launchables = launchablesParams;
    tasks = Lists.newArrayList(taskPaths);
    return this;
}
 
Example #4
Source File: DefaultBuildLauncher.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public BuildLauncher forLaunchables(Iterable<? extends Launchable> launchables) {
    Set<String> taskPaths = new LinkedHashSet<String>();
    List<InternalLaunchable> launchablesParams = Lists.newArrayList();
    for (Launchable launchable : launchables) {
        if (launchable instanceof Task) {
            taskPaths.add(((Task) launchable).getPath());
        } else if (launchable instanceof TaskListingLaunchable) {
            taskPaths.addAll(((TaskListingLaunchable) launchable).getTaskNames());
        } else if (!(launchable instanceof TaskSelector)) {
            throw new GradleException("Only Task or TaskSelector instances are supported: "
                    + (launchable != null ? launchable.getClass() : "null"));
        }
        maybeAddLaunchableParameter(launchablesParams, launchable);
    }
    operationParamsBuilder.setTasks(new ArrayList<String>(taskPaths));
    operationParamsBuilder.setLaunchables(launchablesParams);
    return this;
}
 
Example #5
Source File: DefaultBuildLauncher.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public BuildLauncher forTasks(Iterable<? extends Task> tasks) {
    List<String> taskPaths = new ArrayList<String>();
    for (Task task : tasks) {
        taskPaths.add(task.getPath());
    }
    operationParamsBuilder.setTasks(taskPaths);
    return this;
}
 
Example #6
Source File: DefaultBuildLauncher.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public BuildLauncher forTasks(Iterable<? extends Task> tasks) {
    List<String> taskPaths = new ArrayList<String>();
    for (Task task : tasks) {
        taskPaths.add(task.getPath());
    }
    operationParamsBuilder.setTasks(taskPaths);
    return this;
}
 
Example #7
Source File: GradleConnector.java    From MSPaintIDE with MIT License 4 votes vote down vote up
public List<String> getGradleTaskNames() {
    List<String> taskNames = new ArrayList<>();
    List<GradleTask> tasks = getGradleTasks();
    return tasks.stream().map(Task::getName).collect(Collectors.toList());
}
 
Example #8
Source File: DefaultBuildLauncher.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public BuildLauncher forTasks(Task... tasks) {
    forTasks(Arrays.asList(tasks));
    return this;
}
 
Example #9
Source File: BuildInvocations.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Incubating
DomainObjectSet<? extends Task> getTasks();
 
Example #10
Source File: DefaultBuildLauncher.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public BuildLauncher forTasks(Iterable<? extends Task> tasks) {
    operationParamsBuilder.setLaunchables(tasks);
    return this;
}
 
Example #11
Source File: DefaultBuildLauncher.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public BuildLauncher forTasks(Task... tasks) {
    forTasks(Arrays.asList(tasks));
    return this;
}
 
Example #12
Source File: BuildInvocations.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Incubating
DomainObjectSet<? extends Task> getTasks();
 
Example #13
Source File: DefaultBuildLauncher.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public BuildLauncher forTasks(Task... tasks) {
    forTasks(Arrays.asList(tasks));
    return this;
}
 
Example #14
Source File: BuildInvocations.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Incubating
DomainObjectSet<? extends Task> getTasks();
 
Example #15
Source File: DefaultBuildLauncher.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public BuildLauncher forTasks(Iterable<? extends Task> tasks) {
    operationParamsBuilder.setLaunchables(tasks);
    return this;
}
 
Example #16
Source File: DefaultBuildLauncher.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public BuildLauncher forTasks(Task... tasks) {
    forTasks(Arrays.asList(tasks));
    return this;
}
 
Example #17
Source File: BuildInvocations.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Incubating
DomainObjectSet<? extends Task> getTasks();
 
Example #18
Source File: BuildLauncher.java    From pushfish-android with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * Sets the tasks to be executed. If no tasks are specified, the project's default tasks are executed.
 *
 * <p>Note that the supplied tasks do not necessarily need to belong to the project which this launcher was created for.
 *
 * @param tasks The tasks to be executed.
 * @return this
 * @since 1.0-milestone-3
 */
BuildLauncher forTasks(Task... tasks);
 
Example #19
Source File: BuildLauncher.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * Sets the tasks to be executed. If no tasks are specified, the project's default tasks are executed.
 *
 * <p>Note that the supplied tasks do not necessarily need to belong to the project which this launcher was created for.
 *
 * @param tasks The tasks to be executed.
 * @return this
 * @since 1.0-milestone-3
 */
BuildLauncher forTasks(Task... tasks);
 
Example #20
Source File: BuildLauncher.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * Sets the tasks to be executed. If no tasks are specified, the project's default tasks are executed.
 *
 * <p>Note that the supplied tasks do not necessarily need to belong to the project which this launcher was created for.
 *
 * @param tasks The tasks to be executed.
 * @return this
 * @since 1.0-milestone-3
 */
BuildLauncher forTasks(Iterable<? extends Task> tasks);
 
Example #21
Source File: BuildLauncher.java    From pushfish-android with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * Sets the tasks to be executed. If no tasks are specified, the project's default tasks are executed.
 *
 * <p>Note that the supplied tasks do not necessarily need to belong to the project which this launcher was created for.
 *
 * @param tasks The tasks to be executed.
 * @return this
 * @since 1.0-milestone-3
 */
BuildLauncher forTasks(Iterable<? extends Task> tasks);
 
Example #22
Source File: BuildLauncher.java    From pushfish-android with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * Sets the tasks to be executed. If no tasks are specified, the project's default tasks are executed.
 *
 * <p>Note that the supplied tasks do not necessarily need to belong to the project which this launcher was created for.
 *
 * @param tasks The tasks to be executed.
 * @return this
 * @since 1.0-milestone-3
 */
BuildLauncher forTasks(Task... tasks);
 
Example #23
Source File: BuildLauncher.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * Sets the tasks to be executed. If no tasks are specified, the project's default tasks are executed.
 *
 * <p>Note that the supplied tasks do not necessarily need to belong to the project which this launcher was created for.
 *
 * @param tasks The tasks to be executed.
 * @return this
 * @since 1.0-milestone-3
 */
BuildLauncher forTasks(Task... tasks);
 
Example #24
Source File: BuildLauncher.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * Sets the tasks to be executed. If no tasks are specified, the project's default tasks are executed.
 *
 * <p>Note that the supplied tasks do not necessarily need to belong to the project which this launcher was created for.
 *
 * @param tasks The tasks to be executed.
 * @return this
 * @since 1.0-milestone-3
 */
BuildLauncher forTasks(Iterable<? extends Task> tasks);
 
Example #25
Source File: BuildLauncher.java    From pushfish-android with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * Sets the tasks to be executed. If no tasks are specified, the project's default tasks are executed.
 *
 * <p>Note that the supplied tasks do not necessarily need to belong to the project which this launcher was created for.
 *
 * @param tasks The tasks to be executed.
 * @return this
 * @since 1.0-milestone-3
 */
BuildLauncher forTasks(Iterable<? extends Task> tasks);