public boolean hasSources() { return isTrue(getProperty(SOURCES)); }
public boolean hasSources() { return isTrue(getProperty(SOURCES)); }
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)); } }
private String doResourceDirectory(Jar jar, Map<String, String> extra, boolean preprocess, File sourceFile, String destinationPath) throws Exception { String filter = extra.get("filter:"); boolean flatten = isTrue(extra.get("flatten:")); boolean recursive = true; String directive = extra.get("recursive:"); if (directive != null) { recursive = isTrue(directive); } InstructionFilter iFilter = null; if (filter != null) { iFilter = new InstructionFilter(Instruction.getPattern(filter), recursive); } else { iFilter = new InstructionFilter(null, recursive); } Map<String, File> files = newMap(); resolveFiles(sourceFile, iFilter, recursive, destinationPath, files, flatten); for (Map.Entry<String, File> entry : files.entrySet()) { copy(jar, entry.getKey(), entry.getValue(), preprocess, extra); } return destinationPath; }
private String doResourceDirectory(Jar jar, Map<String, String> extra, boolean preprocess, File sourceFile, String destinationPath) throws Exception { String filter = extra.get("filter:"); boolean flatten = isTrue(extra.get("flatten:")); boolean recursive = true; String directive = extra.get("recursive:"); if (directive != null) { recursive = isTrue(directive); } InstructionFilter iFilter = null; if (filter != null) { iFilter = new InstructionFilter(Instruction.getPattern(filter), recursive, getDoNotCopy()); } else { iFilter = new InstructionFilter(null, recursive, getDoNotCopy()); } Map<String, File> files = newMap(); resolveFiles(sourceFile, iFilter, recursive, destinationPath, files, flatten); for (Map.Entry<String, File> entry : files.entrySet()) { copy(jar, entry.getKey(), entry.getValue(), preprocess, extra); } return destinationPath; }
if (isTrue(getProperty(NOBUNDLES))) return builders;
private void copy(Jar jar, String path, File from, boolean preprocess, Map<String, String> extra) throws Exception { if (doNotCopy(from.getName())) return; if (from.isDirectory()) { File files[] = from.listFiles(); for (int i = 0; i < files.length; i++) { copy(jar, appendPath(path, files[i].getName()), files[i], preprocess, extra); } } else { if (from.exists()) { Resource resource = new FileResource(from); if (preprocess) { resource = new PreprocessResource(this, resource); } String x = extra.get("extra"); if (x != null) resource.setExtra(x); if (path.endsWith("/")) path = path + from.getName(); jar.putResource(path, resource); if (isTrue(extra.get(LIB_DIRECTIVE))) { setProperty(BUNDLE_CLASSPATH, append(getProperty(BUNDLE_CLASSPATH), path)); } } else { error("Input file does not exist: " + from); } } }
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"); } }
Map<String, Map<String, String>> clauses = parseHeader(getProperty(Constants.EXPORT_PACKAGE)); clauses.putAll(parseHeader(getProperty(Constants.PRIVATE_PACKAGE))); if (isTrue(getProperty(Constants.UNDERTEST))) { clauses.putAll(parseHeader(getProperty(Constants.TESTPACKAGES, "test;presence:=optional")));
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"); } } }
public Jar build() throws Exception { init(); if (isTrue(getProperty(NOBUNDLES))) return null;