/** * Flatten a container in the output list. (e.g. expand any libraries). * * @param container the container to flatten * @param list the result list */ public static void flatten(Container container, List<Container> list) throws Exception { if (container.getType() == TYPE.LIBRARY) { flatten(container.getMembers(), list); } else list.add(container); }
/** * Flatten a container in the output list. (e.g. expand any libraries). * * @param container the container to flatten * @param list the result list */ public static void flatten(Container container, List<Container> list) throws Exception { if (container.getType() == TYPE.LIBRARY) { flatten(container.getMembers(), list); } else list.add(container); }
/** * Flatten a container in the output list. (e.g. expand any libraries). * * @param container the container to flatten * @param list the result list */ public static void flatten(Container container, List<Container> list) throws Exception { if (container.getType() == TYPE.LIBRARY) { flatten(container.getMembers(), list); } else list.add(container); } /**
/** * Flatten a container in the output list. (e.g. expand any libraries). * * @param container the container to flatten * @param list the result list */ public static void flatten(Container container, List<Container> list) throws Exception { if (container.getType() == TYPE.LIBRARY) { flatten(container.getMembers(), list); } else list.add(container); } /**
private List<File> getBundles(Collection<Container> containers, Processor reporter) throws Exception { List<File> files = new ArrayList<>(); for (Container container : containers) { switch (container.getType()) { case ERROR : // skip, already reported break; case PROJECT : case EXTERNAL : case REPO : files.add(container.getFile()); break; case LIBRARY : container.contributeFiles(files, reporter); break; } } return files; }
public void addClasspath(Container c) throws IOException { File file = c.getFile(); if ((c.getType() == TYPE.PROJECT) && !file.exists()) { return; } Jar jar = new Jar(file); super.addClasspath(jar); project.unreferencedClasspathEntries.put(jar.getName(), c); }
public void addClasspath(Container c) throws IOException { File file = c.getFile(); if ((c.getType() == TYPE.PROJECT) && !file.exists()) { return; } Jar jar = new Jar(file); super.addClasspath(jar); project.unreferencedClasspathEntries.put(jar.getName(), c); }
/** * Return the this if this is anything else but a library. If it is a * library, return the members. This could work recursively, e.g., libraries * can point to libraries. * * @throws Exception */ public List<Container> getMembers() throws Exception { List<Container> result = project.newList(); // Are ww a library? If no, we are the result if (getType() == TYPE.LIBRARY) { // We are a library, parse the file. This is // basically a specification clause per line. // I.e. you can do bsn; version, bsn2; version. But also // spread it out over lines. try (BufferedReader rd = IO.reader(getFile(), Constants.DEFAULT_CHARSET)) { String line; while ((line = rd.readLine()) != null) { line = line.trim(); if (!line.startsWith("#") && line.length() > 0) { List<Container> list = project.getBundles(Strategy.HIGHEST, line, null); result.addAll(list); } } } } else result.add(this); return result; }
/** * Calculate the classpath. We include our own runtime.jar which includes * the test framework and we include the first of the test frameworks * specified. */ public String[] getClasspath() { try { List<String> classpath = new ArrayList<String>(); classpath.add(getRuntime().getAbsolutePath()); for (Container c : project.getRunpath()) { if (c.getType() != Container.TYPE.ERROR) { if (!c.getFile().getName().startsWith("ee.")) classpath.add(c.getFile().getAbsolutePath()); } else { error("Invalid entry on the " + Constants.RUNPATH + ": " + c); } } return classpath.toArray(new String[classpath.size()]); } catch (Exception e) { error("Calculating class path", e); } return null; }
/** * Return the this if this is anything else but a library. If it is a * library, return the members. This could work recursively, e.g., libraries * can point to libraries. * * @throws Exception */ public List<Container> getMembers() throws Exception { List<Container> result = project.newList(); // Are ww a library? If no, we are the result if (getType() == TYPE.LIBRARY) { // We are a library, parse the file. This is // basically a specification clause per line. // I.e. you can do bsn; version, bsn2; version. But also // spread it out over lines. try (BufferedReader rd = IO.reader(getFile(), Constants.DEFAULT_CHARSET)) { String line; while ((line = rd.readLine()) != null) { line = line.trim(); if (!line.startsWith("#") && line.length() > 0) { List<Container> list = project.getBundles(Strategy.HIGHEST, line, null); result.addAll(list); } } } } else result.add(this); return result; }
/** * Iterate over the entries and place the projects on the projects list and * all the files of the entries on the resultpath. * * @param resultpath * The list that gets all the files * @param projects * The list that gets any projects that are entries * @param entries * The input list of classpath entries */ private void doPath(Collection<Container> resultpath, Collection<Project> projects, Collection<Container> entries, Collection<Container> bootclasspath) { for (Container cpe : entries) { if (cpe.getError() != null) error(cpe.getError()); else { if (cpe.getType() == Container.TYPE.PROJECT) { projects.add(cpe.getProject()); } if (bootclasspath != null && (cpe.getBundleSymbolicName().startsWith("ee.") || cpe.getAttributes().containsKey("boot"))) bootclasspath.add(cpe); else resultpath.add(cpe); } } }
/** * Iterate over the entries and place the projects on the projects list and * all the files of the entries on the resultpath. * * @param resultpath * The list that gets all the files * @param projects * The list that gets any projects that are entries * @param entries * The input list of classpath entries */ private void doPath(Collection<Container> resultpath, Collection<Project> projects, Collection<Container> entries, Collection<Container> bootclasspath) { for (Container cpe : entries) { if (cpe.getError() != null) error(cpe.getError()); else { if (cpe.getType() == Container.TYPE.PROJECT) { projects.add(cpe.getProject()); } if (bootclasspath != null && cpe.getBundleSymbolicName().startsWith("ee.") || cpe.getAttributes().containsKey("boot")) bootclasspath.add(cpe); else resultpath.add(cpe); } } }
/** * Iterate over the entries and place the projects on the projects list and * all the files of the entries on the resultpath. * * @param resultpath * The list that gets all the files * @param projects * The list that gets any projects that are entries * @param entries * The input list of classpath entries */ private void doPath(Collection<Container> resultpath, Collection<Project> projects, Collection<Container> entries, Collection<Container> bootclasspath) { for (Container cpe : entries) { if (cpe.getError() != null) error(cpe.getError()); else { if (cpe.getType() == Container.TYPE.PROJECT) { projects.add(cpe.getProject()); } if (bootclasspath != null && cpe.getBundleSymbolicName().startsWith("ee.") || cpe.getAttributes().containsKey("boot")) bootclasspath.add(cpe); else resultpath.add(cpe); } } }
/** * Calculate the classpath. We include our own runtime.jar which includes * the test framework and we include the first of the test frameworks * specified. */ public String[] getClasspath(ILaunchConfiguration configuration) throws CoreException { try { IJavaProject javaProject = getJavaProject(configuration); Project model = Activator.getDefault().getCentral().getModel(javaProject); List<String> classpath = new ArrayList<String>(); classpath.add(getRuntime().getAbsolutePath()); for (Container c : model.getRunpath()) { if (c.getType() != Container.TYPE.ERROR) { classpath.add(c.getFile().getAbsolutePath()); } else { abort("Invalid entry on the " + Constants.RUNPATH + ": " + c, null, IStatus.ERROR); } } return classpath.toArray(new String[classpath.size()]); } catch (Exception e) { abort("Calculating class path", e, IStatus.ERROR); } return null; }
private void add(List<String> paths, Container container) throws Exception { if (container.getType() == Container.TYPE.LIBRARY) { List<Container> members = container.getMembers(); for (Container sub : members) { add(paths, sub); } } else { if (container.getError() == null) paths.add(container.getFile().getAbsolutePath()); else { paths.add("<<${repo} = " + container.getBundleSymbolicName() + "-" + container.getVersion() + " : " + container.getError() + ">>"); if (isPedantic()) { warning("Could not expand repo path request: %s ", container); } } } }
private void add(List<String> paths, Container container) throws Exception { if (container.getType() == Container.TYPE.LIBRARY) { List<Container> members = container.getMembers(); for (Container sub : members) { add(paths, sub); } } else { if (container.getError() == null) paths.add(container.getFile().getAbsolutePath()); else { paths.add("<<${repo} = " + container.getBundleSymbolicName() + "-" + container.getVersion() + " : " + container.getError() + ">>"); if (isPedantic()) { warning("Could not expand repo path request: %s ", container); } } } }
private void add(List<String> paths, Container container) throws Exception { if (container.getType() == Container.TYPE.LIBRARY) { List<Container> members = container.getMembers(); for (Container sub : members) { add(paths, sub); } } else { if (container.getError() == null) paths.add(container.getFile().getAbsolutePath()); else { paths.add("<<${repo} = " + container.getBundleSymbolicName() + "-" + container.getVersion() + " : " + container.getError() + ">>"); if (isPedantic()) { warning("Could not expand repo path request: %s ", container); } } } }
private void add(List<String> paths, Container container) throws Exception { if (container.getType() == Container.TYPE.LIBRARY) { List<Container> members = container.getMembers(); for (Container sub : members) { add(paths, sub); } } else { if (container.getError() == null) paths.add(container.getFile().getAbsolutePath()); else { paths.add("<<${repo} = " + container.getBundleSymbolicName() + "-" + container.getVersion() + " : " + container.getError() + ">>"); if (isPedantic()) { warning("Could not expand repo path request: %s ", container); } } } }
private void add(List<String> paths, Container container) throws Exception { if (container.getType() == Container.TYPE.LIBRARY) { List<Container> members = container.getMembers(); for (Container sub : members) { add(paths, sub); } } else { if (container.getError() == null) paths.add(IO.absolutePath(container.getFile())); else { paths.add("<<${repo} = " + container.getBundleSymbolicName() + "-" + container.getVersion() + " : " + container.getError() + ">>"); if (isPedantic()) { warning("Could not expand repo path request: %s ", container); } } } }
private void add(List<String> paths, Container container) throws Exception { if (container.getType() == Container.TYPE.LIBRARY) { List<Container> members = container.getMembers(); for (Container sub : members) { add(paths, sub); } } else { if (container.getError() == null) paths.add(IO.absolutePath(container.getFile())); else { paths.add("<<${repo} = " + container.getBundleSymbolicName() + "-" + container.getVersion() + " : " + container.getError() + ">>"); if (isPedantic()) { warning("Could not expand repo path request: %s ", container); } } } }