@Override public void write(OutputStream out) throws Exception { writeManifest(out); }
@Override public void write(OutputStream out) throws Exception { writeManifest(out); }
private void doManifest(Set<String> done, ZipOutputStream jout) throws Exception { check(); if (nomanifest) return; JarEntry ze = new JarEntry("META-INF/MANIFEST.MF"); jout.putNextEntry(ze); writeManifest(jout); jout.closeEntry(); done.add(ze.getName()); }
private void doManifest(Set<String> done, ZipOutputStream jout) throws Exception { check(); if (nomanifest) return; JarEntry ze = new JarEntry(manifestName); ZipUtil.setModifiedTime(ze,lastModified); jout.putNextEntry(ze); writeManifest(jout); jout.closeEntry(); done.add(ze.getName()); }
private void doManifest(Set<String> done, ZipOutputStream jout) throws Exception { check(); if (nomanifest) return; JarEntry ze = new JarEntry(manifestName); ZipUtil.setModifiedTime(ze,lastModified); jout.putNextEntry(ze); writeManifest(jout); jout.closeEntry(); done.add(ze.getName()); }
/** * Cleanup the manifest for writing. Cleaning up consists of adding a space * after any \n to prevent the manifest to see this newline as a delimiter. * * @param out * Output * @throws IOException */ public void writeManifest(OutputStream out) throws Exception { check(); writeManifest(getManifest(), out); }
/** * Cleanup the manifest for writing. Cleaning up consists of adding a space * after any \n to prevent the manifest to see this newline as a delimiter. * * @param out * Output * @throws IOException */ public void writeManifest(OutputStream out) throws Exception { check(); writeManifest(getManifest(), out); }
/** * Cleanup the manifest for writing. Cleaning up consists of adding a space * after any \n to prevent the manifest to see this newline as a delimiter. * * @param out * Output * @throws IOException */ public void writeManifest(OutputStream out) throws Exception { check(); writeManifest(getManifest(), out); }
/** * Get the manifest and write it out separately if -savemanifest is set * * @param dot */ private void doSaveManifest(Jar dot) throws Exception { String output = getProperty(SAVEMANIFEST); if (output == null) return; File f = getFile(output); if (f.isDirectory()) { f = new File(f, "MANIFEST.MF"); } f.delete(); File fp = f.getParentFile(); if (!fp.exists() && !fp.mkdirs()) { throw new IOException("Could not create directory " + fp); } OutputStream out = new FileOutputStream(f); try { Jar.writeManifest(dot.getManifest(), out); } finally { out.close(); } changedFile(f); }
/** * Get the manifest and write it out separately if -savemanifest is set * * @param dot */ private void doSaveManifest(Jar dot) throws Exception { String output = getProperty(SAVEMANIFEST); if (output == null) return; File f = getFile(output); if (f.isDirectory()) { f = new File(f, "MANIFEST.MF"); } f.delete(); File fp = f.getParentFile(); if (!fp.exists() && !fp.mkdirs()) { throw new IOException("Could not create directory " + fp); } OutputStream out = new FileOutputStream(f); try { Jar.writeManifest(dot.getManifest(), out); } finally { out.close(); } changedFile(f); }
/** * Get the manifest and write it out separately if -savemanifest is set * * @param dot */ private void doSaveManifest(Jar dot) throws Exception { String output = getProperty(SAVEMANIFEST); if (output == null) return; File f = getFile(output); if (f.isDirectory()) { f = new File(f, "MANIFEST.MF"); } f.delete(); File fp = f.getParentFile(); if (!fp.exists() && !fp.mkdirs()) { throw new IOException("Could not create directory " + fp); } OutputStream out = new FileOutputStream(f); try { Jar.writeManifest(dot.getManifest(), out); } finally { out.close(); } changedFile(f); }
/** * Cleanup the manifest for writing. Cleaning up consists of adding a space * after any \n to prevent the manifest to see this newline as a delimiter. * * @param out Output * @throws IOException */ public void writeManifest(OutputStream out) throws Exception { check(); stripSignatures(); writeManifest(getManifest(), out); }
/** * Cleanup the manifest for writing. Cleaning up consists of adding a space * after any \n to prevent the manifest to see this newline as a delimiter. * * @param out Output * @throws IOException */ public void writeManifest(OutputStream out) throws Exception { check(); stripSignatures(); writeManifest(getManifest(), out); }
IO.mkdirs(file.getParentFile()); try (OutputStream fout = IO.outputStream(file)) { writeManifest(fout); done.add(manifestName);
public byte[] getTimelessDigest() throws Exception { check(); MessageDigest md = MessageDigest.getInstance("SHA1"); OutputStream dout = new DigestOutputStream(IO.nullStream, md); // dout = System.out; Manifest m = getManifest(); if (m != null) { Manifest m2 = new Manifest(m); Attributes main = m2.getMainAttributes(); String lastmodified = (String) main.remove(new Attributes.Name(Constants.BND_LASTMODIFIED)); String version = main.getValue(new Attributes.Name(Constants.BUNDLE_VERSION)); if (version != null && Verifier.isVersion(version)) { Version v = new Version(version); main.putValue(Constants.BUNDLE_VERSION, v.toStringWithoutQualifier()); } writeManifest(m2, dout); for (Map.Entry<String, Resource> entry : getResources().entrySet()) { String path = entry.getKey(); if (path.equals(manifestName)) continue; Resource resource = entry.getValue(); dout.write(path.getBytes(UTF_8)); resource.write(dout); } } return md.digest(); }
public byte[] getTimelessDigest() throws Exception { check(); MessageDigest md = MessageDigest.getInstance("SHA1"); OutputStream dout = new DigestOutputStream(IO.nullStream, md); // dout = System.out; Manifest m = getManifest(); if (m != null) { Manifest m2 = new Manifest(m); Attributes main = m2.getMainAttributes(); String lastmodified = (String) main.remove(new Attributes.Name(Constants.BND_LASTMODIFIED)); String version = main.getValue(new Attributes.Name(Constants.BUNDLE_VERSION)); if (version != null && Verifier.isVersion(version)) { Version v = new Version(version); main.putValue(Constants.BUNDLE_VERSION, v.toStringWithoutQualifier()); } writeManifest(m2, dout); for (Map.Entry<String, Resource> entry : getResources().entrySet()) { String path = entry.getKey(); if (path.equals(manifestName)) continue; Resource resource = entry.getValue(); dout.write(path.getBytes(UTF_8)); resource.write(dout); } } return md.digest(); }
main.putValue( Constants.BUNDLE_VERSION, v.getWithoutQualifier().toString()); writeManifest(m2, dout);
/** * Get the manifest and write it out separately if -savemanifest is set * * @param dot */ private void doSaveManifest(Jar dot) throws Exception { String output = getProperty(SAVEMANIFEST); if (output == null) return; File f = getFile(output); if (f.isDirectory()) { f = new File(f, "MANIFEST.MF"); } if (!f.exists() || f.lastModified() < dot.lastModified()) { IO.delete(f); File fp = f.getParentFile(); IO.mkdirs(fp); try (OutputStream out = IO.outputStream(f)) { Jar.writeManifest(dot.getManifest(), out); } changedFile(f); } }
/** * Get the manifest and write it out separately if -savemanifest is set * * @param dot */ private void doSaveManifest(Jar dot) throws Exception { String output = getProperty(SAVEMANIFEST); if (output == null) return; File f = getFile(output); if (f.isDirectory()) { f = new File(f, "MANIFEST.MF"); } if (!f.exists() || f.lastModified() < dot.lastModified()) { IO.delete(f); File fp = f.getParentFile(); IO.mkdirs(fp); try (OutputStream out = IO.outputStream(f)) { Jar.writeManifest(dot.getManifest(), out); } changedFile(f); } }
private static String getManifestContent(Jar jarTask, BndManifestExtension extension) throws Throwable { // if we don't want to merge, then delete the existing manifest so that bnd doesn't merge with it if (!extension.mergeWithExisting) { Files.deleteIfExists(outputManifest(jarTask)); } // take the bnd action return BndManifestPlugin.takeBndAction(jarTask.getProject(), jarTask, jar -> { return StringPrinter.buildString(printer -> { try (OutputStream output = printer.toOutputStream(StandardCharsets.UTF_8)) { aQute.bnd.osgi.Jar.writeManifest(jar.getManifest(), printer.toOutputStream(StandardCharsets.UTF_8)); } catch (Exception e) { throw Errors.asRuntime(e); } }); }); }