/** * Emulation of extdirs feature in Java >= 1.2. * This method adds all files in the given * directories (but not in sub-directories!) to the classpath, * so that you don't have to specify them all one by one. * @param extdirs - Path to append files to */ public void addExtdirs(Path extdirs) { if (extdirs == null) { String extProp = System.getProperty("java.ext.dirs"); if (extProp != null) { extdirs = new Path(getProject(), extProp); } else { return; } } for (String d : extdirs.list()) { File dir = resolveFile(getProject(), d); if (dir.exists() && dir.isDirectory()) { FileSet fs = new FileSet(); fs.setDir(dir); fs.setIncludes("*"); addFileset(fs); } } }
kaffeJarFiles.setDir(kaffeShare); kaffeJarFiles.setIncludes("*.jar"); addFileset(kaffeJarFiles); + File.separator + "Packages")); msZipFiles.setIncludes("*.ZIP"); addFileset(msZipFiles); } else {
examinationFileSet.setFile(new File(getPath(FLAWLESS_INPUT))); final Path sourcePath = new Path(antTask.getProject()); sourcePath.addFileset(examinationFileSet); antTask.addPath(sourcePath); antTask.addPath(new Path(new Project()));
@Test public final void testPathsOneFile() throws IOException { // given TestRootModuleChecker.reset(); final CheckstyleAntTask antTask = getCheckstyleAntTask(CUSTOM_ROOT_CONFIG_FILE); final FileSet examinationFileSet = new FileSet(); examinationFileSet.setFile(new File(getPath(FLAWLESS_INPUT))); final Path sourcePath = new Path(antTask.getProject()); sourcePath.addFileset(examinationFileSet); antTask.addPath(sourcePath); // when antTask.execute(); // then assertTrue("Checker is not processed", TestRootModuleChecker.isProcessed()); final List<File> filesToCheck = TestRootModuleChecker.getFilesToCheck(); assertThat("There more files to check then expected", filesToCheck.size(), is(1)); assertThat("The path of file differs from expected", filesToCheck.get(0).getAbsolutePath(), is(getPath(FLAWLESS_INPUT))); }
public void addFileset(FileSet fs) throws BuildException { toAdd.addFileset(fs); }
/** * @param set FileSet */ public final void addFileset(final FileSet set) { getBuildpath().addFileset(set); }
private void addBuildFile(Path path, File buildFile) { FileSet fs = new FileSet(); fs.setFile(buildFile); path.addFileset(fs); }
path.addFileset(fset);
public void execute() { if (applicationDir == null) { throw new BuildException("No applicationDir set!"); } // Add the properties from application.conf as ant properties for (Map.Entry<String,String> entry: properties().entrySet()) { String key = entry.getKey(); String value = project.replaceProperties(entry.getValue()); project.setProperty(prefix + key, value); project.log("Loaded property '" + prefix + key + "'='" + value + "'", Project.MSG_VERBOSE); } // Add the module classpath as an ant property Path path = new Path(project); FilenameSelector endsToJar = new FilenameSelector(); endsToJar.setName("*.jar"); for (File module: modules()) { File moduleLib = new File(module, "lib"); if (moduleLib.exists()) { FileSet fileSet = new FileSet(); fileSet.setDir(moduleLib); fileSet.addFilename(endsToJar); path.addFileset(fileSet); project.log("Added fileSet to path: " + fileSet, Project.MSG_VERBOSE); } else { project.log("Ignoring non existing lib dir: " + moduleLib.getAbsolutePath(), Project.MSG_VERBOSE); } } project.addReference(modulesClasspath, path); project.log("Generated classpath '" + modulesClasspath + "':" + project.getReference(modulesClasspath), Project.MSG_VERBOSE); }
private void addArtifactToResult( ArtifactRepository localRepo, Artifact artifact, FileSet toFileSet, Path path, ArtifactFilter filter ) { String filename = localRepo.pathOf( artifact ); toFileSet.createInclude().setName( filename ); getProject().setProperty( artifact.getDependencyConflictId(), artifact.getFile().getAbsolutePath() ); FileSet artifactFileSet = new FileSet(); artifactFileSet.setProject( getProject() ); artifactFileSet.setFile( artifact.getFile() ); getProject().addReference( artifact.getDependencyConflictId(), artifactFileSet ); if ( path != null && ( filter == null || filter.include( artifact ) ) ) { path.addFileset( artifactFileSet ); } }
private void setupLocalMaven() { // Set the required properties Variable classworldsConfProp = new Variable(); classworldsConfProp.setKey( "classworlds.conf" ); File classworldsPath = new File( mavenHome, "bin/m2.conf" ); classworldsConfProp.setValue( classworldsPath.getAbsolutePath() ); this.addSysproperty( classworldsConfProp ); Variable mavenHomeProp = new Variable(); mavenHomeProp.setKey( "maven.home" ); mavenHomeProp.setValue( mavenHome.getAbsolutePath() ); this.addSysproperty( mavenHomeProp ); // Set the boot classpath FileSet bootDir = new FileSet(); bootDir.setDir( new File ( mavenHome, "boot" ) ); bootDir.setIncludes( "*.jar" ); Path mavenClasspath = new Path( getProject() ); mavenClasspath.addFileset( bootDir ); this.setClasspath( mavenClasspath ); this.setClassname( "org.codehaus.classworlds.Launcher" ); }
set.createInclude().setName( "platform*/lib/*.jar" ); convert.createPath().addFileset( set ); try
jwsFS.setDir(tmpDir); jwsFS.createInclude().setName("src"); sourcepath.addFileset(jwsFS);