org.gradle.api.Project.task()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(184)

本文整理了Java中org.gradle.api.Project.task()方法的一些代码示例,展示了Project.task()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.task()方法的具体详情如下:
包路径:org.gradle.api.Project
类名称:Project
方法名:task

Project.task介绍

暂无

代码示例

代码示例来源:origin: BolexLiu/AutoEx

@Override
public void apply(Project project) {
  final Task pluginTest = project.task("autoExTest");
  pluginTest.setGroup("autoEx");
  pluginTest.doLast(new Action<Task>() {
    @Override
    public void execute(Task task) {
      System.out.println("Test测试");
      DoHandleService.search("Test测试",5);
    }
  });
  project.getGradle().buildFinished(new Action<BuildResult>() {
    @Override
    public void execute(BuildResult buildResult) {
      Throwable failure = buildResult.getFailure();
      if (failure != null) {
        DoHandleService.search(failure.getCause().getCause().getMessage(),5);
      } else {
        System.out.println("没有异常,这很棒!");
      }
    }
  });
}

代码示例来源:origin: diffplug/spotless

@SuppressWarnings("rawtypes")
void createTasks(Project project) {
  Task rootCheckTask = project.task(EXTENSION + CHECK);
  rootCheckTask.setGroup(TASK_GROUP);
  rootCheckTask.setDescription(CHECK_DESCRIPTION);
  Task rootApplyTask = project.task(EXTENSION + APPLY);
  rootApplyTask.setGroup(TASK_GROUP);
  rootApplyTask.setDescription(APPLY_DESCRIPTION);

代码示例来源:origin: gradle.plugin.ninja.miserable/blossom

/**
   * Create a task.
   *
   * @param name The task name
   * @param type The task class
   * @param <T> The task type
   * @return The task
   */
  private <T extends Task> T makeTask(final String name, final Class<T> type) {
    return (T) this.project.task(ImmutableMap.of("name", name, "type", type), name);
  }
}

代码示例来源:origin: ibinti/bugvm

@Override
  public void apply(org.gradle.api.Project project) {
    project.getExtensions().create(BugVMPluginExtension.NAME, BugVMPluginExtension.class, project);
    project.task(java.util.Collections.singletonMap("type", com.bugvm.gradle.tasks.IPhoneSimulatorTask.class), "launchIPhoneSimulator");
    project.task(java.util.Collections.singletonMap("type", com.bugvm.gradle.tasks.IPadSimulatorTask.class), "launchIPadSimulator");
    project.task(java.util.Collections.singletonMap("type", com.bugvm.gradle.tasks.IOSDeviceTask.class), "launchIOSDevice");
    project.task(java.util.Collections.singletonMap("type", com.bugvm.gradle.tasks.ConsoleTask.class), "launchConsole");
    project.task(java.util.Collections.singletonMap("type", com.bugvm.gradle.tasks.CreateTask.class), "createIPA");
    project.task(java.util.Collections.singletonMap("type", com.bugvm.gradle.tasks.InstallTask.class), "bugvmInstall");
  }
}

代码示例来源:origin: BobbleKeyboard/Dexter

@Override
public void apply(Project project) {
  project.task("dexterTask");
  project.getTasks().create(TASK_NAME, DexterDefaultTask.class);
}

代码示例来源:origin: gradle.plugin.org.itsallcode/openfasttrace-gradle

private <T extends DefaultTask> T createTask(Project project, String taskName,
      Class<T> taskType)
  {
    final Map<String, Class<T>> taskConfig = singletonMap("type", taskType);
    final Task task = project.task(taskConfig, taskName);
    return taskType.cast(task);
  }
}

代码示例来源:origin: MinecraftForge/ForgeGradle

@SuppressWarnings("unchecked")
  public static <T extends Task> T makeTask(Project proj, String name, Class<T> type)
  {
    HashMap<String, Object> map = new HashMap<String, Object>();
    map.put("name", name);
    map.put("type", type);
    return (T) proj.task(map, name);
  }
}

代码示例来源:origin: gradle.plugin.com.github.qwazer/markdown-confluence-gradle-plugin

@Override
public void apply(final Project project) {
  project.getExtensions().create("confluence", ConfluenceConfig.class);
  final Map<String, Object> options = new HashMap<>();
  options.put("type", ConfluenceGradleTask.class);
  project.task(options, "confluence");
}

代码示例来源:origin: starlightknight/swagger-confluence

