public void addSourcepath(File cp) { if (!cp.exists()) warning("File on sourcepath that does not exist: " + cp); sourcePath.add(cp); }
public void addSourcepath(File cp) { if (!cp.exists()) warning("File on sourcepath that does not exist: " + cp); sourcePath.add(cp); }
private void resolveFiles(File dir, FileFilter filter, boolean recursive, String path, Map<String, File> files, boolean flatten) { if (Analyzer.doNotCopy.matcher(dir.getName()).matches()) { return; } File[] fs = dir.listFiles(filter); for (File file : fs) { if (file.isDirectory()) { if (recursive) { String nextPath; if ( flatten ) nextPath = path; else nextPath = appendPath( path, file.getName()); resolveFiles(file, filter, recursive, nextPath, files, flatten); } // Directories are ignored otherwise } else { String p =appendPath(path, file.getName()); if ( files.containsKey(p)) warning("Include-Resource overwrites entry %s from file %s", p, file); files.put(p, file); } } }
public void cleanupVersion(Map<String, Map<String, String>> mapOfMap, String defaultVersion) { for (Iterator<Map.Entry<String, Map<String, String>>> e = mapOfMap.entrySet().iterator(); e .hasNext();) { Map.Entry<String, Map<String, String>> entry = e.next(); Map<String, String> attributes = entry.getValue(); String v = attributes.get(Constants.VERSION_ATTRIBUTE); if (v == null && defaultVersion != null) { if (!isTrue(getProperty(Constants.NODEFAULTVERSION))) { v = defaultVersion; if (isPedantic()) warning("Used bundle version %s for exported package %s", v, entry.getKey()); } else { if (isPedantic()) warning("No export version for exported package %s", entry.getKey()); } } if (v != null) attributes.put(Constants.VERSION_ATTRIBUTE, cleanupVersion(v)); } }
/** * * @param jar * @param name * @param instructions */ private void doExpand(Jar jar, String name, Map<Instruction, Map<String, String>> instructions, boolean mandatory) { Set<Instruction> superfluous = removeMarkedDuplicates(instructions .keySet()); for (Iterator<Jar> c = getClasspath().iterator(); c.hasNext();) { Jar now = c.next(); doExpand(jar, instructions, now, superfluous); } if (mandatory && superfluous.size() > 0) { StringBuffer sb = new StringBuffer(); String del = "Instructions in " + name + " that are never used: "; for (Iterator<Instruction> i = superfluous.iterator(); i.hasNext();) { Instruction p = i.next(); sb.append(del); sb.append(p.getPattern()); del = ", "; } warning(sb.toString()); } }
private void resolveFiles(File dir, FileFilter filter, boolean recursive, String path, Map<String, File> files, boolean flatten) { if (doNotCopy(dir.getName())) { return; } File[] fs = dir.listFiles(filter); for (File file : fs) { if (file.isDirectory()) { if (recursive) { String nextPath; if (flatten) nextPath = path; else nextPath = appendPath(path, file.getName()); resolveFiles(file, filter, recursive, nextPath, files, flatten); } // Directories are ignored otherwise } else { String p = appendPath(path, file.getName()); if (files.containsKey(p)) warning("Include-Resource overwrites entry %s from file %s", p, file); files.put(p, file); } } }
/** * * @param jar * @param name * @param instructions */ private void doExpand(Jar jar, String name, Map<Instruction, Map<String, String>> instructions, boolean mandatory) { Set<Instruction> superfluous = removeMarkedDuplicates(instructions.keySet()); for (Iterator<Jar> c = getClasspath().iterator(); c.hasNext();) { Jar now = c.next(); doExpand(jar, instructions, now, superfluous); } if (mandatory && superfluous.size() > 0) { StringBuilder sb = new StringBuilder(); String del = "Instructions in " + name + " that are never used: "; for (Iterator<Instruction> i = superfluous.iterator(); i.hasNext();) { Instruction p = i.next(); sb.append(del); sb.append(p.toString()); del = "\n "; } sb.append("\nClasspath: "); sb.append(Processor.join(getClasspath())); sb.append("\n"); warning("%s",sb.toString()); if (isPedantic()) diagnostics = true; } }
/** * Parse the Bundle-Includes header. Files in the bundles Include header are * included in the jar. The source can be a directory or a file. * * @throws IOException * @throws FileNotFoundException */ private void doIncludeResources(Jar jar) throws Exception { String includes = getProperty("Bundle-Includes"); if (includes == null) { includes = getProperty(INCLUDERESOURCE); if (includes == null) includes = getProperty("Include-Resource"); } else warning("Please use -includeresource instead of Bundle-Includes"); if (includes == null) return; Map<String, Map<String, String>> clauses = parseHeader(includes); for (Iterator<Map.Entry<String, Map<String, String>>> i = clauses .entrySet().iterator(); i.hasNext();) { Map.Entry<String, Map<String, String>> entry = i.next(); doIncludeResource(jar, entry.getKey(), entry.getValue()); } }
/** * Parse the Bundle-Includes header. Files in the bundles Include header are * included in the jar. The source can be a directory or a file. * * @throws IOException * @throws FileNotFoundException */ private void doIncludeResources(Jar jar) throws Exception { String includes = getProperty("Bundle-Includes"); if (includes == null) { includes = getProperty(INCLUDERESOURCE); if (includes == null || includes.length() == 0) includes = getProperty("Include-Resource"); } else warning("Please use -includeresource instead of Bundle-Includes"); doIncludeResource(jar, includes); }
warning("Including sources but " + SOURCEPATH + " does not contain any source directories ");
File sub = getFile(f.getParentFile(), part); if (!sub.exists() || !sub.getParentFile().equals(f.getParentFile())) { warning("Invalid Class-Path entry %s in %s, must exist and must reside in same directory", sub, f); } else {
warning("Including sources but " + SOURCEPATH + " does not contain any source directories ");
private void doExpand(Jar jar) throws IOException { if (getClasspath().size() == 0 && (getProperty(EXPORT_PACKAGE) != null || getProperty(PRIVATE_PACKAGE) != null)) warning("Classpath is empty. Private-Package and Export-Package can only expand from the classpath when there is one"); Map<Instruction, Map<String, String>> privateMap = replaceWitInstruction( getHeader(PRIVATE_PACKAGE), PRIVATE_PACKAGE); Map<Instruction, Map<String, String>> exportMap = replaceWitInstruction( getHeader(EXPORT_PACKAGE), EXPORT_PACKAGE); if (isTrue(getProperty(Constants.UNDERTEST))) { privateMap.putAll(replaceWitInstruction(parseHeader(getProperty( Constants.TESTPACKAGES, "test;presence:=optional")), TESTPACKAGES)); } if (!privateMap.isEmpty()) doExpand(jar, "Private-Package, or -testpackages", privateMap, true); if (!exportMap.isEmpty()) { Jar exports = new Jar("exports"); doExpand(exports, "Export-Package", exportMap, true); jar.addAll(exports); exports.close(); } if (privateMap.isEmpty() && exportMap.isEmpty() && !isResourceOnly()) { warning("Neither Export-Package, Private-Package, -testpackages is set, therefore no packages will be included"); } }
private void doExpand(Jar jar) throws IOException { if (getClasspath().size() == 0 && (getProperty(EXPORT_PACKAGE) != null || getProperty(EXPORT_PACKAGE) != null || getProperty(PRIVATE_PACKAGE) != null)) warning("Classpath is empty. Private-Package and Export-Package can only expand from the classpath when there is one"); Map<Instruction, Map<String, String>> privateMap = Instruction .replaceWithInstruction(getHeader(PRIVATE_PACKAGE)); Map<Instruction, Map<String, String>> exportMap = Instruction .replaceWithInstruction(getHeader(EXPORT_PACKAGE)); if (isTrue(getProperty(Constants.UNDERTEST))) { privateMap.putAll(Instruction.replaceWithInstruction(parseHeader(getProperty( Constants.TESTPACKAGES, "test;presence:=optional")))); } if (!privateMap.isEmpty()) doExpand(jar, "Private-Package, or -testpackages", privateMap, true); if (!exportMap.isEmpty()) { Jar exports = new Jar("exports"); doExpand(exports, EXPORT_PACKAGE, exportMap, true); jar.addAll(exports); exports.close(); } if (!isNoBundle()) { if (privateMap.isEmpty() && exportMap.isEmpty() && !isResourceOnly() && getProperty(EXPORT_CONTENTS) == null) { warning("None of Export-Package, Provide-Package, Private-Package, -testpackages, or -exportcontents is set, therefore no packages will be included"); } } }
warning(diagnostic(pack, getClasspath(), classpathEntry.source)); overwriteResource = false;
warning("%s", diagnostic(pack, getClasspath(), classpathEntry.source)); overwriteResource = false; break;