path.setLocation(file);
setLocation(f); } else if (f.getParentFile() != null && f.getParentFile().exists() && containsWildcards(f.getName())) { setLocation(f); log("adding " + f + " which contains wildcards and may not do what you intend it to do depending on your OS or version of Java",
containingPath.setLocation(resolveFile(attributeValue)); } else if (PATHID.equals(nodeName)) {
createClasspath().setLocation(findJar());
g.setDestdir(destination); File input = new File(ioTempFile, jarId + "in"); sourcePath.setLocation(input); g.setSrcdir(sourcePath); input.mkdir();
g.setDestdir(destination); File input = new File(ioTempFile, jarId + "in"); sourcePath.setLocation(input); g.setSrcdir(sourcePath); input.mkdir();
createClasspath().setLocation(findJar());
/** * Helper method invoked by isRebuildRequired to get a ClassLoader for a * Jar File passed to it. * * @param classjar java.io.File representing jar file to get classes from. * @return the classloader for the jarfile. * @throws IOException if there is a problem. */ protected ClassLoader getClassLoaderFromJar(File classjar) throws IOException { Path lookupPath = new Path(getTask().getProject()); lookupPath.setLocation(classjar); Path classpath = getCombinedClasspath(); if (classpath != null) { lookupPath.append(classpath); } return getTask().getProject().createClassLoader(lookupPath); } }
/** * Helper method invoked by isRebuildRequired to get a ClassLoader for a * Jar File passed to it. * * @param classjar java.io.File representing jar file to get classes from. * @return a classloader for the jar file. * @throws IOException if there is an error. */ protected ClassLoader getClassLoaderFromJar(File classjar) throws IOException { Path lookupPath = new Path(getTask().getProject()); lookupPath.setLocation(classjar); Path classpath = getCombinedClasspath(); if (classpath != null) { lookupPath.append(classpath); } return getTask().getProject().createClassLoader(lookupPath); } }
/** * Builds the compilation classpath. * @return the compilation class path */ protected Path getCompileClasspath() { final Path classpath = new Path(project); // add dest dir to classpath so that previously compiled and // untouched classes are on classpath if (destDir != null && getJavac().isIncludeDestClasses()) { classpath.setLocation(destDir); } // Combine the build classpath with the system classpath, in an // order determined by the value of build.sysclasspath Path cp = compileClasspath; if (cp == null) { cp = new Path(project); } if (includeAntRuntime) { classpath.addExisting(cp.concatSystemClasspath("last")); } else { classpath.addExisting(cp.concatSystemClasspath("ignore")); } if (includeJavaRuntime) { classpath.addJavaRuntime(); } return classpath; }
/** * Builds the compilation classpath. * @return the classpath */ protected Path getCompileClasspath() { Path classpath = new Path(attributes.getProject()); // add dest dir to classpath so that previously compiled and // untouched classes are on classpath classpath.setLocation(attributes.getBase()); // Combine the build classpath with the system classpath, in an // order determined by the value of build.sysclasspath Path cp = attributes.getClasspath(); if (cp == null) { cp = new Path(attributes.getProject()); } if (attributes.getIncludeantruntime()) { classpath.addExisting(cp.concatSystemClasspath("last")); } else { classpath.addExisting(cp.concatSystemClasspath("ignore")); } if (attributes.getIncludejavaruntime()) { classpath.addJavaRuntime(); } return classpath; }
public void setClassPath(List<File> cpath) { Path path = new Path(project); for (File file: cpath) { path.setLocation(file); info.append(" cp=" + file + "\n"); } javac.setClasspath(path); }
public void setClassPath(List<File> cpath) { Path path = new Path(project); for (File file : cpath) { path.setLocation(file); info.append(" cp=" + file + "\n"); } javac.setClasspath(path); }
/** * Adds a classpath source which contains the given resource. * * TODO: [GH-213] this is extremely ugly; separate the code required to run on the * forked JVM into an isolated bundle and either create it on-demand (in temp. * files location?) or locate it in classpath somehow (in a portable way). */ private org.apache.tools.ant.types.Path addSlaveClasspath() { org.apache.tools.ant.types.Path path = new org.apache.tools.ant.types.Path(getProject()); String [] REQUIRED_SLAVE_CLASSES = { SlaveMain.class.getName(), Strings.class.getName(), MethodGlobFilter.class.getName(), TeeOutputStream.class.getName() }; for (String clazz : Arrays.asList(REQUIRED_SLAVE_CLASSES)) { String resource = clazz.replace(".", "/") + ".class"; File f = LoaderUtils.getResourceSource(getClass().getClassLoader(), resource); if (f != null) { path.createPath().setLocation(f); } else { throw new BuildException("Could not locate classpath for resource: " + resource); } } return path; } }
/** * Adds a classpath source which contains the given resource. * * TODO: [GH-213] this is extremely ugly; separate the code required to run on the * forked JVM into an isolated bundle and either create it on-demand (in temp. * files location?) or locate it in classpath somehow (in a portable way). */ private org.apache.tools.ant.types.Path addSlaveClasspath() { org.apache.tools.ant.types.Path path = new org.apache.tools.ant.types.Path(getProject()); String [] REQUIRED_SLAVE_CLASSES = { SlaveMain.class.getName(), Strings.class.getName(), MethodGlobFilter.class.getName(), TeeOutputStream.class.getName() }; for (String clazz : Arrays.asList(REQUIRED_SLAVE_CLASSES)) { String resource = clazz.replace(".", "/") + ".class"; File f = LoaderUtils.getResourceSource(getClass().getClassLoader(), resource); if (f != null) { path.createPath().setLocation(f); } else { throw new BuildException("Could not locate classpath for resource: " + resource); } } return path; } }
/** * Compiles a directory tree. Throws a <code>CompilationException</code> if build fails. * * @param srcDir Source directory holding the files to be compiled. * @param destDir Destination directory to put the compiled classes in. */ private void compileDirectory(final File srcDir, final File destDir) { File[] entries = srcDir.listFiles(); for (int i = 0; i < entries.length; i++) { File entry = entries[i]; if (entry.isDirectory() && !IGNORE_DIRS.contains(entry.getName())) { compileDirectory(entry, destDir); } } entries = null; try { Path srcPath = _compiler.createSrc(); srcPath.setLocation(destDir); _compiler.setSrcdir(srcPath); _compiler.execute(); } catch (BuildException ex) { throw new CompilationException("Problem compiling directory " + srcDir, ex); } }
if (f != null) { log("Found " + f.getAbsolutePath(), Project.MSG_DEBUG); antRuntimeClasses.createPath().setLocation(f); return true; } else {
public void setDestdir( File outputDirectory ) { this.destdir = outputDirectory; if ( destdir != null ) { Path dst = new Path( getProject() ); dst.setLocation( destdir ); createClasspath().add( dst ); } }
java.createClasspath().setLocation(proguardJar);
public void compile(List files, CompilationUnit cu) { // forward options if (javac.getClasspath()==null) { javac.setClasspath(compileClasspath); } if (javac.getSourcepath()==null && compileSourcepath!=null) { javac.createSourcepath().add(compileSourcepath); } if (javac.getEncoding()==null) { javac.setEncoding(encoding); } javac.setDestdir(destDir); Path p = javac.createSrc(); p.add(src); Path tmpDir = new Path(getProject()); File dir = (File) cu.getConfiguration().getJointCompilationOptions().get("stubDir"); tmpDir.setLocation(dir); p.add(tmpDir); javac.execute(); } };