本文整理汇总了Java中org.apache.tools.ant.types.PatternSet类的典型用法代码示例。如果您正苦于以下问题:Java PatternSet类的具体用法?Java PatternSet怎么用?Java PatternSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PatternSet类属于org.apache.tools.ant.types包,在下文中一共展示了PatternSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import org.apache.tools.ant.types.PatternSet; //导入依赖的package包/类
@Override
public List<LayoutFileSet> build(TempFileFactory temp) {
final File outputDir = temp.allocateTempFile("extractedDir");
expandTask.setProject(getProject());
expandTask.setSrc(new File(jarPath.replace('/', File.separatorChar)));
File target = outputDir;
if (!pathInJar.endsWith("/")) {
pathInJar += "/";
}
if (pathInJar.startsWith("/")) {
pathInJar = pathInJar.substring(1);
}
if (pathInJar.length() > 0) {
final PatternSet patternSet = new PatternSet();
patternSet.createInclude().setName(pathInJar + "**");
expandTask.addPatternset(patternSet);
target = new File(outputDir, pathInJar.replace('/', File.separatorChar));
}
expandTask.setDest(outputDir);
expandTask.perform();
final LayoutFileSet fileSet = new LayoutFileSet();
fileSet.setDir(target);
return Collections.singletonList(fileSet);
}
示例2: verifyPathAdheresToDesign
import org.apache.tools.ant.types.PatternSet; //导入依赖的package包/类
private void verifyPathAdheresToDesign(Design d, Path p) throws ClassFormatException, IOException {
String files[] = p.list();
for (int i = 0; i < files.length; i++) {
File file = new File(files[i]);
if (file.isDirectory()) {
FileSet set = new FileSet();
set.setDir(file);
set.setProject(task.getProject());
PatternSet.NameEntry entry1 = set.createInclude();
PatternSet.NameEntry entry2 = set.createInclude();
PatternSet.NameEntry entry3 = set.createInclude();
entry1.setName("**/*.class");
entry2.setName("**/*.jar");
entry3.setName("**/*.war");
DirectoryScanner scanner = set.getDirectoryScanner(task.getProject());
scanner.setBasedir(file);
String[] scannerFiles = scanner.getIncludedFiles();
for (int j = 0; j < scannerFiles.length; j++) {
verifyPartOfPath(scannerFiles[j], new File(file, scannerFiles[j]), d);
}
} else
verifyPartOfPath(files[i], file, d);
}
}
示例3: toFileSet
import org.apache.tools.ant.types.PatternSet; //导入依赖的package包/类
private FileSet toFileSet(boolean withPatterns) {
FileSet fs = new FileSet();
fs.setCaseSensitive(isCaseSensitive());
fs.setFollowSymlinks(isFollowSymlinks());
fs.setMaxLevelsOfSymlinks(getMaxLevelsOfSymlinks());
fs.setProject(getProject());
if (withPatterns) {
PatternSet ps = mergePatterns(getProject());
fs.appendIncludes(ps.getIncludePatterns(getProject()));
fs.appendExcludes(ps.getExcludePatterns(getProject()));
for (FileSelector sel : getSelectors(getProject())) {
fs.appendSelector(sel);
}
fs.setDefaultexcludes(getDefaultexcludes());
}
return fs;
}
示例4: assertPattern
import org.apache.tools.ant.types.PatternSet; //导入依赖的package包/类
private void assertPattern(String cluster, String file) {
Object ref = task.getProject().getReference("pattern.set");
assertNotNull("Reference is found", ref);
assertTrue("Right instance: " + ref, ref instanceof PatternSet);
PatternSet ps = (PatternSet)ref;
List<String> arr = Arrays.asList(ps.getIncludePatterns(task.getProject()));
assertTrue(file + " is there: " + arr, arr.contains(file));
}
示例5: execute
import org.apache.tools.ant.types.PatternSet; //导入依赖的package包/类
@Override
public void execute() throws BuildException {
List<String> includes = new ArrayList<>();
if (locales != null && !locales.isEmpty()) {
if (!srcDir.exists()) {
log("No l10n files present. Do hg clone http://hg.netbeans.org/main/l10n!", Project.MSG_VERBOSE);
return;
}
StringTokenizer tok = new StringTokenizer(locales, ",");
while (tok.hasMoreElements()) {
String locale = tok.nextToken();
if (locale.equals("default")) { // NOI18N
locale = Locale.getDefault().toString();
}
for (String l = locale; l != null; l = trailingUnderscore(l)) {
processLocale(l, includes, l.equals(locale));
}
}
}
if (patternset != null) {
PatternSet ps = new PatternSet();
ps.setProject(getProject());
if (includes.isEmpty()) {
ps.createInclude().setName("I/dont/exist/at/all");
} else {
for (String s : includes) {
ps.createInclude().setName(s);
}
}
getProject().addReference(patternset, ps);
}
}
示例6: fixJarName
import org.apache.tools.ant.types.PatternSet; //导入依赖的package包/类
private String fixJarName(String prefixDir, String name) {
if (prefixDir.endsWith("locale/") && baseFiles != null) {
prefixDir = prefixDir.substring(0, prefixDir.length() - 7);
PatternSet bf = (PatternSet)getProject().getReference(baseFiles);
for (String p : bf.getIncludePatterns(getProject())) {
if (p.startsWith(prefixDir)) {
String realName = p.substring(prefixDir.length());
if (realName.indexOf('/') != -1 || realName.indexOf('\\') != -1) {
continue;
}
int indx = realName.indexOf(name);
if (indx == -1) {
continue;
}
return realName.substring(0, indx + name.length());
}
}
}
if (name.equals("autoupdate-ui_nb")) {
return "org-netbeans-modules-autoupdate-ui_nb";
}
if (name.equals("options-api_nb")) {
return "org-netbeans-modules-options-api_nb";
}
if (name.equals("uihandler_nb")) {
return "org-netbeans-modules-uihandler_nb";
}
return name;
}
示例7: setJars
import org.apache.tools.ant.types.PatternSet; //导入依赖的package包/类
/**
* Setter for the "jars" attribute (required if no "jarfileset" is present)
*
* @deprecated Use <jarfileset> and/or <jarfilelist> nested tasks instead.
*
* @param s A list of jar files or patternsets (space or comma seperated)
*/
public void setJars(String s) {
PatternSet patset = new PatternSet();
patset.setIncludes(s);
String[] jarNames = patset.getIncludePatterns(getProject());
for (int i = 0; i < jarNames.length; i++)
mJarAttrs.add(getProject().resolveFile(jarNames[i]));
}
示例8: setExecs
import org.apache.tools.ant.types.PatternSet; //导入依赖的package包/类
/**
* Setter for the "execs" attribute
*
* @deprecated Use <execfileset/> or <execfilelist/> nested tasks instead.
*
* @param s A list of files or patternsets (space or comma seperated)
*/
public void setExecs(String s) {
PatternSet patset = new PatternSet();
patset.setIncludes(s);
String[] execNames = patset.getIncludePatterns(getProject());
for (int i = 0; i < execNames.length; i++) {
File f = new File(execNames[i]);
mExecAttrs.add(f);
}
}
示例9: setExtraclasspath
import org.apache.tools.ant.types.PatternSet; //导入依赖的package包/类
/**
* Setter for the "extraclasspath" attribute (optional)
*
* @param s A list of files or patternsets (space or comma seperated)
*/
public void setExtraclasspath(String s) {
if (s == null || s.trim().equals("")) return;
PatternSet patset = new PatternSet();
patset.setIncludes(s);
String[] cpNames = patset.getIncludePatterns(getProject());
for (int i = 0; i < cpNames.length; i++) {
File f = new File(cpNames[i]);
mExtraClassPathAttrs.add(f);
}
}
示例10: createExpand
import org.apache.tools.ant.types.PatternSet; //导入依赖的package包/类
private Expand createExpand(File jarFile)
{
String outputDir = expandDir + File.separator + jarFile.getName();
Project prj = new Project();
FileSet fileSet = createFileSetForJarFile(jarFile, prj);
PatternSet patternSet = createPatternSet(prj);
Expand expand = new Expand();
expand.setProject(prj);
expand.setOverwrite(true);
expand.setDest(new File(outputDir));
expand.addFileset(fileSet);
expand.addPatternset(patternSet);
return expand;
}
示例11: createPatternSet
import org.apache.tools.ant.types.PatternSet; //导入依赖的package包/类
private PatternSet createPatternSet(Project prj)
{
PatternSet patternSet = new PatternSet();
patternSet.setProject(prj);
patternSet.setIncludes("**/*");
return patternSet;
}
示例12: createPatternSet
import org.apache.tools.ant.types.PatternSet; //导入依赖的package包/类
/**
* Create a nested patternset.
* @return <code>PatternSet</code>.
*/
public synchronized PatternSet createPatternSet() {
if (isReference()) {
throw noChildrenAllowed();
}
PatternSet patterns = new PatternSet();
additionalPatterns.addElement(patterns);
ds = null;
setChecked(false);
return patterns;
}
示例13: createInclude
import org.apache.tools.ant.types.PatternSet; //导入依赖的package包/类
/**
* Add a name entry to the include list.
* @return <code>PatternSet.NameEntry</code>.
*/
public synchronized PatternSet.NameEntry createInclude() {
if (isReference()) {
throw noChildrenAllowed();
}
ds = null;
return defaultPatterns.createInclude();
}
示例14: createIncludesFile
import org.apache.tools.ant.types.PatternSet; //导入依赖的package包/类
/**
* Add a name entry to the include files list.
* @return <code>PatternSet.NameEntry</code>.
*/
public synchronized PatternSet.NameEntry createIncludesFile() {
if (isReference()) {
throw noChildrenAllowed();
}
ds = null;
return defaultPatterns.createIncludesFile();
}
示例15: createExclude
import org.apache.tools.ant.types.PatternSet; //导入依赖的package包/类
/**
* Add a name entry to the exclude list.
* @return <code>PatternSet.NameEntry</code>.
*/
public synchronized PatternSet.NameEntry createExclude() {
if (isReference()) {
throw noChildrenAllowed();
}
ds = null;
return defaultPatterns.createExclude();
}