本文整理汇总了Java中org.gradle.tooling.model.GradleTask.getName方法的典型用法代码示例。如果您正苦于以下问题:Java GradleTask.getName方法的具体用法?Java GradleTask.getName怎么用?Java GradleTask.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.gradle.tooling.model.GradleTask
的用法示例。
在下文中一共展示了GradleTask.getName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newIdeaGradleProject
import org.gradle.tooling.model.GradleTask; //导入方法依赖的package包/类
/**
* Creates a new {@link IdeaGradleProject}.
* @param moduleName the name of the IDEA module.
* @param gradleProject the Gradle project.
* @param buildFile the build.gradle file.
* @param gradleVersion the version of Gradle used to sync the project.
*/
public static IdeaGradleProject newIdeaGradleProject(@NotNull String moduleName,
@NotNull GradleProject gradleProject,
@Nullable File buildFile,
@Nullable String gradleVersion) {
List<String> taskNames = Lists.newArrayList();
DomainObjectSet<? extends GradleTask> tasks = gradleProject.getTasks();
if (!tasks.isEmpty()) {
for (GradleTask task : tasks) {
String name = task.getName();
if (isNotEmpty(name)) {
taskNames.add(task.getProject().getPath() + SdkConstants.GRADLE_PATH_SEPARATOR + task.getName());
}
}
}
return new IdeaGradleProject(moduleName, taskNames, gradleProject.getPath(), buildFile, gradleVersion);
}
示例2: runSelectedTask
import org.gradle.tooling.model.GradleTask; //导入方法依赖的package包/类
private void runSelectedTask(String[] arguments) {
ISelection selection = viewer.getSelection();
Object obj = ((IStructuredSelection) selection).getFirstElement();
if (obj == null) {
return;
}
final GradleTask task = (GradleTask) obj;
GradleBuildJob buildJob = new GradleBuildJob("Running task " + task.getName(), project, task.getName()) {
@Override
protected void handleException(final Exception ex) {
displayErrorInProperThread(getSite().getShell(), "Task run Error", "Could not run task " + task.getName() + " : " + ex.getCause().getMessage());
}
};
buildJob.setArguments(arguments);
buildJob.doSchedule();
}
示例3: isAndroidProject
import org.gradle.tooling.model.GradleTask; //导入方法依赖的package包/类
private static boolean isAndroidProject(@NotNull IdeaModule module) {
// A Gradle project is an Android project is if has at least one task with name starting with 'android'.
for (GradleTask task : module.getGradleProject().getTasks()) {
String taskName = task.getName();
if (taskName != null && taskName.startsWith(ANDROID_TASK_NAME_PREFIX)) {
return true;
}
}
return false;
}
示例4: getText
import org.gradle.tooling.model.GradleTask; //导入方法依赖的package包/类
public String getText(Object obj) {
if (obj instanceof GradleTask) {
GradleTask task = (GradleTask) obj;
String text = task.getName();
if (task.getDescription() != null) {
text = text + " - " + task.getDescription();
}
return text;
}
return obj.toString();
}