本文整理汇总了Java中org.apache.tools.ant.types.PropertySet类的典型用法代码示例。如果您正苦于以下问题:Java PropertySet类的具体用法?Java PropertySet怎么用?Java PropertySet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PropertySet类属于org.apache.tools.ant.types包,在下文中一共展示了PropertySet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addPropertyset
import org.apache.tools.ant.types.PropertySet; //导入依赖的package包/类
/**
* Set of properties to pass to the new project.
* @param ps the <code>PropertySet</code> to pass.
* @since Ant 1.6
*/
public void addPropertyset(PropertySet ps) {
if (callee == null) {
init();
}
callee.addPropertyset(ps);
}
示例2: add
import org.apache.tools.ant.types.PropertySet; //导入依赖的package包/类
/**
* Restrict the expanded properties using a PropertySet.
* @param propertySet replacement lookup
*/
public void add(PropertySet propertySet) {
if (this.propertySet != null) {
throw new BuildException("expandproperties filter accepts only one propertyset");
}
this.propertySet = propertySet;
}
示例3: addConfiguredPropertyset
import org.apache.tools.ant.types.PropertySet; //导入依赖的package包/类
public void addConfiguredPropertyset(PropertySet ps) {
propertysets.add(ps);
// Copy the contents of the propertyset into the argument-list.
for (Iterator<?> prop=ps.iterator(); prop.hasNext(); ) {
PropertyResource res = (PropertyResource)prop.next();
args.add(new Arg(res.getName(), res.getValue()));
}
}
示例4: testSerialRun_SingleModule_WithPropertySets_AndInheritedPropertiesByDefault
import org.apache.tools.ant.types.PropertySet; //导入依赖的package包/类
public void testSerialRun_SingleModule_WithPropertySets_AndInheritedPropertiesByDefault()
{
final ModuleInfo moduleInfo = new ModuleInfo("foo/", moduleLoader);
moduleInfo.addAttribute("1", "2");
moduleLoader.modules.put("foo/", moduleInfo);
final MockCallTargetTask task1 = new MockCallTargetTask(project);
project.tasks.add(task1);
task.init();
task.setTarget("testTarget");
task.setModuleRefId("moduleRef");
task.createModule().setPath("foo");
task.addConfigured(moduleLoader);
final PropertySet propSet1 = new PropertySet();
propSet1.setProject(project);
propSet1.appendName("123");
propSet1.appendName("hello");
propSet1.appendName("no_such_property");
final PropertySet propSet2 = new PropertySet();
propSet2.setProject(project);
propSet2.appendName("qwerty");
task.addPropertyset(propSet1);
task.addPropertyset(propSet2);
project.setProperty("123", "456");
project.setProperty("12345", "45678");
project.setProperty("hello", "universe");
project.setProperty("qwerty", "board");
task.perform();
TestUtil.assertCallTargetState(task1, true, "testTarget", true, false, "moduleRef", moduleInfo,
TestUtil.<String, Object>map("123", "456", "12345", "45678", "hello", "universe", "qwerty", "board"));
}
示例5: testSerialRun_SingleModule_WithPropertySets_AndInheritedPropertiesForced
import org.apache.tools.ant.types.PropertySet; //导入依赖的package包/类
public void testSerialRun_SingleModule_WithPropertySets_AndInheritedPropertiesForced()
{
final ModuleInfo moduleInfo = new ModuleInfo("foo/", moduleLoader);
moduleInfo.addAttribute("1", "2");
moduleLoader.modules.put("foo/", moduleInfo);
final MockCallTargetTask task1 = new MockCallTargetTask(project);
project.tasks.add(task1);
task.init();
task.setTarget("testTarget");
task.setModuleRefId("moduleRef");
task.createModule().setPath("foo");
task.addConfigured(moduleLoader);
task.setInheritAll(true);
final PropertySet propSet1 = new PropertySet();
propSet1.setProject(project);
propSet1.appendName("123");
propSet1.appendName("hello");
propSet1.appendName("no_such_property");
final PropertySet propSet2 = new PropertySet();
propSet2.setProject(project);
propSet2.appendName("qwerty");
task.addPropertyset(propSet1);
task.addPropertyset(propSet2);
project.setProperty("123", "456");
project.setProperty("12345", "45678");
project.setProperty("hello", "universe");
project.setProperty("qwerty", "board");
task.perform();
TestUtil.assertCallTargetState(task1, true, "testTarget", true, false, "moduleRef", moduleInfo,
TestUtil.<String, Object>map("123", "456", "12345", "45678", "hello", "universe", "qwerty", "board"));
}
示例6: testSerialRun_SingleModule_WithPropertySets_PropertiesNotInherited
import org.apache.tools.ant.types.PropertySet; //导入依赖的package包/类
public void testSerialRun_SingleModule_WithPropertySets_PropertiesNotInherited()
{
final ModuleInfo moduleInfo = new ModuleInfo("foo/", moduleLoader);
moduleInfo.addAttribute("1", "2");
moduleLoader.modules.put("foo/", moduleInfo);
final MockCallTargetTask task1 = new MockCallTargetTask(project);
project.tasks.add(task1);
task.init();
task.setTarget("testTarget");
task.setModuleRefId("moduleRef");
task.createModule().setPath("foo");
task.addConfigured(moduleLoader);
task.setInheritAll(false);
final PropertySet propSet1 = new PropertySet();
propSet1.setProject(project);
propSet1.appendName("123");
propSet1.appendName("hello");
propSet1.appendName("no_such_property");
final PropertySet propSet2 = new PropertySet();
propSet2.setProject(project);
propSet2.appendName("qwerty");
task.addPropertyset(propSet1);
task.addPropertyset(propSet2);
project.setProperty("123", "456");
project.setProperty("12345", "45678");
project.setProperty("hello", "universe");
project.setProperty("qwerty", "board");
task.perform();
TestUtil.assertCallTargetState(task1, true, "testTarget", false, false, "moduleRef", moduleInfo,
TestUtil.<String, Object>map("123", "456", "hello", "universe", "qwerty", "board"));
}
示例7: addConfiguredPropertyset
import org.apache.tools.ant.types.PropertySet; //导入依赖的package包/类
/**
* A set of properties to pass from the build environment to the install compile
*
* @param ps The propertyset collection of properties
*/
public void addConfiguredPropertyset(PropertySet ps)
{
if (properties == null)
{
properties = new Properties();
}
properties.putAll(ps.getProperties());
}
示例8: addConfiguredPropertySet
import org.apache.tools.ant.types.PropertySet; //导入依赖的package包/类
public void addConfiguredPropertySet(PropertySet ps) {
properties.putAll(ps.getProperties());
}
示例9: initializeProject
import org.apache.tools.ant.types.PropertySet; //导入依赖的package包/类
/**
* Attaches the build listeners of the current project to the new
* project, configures a possible logfile, transfers task and
* data-type definitions, transfers properties (either all or just
* the ones specified as user properties to the current project,
* depending on inheritall), transfers the input handler.
*/
private void initializeProject() {
newProject.setInputHandler(getProject().getInputHandler());
Iterator<BuildListener> iter = getBuildListeners();
while (iter.hasNext()) {
newProject.addBuildListener(iter.next());
}
if (output != null) {
File outfile;
if (dir != null) {
outfile = FILE_UTILS.resolveFile(dir, output);
} else {
outfile = getProject().resolveFile(output);
}
try {
out = new PrintStream(Files.newOutputStream(outfile.toPath()));
DefaultLogger logger = new DefaultLogger();
logger.setMessageOutputLevel(Project.MSG_INFO);
logger.setOutputPrintStream(out);
logger.setErrorPrintStream(out);
newProject.addBuildListener(logger);
} catch (IOException ex) {
log("Ant: Can't set output to " + output);
}
}
// set user-defined properties
if (useNativeBasedir) {
addAlmostAll(getProject().getUserProperties(), PropertyType.USER);
} else {
getProject().copyUserProperties(newProject);
}
if (!inheritAll) {
// set Ant's built-in properties separately,
// because they are not being inherited.
newProject.initProperties();
} else {
// set all properties from calling project
addAlmostAll(getProject().getProperties(), PropertyType.PLAIN);
}
for (PropertySet ps : propertySets) {
addAlmostAll(ps.getProperties(), PropertyType.PLAIN);
}
}
示例10: configureSubModule
import org.apache.tools.ant.types.PropertySet; //导入依赖的package包/类
private Project configureSubModule(File file, File directory) {
Project subModule = getProject().createSubProject();
subModule.setNewProperty(EasyAntMagicNames.SUBMODULE, "true");
subModule.setJavaVersionProperty();
for (BuildListener buildListener : getProject().getBuildListeners()) {
subModule.addBuildListener(buildListener);
}
// copy all User properties
addAlmostAll(getProject().getUserProperties(), subModule, PropertyType.USER);
// inherit meta.target directory, for shared build repository.
String metaTarget = getProject().getProperty(EasyAntMagicNames.META_TARGET);
if (metaTarget != null) {
File metaDir = getProject().resolveFile(metaTarget);
subModule.setNewProperty(EasyAntMagicNames.META_TARGET, metaDir.getAbsolutePath());
}
// inherit easyant offline base
String offlineBaseDir = getProject().getProperty(EasyAntMagicNames.OFFLINE_BASE_DIRECTORY);
if (offlineBaseDir != null) {
subModule.setInheritedProperty(EasyAntMagicNames.OFFLINE_BASE_DIRECTORY, offlineBaseDir);
}
subModule.initProperties();
// copy nested properties
for (PropertySet ps : propertySets) {
addAlmostAll(ps.getProperties(), subModule, PropertyType.PLAIN);
}
overrideProperties(subModule);
addReferences(subModule);
getEasyAntEngine().configureEasyAntIvyInstance(subModule);
subModule.addReference(EasyAntMagicNames.PLUGIN_SERVICE_INSTANCE,
getProject().getReference(EasyAntMagicNames.PLUGIN_SERVICE_INSTANCE));
subModule.setName(file.getName());
subModule.setBaseDir(directory);
return subModule;
}
示例11: addPropertyset
import org.apache.tools.ant.types.PropertySet; //导入依赖的package包/类
@Override
public void addPropertyset(final PropertySet propertySet)
{
propertySets.add(propertySet);
super.addPropertyset(propertySet);
}
示例12: setPrefix
import org.apache.tools.ant.types.PropertySet; //导入依赖的package包/类
/**
* If the prefix is set, then only properties which start with this
* prefix string will be recorded. If regex is not set and if this
* is never set, or it is set to an empty string or <tt>null</tt>,
* then all properties will be recorded.
*
* <p>For example, if the attribute is set as:</p>
* <pre><echoproperties prefix="ant." /></pre>
* then the property "ant.home" will be recorded, but "ant-example"
* will not.
*
* @param prefix The new prefix value
*/
public void setPrefix(String prefix) {
if (prefix != null && prefix.length() != 0) {
this.prefix = prefix;
PropertySet ps = new PropertySet();
ps.setProject(getProject());
ps.appendPrefix(prefix);
addPropertyset(ps);
}
}
示例13: setRegex
import org.apache.tools.ant.types.PropertySet; //导入依赖的package包/类
/**
* If the regex is set, then only properties whose names match it
* will be recorded. If prefix is not set and if this is never set,
* or it is set to an empty string or <tt>null</tt>, then all
* properties will be recorded.
*
* <p>For example, if the attribute is set as:</p>
* <pre><echoproperties prefix=".*ant.*" /></pre>
* then the properties "ant.home" and "user.variant" will be recorded,
* but "ant-example" will not.
*
* @param regex The new regex value
*
* @since Ant 1.7
*/
public void setRegex(String regex) {
if (!(regex == null || regex.isEmpty())) {
this.regex = regex;
PropertySet ps = new PropertySet();
ps.setProject(getProject());
ps.appendRegex(regex);
addPropertyset(ps);
}
}
示例14: addSyspropertyset
import org.apache.tools.ant.types.PropertySet; //导入依赖的package包/类
/**
* Adds a set of properties that will be used as system properties
* that tests can access.
*
* <p>This might be useful to transfer Ant properties to the
* testcases when JVM forking is not enabled.</p>
*
* @param sysp set of properties to be added
* @since Ant 1.6
*/
public void addSyspropertyset(final PropertySet sysp) {
getCommandline().addSyspropertyset(sysp);
}
示例15: addPropertyset
import org.apache.tools.ant.types.PropertySet; //导入依赖的package包/类
/**
* A set of properties to write.
* @param ps the property set to write
* @since Ant 1.6
*/
public void addPropertyset(PropertySet ps) {
propertySets.add(ps);
}