Package aQute.bnd.osgi

Examples of aQute.bnd.osgi.Jar


            throw new CoreException(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Bnd analysis failed", e));
        }
    }

    static void mergeCapabilities(Map<String,List<ExportPackage>> exports, MultiMap<String,String> usedBy, Map<String,Set<Version>> bundleVersions, Builder builder) throws Exception {
        Jar jar = builder.getJar();
        if (jar == null)
            return;
        Manifest manifest = jar.getManifest();
        if (manifest == null)
            return;

        Attributes attribs = manifest.getMainAttributes();
        String exportPkgStr = attribs.getValue(Constants.EXPORT_PACKAGE);
View Full Code Here


        return result;
    }

    static void mergeRequirements(Map<String,List<ImportPackage>> imports, Map<String,List<ExportPackage>> exports, MultiMap<String,String> usedBy, Map<String,List<RequiredBundle>> requiredBundles, Map<String,Set<Version>> bundleVersions,
            Builder builder) throws Exception {
        Jar jar = builder.getJar();
        if (jar == null)
            return;
        Manifest manifest = jar.getManifest();
        if (manifest == null)
            return;
        Attributes attribs = manifest.getMainAttributes();

        // Process imports
View Full Code Here

  public static Baseline createBaseline(Builder builder) {

    try {

      if (builder instanceof ProjectBuilder) {
        Jar jar = builder.build();

        Jar currentJar = ((ProjectBuilder) builder).getLastRevision();
        if (currentJar == null) {
            currentJar = new Jar("."); //$NON-NLS-1$
        }

        DiffPluginImpl differ = new DiffPluginImpl();
            String diffignore = builder.getProperty(Constants.DIFFIGNORE);
            if (diffignore != null)
View Full Code Here

    }

    private static boolean release(ReleaseContext context, List<IReleaseParticipant> participants, Builder builder) throws Exception {

        Jar jar;

        if (context.getReleaseOption() == ReleaseOption.UPDATE_RELEASE) {
            jar = builder.build();
        } else {
            // No need to rebuild if release only
            File jarFile = new File(context.getProject().getTarget(), builder.getBsn() + ".jar");
            if (jarFile.isFile()) {
                jar = new Jar(jarFile);
            } else {
                jar = builder.build();
            }
        }

        handleBuildErrors(context, builder, jar);

        String symbName = ReleaseUtils.getBundleSymbolicName(jar);
        String version = ReleaseUtils.getBundleVersion(jar);

        boolean proceed = preJarRelease(context, participants, jar);
        if (!proceed) {
            postRelease(context, participants, false);
            displayErrors(context);
            return false;
        }

        JarResource jr = new JarResource(jar);
        InputStream is = new BufferedInputStream(jr.openInputStream());
        try {
            context.getProject().release(context.getReleaseRepository().getName(), jar.getName(), is);
        } finally {
            is.close();
        }

        File file = context.getReleaseRepository().get(symbName, Version.parseVersion(version), null);
        Jar releasedJar = null;
        if (file != null && file.exists()) {
            IResource resource = ReleaseUtils.toResource(file);
            if (resource != null) {
                resource.refreshLocal(IResource.DEPTH_ZERO, null);
            }
View Full Code Here

  }

  private static boolean release(ReleaseContext context, List<IReleaseParticipant> participants, Builder builder) throws Exception {

      Jar jar;

      if (context.getReleaseOption() == ReleaseOption.UPDATE_RELEASE) {
          jar = builder.build();
      } else {
          // No need to rebuild if release only
          File jarFile = new File(context.getProject().getTarget(), builder.getBsn() + ".jar");
          if (jarFile.isFile()) {
              jar = new Jar(jarFile);
          } else {
              jar = builder.build();
          }
      }

    handleBuildErrors(context, builder, jar);

    String symbName = ReleaseUtils.getBundleSymbolicName(jar);
    String version = ReleaseUtils.getBundleVersion(jar);

    boolean proceed = preJarRelease(context, participants, jar);
    if (!proceed) {
      postRelease(context, participants, false);
      displayErrors(context);
      return false;
    }

    JarResource jr = new JarResource(jar);
    InputStream is = new BufferedInputStream(jr.openInputStream());
    try {
        context.getProject().release(context.getReleaseRepository().getName(), jar.getName(), is);
    } finally {
        is.close();
    }

    File file = context.getReleaseRepository().get(symbName, Version.parseVersion(version), null);
    Jar releasedJar = null;
    if (file != null && file.exists()) {
      IResource resource = ReleaseUtils.toResource(file);
      if (resource != null) {
        resource.refreshLocal(IResource.DEPTH_ZERO, null);
      }
View Full Code Here

          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

            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

     * @throws Exception
     *             On failure
     */
    public static boolean jarsDiffer(File first, File second) throws Exception {
        Differ di = new DiffPluginImpl();
        Tree n = di.tree(new Jar(second));
        Tree o = di.tree(new Jar(first));
        Diff diff = n.diff(o);
        for (Diff child : diff.getChildren()) {
            for (Diff childc : child.getChildren()) {
                if (childc.getDelta() == Delta.UNCHANGED || childc.getDelta() == Delta.IGNORED) {
                    continue;
View Full Code Here

            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

            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.Jar

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.