@Override public void processLibrary(String libRootPath, IPropertySource properties) { StringBuilder sb = new StringBuilder(libRootPath); for (String segment : mLeafSegments) { sb.append('/'); Matcher m = PH.matcher(segment); if (m.matches()) { String value = properties.getProperty(m.group(1)); if (value == null) { value = TaskHelper.getDefault(m.group(1)); } if (value == null) { throw new BuildException( "Failed to resolve '" + m.group(1) + "' for project " + libRootPath); } sb.append(value); } else { sb.append(segment); } } PathElement element = mPath.createPathElement(); element.setPath(sb.toString()); }
@Override public void execute() throws BuildException { Java java = new Java(this); java.setFork(true); java.setClassname(getClassname()+"_impl"); if(assertions() != null) { java.addAssertions(assertions()); } Path path = getClasspath(); PathElement jlo_base = path.createPathElement(); File loc = JLoProjectConfigurator.jloBase().getAbsoluteFile().getAbsoluteFile(); jlo_base.setLocation(loc); path.add(jlo_base); path.addJavaRuntime(); java.setClasspath(path); java.execute(); }
/** * Executes the processor using a given DependencyHelper. * @param helper * @param processor * @throws BuildException */ private void execute(@NonNull DependencyHelper helper, @Nullable LibraryProcessor processor) throws BuildException { final Project antProject = getProject(); System.out.println("Library dependencies:"); Path path = new Path(antProject); if (helper.getLibraryCount() > 0) { System.out.println("\n------------------\nOrdered libraries:"); helper.processLibraries(processor); if (mLibraryFolderPathOut != null) { if (mLeaf == null) { // Fill a Path object with all the libraries in reverse order. // This is important so that compilation of libraries happens // in the reverse order. List<File> libraries = helper.getLibraries(); for (int i = libraries.size() - 1 ; i >= 0; i--) { File library = libraries.get(i); PathElement element = path.createPathElement(); element.setPath(library.getAbsolutePath()); } } else { path = ((LeafProcessor) processor).getPath(); } } } else { System.out.println("No Libraries"); } antProject.addReference(mLibraryFolderPathOut, path); }
/** * Make an array of artifacts a path and save it in the ant references */ private Path makePath(String pathId, List<ArtifactDownloadReport> artifacts) { log("Path '" + pathId + "' computed with " + artifacts.size() + " files", Project.MSG_VERBOSE); Path path = new Path(getProject()); for (ArtifactDownloadReport artifact : artifacts) { if (artifact.getLocalFile() != null) { PathElement pe = path.createPathElement(); pe.setLocation(artifact.getLocalFile()); log("Adding to path '" + pathId + "': " + artifact.getLocalFile(), Project.MSG_DEBUG); } } getProject().addReference(pathId, path); return path; }
private void addClasspathAttributes(final Attributes attributes, final ModuleInfo moduleInfo) throws ModuleNotLoadedException { for (final ClasspathAttribute attrib : classpathAttributes) { final String attributeName = attrib.name; if (attributeName == null) { throw new BuildException("A 'classpathAttribute' element with undefined name is encountered."); } final String value = (String) attributes.remove(new Name(attributeName)); if (value == null) { continue; } final Path classpath = new Path(getProject()); final Matcher m = listElementPattern.matcher(value); while (m.find()) { final String url = m.group(); final String classpathElement; try { classpathElement = decodeUrl(url); } catch (RuntimeException ex) { throw new ModuleNotLoadedException(MessageFormat.format( "Unable to load the module ''{2}''. The classpath attribute ''{1}'' " + "contains an invalid URL element: ''{0}''.", m.group(), attributeName, moduleInfo.getPath()), ex); } final PathElement element = classpath.createPathElement(); element.setPath(new File(moduleInfo.getPath(), classpathElement).getPath()); } moduleInfo.addAttribute(attributeName, classpath); } }
public PathElement createPathElement() throws BuildException { return toAdd.createPathElement(); }
public PathElement createPathElement() throws BuildException { return path.createPathElement(); }