當前位置: 首頁>>代碼示例>>Java>>正文


Java FileSet.setProject方法代碼示例

本文整理匯總了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();
}
 
開發者ID:dragon-yuan,項目名稱:Ins_fb_pictureSpider_WEB,代碼行數:17,代碼來源:CompressionUtil.java

示例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;
}
 
開發者ID:qinjr,項目名稱:TeamNote,代碼行數:21,代碼來源:ExportUtilImpl.java

示例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();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:MultiFilesTask.java

示例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);
	}
}
 
開發者ID:cniweb,項目名稱:ant-contrib,代碼行數:25,代碼來源:VerifyDesignDelegate.java

示例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();
	}
}
 
開發者ID:Petasoft,項目名稱:Export,代碼行數:34,代碼來源:Zip.java

示例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();
}
 
開發者ID:apache,項目名稱:ant-ivy,代碼行數:23,代碼來源:AntBuildResolverTest.java

示例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);
    }
}
 
開發者ID:apache,項目名稱:ant,代碼行數:22,代碼來源:BatchTest.java

示例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;
}
 
開發者ID:apache,項目名稱:ant,代碼行數:19,代碼來源:Sync.java

示例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;

}
 
開發者ID:apache,項目名稱:ant-easyant-core,代碼行數:25,代碼來源:EnvironmentStrategy.java

示例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;
}
 
開發者ID:jenkinsci,項目名稱:deployer-framework-plugin,代碼行數:21,代碼來源:StaticSelectionDeploySource.java

示例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;
}
 
開發者ID:jenkinsci,項目名稱:deployer-framework-plugin,代碼行數:25,代碼來源:WildcardPathDeploySource.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:MakeMasterJNLP.java

示例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();
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:12,代碼來源:ZipUtils.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:DexExecTask.java

示例15: setDir

import org.apache.tools.ant.types.FileSet; //導入方法依賴的package包/類
/** Sets a directory as base for class files. The implicit pattern '**&#47;*.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);
}
 
開發者ID:policeman-tools,項目名稱:forbidden-apis,代碼行數:10,代碼來源:AntTask.java


注:本文中的org.apache.tools.ant.types.FileSet.setProject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。