本文整理汇总了Java中org.apache.tools.ant.util.GlobPatternMapper类的典型用法代码示例。如果您正苦于以下问题:Java GlobPatternMapper类的具体用法?Java GlobPatternMapper怎么用?Java GlobPatternMapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GlobPatternMapper类属于org.apache.tools.ant.util包,在下文中一共展示了GlobPatternMapper类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: scanDir
import org.apache.tools.ant.util.GlobPatternMapper; //导入依赖的package包/类
/**
* Scans the directory looking for source files to be compiled.
* The results are returned in the class variable compileList
*
* @param srcDir The source directory
* @param destDir The destination directory
* @param files An array of filenames
*/
protected void scanDir(File srcDir, File destDir, String[] files) {
GlobPatternMapper m = new GlobPatternMapper();
SourceFileScanner sfs = new SourceFileScanner(this);
File[] newFiles;
for (String extension : getScriptExtensions()) {
m.setFrom("*." + extension);
m.setTo("*.class");
newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m);
addToCompileList(newFiles);
}
if (jointCompilation) {
m.setFrom("*.java");
m.setTo("*.class");
newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m);
addToCompileList(newFiles);
}
}
开发者ID:apache,项目名称:groovy,代码行数:27,代码来源:Groovyc.java
示例2: scanDir
import org.apache.tools.ant.util.GlobPatternMapper; //导入依赖的package包/类
@Override
protected void scanDir(File srcDir, File destDir, String[] files) {
GlobPatternMapper m = new GlobPatternMapper();
m.setFrom("*.f3");
m.setTo("*.class");
SourceFileScanner sfs = new SourceFileScanner(this);
File[] newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m);
if (newFiles.length > 0) {
File[] newCompileList
= new File[compileList.length + newFiles.length];
System.arraycopy(compileList, 0, newCompileList, 0, compileList.length);
System.arraycopy(newFiles, 0, newCompileList, compileList.length, newFiles.length);
compileList = newCompileList;
}
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:17,代码来源:F3AntTask.java
示例3: scanDir
import org.apache.tools.ant.util.GlobPatternMapper; //导入依赖的package包/类
/**
* Scans the directory looking for source files to be compiled.
* The results are returned in the class variable compileList
*
* @param srcDir The source directory
* @param destDir The destination directory
* @param files An array of filenames
*/
protected void scanDir(final File srcDir, final File destDir, final String[] files) {
final GlobPatternMapper m = new GlobPatternMapper();
final String[] extensions = findSupportedFileExtensions();
for (String extension : extensions) {
m.setFrom(extension);
m.setTo("*.class");
final SourceFileScanner sfs = new SourceFileScanner(this);
final File[] newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m);
if (newFiles.length > 0) {
lookForPackageInfos(srcDir, newFiles);
final File[] newCompileList
= new File[compileList.length + newFiles.length];
System.arraycopy(compileList, 0, newCompileList, 0,
compileList.length);
System.arraycopy(newFiles, 0, newCompileList,
compileList.length, newFiles.length);
compileList = newCompileList;
}
}
}
开发者ID:apache,项目名称:ant,代码行数:31,代码来源:Javac.java
示例4: getMapper
import org.apache.tools.ant.util.GlobPatternMapper; //导入依赖的package包/类
/**
* Constructs a glob pattern mapper which matches file names ending
* with {@code ext} to ones ending with ".class".
* @param ext a file name extension, including the period
* (e.g. ".scm").
*/
private FileNameMapper getMapper(String ext) {
GlobPatternMapper m = new GlobPatternMapper();
m.setFrom("*" + ext);
m.setTo("*.class");
ChainedMapper c = new ChainedMapper();
c.add(m);
c.add(MangleFileNameMapper.INSTANCE);
return c;
}
开发者ID:spurious,项目名称:kawa-mirror,代码行数:16,代码来源:Kawac.java
示例5: getMapper
import org.apache.tools.ant.util.GlobPatternMapper; //导入依赖的package包/类
/**
* Constructs a glob pattern mapper which matches file names ending
* with {@code ext} to ones ending with ".class".
* @param ext a file name extension, including the period
* (e.g. ".scm").
*/
private FileNameMapper getMapper(String ext) {
GlobPatternMapper m = new GlobPatternMapper();
m.setFrom("*" + ext);
m.setTo("*.class");
return m;
}
开发者ID:mit-cml,项目名称:ai2-kawa,代码行数:13,代码来源:Kawac.java
示例6: compile
import org.apache.tools.ant.util.GlobPatternMapper; //导入依赖的package包/类
protected void compile() {
Path path = getClasspath();
if (path != null) {
config.setClasspath(path.toString());
}
config.setTargetDirectory(destdir);
GroovyClassLoader gcl = createClassLoader();
CompilationUnit compilation = new CompilationUnit(config, null, gcl);
GlobPatternMapper mapper = new GlobPatternMapper();
mapper.setFrom("*.groovy");
mapper.setTo("*.class");
int count = 0;
String[] list = src.list();
for (int i = 0; i < list.length; i++) {
File basedir = getProject().resolveFile(list[i]);
if (!basedir.exists()) {
throw new BuildException("Source directory does not exist: " + basedir, getLocation());
}
DirectoryScanner scanner = getDirectoryScanner(basedir);
String[] includes = scanner.getIncludedFiles();
if (force) {
log.debug("Forcefully including all files from: " + basedir);
for (int j=0; j < includes.length; j++) {
File file = new File(basedir, includes[j]);
log.debug(" " + file);
compilation.addSource(file);
count++;
}
}
else {
log.debug("Including changed files from: " + basedir);
SourceFileScanner sourceScanner = new SourceFileScanner(this);
File[] files = sourceScanner.restrictAsFiles(includes, basedir, destdir, mapper);
for (int j=0; j < files.length; j++) {
log.debug(" " + files[j]);
compilation.addSource(files[j]);
count++;
}
}
}
if (count > 0) {
log.info("Compiling " + count + " source file" + (count > 1 ? "s" : "") + " to " + destdir);
compilation.compile();
}
else {
log.info("No sources found to compile");
}
}
开发者ID:apache,项目名称:groovy,代码行数:64,代码来源:GroovycTask.java
示例7: testChained
import org.apache.tools.ant.util.GlobPatternMapper; //导入依赖的package包/类
@Test
public void testChained() {
// a --> b --> c --- def
// \-- ghi
FileNameMapper mapperAB = new GlobPatternMapper();
mapperAB.setFrom("a");
mapperAB.setTo("b");
FileNameMapper mapperBC = new GlobPatternMapper();
mapperBC.setFrom("b");
mapperBC.setTo("c");
//implicit composite
Mapper mapperCX = new Mapper(project);
FileNameMapper mapperDEF = new GlobPatternMapper();
mapperDEF.setFrom("c");
mapperDEF.setTo("def");
FileNameMapper mapperGHI = new GlobPatternMapper();
mapperGHI.setFrom("c");
mapperGHI.setTo("ghi");
mapperCX.add(mapperDEF);
mapperCX.add(mapperGHI);
Mapper chained = new Mapper(project);
chained.setClassname(ChainedMapper.class.getName());
chained.add(mapperAB);
chained.add(mapperBC);
chained.addConfiguredMapper(mapperCX);
FileNameMapper fileNameMapper = chained.getImplementation();
String[] targets = fileNameMapper.mapFileName("a");
assertNotNull("no filenames mapped", targets);
assertEquals("wrong number of filenames mapped", 2, targets.length);
List list = Arrays.asList(targets);
assertTrue("cannot find expected target \"def\"", list.contains("def"));
assertTrue("cannot find expected target \"ghi\"", list.contains("ghi"));
}
开发者ID:apache,项目名称:ant,代码行数:43,代码来源:MapperTest.java
注:本文中的org.apache.tools.ant.util.GlobPatternMapper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论