當前位置: 首頁>>代碼示例>>Java>>正文


Java Project.task方法代碼示例

本文整理匯總了Java中org.gradle.api.Project.task方法的典型用法代碼示例。如果您正苦於以下問題:Java Project.task方法的具體用法?Java Project.task怎麽用?Java Project.task使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.gradle.api.Project的用法示例。


在下文中一共展示了Project.task方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doesNothingIfTaskSkipped

import org.gradle.api.Project; //導入方法依賴的package包/類
@Test
public void doesNothingIfTaskSkipped() throws IOException, TransformerException {
    Project project = ProjectBuilder.builder().withName("fooproject").withProjectDir(projectDir.getRoot()).build();
    Checkstyle checkstyle = createCheckstyleTask(project);

    checkstyle.setDidWork(false);

    StyleTaskTimer timer = mock(StyleTaskTimer.class);
    when(timer.getTaskTimeNanos(checkstyle)).thenReturn(FAILED_CHECKSTYLE_TIME_NANOS);

    File targetFile = new File(projectDir.getRoot(), "reports/report.xml");

    CircleStyleFinalizer finalizer = (CircleStyleFinalizer) project
            .task(ImmutableMap.of("type", CircleStyleFinalizer.class), "checkstyleTestCircleFinalizer");
    finalizer.setReportParser(CheckstyleReportHandler.PARSER);
    finalizer.setStyleTask(checkstyle);
    finalizer.setReporting(checkstyle);
    finalizer.setStyleTaskTimer(timer);
    finalizer.setTargetFile(targetFile);

    finalizer.createCircleReport();

    assertThat(targetFile).doesNotExist();
    assertThat(finalizer.getDidWork()).isFalse();
}
 
開發者ID:palantir,項目名稱:gradle-circle-style,代碼行數:26,代碼來源:CircleStyleFinalizerTests.java

示例2: translatesCheckstyleReport

import org.gradle.api.Project; //導入方法依賴的package包/類
@Test
public void translatesCheckstyleReport() throws IOException, TransformerException {
    Project project = ProjectBuilder.builder().withName("fooproject").withProjectDir(projectDir.getRoot()).build();
    Checkstyle checkstyle = createCheckstyleTask(project);

    checkstyle.setDidWork(true);

    StyleTaskTimer timer = mock(StyleTaskTimer.class);
    when(timer.getTaskTimeNanos(checkstyle)).thenReturn(FAILED_CHECKSTYLE_TIME_NANOS);

    File targetFile = new File(projectDir.getRoot(), "reports/report.xml");

    CircleStyleFinalizer finalizer = (CircleStyleFinalizer) project
            .task(ImmutableMap.of("type", CircleStyleFinalizer.class), "checkstyleTestCircleFinalizer");
    finalizer.setReportParser(CheckstyleReportHandler.PARSER);
    finalizer.setStyleTask(checkstyle);
    finalizer.setReporting(checkstyle);
    finalizer.setStyleTaskTimer(timer);
    finalizer.setTargetFile(targetFile);

    finalizer.createCircleReport();

    String report = Resources.toString(targetFile.toURI().toURL(), UTF_8);
    String expectedReport = Resources.toString(testFile("two-namecheck-failures-checkstyle-report.xml"), UTF_8);

    assertThat(report).isEqualTo(expectedReport);
}
 
開發者ID:palantir,項目名稱:gradle-circle-style,代碼行數:28,代碼來源:CircleStyleFinalizerTests.java

示例3: apply

import org.gradle.api.Project; //導入方法依賴的package包/類
@Override
public void apply(Project target) {
    project = target;
    String lifecycleTaskName = getLifecycleTaskName();
    lifecycleTask = target.task(lifecycleTaskName);
    lifecycleTask.setGroup("IDE");
    cleanTask = target.task(cleanName(lifecycleTaskName));
    cleanTask.setGroup("IDE");
    onApply(target);
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:11,代碼來源:IdePlugin.java

示例4: createBinaryLifecycleTask

import org.gradle.api.Project; //導入方法依賴的package包/類
private void createBinaryLifecycleTask(SourceSet sourceSet, Project target) {
    sourceSet.compiledBy(sourceSet.getClassesTaskName());

    Task binaryLifecycleTask = target.task(sourceSet.getClassesTaskName());
    binaryLifecycleTask.setGroup(LifecycleBasePlugin.BUILD_GROUP);
    binaryLifecycleTask.setDescription("Assembles " + sourceSet.getOutput() + ".");
    binaryLifecycleTask.dependsOn(sourceSet.getOutput().getDirs());
    binaryLifecycleTask.dependsOn(sourceSet.getCompileJavaTaskName());
    binaryLifecycleTask.dependsOn(sourceSet.getProcessResourcesTaskName());
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:11,代碼來源:JavaBasePlugin.java

示例5: apply

import org.gradle.api.Project; //導入方法依賴的package包/類
@Override
public void apply(Project project) {
    project.getExtensions().create("audit", AuditExtensions.class);
    Task audit = project.task("audit");
    audit.doLast(this::doAudit);
}
 
開發者ID:OSSIndex,項目名稱:ossindex-gradle-plugin,代碼行數:7,代碼來源:OssIndexPlugin.java


注:本文中的org.gradle.api.Project.task方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。