Java 类org.gradle.api.UnknownTaskException 实例源码

项目:gradle-circle-style    文件:CircleStylePlugin.java   
private static <T extends Task> T createTask(TaskContainer tasks, String preferredName, Class<T> type) {
    String name = preferredName;
    int count = 1;
    while (true) {
        try {
            Task existingTask = tasks.getByName(name);
            if (type.isInstance(existingTask)) {
                return null;
            }
        } catch (UnknownTaskException e) {
            return tasks.create(name, type);
        }
        count++;
        name = preferredName + count;
    }
}
项目:Reer    文件:DefaultTaskContainer.java   
@Override
public Task resolveTask(TaskReference reference) {
    for (TaskReferenceResolver taskResolver : project.getServices().getAll(TaskReferenceResolver.class)) {
        Task constructed = taskResolver.constructTask(reference, this);
        if (constructed != null) {
            return constructed;
        }
    }

    throw new UnknownTaskException(String.format("Task reference '%s' could not be resolved in %s.", reference.getName(), project));
}
项目:Reer    文件:DefaultTaskContainer.java   
public Task getByPath(String path) throws UnknownTaskException {
    Task task = findByPath(path);
    if (task == null) {
        throw new UnknownTaskException(String.format("Task with path '%s' not found in %s.", path, project));
    }
    return task;
}
项目:junit-reporter    文件:TestHTMLReporterPlugin.java   
private void addFinalizedBy(String taskName, Project project, TestHTMLReporterPluginTask junit5HTMLReport) {
    try {
        Task task = project.getTasks().getByName(taskName);
        task.finalizedBy(junit5HTMLReport);
    } catch (UnknownTaskException e) {
        System.out.println("unable to finalize " + taskName);
    }
}
项目:Pushjet-Android    文件:AntTarget.java   
private Set<Task> getAntTargetDependencies() {
    Set<Task> tasks = new LinkedHashSet<Task>();
    Enumeration dependencies = target.getDependencies();
    while (dependencies.hasMoreElements()) {
        String name = (String) dependencies.nextElement();
        Task dependency = getProject().getTasks().findByName(name);
        if (dependency == null) {
            throw new UnknownTaskException(String.format("Imported Ant target '%s' depends on target or task '%s' which does not exist", getName(), name));
        }
        tasks.add(dependency);
    }
    return tasks;
}
项目:Reer    文件:DefaultTaskCollection.java   
@Override
protected UnknownDomainObjectException createNotFoundException(String name) {
    return new UnknownTaskException(String.format("Task with name '%s' not found in %s.", name, project));
}
项目:crnk-framework    文件:TSGeneratorPlugin.java   
void setupPackageTasks(Project project, Task generateTask) {
    final File buildDir = new File(project.getBuildDir(), "npm_compile");
    final File distDir = getNpmOutputDir(project);

    project.getTasks().create(PublishTypescriptStubsTask.NAME, PublishTypescriptStubsTask.class);
    TSGeneratorConfig config = project.getExtensions().getByType(TSGeneratorConfig.class);

    Copy copySources = project.getTasks().create("processTypescript", Copy.class);
    copySources.from(config.getGenDir());
    copySources.into(buildDir);
    copySources.dependsOn(generateTask);

    // copy .npmrc file from root to working directory if available
    final File npmrcFile = new File(project.getProjectDir(), ".npmrc");
    if (npmrcFile.exists()) {
        copySources.getInputs().file(npmrcFile);
        copySources.doFirst(new Action<Task>() {
            @Override
            public void execute(Task task) {
                File targetFile = new File(buildDir, ".npmrc");
                buildDir.mkdirs();
                TypescriptUtils.copyFile(npmrcFile, targetFile);
            }
        });
    }

    CompileTypescriptStubsTask compileTypescriptTask = project.getTasks().create(CompileTypescriptStubsTask.NAME,
            CompileTypescriptStubsTask.class);
    try {
        NpmInstallTask npmInstall = (NpmInstallTask) project.getTasks().getByName("npmInstall");
        npmInstall.setWorkingDir(buildDir);
        npmInstall.dependsOn(copySources);
        npmInstall.getInputs().file(new File(buildDir, "package.json"));
        npmInstall.getOutputs().dir(new File(buildDir, "node_modules"));
        compileTypescriptTask.dependsOn(npmInstall);
    }
    catch (UnknownTaskException e) {
        LOGGER.warn("task not found, ok in testing", e);
    }

    ConfigurableFileTree fileTree = project.fileTree(buildDir);
    fileTree.include("package.json");
    fileTree.include(".npmrc");
    fileTree.include("**/*.ts");
    fileTree.exclude("**/*.d.ts");
    compileTypescriptTask.getInputs().files(fileTree);
    compileTypescriptTask.setWorkingDir(buildDir);
    compileTypescriptTask.getOutputs().dir(buildDir);

    ConfigurableFileTree assembleFileTree = project.fileTree(new File(buildDir, "src"));
    assembleFileTree.include("**/*.ts");
    assembleFileTree.include("**/*.js");
    assembleFileTree.include("**/*.js.map");

    Copy assembleSources = project.getTasks().create("assembleTypescript", Copy.class);
    assembleSources.from(assembleFileTree);
    assembleSources.from(new File(buildDir, "package.json"));
    assembleSources.into(distDir);
    assembleSources.dependsOn(compileTypescriptTask);
}
项目:Pushjet-Android    文件:DefaultTaskCollection.java   
@Override
protected UnknownDomainObjectException createNotFoundException(String name) {
    return new UnknownTaskException(String.format("Task with name '%s' not found in %s.", name, project));
}
项目:Pushjet-Android    文件:DefaultTaskCollection.java   
@Override
protected UnknownDomainObjectException createNotFoundException(String name) {
    return new UnknownTaskException(String.format("Task with name '%s' not found in %s.", name, project));
}
项目:Reer    文件:TaskCollection.java   
/**
 * {@inheritDoc}
 */
T getByName(String name, Closure configureClosure) throws UnknownTaskException;
项目:Reer    文件:TaskCollection.java   
/**
 * {@inheritDoc}
 */
T getByName(String name) throws UnknownTaskException;
项目:Reer    文件:TaskCollection.java   
/**
 * {@inheritDoc}
 */
T getAt(String name) throws UnknownTaskException;
项目:Pushjet-Android    文件:TaskCollection.java   
/**
 * {@inheritDoc}
 */
T getByName(String name, Closure configureClosure) throws UnknownTaskException;
项目:Pushjet-Android    文件:TaskCollection.java   
/**
 * {@inheritDoc}
 */
T getByName(String name) throws UnknownTaskException;
项目:Pushjet-Android    文件:TaskCollection.java   
/**
 * {@inheritDoc}
 */
T getAt(String name) throws UnknownTaskException;
项目:Pushjet-Android    文件:TaskCollection.java   
/**
 * {@inheritDoc}
 */
T getByName(String name, Closure configureClosure) throws UnknownTaskException;
项目:Pushjet-Android    文件:TaskCollection.java   
/**
 * {@inheritDoc}
 */
T getByName(String name) throws UnknownTaskException;
项目:Pushjet-Android    文件:TaskCollection.java   
/**
 * {@inheritDoc}
 */
T getAt(String name) throws UnknownTaskException;