本文整理汇总了Java中org.gradle.tooling.model.Launchable类的典型用法代码示例。如果您正苦于以下问题:Java Launchable类的具体用法?Java Launchable怎么用?Java Launchable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Launchable类属于org.gradle.tooling.model包,在下文中一共展示了Launchable类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setLaunchables
import org.gradle.tooling.model.Launchable; //导入依赖的package包/类
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"));
}
}
// Tasks are ignored by providers if launchables is not null
this.launchables = launchablesParams.isEmpty() ? null : launchablesParams;
tasks = Lists.newArrayList(taskPaths);
return this;
}
示例2: setLaunchables
import org.gradle.tooling.model.Launchable; //导入依赖的package包/类
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;
}
示例3: forLaunchables
import org.gradle.tooling.model.Launchable; //导入依赖的package包/类
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;
}
示例4: getPublicTasks
import org.gradle.tooling.model.Launchable; //导入依赖的package包/类
/**
* Returns unmodifiable list with public tasks from Gradle project.
*
* @param projectModel
* gradle project model
* @return unmodifiable list which contains public tasks
* @see GradleTask
* @see Task
* @see Launchable
*/
public static List<String> getPublicTasks(GradleProject projectModel) {
checkNotNull(projectModel);
List<String> tasks = projectModel.getTasks()
.stream()
.filter(Launchable::isPublic)
.map(Task::getPath)
.collect(Collectors.toList());
return unmodifiableList(tasks);
}
示例5: maybeAddLaunchableParameter
import org.gradle.tooling.model.Launchable; //导入依赖的package包/类
private void maybeAddLaunchableParameter(List<InternalLaunchable> launchablesParams, Launchable launchable) {
Object original = launchable;
try {
if (Proxy.isProxyClass(launchable.getClass())) {
original = new ProtocolToModelAdapter().unpack(launchable);
}
} catch (IllegalArgumentException iae) {
// ignore: launchable created on consumer side for older provider
}
if (original instanceof InternalLaunchable) {
launchablesParams.add((InternalLaunchable) original);
}
}
示例6: forLaunchables
import org.gradle.tooling.model.Launchable; //导入依赖的package包/类
public BuildLauncher forLaunchables(Launchable... launchables) {
return forLaunchables(Arrays.asList(launchables));
}
示例7: preprocessLaunchables
import org.gradle.tooling.model.Launchable; //导入依赖的package包/类
protected void preprocessLaunchables(Iterable<? extends Launchable> launchables) {
}
示例8: forLaunchables
import org.gradle.tooling.model.Launchable; //导入依赖的package包/类
/**
* Sets the launchables to execute. If no entries are specified, the project's default tasks are executed.
*
* @param launchables The launchables for this build.
* @return this
* @since 1.12
*/
@Incubating
BuildLauncher forLaunchables(Launchable... launchables);