/** * * @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()); } }
/** * * @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; } }
doExpand(dot, CONDITIONAL_PACKAGE + " Private imports", Instruction.replaceWithInstruction(filtered), false);
doExpand(dot, CONDITIONAL_PACKAGE + " Private imports", replaceWitInstruction(filtered, CONDITIONAL_PACKAGE), false); } while (dot.getDirectories().size() > size);
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"); } } }
doExpand(dot); doIncludeResources(dot);
doExpand(dot); doIncludeResources(dot); doConditional(dot);