/** * Utility method to set the appropriate property * to indicate that specified file satisfies library * requirements. * * @param file the library */ private void setLibraryProperty(final File file) { getProject().setNewProperty(propertyName, file.getAbsolutePath()); }
private void setProperty(String name, String value) { if (name != null) { getProject().setNewProperty(name, value); } } }
/** * Helper method to set result property to the * passed in value if appropriate. * * @param result the exit code */ protected void maybeSetResultPropertyValue(int result) { String res = Integer.toString(result); if (resultProperty != null) { getProject().setNewProperty(resultProperty, res); } }
/** * helper that encapsulates prefix logic and property setting * policy (i.e. we use setNewProperty instead of setProperty). */ private void setProperty(String name, String value) { getProject().setNewProperty(prefix + name, value); }
/** * Close the PropertyOutputStream, storing the property. */ @Override public void close() { if (project != null && property != null) { String s = new String(toByteArray()); project.setNewProperty(property, trim ? s.trim() : s); } }
/** * Helper method to set result property to the * passed in value if appropriate. * * @param result value desired for the result property value. */ protected void maybeSetResultPropertyValue(int result) { if (resultProperty != null) { String res = Integer.toString(result); getProject().setNewProperty(resultProperty, res); } }
private void setProperty(String name, String value) { getProject().setNewProperty(prefix + name, value); }
/** * Set a property from a ByteArrayOutputStream * * @param baos * contains the property value. * @param propertyName * the property name. */ private void setPropertyFromBAOS(final ByteArrayOutputStream baos, final String propertyName) { final BufferedReader in = new BufferedReader(new StringReader(Execute.toString(baos))); managingTask.getProject().setNewProperty(propertyName, in.lines().collect(Collectors.joining(System.lineSeparator()))); }
/** * Calculate the checksum(s). * @throws BuildException on error */ @Override public void execute() throws BuildException { isCondition = false; boolean value = validateAndExecute(); if (verifyProperty != null) { getProject().setNewProperty(verifyProperty, Boolean.toString(value)); } }
/** * Execute this task. * @throws BuildException on error */ @Override public void execute() throws BuildException { if (property == null) { throw new BuildException("property attribute required", getLocation()); } if (file == null) { throw new BuildException("file attribute required", getLocation()); } getProject().setNewProperty(property, file.getParent()); } }
/** * Run task. * * @exception BuildException if an error occurs */ @Override public void execute() throws BuildException { File savedFile = myFile; // may be altered in validate validate(); final Properties properties = loadProperties(); final int buildNumber = getBuildNumber(properties); properties.put(DEFAULT_PROPERTY_NAME, String.valueOf(buildNumber + 1)); // Write the properties file back out try (OutputStream output = Files.newOutputStream(myFile.toPath())) { properties.store(output, "Build Number for ANT. Do not edit!"); } catch (final IOException ioe) { throw new BuildException("Error while writing " + myFile, ioe); } finally { myFile = savedFile; } //Finally set the property getProject().setNewProperty(DEFAULT_PROPERTY_NAME, String.valueOf(buildNumber)); }
/** * do the work * @throws BuildException if required attributes are not supplied * property and attribute are required attributes */ @Override public void execute() throws BuildException { if (property == null) { throw new BuildException("property attribute required", getLocation()); } if (file == null) { throw new BuildException("file attribute required", getLocation()); } getProject().setNewProperty(property, removeExtension(file.getName(), suffix)); }
/** * Execute as a Task. */ @Override public void execute() { if (rc == null) { throw new BuildException(ONE_NESTED_MESSAGE); } if (property == null) { log("resource count = " + rc.size()); } else { getProject().setNewProperty(property, Integer.toString(rc.size())); } }
/** * Creates the temporary file. * * @exception BuildException if something goes wrong with the build */ @Override public void execute() throws BuildException { if (property == null || property.isEmpty()) { throw new BuildException("no property specified"); } if (destDir == null) { destDir = getProject().resolveFile("."); } File tfile = FILE_UTILS.createTempFile(prefix, suffix, destDir, deleteOnExit, createFile); getProject().setNewProperty(property, tfile.toString()); } }
/** * Actions to be taken on an unsuccessful wait. * This is an override point. It is where the timeout processing takes place. * The base implementation sets the timeoutproperty if there was a timeout * and the property was defined. * @since Ant1.7 */ protected void processTimeout() { log(getTaskName() + ": timeout", Project.MSG_VERBOSE); if (timeoutProperty != null) { getProject().setNewProperty(timeoutProperty, "true"); } }
/** * Execute the task. * * @throws BuildException if something goes wrong. */ @Override public void execute() throws BuildException { validate(); final Project prj = getProject(); final Stream<Extension> extensions; // Check if list of files to check has been specified if (!extensionFileSets.isEmpty()) { extensions = extensionFileSets.stream() .map(xset -> xset.toExtensions(prj)).flatMap(Stream::of); } else { extensions = Stream.of( Extension.getAvailable(ExtensionUtil.getManifest(libraryFile))); } final Extension test = requiredExtension.toExtension(); if (extensions.anyMatch(x -> x.isCompatibleWith(test))) { prj.setNewProperty(propertyName, "true"); } }
/** * Run as a task. * @throws BuildException if an error occurs. */ @Override public void execute() throws BuildException { if (propertyname == null) { throw new BuildException("'property' must be set."); } if (atLeast != null || exactly != null) { // If condition values are set, evaluate the condition if (eval()) { getProject().setNewProperty(propertyname, getVersion().toString()); } } else { // Raw task getProject().setNewProperty(propertyname, getVersion().toString()); } }
getProject().setNewProperty(m_failurePropertyName, "true"); getProject().setNewProperty(m_failurePropertyName, "true"); getProject().setNewProperty(m_skippedPropertyName, "true"); getProject().setNewProperty(m_fspPropertyName, "true");
/** * Sets property to true if target file(s) have a more recent timestamp * than (each of) the corresponding source file(s). * @throws BuildException on error */ @Override public void execute() throws BuildException { if (property == null) { throw new BuildException("property attribute is required.", getLocation()); } boolean upToDate = eval(); if (upToDate) { getProject().setNewProperty(property, getValue()); if (mapperElement == null) { log("File \"" + targetFile.getAbsolutePath() + "\" is up-to-date.", Project.MSG_VERBOSE); } else { log("All target files are up-to-date.", Project.MSG_VERBOSE); } } }
/** * Executes the task. * @exception BuildException if an error occurs */ @Override public void execute() throws BuildException { checkParameters(); resetFileLists(); // scan source directories and dest directory to build up // compile list if (hasPath(src)) { collectFileListFromSourcePath(); } else { assert hasPath(moduleSourcepath) : "Either srcDir or moduleSourcepath must be given"; collectFileListFromModulePath(); } compile(); if (updatedProperty != null && taskSuccess && compileList.length != 0) { getProject().setNewProperty(updatedProperty, "true"); } }