/** * @throws IOException * @throws MalformedURLException */ protected Jar getJarFromFileOrURL(String spec) throws IOException, MalformedURLException { Jar jar; File jarFile = getFile(spec); if (jarFile.exists()) { jar = new Jar(jarFile); } else { URL url = new URL(spec); try (InputStream in = url.openStream()) { jar = new Jar(url.getFile(), in); } } addClose(jar); return jar; }
help(); return; trace("option " + option); if (option.equals("-temp")) temp = getFile(args[++i]); else { help(); error("Invalid option " + option); trace("temp dir " + temp); IO.delete(temp); if (!temp.exists() && !temp.mkdirs()) { settings(); else if (cmd.equals("help")) help(); else if (cmd.equals("bundle")) bundle(args, i); else if (cmd.equals("view")) view(args, i); else error("No such command %s, type help", cmd);
private void copyInfo(Jar source, Jar dest, String type) throws Exception { source.ensureManifest(); dest.ensureManifest(); copyInfoResource(source, dest, "LICENSE"); copyInfoResource(source, dest, "LICENSE.html"); copyInfoResource(source, dest, "about.html"); Manifest sm = source.getManifest(); Manifest dm = dest.getManifest(); copyInfoHeader(sm, dm, "Bundle-Description", ""); copyInfoHeader(sm, dm, "Bundle-Vendor", ""); copyInfoHeader(sm, dm, "Bundle-Copyright", ""); copyInfoHeader(sm, dm, "Bundle-DocURL", ""); copyInfoHeader(sm, dm, "Bundle-License", ""); copyInfoHeader(sm, dm, "Bundle-Name", " " + type); copyInfoHeader(sm, dm, "Bundle-SymbolicName", "." + type); copyInfoHeader(sm, dm, "Bundle-Version", ""); }
command.add(getProperty("javadoc", "javadoc")); command.add("-quiet"); command.add("-protected"); set(pp, "-doctitle", description(attr)); set(pp, "-header", description(attr)); set(pp, "-windowtitle", name(attr)); set(pp, "-bottom", copyright(attr)); set(pp, "-footer", license(attr)); removeDuplicateMarker(key); command.add(key); command.add(value); warning("Error during execution of javadoc command: %s\n******************\n%s", out, err); addClose(jar); return jar;
trace("bundle option %s", option); if (option.equals("-scm")) scm = args[i++]; String email = settings.remove("email"); if (email == null) error("No developer email set, you can set global default email with: bnd global email Peter.Kriens@aQute.biz"); else developers.add(email); error("too few arguments, no bundle specified"); return; error("too many arguments, only one bundle allowed"); return; Jar binaryJar = getJarFromFileOrURL(input); trace("got %s", binaryJar); if (binaryJar == null) { error("JAR does not exist: %s", input); return; File original = getFile(temp, "original"); if (!original.exists() && !original.mkdirs()) { throw new IOException("Could not create directory " + original); trace("got manifest"); if (version != null)
private void sign(File file, String passphrase) throws Exception { trace("signing %s", file); File asc = new File(file.getParentFile(), file.getName() + ".asc"); asc.delete(); Command command = new Command(); command.setTrace(); command.add(getProperty("gpgp", "gpg")); if (passphrase != null) command.add("--passphrase", passphrase); command.add("-ab", "--sign"); // not the -b!! command.add(file.getAbsolutePath()); System.err.println(command); StringBuilder stdout = new StringBuilder(); StringBuilder stderr = new StringBuilder(); int result = command.execute(stdout, stderr); if (result != 0) { error("gpg signing %s failed because %s", file, "" + stdout + stderr); } }
private void sign(File file, String passphrase) throws Exception { logger.debug("signing {}", file); File asc = new File(file.getParentFile(), file.getName() + ".asc"); IO.delete(asc); Command command = new Command(); command.setTrace(); command.add(getProperty("gpg", "gpg")); if (passphrase != null) command.add("--passphrase", passphrase); command.add("-ab", "--sign"); // not the -b!! command.add(IO.absolutePath(file)); StringBuilder stdout = new StringBuilder(); StringBuilder stderr = new StringBuilder(); int result = command.execute(stdout, stderr); if (result != 0) { error("gpg signing %s failed because %s", file, "" + stdout + stderr); } }
/** * Show the maven settings * * @throws FileNotFoundException * @throws Exception */ private void settings() throws FileNotFoundException, Exception { File userHome = new File(System.getProperty("user.home")); File m2 = new File(userHome, ".m2"); if (!m2.isDirectory()) { error("There is no m2 directory at %s", userHome); return; } File settings = new File(m2, "settings.xml"); if (!settings.isFile()) { error("There is no settings file at '%s'", settings.getAbsolutePath()); return; } FileReader rdr = new FileReader(settings); LineCollection lc = new LineCollection(new BufferedReader(rdr)); while (lc.hasNext()) { System.out.println(lc.next()); } }
command.add(getProperty("javadoc", "javadoc")); command.add("-quiet"); command.add("-protected"); set(pp, "-doctitle", description(attr)); set(pp, "-header", description(attr)); set(pp, "-windowtitle", name(attr)); set(pp, "-bottom", copyright(attr)); set(pp, "-footer", license(attr)); removeDuplicateMarker(key); command.add(key); command.add(value); warning("Error during execution of javadoc command: %s\n******************\n%s", out, err); addClose(jar); return jar;
trace("bundle option %s", option); if (option.equals("-scm")) scm = args[i++]; String email = settings.remove("email"); if (email == null) error("No developer email set, you can set global default email with: bnd global email Peter.Kriens@aQute.biz"); else developers.add(email); error("too few arguments, no bundle specified"); return; error("too many arguments, only one bundle allowed"); return; Jar binaryJar = getJarFromFileOrURL(input); trace("got %s", binaryJar); if (binaryJar == null) { error("JAR does not exist: %s", input); return; File original = getFile(temp, "original"); if (!original.exists() && !original.mkdirs()) { throw new IOException("Could not create directory " + original); trace("got manifest"); if (version != null)
private void sign(File file, String passphrase) throws Exception { trace("signing %s", file); File asc = new File(file.getParentFile(), file.getName() + ".asc"); asc.delete(); Command command = new Command(); command.setTrace(); command.add(getProperty("gpg", "gpg")); if (passphrase != null) command.add("--passphrase", passphrase); command.add("-ab", "--sign"); // not the -b!! command.add(file.getAbsolutePath()); System.err.println(command); StringBuilder stdout = new StringBuilder(); StringBuilder stderr = new StringBuilder(); int result = command.execute(stdout, stderr); if (result != 0) { error("gpg signing %s failed because %s", file, "" + stdout + stderr); } }
private void sign(File file, String passphrase) throws Exception { logger.debug("signing {}", file); File asc = new File(file.getParentFile(), file.getName() + ".asc"); IO.delete(asc); Command command = new Command(); command.setTrace(); command.add(getProperty("gpg", "gpg")); if (passphrase != null) command.add("--passphrase", passphrase); command.add("-ab", "--sign"); // not the -b!! command.add(IO.absolutePath(file)); StringBuilder stdout = new StringBuilder(); StringBuilder stderr = new StringBuilder(); int result = command.execute(stdout, stderr); if (result != 0) { error("gpg signing %s failed because %s", file, "" + stdout + stderr); } }
/** * Show the maven settings * * @throws FileNotFoundException * @throws Exception */ private void settings() throws FileNotFoundException, Exception { File userHome = new File(System.getProperty("user.home")); File m2 = new File(userHome, ".m2"); if (!m2.isDirectory()) { error("There is no m2 directory at %s", userHome); return; } File settings = new File(m2, "settings.xml"); if (!settings.isFile()) { error("There is no settings file at '%s'", settings.getAbsolutePath()); return; } LineCollection lc = new LineCollection(IO.reader(settings)); while (lc.hasNext()) { System.err.println(lc.next()); } }
command.add(getProperty("javadoc", "javadoc")); command.add("-quiet"); command.add("-protected"); set(pp, "-doctitle", description(attr)); set(pp, "-header", description(attr)); set(pp, "-windowtitle", name(attr)); set(pp, "-bottom", copyright(attr)); set(pp, "-footer", license(attr)); removeDuplicateMarker(key); command.add(key); command.add(value); warning("Error during execution of javadoc command: %s\n******************\n%s", out, err); addClose(jar); return jar;
trace("bundle option %s", option); if (option.equals("-scm")) scm = args[i++]; String email = settings.globalGet(Settings.EMAIL, null); if (email == null) error("No developer email set, you can set global default email with: bnd global email Peter.Kriens@aQute.biz"); else developers.add(email); error("too few arguments, no bundle specified"); return; error("too many arguments, only one bundle allowed"); return; Jar binaryJar = getJarFromFileOrURL(input); trace("got %s", binaryJar); if (binaryJar == null) { error("JAR does not exist: %s", input); return; File original = getFile(temp, "original"); original.mkdirs(); binaryJar.expand(original); trace("got manifest"); if (version != null)
help(); return; trace("option " + option); if (option.equals("-temp")) temp = getFile(args[++i]); else { help(); error("Invalid option " + option); trace("temp dir " + temp); IO.delete(temp); temp.mkdirs(); settings(); else if (cmd.equals("help")) help(); else if (cmd.equals("bundle")) bundle(args, i); else if (cmd.equals("view")) view(args, i); else error("No such command %s, type help", cmd);
private void sign(File file, String passphrase) throws Exception { trace("signing %s", file); File asc = new File(file.getParentFile(), file.getName() + ".asc"); asc.delete(); Command command = new Command(); command.setTrace(); command.add(getProperty("gpgp", "gpg")); if (passphrase != null) command.add("--passphrase", passphrase); command.add("-ab", "--sign"); // not the -b!! command.add(file.getAbsolutePath()); System.out.println(command); StringBuffer stdout = new StringBuffer(); StringBuffer stderr = new StringBuffer(); int result = command.execute(stdout, stderr); if (result != 0) { error("gpg signing %s failed because %s", file, "" + stdout + stderr); } }
private void copyInfo(Jar source, Jar dest, String type) throws Exception { source.ensureManifest(); dest.ensureManifest(); copyInfoResource(source, dest, "LICENSE"); copyInfoResource(source, dest, "LICENSE.html"); copyInfoResource(source, dest, "about.html"); Manifest sm = source.getManifest(); Manifest dm = dest.getManifest(); copyInfoHeader(sm, dm, Constants.BUNDLE_DESCRIPTION, ""); copyInfoHeader(sm, dm, Constants.BUNDLE_VENDOR, ""); copyInfoHeader(sm, dm, Constants.BUNDLE_COPYRIGHT, ""); copyInfoHeader(sm, dm, Constants.BUNDLE_DOCURL, ""); copyInfoHeader(sm, dm, Constants.BUNDLE_LICENSE, ""); copyInfoHeader(sm, dm, Constants.BUNDLE_NAME, " " + type); copyInfoHeader(sm, dm, Constants.BUNDLE_SYMBOLICNAME, "." + type); copyInfoHeader(sm, dm, Constants.BUNDLE_VERSION, ""); }
/** * @throws IOException * @throws MalformedURLException */ protected Jar getJarFromFileOrURL(String spec) throws IOException, MalformedURLException { Jar jar; File jarFile = getFile(spec); if (jarFile.exists()) { jar = new Jar(jarFile); } else { URL url = new URL(spec); try (InputStream in = url.openStream()) { jar = new Jar(url.getFile(), in); } } addClose(jar); return jar; }
/** * Show the maven settings * * @throws FileNotFoundException * @throws Exception */ private void settings() throws FileNotFoundException, Exception { File userHome = new File(System.getProperty("user.home")); File m2 = new File(userHome, ".m2"); if (!m2.isDirectory()) { error("There is no m2 directory at %s", userHome); return; } File settings = new File(m2, "settings.xml"); if (!settings.isFile()) { error("There is no settings file at '%s'", settings.getAbsolutePath()); return; } try (LineCollection lc = new LineCollection(IO.reader(settings))) { while (lc.hasNext()) { System.err.println(lc.next()); } } }