Package aQute.bnd.osgi

Examples of aQute.bnd.osgi.Builder


        // Calculate the manifest
        try {
            Project bndProject = Central.getInstance().getModel(JavaCore.create(project));
            if (bndProject == null)
                return null;
            Builder builder;
            if (file.getName().equals(Project.BNDFILE)) {
                builder = bndProject.getSubBuilders().iterator().next();
            } else {
                builder = bndProject.getSubBuilder(file);
            }

            if (builder == null) {
                builder = new Builder();
                builder.setProperties(file);
            }
            builder.build();
            return builder;
        } catch (Exception e) {
            throw new CoreException(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Bnd analysis failed", e));
        }
    }
View Full Code Here


public class DiffHelper {

  public static Baseline createBaseline(Project project, String bsn) throws Exception {

    List<Builder> builders = project.getBuilder(null).getSubBuilders();
    Builder builder = null;
    for (Builder b : builders) {
      if (bsn.equals(b.getBsn())) {
        builder = b;
        break;
      }
View Full Code Here

            return false;
        }

        for (Baseline diff : diffs) {
            Collection< ? extends Builder> builders = context.getProject().getBuilder(null).getSubBuilders();
            Builder builder = null;
            for (Builder b : builders) {
                if (b.getBsn().equals(diff.getBsn())) {
                    builder = b;
                    break;
                }
View Full Code Here

        List<MacroInfo> bsns = new ArrayList<MacroInfo>();
        for (ProjectDiff diff : projectDiffs) {
            if (diff.isRelease()) {
                for (Baseline baseline : diff.getBaselines()) {
                    try {
                        Builder builder = diff.getProject().getSubBuilder(baseline.getBsn());
                        String bundleVersion = builder.getUnprocessedProperty(Constants.BUNDLE_VERSION, "");
                        if (bundleVersion.startsWith("${")) {
                            MacroInfo info = new MacroInfo();
                            info.projectDiff = diff;
                            info.bsn = builder.getBsn();
                            info.macro = bundleVersion;
                            bsns.add(info);
                        }
                    } catch (Exception e) {}
                }
View Full Code Here

            return false;
        }

        for (Baseline diff : diffs) {
            Collection<? extends Builder> builders = context.getProject().getBuilder(null).getSubBuilders();
            Builder builder = null;
            for (Builder b : builders) {
                if (b.getBsn().equals(diff.getBsn())) {
                    builder = b;
                    break;
                }
View Full Code Here

        List<MacroInfo> bsns = new ArrayList<MacroInfo>();
        for (ProjectDiff diff : projectDiffs) {
            if (diff.isRelease()) {
                for (Baseline baseline : diff.getBaselines()) {
                    try {
                        Builder builder = diff.getProject().getSubBuilder(baseline.getBsn());
                        String bundleVersion = builder.getUnprocessedProperty(Constants.BUNDLE_VERSION, "");
                        if (bundleVersion.startsWith("${")) {
                            MacroInfo info = new MacroInfo();
                            info.projectDiff = diff;
                            info.bsn = builder.getBsn();
                            info.macro = bundleVersion;
                            bsns.add(info);
                        }
                    } catch (Exception e) {
                    }
View Full Code Here

        }
    }

    /** Creates a bundle on disk, using the specified file, symbolic name and version. */
    private void createBundleOnDisk(File f, String bsn, String v, String... headers) throws Exception {
        Builder b = new Builder();
        try {
          b.setProperty("Bundle-SymbolicName", bsn);
          b.setProperty("Bundle-Version", v);
          for (int i = 0; i < headers.length; i += 2) {
              b.setProperty(headers[i], headers[i + 1]);
          }
          Jar jar = b.build();
          jar.getManifest(); // Not sure whether this is needed...
          jar.write(f);
        } finally {
          b.close();
        }
    }
View Full Code Here

    }

    public static File createTmpBundleOnDisk(String bsn, String v, String... headers) throws Exception {
        File file = File.createTempFile("bundle", ".jar");
        file.deleteOnExit();
        Builder b = new Builder();
        try {
            b.setProperty("Bundle-SymbolicName", bsn);
            b.setProperty("Bundle-Version", v);
            for (int i = 0; i < headers.length; i += 2) {
                b.setProperty(headers[i], headers[i + 1]);
            }
            Jar jar = b.build();
            jar.getManifest(); // Not sure whether this is needed...
            jar.write(file);
            return file;
        }
        finally {
            b.close();
        }
    }
View Full Code Here

            return m_version;
        }
    }

    protected static File createBundle(String bsn, Version version, String... headers) throws Exception {
        Builder b = new Builder();

        try {
            b.setProperty("Bundle-SymbolicName", bsn);
            b.setProperty("Bundle-Version", version.toString());
            for (int i = 0; i < headers.length; i += 2) {
                b.setProperty(headers[i], headers[i + 1]);
            }
            b.setProperty("Include-Resource", "bnd.bnd"); // prevent empty jar bug

            Jar jar = b.build();
            jar.getManifest(); // Not sure whether this is needed...

            File file = File.createTempFile("testbundle", ".jar");
            file.deleteOnExit();

            jar.write(file);
            return file;
        }
        finally {
            b.close();
        }
    }
View Full Code Here

            }
        }
    }

    protected static File createBundle(String bsn, Version version, String... headers) throws Exception {
        Builder b = new Builder();

        try {
            b.setProperty("Bundle-SymbolicName", bsn);
            b.setProperty("Bundle-Version", version.toString());
            for (int i = 0; i < headers.length; i += 2) {
                b.setProperty(headers[i], headers[i + 1]);
            }
            b.setProperty("Include-Resource", "bnd.bnd"); // prevent empty jar bug

            Jar jar = b.build();
            jar.getManifest(); // Not sure whether this is needed...

            File file = File.createTempFile("testbundle", ".jar");
            file.deleteOnExit();

            jar.write(file);
            return file;
        }
        finally {
            b.close();
        }
    }
View Full Code Here

TOP

Related Classes of aQute.bnd.osgi.Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.