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

x33g5p2x  于2022-01-29 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(149)

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

Task.getName介绍

暂无

代码示例

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

.matching(task -> task.getName().equals(JavaBasePlugin.CHECK_TASK_NAME))
.all(task -> task.dependsOn(rootCheckTask));

代码示例来源:origin: gradle.plugin.ru.javasaw/javasaw

@Override
  public boolean canConfigure(Task task) {
    return JavaPlugin.COMPILE_JAVA_TASK_NAME.equals(task.getName());
  }
}

代码示例来源:origin: gradle.plugin.org.shipkit/shipkit

@Override
  public boolean isSatisfiedBy(Task t) {
    return t.getName().equals(name);
  }
};

代码示例来源:origin: gradle.plugin.ru.javasaw/javasaw

@Override
  public boolean canConfigure(Task task) {
    return JavaPlugin.COMPILE_TEST_JAVA_TASK_NAME.equals(task.getName());
  }
}

代码示例来源:origin: gradle.plugin.ru.javasaw/javasaw

@Override
  public boolean canConfigure(Task task) {
    return JavaPlugin.TEST_TASK_NAME.equals(task.getName());
  }
}

代码示例来源:origin: org.shipkit/shipkit

/**
   * Task that matches any of the provided names
   */
  public static Spec<Task> withName(final String... names) {
    Set<String> namesSet = new HashSet<>(asList(names));
    return t -> namesSet.contains(t.getName());
  }
}

代码示例来源:origin: gradle.plugin.com.palantir.python/gradle-miniconda-plugin

public static String getCleanTaskName(Task task) {
  String name = task.getName();
  if (name.isEmpty()) {
    throw new IllegalArgumentException("Cannot have an empty name");
  }
  String firstChar = name.substring(0, 1);
  return "clean" + firstChar.toUpperCase() + name.substring(1);
}

代码示例来源: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: org.gradle/gradle-core

public void execute(Task task) {
    if (task.getName().equals(dependency)) {
      task.shouldRunAfter(finalPrevious);
    }
  }
});

代码示例来源:origin: io.freefair.gradle/android-gradle-plugins

private void configureTaskRule() {
  project.getTasks().withType(getCastedTaskType(), task -> {
    String prunedName = task.getName().replaceFirst(getTaskBaseName(), "");
    if (prunedName.isEmpty()) {
      prunedName = task.getName();
    }
    prunedName = ("" + prunedName.charAt(0)).toLowerCase() + prunedName.substring(1);
    configureTaskDefaults(task, prunedName);
  });
}

代码示例来源:origin: org.gradle/gradle-core

public boolean isSatisfiedBy(Task element) {
    if (!element.getName().equals(taskName)) {
      return true;
    }
    for (Project current = element.getProject(); current != null; current = current.getParent()) {
      if (current.equals(targetProject)) {
        return false;
      }
    }
    return true;
  }
}

代码示例来源:origin: org.gradle/gradle-core

public Set<? extends Task> getDependencies(Task task) {
    Set<Task> tasks = Sets.newHashSetWithExpectedSize(taskDependencyNames.size());
    for (String dependedOnTaskName : taskDependencyNames) {
      Task dependency = task.getProject().getTasks().findByName(dependedOnTaskName);
      if (dependency == null) {
        throw new UnknownTaskException(String.format("Imported Ant target '%s' depends on target or task '%s' which does not exist", task.getName(), dependedOnTaskName));
      }
      tasks.add(dependency);
    }
    return tasks;
  }
}

代码示例来源:origin: org.gradle/gradle-core

@Override
public void prepareForExecution(Task task) {
  assert task.getProject() == project;
  if (modelNode.hasLink(task.getName())) {
    realizeTask(MODEL_PATH.child(task.getName()), ModelNode.State.GraphClosed);
  }
}

代码示例来源:origin: gradle.plugin.ru.javasaw/javasaw

@Override
public void configure(Task task) {
  LOGGER.info("running configurer for :" + task.getName());
  GroovyCompile groovyCompile = (GroovyCompile) task;
  groovyCompile.doFirst(action -> {
    LOGGER.debug("groovy test compiler args " + groovyCompile.getOptions().getAllCompilerArgs());
  });
}

代码示例来源:origin: me.seeber.gradle/gradle-project-config

/**
 * Configure the eclipse task
 *
 * @param task Task to configure
 * @param pluginExtension Plugin extension
 */
@Mutate
public void configureTasks(@Each Task task, GradlePluginDevelopmentExtension pluginExtension) {
  if (task.getName().equals("eclipse")) {
    task.dependsOn("pluginUnderTestMetadata");
  }
}

代码示例来源:origin: gradle.plugin.me.seeber.gradle/gradle-project-config

/**
 * Configure the eclipse task
 *
 * @param task Task to configure
 * @param pluginExtension Plugin extension
 */
@Mutate
public void configureTasks(@Each Task task, GradlePluginDevelopmentExtension pluginExtension) {
  if (task.getName().equals("eclipse")) {
    task.dependsOn("pluginUnderTestMetadata");
  }
}

代码示例来源:origin: gradle.plugin.de.lukaskoerfer.gradle/debugging

private void createDebugTask(String taskName, Task targetTask, DebugConfiguration configuration) {
  Debug task = project.getTasks().create(taskName, Debug.class);
  task.setGroup(capitalize(DEBUG_TASK_GROUP));
  task.setDescription("Debugs the task '" + targetTask.getName() + "' with the '" + configuration.getName() + "' debug configuration");
  task.copyFrom(configuration);
  task.setTarget((JavaForkOptions) targetTask);
}

代码示例来源:origin: palantir/gradle-baseline

private static Task task(String projectName, String taskName) {
  Task task = Mockito.mock(Task.class, Mockito.RETURNS_DEEP_STUBS);
  when(task.getProject().getName()).thenReturn(projectName);
  when(task.getName()).thenReturn(taskName);
  return task;
}

代码示例来源:origin: gradle.plugin.de.lukaskoerfer.gradle/debugging

private void createDebugTasks(DebugConfiguration configuration) {
  debuggableTasks.all(targetTask -> {
    String taskName = configuration.getPrefix() + capitalize(targetTask.getName());
    createDebugTask(taskName, targetTask, configuration);
  });
}

代码示例来源:origin: gradle.plugin.ru.javasaw/javasaw

@Override
public void configure(Task task) {
  LOGGER.info("running configurer for :" + task.getName());
  JavaCompile javaCompile = (JavaCompile) task;
  ModuleDefinition moduleDefinition = moduleInfoService.getModuleFDefinition(javaCompile.getSource(), task.getProject().getName());
  javaCompile.doFirst(action -> {
    JavaSawExtension extension = (JavaSawExtension) project.getExtensions().getByName(JAVA_SAW_EXT_NAME);
    JavaCompileTaskArgs compilerArgs = argsPatcher.patch(javaCompile.getClasspath().getAsPath(), extension, moduleDefinition);
    javaCompile.getOptions().setCompilerArgs(compilerArgs.getCompilerResultArgs());
    LOGGER.debug("java compiler args " + javaCompile.getOptions().getAllCompilerArgs());
  });
}

相关文章