本文整理汇总了Java中org.apache.tools.ant.util.GlobPatternMapper.setTo方法的典型用法代码示例。如果您正苦于以下问题:Java GlobPatternMapper.setTo方法的具体用法?Java GlobPatternMapper.setTo怎么用?Java GlobPatternMapper.setTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tools.ant.util.GlobPatternMapper
的用法示例。
在下文中一共展示了GlobPatternMapper.setTo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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;
}
}
示例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;
}
}
}
示例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;
}
示例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;
}
示例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");
}
}