@Override public void exec() { if (Utils.isNullOrEmpty(url) || Utils.isNullOrEmpty(output)) { throw new IllegalArgumentException("Schema URL and output path can't be empty"); } setScript(new File(getProject().getTasks().getByPath(ApolloCodegenInstallTask.NAME).getOutputs().getFiles() .getAsPath(), ApolloLocalCodegenGenerationTask.APOLLO_CODEGEN_EXEC_FILE)); List<String> args = Lists.newArrayList("introspect-schema", url, "--output", getProject().file(output) .getAbsolutePath()); if (!headers.isEmpty()) { for(String h : headers) { args.add("--header"); args.add(h); } } if (insecure) { args.add("--insecure"); args.add("true"); } setArgs(args); super.exec(); }
@Override public Void call() { File runnableJarFile = executableJarTask.getOutputs() .getFiles().iterator().next(); Path stubPath = Paths.get(outputDir.getAbsolutePath() + File.separator + "stub.sh"); try { Files.copy(this.getClass().getResourceAsStream("/stub.sh"), stubPath); TFiles.cat(jarshFile.getAbsolutePath(), stubPath.toFile() .getAbsolutePath(), runnableJarFile .getAbsolutePath()); Files.delete(stubPath); jarshFile.setExecutable(true); } catch (Exception e) { throw new RuntimeException(e); } return null; }
} else if (element instanceof Task) { Task task = (Task) element; queue.add(0, task.getOutputs().getFiles()); } else if (element instanceof TaskOutputs) { TaskOutputs outputs = (TaskOutputs) element; queue.add(0, outputs.getFiles()); } else if (element instanceof Callable) { Callable callable = (Callable) element;
/** * Returns the input files for a task. * * @param extraDirectory the image's configured extra directory * @param project the gradle project * @return the input files to the task are all the output files for all the dependencies of the * {@code classes} task */ static FileCollection getInputFiles(File extraDirectory, Project project) { Task classesTask = project.getTasks().getByPath("classes"); Set<? extends Task> classesDependencies = classesTask.getTaskDependencies().getDependencies(classesTask); List<FileCollection> dependencyFileCollections = new ArrayList<>(); for (Task task : classesDependencies) { dependencyFileCollections.add(task.getOutputs().getFiles()); } if (Files.exists(extraDirectory.toPath())) { return project.files(dependencyFileCollections, extraDirectory); } else { return project.files(dependencyFileCollections); } }
@Override public void exec() { if (Utils.isNullOrEmpty(url) || Utils.isNullOrEmpty(output)) { throw new IllegalArgumentException("Schema URL and output path can't be empty"); } setScript(new File(getProject().getTasks().getByPath(ApolloCodeGenInstallTask.NAME).getOutputs().getFiles() .getAsPath(), ApolloIRGenTask.APOLLO_CODEGEN_EXEC_FILE)); List<String> args = Lists.newArrayList("introspect-schema", url, "--output", getProject().file(output) .getAbsolutePath()); if (!headers.isEmpty()) { for(String h : headers) { args.add("--header"); args.add(h); } } if (insecure) { args.add("--insecure"); args.add("true"); } setArgs(args); super.exec(); }
/** * Returns the appengine service directory for this project and modifies the task dependencies of * run/start to ensure {@code serviceProject} is built first. */ public File projectAsService(Project serviceProject) { if (!serviceProject.equals(project)) { project.evaluationDependsOn(serviceProject.getPath()); } project .getTasks() .findByName(AppEngineStandardPlugin.RUN_TASK_NAME) .dependsOn(serviceProject.getTasks().findByPath(BasePlugin.ASSEMBLE_TASK_NAME)); project .getTasks() .findByName(AppEngineStandardPlugin.START_TASK_NAME) .dependsOn(serviceProject.getTasks().findByPath(BasePlugin.ASSEMBLE_TASK_NAME)); return serviceProject .getTasks() .findByName(AppEngineStandardPlugin.EXPLODE_WAR_TASK_NAME) .getOutputs() .getFiles() .getSingleFile(); }
public static Delete createCleanupTask(TaskContainer tasks, Task task) { String cleanTaskName = getCleanTaskName(task); Delete clean = tasks.create(cleanTaskName, Delete.class); clean.setGroup(task.getGroup()); clean.setDescription("Cleans for " + task.getName()); clean.delete(task.getOutputs().getFiles()); task.mustRunAfter(clean); return clean; }
@Override public Set<File> call() { // when the application is obfuscated, the original resources may have been // adapted to match changing package names for instance, so we take the // resources from the obfuscation process results rather than the original // exploded library's classes.jar files. if (config.isMinifyEnabled() && variantData.obfuscationTask != null) { return variantData.obfuscationTask.getOutputs().getFiles().getFiles(); } return scope.getGlobalScope().getAndroidBuilder().getPackagedJars(config); } });
return project.getTasks().stream() .filter(task -> task instanceof ClojureCompile || task instanceof ClojureScriptCompile || task instanceof ProcessResources) .allMatch(task -> !task.getOutputs().getFiles().contains(file)); }); };
return project.getTasks().stream() .filter(task -> task instanceof ClojureCompile || task instanceof ClojureScriptCompile || task instanceof ProcessResources) .allMatch(task -> !task.getOutputs().getFiles().contains(file)); }); };
void executesInside(Project project) { this.setBaseName(project.getName()); project.afterEvaluate(p -> { mergeContentOf(p.getConfigurations().getAt("capsule"), p); from(p.getTasks().getAt("jar").getOutputs().getFiles()); from(p.getConfigurations().getAt(RUNTIME_CONFIGURATION_NAME)); defaultAttributesUsingDetailsFrom(p); capsuleManifest.writeTo(getManifest()); }); }
for (Task task : getProject().getTasks()) { if (task.getName().startsWith("compile")) { for (File file : task.getOutputs().getFiles()) { urls.add(file.toURI().toURL());
protected void configureTaskBuildXSD(BuildXSDTask buildXSDTask) { FileCollection inputFiles = buildXSDTask.getInputFiles(); if (inputFiles.isEmpty()) { return; } Task generateTask = addTaskBuildXSDGenerate(buildXSDTask); Task compileTask = addTaskBuildXSDCompile(buildXSDTask, generateTask); buildXSDTask.from(compileTask.getOutputs()); buildXSDTask.from(generateTask.getOutputs()); TaskOutputs taskOutputs = buildXSDTask.getOutputs(); GradleUtil.addDependency( buildXSDTask.getProject(), JavaPlugin.COMPILE_CONFIGURATION_NAME, taskOutputs.getFiles()); }
} else if (element instanceof TaskOutputs) { TaskOutputs outputs = (TaskOutputs) element; taskContext.add(outputs.getFiles()); } else if (element instanceof RegularFileVar || element instanceof DirectoryVar) { taskContext.add(element);
private void _configureTaskBuildWSDL( final BuildWSDLTask buildWSDLTask, Copy processResourcesTask, Configuration wsdlBuilderConfiguration) { FileCollection fileCollection = buildWSDLTask.getSource(); if (fileCollection.isEmpty()) { return; } Project project = buildWSDLTask.getProject(); for (File inputFile : fileCollection) { _addTaskBuildWSDLTasks( buildWSDLTask, inputFile, wsdlBuilderConfiguration); } if (buildWSDLTask.isBuildLibs()) { TaskOutputs taskOutputs = buildWSDLTask.getOutputs(); GradleUtil.addDependency( project, JavaPlugin.COMPILE_CONFIGURATION_NAME, taskOutputs.getFiles()); } if (buildWSDLTask.isIncludeWSDLs() && (processResourcesTask != null)) { processResourcesTask.into( "wsdl", new Closure<Void>(project) { @SuppressWarnings("unused") public void doCall(CopySpec copySpec) { copySpec.from(buildWSDLTask.getSource()); } }); } }
private static void configureDetailedNotes(final UpdateReleaseNotesTask task, final FetchReleaseNotesTask releaseNotesFetcher, final Project project, final ShipkitConfiguration conf, final Task contributorsFetcher) { task.dependsOn(releaseNotesFetcher); task.dependsOn(contributorsFetcher); task.setVersion(project.getVersion().toString()); task.setTagPrefix(conf.getGit().getTagPrefix()); task.setGitHubRepository(conf.getGitHub().getRepository()); task.setDevelopers(conf.getTeam().getDevelopers()); task.setContributors(conf.getTeam().getContributors()); if (conf.getTeam().getContributors().isEmpty()) { task.setContributorsDataFile(contributorsFetcher.getOutputs().getFiles().getSingleFile()); } task.setGitHubLabelMapping(conf.getReleaseNotes().getLabelMapping()); task.setReleaseNotesFile(project.file(conf.getReleaseNotes().getFile())); task.setGitHubUrl(conf.getGitHub().getUrl()); task.setPreviousVersion(project.getExtensions().getByType(VersionInfo.class).getPreviousVersion()); task.setReleaseNotesData(releaseNotesFetcher.getOutputFile()); } }
private static void configureDetailedNotes(final UpdateReleaseNotesTask task, final FetchReleaseNotesTask releaseNotesFetcher, final Project project, final ShipkitConfiguration conf, final Task contributorsFetcher) { task.dependsOn(releaseNotesFetcher); task.dependsOn(contributorsFetcher); task.setVersion(project.getVersion().toString()); task.setTagPrefix(conf.getGit().getTagPrefix()); task.setGitHubRepository(conf.getGitHub().getRepository()); task.setDevelopers(conf.getTeam().getDevelopers()); task.setContributors(conf.getTeam().getContributors()); if (conf.getTeam().getContributors().isEmpty()) { task.setContributorsDataFile(contributorsFetcher.getOutputs().getFiles().getSingleFile()); } task.setGitHubLabelMapping(conf.getReleaseNotes().getLabelMapping()); task.setReleaseNotesFile(project.file(conf.getReleaseNotes().getFile())); task.setGitHubUrl(conf.getGitHub().getUrl()); task.setPreviousVersion(project.getExtensions().getByType(VersionInfo.class).getPreviousVersion()); task.setReleaseNotesData(releaseNotesFetcher.getOutputFile()); } }