本文整理匯總了Java中org.apache.tools.ant.types.FileSet.setProject方法的典型用法代碼示例。如果您正苦於以下問題:Java FileSet.setProject方法的具體用法?Java FileSet.setProject怎麽用?Java FileSet.setProject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.tools.ant.types.FileSet
的用法示例。
在下文中一共展示了FileSet.setProject方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: compress
import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
public static void compress(String desPath, String srcPath){
File desFile = new File(desPath);// 目標文件
File srcFile = new File(srcPath);// 源文件
if (!srcFile.exists())
throw new RuntimeException("需要壓縮的文件不存在");
Project project = new Project();
Zip zip = new Zip();
zip.setProject(project);
zip.setDestFile(desFile);
FileSet fileSet = new FileSet();
fileSet.setProject(project);
fileSet.setDir(srcFile);
zip.addFileset(fileSet);
zip.execute();
}
示例2: compressExe
import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
public File compressExe(File srcDir, String destZipPath) {
Project prj = new Project();
Zip zip = new Zip();
File dest = new File(destZipPath);
zip.setProject(prj);
zip.setDestFile(dest);
FileSet fileSet = new FileSet();
fileSet.setProject(prj);
fileSet.setDir(srcDir);
zip.addFileset(fileSet);
zip.execute();
File[] files = srcDir.listFiles();
for (int i = 0;i < files.length;i++) {
files[i].delete();
}
srcDir.delete();
return dest;
}
示例3: getFilesByNameEntryFilter
import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
* Returns a list of files found in a given folder, matching a given filter.
* @param folder the folder to search
* @param filters the filter for the files. Typically a glob.
* @return an iterator.
*/
private Iterator<?> getFilesByNameEntryFilter(String folder, String... filters) {
Project taskProject = getProject();
// create a fileset to find all the files in the folder
FileSet fs = new FileSet();
fs.setProject(taskProject);
fs.setDir(new File(folder));
for (String filter : filters) {
NameEntry include = fs.createInclude();
include.setName(filter);
}
// loop through the results of the file set
return fs.iterator();
}
示例4: verifyPathAdheresToDesign
import org.apache.tools.ant.types.FileSet; //導入方法依賴的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);
}
}
示例5: compress
import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
* ʹ��zipѹ���ļ�
*
* @param source
* ��Ҫѹ�����ļ�
* @param target
* ѹ�����ļ��Ĵ��·��
* @param delflag
* ѹ�����Ƿ�ɾ��Դ�ļ�
*/
public static void compress(File source, File target, boolean delflag) {
if (!target.exists()) {
target.mkdirs();
}
File zipFile = new File(target.getAbsolutePath() + File.separator
+ source.getName() + ".zip");
Project prj = new Project();
org.apache.tools.ant.taskdefs.Zip zip = new org.apache.tools.ant.taskdefs.Zip();
zip.setProject(prj);
zip.setDestFile(zipFile);
FileSet fileSet = new FileSet();
fileSet.setProject(prj);
fileSet.setDir(target);
// ������Щ�ļ����ļ���
fileSet.setIncludes(source.getName());
// �ų���Щ�ļ����ļ���
fileSet.setExcludes("*.zip");
zip.addFileset(fileSet);
zip.execute();
if (delflag) {
source.delete();
}
}
示例6: setUp
import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@Before
public void setUp() {
TestHelper.cleanCache();
project = TestHelper.newProject();
project.setProperty("ivy.cache.dir", TestHelper.cache.getAbsolutePath());
AntWorkspaceResolver antWorkspaceResolver = new AntWorkspaceResolver();
antWorkspaceResolver.setName("test-workspace");
wa = antWorkspaceResolver.createArtifact();
FileSet fileset = new FileSet();
fileset.setProject(project);
fileset.setDir(new File("test/workspace"));
fileset.setIncludes("*/ivy.xml");
antWorkspaceResolver.addConfigured(fileset);
antWorkspaceResolver.setProject(project);
configure = new IvyConfigure();
configure.setProject(project);
configure.setFile(new File("test/workspace/ivysettings.xml"));
configure.addConfiguredWorkspaceResolver(antWorkspaceResolver);
configure.execute();
}
示例7: addFileSet
import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
* Add a new fileset instance to this batchtest. Whatever the fileset is,
* only filename that are <tt>.java</tt> or <tt>.class</tt> will be
* considered as 'candidates'.
* @param fs the new fileset containing the rules to get the testcases.
*/
public void addFileSet(FileSet fs) {
add(fs);
// this one is here because the changes to support ResourceCollections
// have broken Magic's JUnitTestTask.
//
// The task adds a FileSet to a BatchTest instance using the
// Java API and without telling the FileSet about its project
// instance. The original code would pass in project on the
// call to getDirectoryScanner - which is now hidden deep into
// Resources.iterator() and not reachable.
if (fs.getProject() == null) {
fs.setProject(project);
}
}
示例8: toFileSet
import org.apache.tools.ant.types.FileSet; //導入方法依賴的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;
}
示例9: doCheck
import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
* check environment variable
*
* @return return true if the environment variable exist
*/
protected boolean doCheck() {
log("Checking environment variable ...", Project.MSG_VERBOSE);
if (getEnv() != null && System.getenv(getEnv()) != null) {
log(getEnv() + " found !", Project.MSG_VERBOSE);
File libDir = new File(System.getenv(getEnv()), getLayout());
FileSet fileSet = new FileSet();
fileSet.setDir(libDir);
fileSet.setIncludes(getFilter());
fileSet.setProject(getProject());
fileSet.setLocation(getLocation());
getPath().addFileset(fileSet);
getProject().addReference(getPathid(), getPath());
return true;
}
return false;
}
示例10: doFillFilePathItems
import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
@SuppressWarnings("unused") // used by stapler
public ListBoxModel doFillFilePathItems()
throws IOException, InterruptedException {
Run run = findRun();
ListBoxModel m = new ListBoxModel();
if (run != null) {
FileSet fileSet = new FileSet();
fileSet.setProject(new Project());
fileSet.setDir(run.getArtifactsDir());
fileSet.setIncludes("**/*.war");
for (String path : fileSet.getDirectoryScanner().getIncludedFiles()) {
m.add(path);
}
}
return m;
}
示例11: getApplicationFile
import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
@CheckForNull
public File getApplicationFile(@NonNull Run run) {
File result = null;
if (run.getArtifactsDir().isDirectory()) {
FileSet fileSet = new FileSet();
fileSet.setProject(new Project());
fileSet.setDir(run.getArtifactsDir());
fileSet.setIncludes(getFilePattern());
try {
String[] files = fileSet.getDirectoryScanner().getIncludedFiles();
if (files.length > 0) {
result = new File(run.getArtifactsDir(), files[0]);
}
} catch (BuildException e) {
LOGGER.log(Level.FINE, Messages.WildcardPathDeploySource_CouldNotListFromBuildArtifacts(
getFilePattern(), run), e);
}
}
return result;
}
示例12: createModules
import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
public FileSet createModules()
throws BuildException {
FileSet fs = new FileSet();
fs.setProject(getProject());
addConfigured(fs);
return fs;
}
示例13: generateZipFile
import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
public static void generateZipFile(String zipFile, String sourceDir) {
Project project = new Project();
Zip zip = new Zip();
zip.setProject(project);
zip.setDestFile(new File(zipFile));
FileSet fileSet = new FileSet();
fileSet.setProject(project);
fileSet.setDir(new File(sourceDir));
zip.addFileset(fileSet);
zip.execute();
}
示例14: createFileSet
import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/**
* Returns an object representing a nested <var>path</var> element.
*/
public Object createFileSet() {
if (mFileSetInputs == null) {
mFileSetInputs = new ArrayList<FileSet>();
}
FileSet fs = new FileSet();
fs.setProject(getProject());
mFileSetInputs.add(fs);
return fs;
}
示例15: setDir
import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/** Sets a directory as base for class files. The implicit pattern '**/*.class' is used to only scan class files. */
public void setDir(File dir) {
final FileSet fs = new FileSet();
fs.setProject(getProject());
fs.setDir(dir);
// needed if somebody sets restrictClassFilename=false:
fs.setIncludes("**/*.class");
classFiles.add(fs);
}