/** * Set the {@code outputFile}. * * @param outputFile The new file. */ public void setOutputFile(RegularFileProperty outputFile) { this.outputFile.set(outputFile); }
@TaskAction public void perform() throws TransformerException, FileNotFoundException { final StreamSource source = new StreamSource(inputBundleFile.getAsFile().get()); final StreamResult streamResult = new StreamResult(new FileOutputStream(outputBundleFile.getAsFile().get())); transformer.transform(source, streamResult); } }
@Override public void execute(Object o) { File file = azure.getTestEnvFile().get().getAsFile(); if (file.exists()) { file.delete(); } } });
rootProject.getTasks().register(extractGeneratorTaskName, ExtractDefFileGeneratorTask.class, task -> { task.getOutputs().file(task.defFileGenerator); task.defFileGenerator.set(rootProject.getLayout().getBuildDirectory().file("DefFileGenerator.exe")); task.doLast(t -> { File file = task.defFileGenerator.getAsFile().get(); InputStream is = ExportsConfigRules.class.getResourceAsStream("/DefFileGenerator.exe"); OutputStream os = null; tmpDir.mkdirs(); ExtractDefFileGeneratorTask extractTask = (ExtractDefFileGeneratorTask)rootProject.getTasks().named(extractGeneratorTaskName).get(); String exeName = extractTask.defFileGenerator.getAsFile().get().toString(); project.exec(exec -> { exec.setExecutable(exeName);
private void setDefaults(GatewayExportPluginConfig pluginConfig, @NotNull Project project) { if (!pluginConfig.getSolutionDir().isPresent()) { pluginConfig.getSolutionDir().set(new File(project.getProjectDir(), "src/main/gateway")); } if (!pluginConfig.getRawBundle().isPresent()) { pluginConfig.getRawBundle().set(new File(new File(project.getBuildDir(), "gateway"), project.getName() + ".raw.bundle")); } if (!pluginConfig.getSanitizedBundle().isPresent()) { pluginConfig.getSanitizedBundle().set(new File(new File(project.getBuildDir(), "gateway"), project.getName() + ".sanitized.bundle")); } }
public void setSourceMap(boolean sourceMap) { this.sourceMapEnabled = (Boolean) sourceMap; this.sourceMapFile.set((File) null); }
private File getOuputFileInternal() { return outputFile.getAsFile().get(); } }
@TaskAction public void generateLocalextensions() throws IOException { Path target = getTarget().get().getAsFile().toPath(); Set<String> extensions = cloudExtensions.get(); try (BufferedWriter writer = Files.newBufferedWriter(target, StandardCharsets.UTF_8, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) { writer.write(START); writer.write(String.format("\n<!-- GENERATED by task %s at %s -->\n\n", getName(), Instant.now())); for (String extension : extensions) { writer.write(String.format(EXTENSION, extension)); } writer.write(END); } }
public void setReportFile(File reportFile) { this.reportFile.set(reportFile); }
private List<Path> getAllImportFiles() { final Stream<Path> importedRequirementPaths = importedRequirements.get().stream() .map(File::toPath); final Stream<Path> inputDirPaths = Stream.of(requirementsFile.getAsFile().get().toPath()); return Stream.concat(importedRequirementPaths, inputDirPaths).collect(toList()); }
@TaskAction public void readFile() { try { String fPath = file.get().getAsFile().getAbsolutePath(); String contentStr = new String(Files.readAllBytes(Paths.get(fPath))); getLogger().info("contentStr: " + contentStr); this.content.set(contentStr); } catch(IOException ioe) { throw new GradleException("error when reading file: " + ioe.getMessage()); } }
public void setSourceMap(File sourceMap) { this.sourceMapEnabled = true; this.sourceMapFile.set((File) sourceMap); }
@TaskAction @SneakyThrows public void generateLombokConfig() { try (PrintWriter writer = ResourceGroovyMethods.newPrintWriter(outputFile.getAsFile().get(), "ISO-8859-1")) { writer.println("# This file is generated by the 'io.freefair.lombok' Gradle plugin"); properties.get().entrySet().stream() .sorted(Comparator.comparing(Map.Entry::getKey, String.CASE_INSENSITIVE_ORDER)) .forEach(entry -> writer.println(entry.getKey() + " = " + entry.getValue()) ); } } }
public void setSourceMap(File sourceMap) { this.sourceMapEnabled = true; this.sourceMapFile.set((File) sourceMap); }
/** * Reads the report at the given path. * * @return The report as JSON-String. */ private String readExportPath() { Path path = outputFile.getAsFile().get().toPath(); if (!Files.isReadable(path)) { throw new IllegalStateException(String.format("Dependency compliance export expectet at '%s' is not present.", path.toString())); } try { byte[] bytes = Files.readAllBytes(path); return new String(bytes, CHARSET); } catch (IOException e) { throw new IllegalStateException("Cannot read file: " + path); } } }