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");
}
}
}