本文整理匯總了Java中org.apache.tools.ant.types.Path.list方法的典型用法代碼示例。如果您正苦於以下問題:Java Path.list方法的具體用法?Java Path.list怎麽用?Java Path.list使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.tools.ant.types.Path
的用法示例。
在下文中一共展示了Path.list方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: execute
import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
public void execute() throws BuildException {
if (paths.isEmpty()) {
throw new BuildException ("Source dir or fileset required to scan for images");
}
if (outDir == null) {
throw new BuildException ("Output directory for cache file must be specified");
}
try {
CacheWriter writer = new CacheWriter();
writer.setDir(outDir.toString(), clean);
Iterator it = paths.iterator();
while (it.hasNext()) {
Path curr = (Path) it.next();
String[] dirs = curr.list();
for (int i=0; i < dirs.length; i++) {
System.err.println("WriteDir " + dirs[i]);
writer.writeDir(dirs[i], true);
}
}
} catch (IOException ioe) {
ioe.printStackTrace();
throw new BuildException (ioe.getMessage());
}
}
示例2: testProjectsNotSet
import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
@Test
public void testProjectsNotSet() {
task.setWorkspacedir(TESTWORKSPACE);
task.setProjects("");
task.execute();
Path path = (Path) project.getReference("resolved.projects.path");
String[] entries = path.list();
assertEquals(4, entries.length);
assertEquals(new File("resources/testworkspace/project-lib")
.getAbsolutePath(), entries[0]);
assertEquals(new File("resources/testworkspace/project-a")
.getAbsolutePath(), entries[1]);
assertEquals(new File("resources/testworkspace/project-b")
.getAbsolutePath(), entries[2]);
assertEquals(new File("resources/testworkspace/project-c")
.getAbsolutePath(), entries[3]);
}
示例3: testSetClasspathRef1
import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
/** This test is created to satisfy pitest, it is hard to emulate Reference by Id. */
@Test
public void testSetClasspathRef1() {
final CheckstyleAntTask antTask = new CheckstyleAntTask();
final Project project = new Project();
antTask.setClasspath(new Path(project, "firstPath"));
antTask.setClasspathRef(new Reference(project, "idXX"));
try {
assertNotNull("Classpath should not be null",
Whitebox.getInternalState(antTask, "classpath"));
final Path classpath = (Path) Whitebox.getInternalState(antTask, "classpath");
classpath.list();
fail("Exception is expected");
}
catch (BuildException ex) {
assertEquals("unexpected exception message",
"Reference idXX not found.", ex.getMessage());
}
}
示例4: createClassLoader
import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
protected GroovyClassLoader createClassLoader() {
GroovyClassLoader gcl =
AccessController.doPrivileged(
new PrivilegedAction<GroovyClassLoader>() {
@Override
public GroovyClassLoader run() {
return new GroovyClassLoader(ClassLoader.getSystemClassLoader(), config);
}
});
Path path = getClasspath();
if (path != null) {
final String[] filePaths = path.list();
for (int i = 0; i < filePaths.length; i++) {
String filePath = filePaths[i];
gcl.addClasspath(filePath);
}
}
return gcl;
}
示例5: loadRegisteredScriptExtensions
import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
private void loadRegisteredScriptExtensions() {
if (scriptExtensions.isEmpty()) {
scriptExtensions.add(getScriptExtension().substring(2)); // first extension will be the one set explicitly on <groovyc>
Path classpath = getClasspath() != null ? getClasspath() : new Path(getProject());
final String[] pe = classpath.list();
try (GroovyClassLoader loader = new GroovyClassLoader(getClass().getClassLoader())) {
for (String file : pe) {
loader.addClasspath(file);
}
scriptExtensions.addAll(SourceExtensionHandler.getRegisteredExtensions(loader));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
示例6: verifyPathAdheresToDesign
import org.apache.tools.ant.types.Path; //導入方法依賴的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);
}
}
示例7: getSorted
import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
private String[] getSorted(String property) {
Path path = new Path(project);
path.setPath(property);
String paths[] = path.list();
String rets [] = new String[paths.length];
for (int i = 0; i < paths.length; i++) {
rets[i] = new File(paths[i]).getName();
}
return rets;
}
示例8: getLazyJarsSet
import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
private static Set<? extends File> getLazyJarsSet(final Project prj, final List<? extends File> runCp, final Path value) {
final Set<File> result = new HashSet<File>();
if (value != null) {
for (String pathElement : value.list()) {
result.add(prj.resolveFile(pathElement));
}
}
for (File re : runCp) {
if (Project.toBoolean(prj.getProperty(String.format(JNLP_LAZY_FORMAT, re.getName())))) {
result.add(re);
}
}
return result;
}
示例9: verifyPaths
import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
static void verifyPaths(Project project, Path path) {
if (path == null) return ;
String[] paths = path.list();
for (int i = 0; i < paths.length; i++) {
String pathName = project.replaceProperties(paths[i]);
File file = FileUtil.normalizeFile
(project.resolveFile (pathName));
if (!file.exists()) {
project.log("Non-existing path \""+pathName+"\" provided.", Project.MSG_WARN);
//throw new BuildException("Non-existing path \""+paths[i]+"\" provided.");
}
}
}
示例10: convertToClassPath
import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
private static ClassPath convertToClassPath (Project project, Path path) {
String[] paths = path == null ? new String [0] : path.list ();
List l = new ArrayList ();
int i, k = paths.length;
for (i = 0; i < k; i++) {
String pathName = project.replaceProperties(paths[i]);
File f = FileUtil.normalizeFile (project.resolveFile (pathName));
if (!isValid (f, project)) continue;
URL url = fileToURL (f, project, true, false);
if (url == null) continue;
l.add (url);
}
URL[] urls = (URL[]) l.toArray (new URL [l.size ()]);
return ClassPathSupport.createClassPath (urls);
}
示例11: testProjectLib
import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
@Test
public void testProjectLib() {
task.setWorkspacedir(TESTWORKSPACE);
task.setProjects("project-lib");
task.execute();
Path path = (Path) project.getReference("resolved.projects.path");
String[] entries = path.list();
assertEquals(1, entries.length);
assertEquals(new File("resources/testworkspace/project-lib")
.getAbsolutePath(), entries[0]);
}
示例12: testProjectA
import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
@Test
public void testProjectA() {
task.setWorkspacedir(TESTWORKSPACE);
task.setProjects("project-a");
task.execute();
Path path = (Path) project.getReference("resolved.projects.path");
String[] entries = path.list();
assertEquals(2, entries.length);
assertEquals(new File("resources/testworkspace/project-lib")
.getAbsolutePath(), entries[0]);
assertEquals(new File("resources/testworkspace/project-a")
.getAbsolutePath(), entries[1]);
}
示例13: testProjectAandLib
import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
@Test
public void testProjectAandLib() {
task.setWorkspacedir(TESTWORKSPACE);
task.setProjects("project-a, project-lib");
task.execute();
Path path = (Path) project.getReference("resolved.projects.path");
String[] entries = path.list();
assertEquals(2, entries.length);
assertEquals(new File("resources/testworkspace/project-lib")
.getAbsolutePath(), entries[0]);
assertEquals(new File("resources/testworkspace/project-a")
.getAbsolutePath(), entries[1]);
}
示例14: testProjectBandA
import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
@Test
public void testProjectBandA() {
task.setWorkspacedir(TESTWORKSPACE);
task.setProjects("project-b, project-a");
task.execute();
Path path = (Path) project.getReference("resolved.projects.path");
String[] entries = path.list();
assertEquals(3, entries.length);
assertEquals(new File("resources/testworkspace/project-lib")
.getAbsolutePath(), entries[0]);
assertEquals(new File("resources/testworkspace/project-b")
.getAbsolutePath(), entries[1]);
assertEquals(new File("resources/testworkspace/project-a")
.getAbsolutePath(), entries[2]);
}
示例15: processExtraResourcesPaths
import org.apache.tools.ant.types.Path; //導入方法依賴的package包/類
/**
* Process any extraresourcespath elements provided to this task and
* include the resources they refer to in the given set.
*/
private void processExtraResourcesPaths(Set<URL> resources) {
for(Path p : extraResourcesPaths) {
for(String resource : p.list()) {
File resourceFile = new File(resource);
try {
resources.add(resourceFile.toURI().toURL());
}
catch(MalformedURLException e) {
throw new BuildException("Couldn't construct URL for extra resource "
+ resourceFile, e, getLocation());
}
}
}
}