/** * Copies all user properties that have not been set on the * command line or a GUI tool from this instance to the Project * instance given as the argument. * * <p>To copy all "user" properties, you will also have to call * {@link #copyUserProperties copyUserProperties}.</p> * * <p>Does not copy properties held by implementations of * delegates (like local properties).</p> * * @param other the project to copy the properties to. Must not be null. * * @since Ant 1.6 */ public void copyInheritedProperties(Project other) { //avoid concurrent modification: synchronized (inheritedProperties) { for (Map.Entry<String, Object> entry : inheritedProperties.entrySet()) { String arg = entry.getKey(); if (other.getUserProperty(arg) == null) { other.setInheritedProperty(arg, entry.getValue().toString()); } } } }
private void delegateCommandSystemProperties() { // Iterate over command-line args and pass them through as sysproperty // exclude any built-in properties that start with "ant." for (Object propKey : getProject().getUserProperties().keySet()) { String propName = (String) propKey; String propVal = getProject().getUserProperty(propName); if (propName.startsWith("ant.")) { log("Excluding ant property: " + propName + ": " + propVal, Project.MSG_DEBUG); } else { log("Including user property: " + propName + ": " + propVal, Project.MSG_DEBUG); Environment.Variable var = new Environment.Variable(); var.setKey(propName); var.setValue(propVal); addSysproperty(var); } } }
private void delegateCommandSystemProperties() { // Iterate over command-line args and pass them through as sysproperty // exclude any built-in properties that start with "ant." for (Object propKey : getProject().getUserProperties().keySet()) { String propName = (String) propKey; String propVal = getProject().getUserProperty(propName); if (propName.startsWith("ant.")) { log("Excluding ant property: " + propName + ": " + propVal, Project.MSG_DEBUG); } else { log("Including user property: " + propName + ": " + propVal, Project.MSG_DEBUG); Environment.Variable var = new Environment.Variable(); var.setKey(propName); var.setValue(propVal); addSysproperty(var); } } }
private void setPropertiesFromFiles(Project project, List<Properties> allProperties) { for (Properties props : allProperties) { Enumeration<?> propertyNames = props.propertyNames(); while (propertyNames.hasMoreElements()) { String name = (String) propertyNames.nextElement(); // do not override extra local properties with the global settings if (project.getUserProperty(name) == null) { project.setUserProperty(name, props.getProperty(name)); } } } }
public void setSeed(String randomSeed) { if (!Strings.isNullOrEmpty(getProject().getUserProperty(SYSPROP_RANDOM_SEED()))) { String userProperty = getProject().getUserProperty(SYSPROP_RANDOM_SEED()); if (!userProperty.equals(randomSeed)) { log("Ignoring seed attribute because it is overridden by user properties.", Project.MSG_WARN); } } else if (!Strings.isNullOrEmpty(randomSeed)) { this.random = randomSeed; } }
/** * Initial random seed used for shuffling test suites and other sources * of pseudo-randomness. If not set, any random value is set. * * <p>The seed's format is compatible with {@link RandomizedRunner} so that * seed can be fixed for suites and methods alike. */ public void setSeed(String randomSeed) { if (!Strings.isNullOrEmpty(getProject().getUserProperty(SYSPROP_RANDOM_SEED()))) { String userProperty = getProject().getUserProperty(SYSPROP_RANDOM_SEED()); if (!userProperty.equals(randomSeed)) { log("Ignoring seed attribute because it is overridden by user properties.", Project.MSG_WARN); } } else if (!Strings.isNullOrEmpty(randomSeed)) { this.random = randomSeed; } }
@VisibleForTesting Job getJob() { String tempDir = getProject().getUserProperty(ANT_TEMP_DIR); if (tempDir == null) { tempDir = getProject().getProperty(ANT_TEMP_DIR); } if (tempDir == null) { throw new IllegalStateException(); } final Job job = ExtensibleAntInvoker.getJob(new File(tempDir), getProject()); if (job == null) { throw new IllegalStateException(); } return job; }
public void setSeed(String randomSeed) { if (!Strings.isNullOrEmpty(getProject().getUserProperty(SYSPROP_RANDOM_SEED()))) { String userProperty = getProject().getUserProperty(SYSPROP_RANDOM_SEED()); if (!userProperty.equals(randomSeed)) { log("Ignoring seed attribute because it is overridden by user properties.", Project.MSG_WARN); } } else if (!Strings.isNullOrEmpty(randomSeed)) { this.random = randomSeed; } }
private void loadExtraPropertyFiles(Project project) { if (fPropertyFiles != null) { try { List<Properties> allProperties = AntCoreUtil.loadPropertyFiles(fPropertyFiles, project.getUserProperty("basedir"), getEditedFile().getAbsolutePath()); //$NON-NLS-1$ setPropertiesFromFiles(project, allProperties); } catch (IOException e1) { AntUIPlugin.log(e1); } } }
/** * Initializes custom prefix for all junit4 properties. This must be consistent * across all junit4 invocations if done from the same classpath. Use only when REALLY needed. */ public void setPrefix(String prefix) { if (!Strings.isNullOrEmpty(getProject().getUserProperty(SYSPROP_PREFIX()))) { log("Ignoring prefix attribute because it is overridden by user properties.", Project.MSG_WARN); } else { SysGlobals.initializeWith(prefix); } }
/** * Initial random seed used for shuffling test suites and other sources * of pseudo-randomness. If not set, any random value is set. * * <p>The seed's format is compatible with {@link RandomizedRunner} so that * seed can be fixed for suites and methods alike. */ public void setSeed(String randomSeed) { if (!Strings.isNullOrEmpty(getProject().getUserProperty(SYSPROP_RANDOM_SEED()))) { String userProperty = getProject().getUserProperty(SYSPROP_RANDOM_SEED()); if (!userProperty.equals(randomSeed)) { log("Ignoring seed attribute because it is overridden by user properties.", Project.MSG_WARN); } } else if (!Strings.isNullOrEmpty(randomSeed)) { this.random = randomSeed; } }
/** * Load all properties from the files */ private void loadPropertyFiles(Project project) { List<String> fileNames = Arrays.asList(AntCorePlugin.getPlugin().getPreferences().getCustomPropertyFiles()); try { List<Properties> allProperties = AntCoreUtil.loadPropertyFiles(fileNames, project.getUserProperty("basedir"), getEditedFile().getAbsolutePath()); //$NON-NLS-1$ setPropertiesFromFiles(project, allProperties); } catch (IOException e1) { AntUIPlugin.log(e1); } }
/** * Initializes custom prefix for all junit4 properties. This must be consistent * across all junit4 invocations if done from the same classpath. Use only when REALLY needed. */ public void setPrefix(String prefix) { if (!Strings.isNullOrEmpty(getProject().getUserProperty(SYSPROP_PREFIX()))) { log("Ignoring prefix attribute because it is overridden by user properties.", Project.MSG_WARN); } else { SysGlobals.initializeWith(prefix); } }