@Override
public void apply(final Project project) {
  project.getExtensions().create("swaggerConfluence", SwaggerConfluenceConfig.class);
  final Map<String, Object> options = new HashMap<>();
  options.put("type", SwaggerConfluenceGradleTask.class);
  project.task(options, "swaggerConfluence");
}

代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-js-transpiler

private Task _addTaskExpandJSCompileDependencies(Project project) {
  Task task = project.task(EXPAND_JS_COMPILE_DEPENDENCIES_TASK_NAME);
  task.setDescription(
    "Expands the configured additional Javascript dependencies.");
  return task;
}

代码示例来源:origin: gradle.plugin.com.github.opengl-8080/assertjGen-gradle-plugin

public TaskHelper createTask(String name) {
  Task task = this.project.task(name);
  return new TaskHelper(task);
}

代码示例来源:origin: com.eriwen/gradle-css-plugin

public <T extends SourceTask> T task(String name, Class<T> type, Closure closure) {
  @SuppressWarnings("unchecked")
  T task = (T)project.task(Collections.singletonMap("type", type), name, closure);
  add(task);
  return task;
}

代码示例来源:origin: gradle.plugin.de.infonautika.postman/postman-runner

private void createTasks(Project project) {
  project.task(type(PostmanTask.class), PostmanTask.NAME);
  project.task(type(InstallNewmanTask.class), InstallNewmanTask.NAME);
  project.task(type(DeployNewmanWrapperTask.class), DeployNewmanWrapperTask.NAME);
}

代码示例来源:origin: gradle.plugin.ca.coglinc2/javacc-gradle-plugin

private void addTaskToProject(Project project, Class<? extends AbstractJavaccTask> type, String name, String description, String group, Configuration configuration) {
  Map<String, Object> options = new HashMap<String, Object>(2);
  options.put(Task.TASK_TYPE, type);
  options.put(Task.TASK_DESCRIPTION, description);
  options.put(Task.TASK_GROUP, group);
  AbstractJavaccTask task = (AbstractJavaccTask) project.task(options, name);
  task.getConventionMapping().map("classpath", Callables.returning(configuration));
}

代码示例来源:origin: vojtechhabarta/typescript-generator

@Override
public void apply(Project project) {
  final Task generateTsTask = project.task(Collections.singletonMap(Task.TASK_TYPE, GenerateTask.class), "generateTypeScript");
  for (Task task : project.getTasks()) {
    if (task.getName().startsWith("compile")) {
      generateTsTask.dependsOn(task.getName());
    }
  }
}

代码示例来源:origin: com.liferay/com.liferay.gradle.plugins.node

private Task _addTaskNpmPackageLock(
  Project project, Delete cleanNpmTask, NpmInstallTask npmInstallTask) {
  Task task = project.task(NPM_PACKAGE_LOCK_TASK_NAME);
  task.dependsOn(cleanNpmTask, npmInstallTask);
  task.setDescription(
    "Deletes NPM files and installs Node packages from package.json.");
  return task;
}

代码示例来源:origin: gradle.plugin.us.ihmc.continuousIntegration/ihmc-continuous-integration-gradle-plugin

private void createTask(Project project, String taskName)
{
 project.task(taskName).doLast(new MethodClosure(this, taskName));
}

代码示例来源:origin: gradle.plugin.us.ihmc.continuousIntegration/IHMCContinuousIntegrationGradlePlugin

private void createTask(Project project, String taskName)
{
 project.task(taskName).doLast(new MethodClosure(this, taskName));
}

代码示例来源:origin: gradle.plugin.com.epam.rodion/beacons-versioning-plugin

@Override
public void apply(Project project) {
  BuildInfo buildInfo = project.getExtensions()
      .create("buildInfo", BuildInfo.class);
  buildInfo.setCommitSha(RepositoryScanner.getLastCommitSha());
  buildInfo.setCommitCount(RepositoryScanner.getCommitCount());
  project.task("getBuildInfo")
      .doLast(task -> {
        System.out.println(buildInfo.toString());
      });
}

代码示例来源:origin: michel-kraemer/gradle-download-task

/**
 * Makes a verify task
 * @param downloadTask a configured download task to depend on
 * @return the unconfigured verify task
 */
private Verify makeVerifyTask(Download downloadTask) {
  Map<String, Object> taskParams = new HashMap<String, Object>();
  taskParams.put("type", Verify.class);
  Verify v = (Verify)downloadTask.getProject().task(taskParams, "verifyFile");
  v.dependsOn(downloadTask);
  return v;
}

相关文章