Package org.apache.tools.ant.taskdefs.Manifest

Examples of org.apache.tools.ant.taskdefs.Manifest.Section


     */
    // CheckStyle:LineLength ON
    private void checkJarSpec() {
        String br = System.getProperty("line.separator");
        StringBuffer message = new StringBuffer();
        Section mainSection = (configuredManifest == null)
                            ? null
                            : configuredManifest.getMainSection();

        if (mainSection == null) {
            message.append("No Implementation-Title set.");
            message.append("No Implementation-Version set.");
            message.append("No Implementation-Vendor set.");
        } else {
            if (mainSection.getAttribute("Implementation-Title") == null) {
                message.append("No Implementation-Title set.");
            }
            if (mainSection.getAttribute("Implementation-Version") == null) {
                message.append("No Implementation-Version set.");
            }
            if (mainSection.getAttribute("Implementation-Vendor") == null) {
                message.append("No Implementation-Vendor set.");
            }
        }

        if (message.length() > 0) {
View Full Code Here


     */
    // CheckStyle:LineLength ON
    private void checkJarSpec() {
        String br = System.getProperty("line.separator");
        StringBuffer message = new StringBuffer();
        Section mainSection = (configuredManifest == null)
                            ? null
                            : configuredManifest.getMainSection();

        if (mainSection == null) {
            message.append("No Implementation-Title set.");
            message.append("No Implementation-Version set.");
            message.append("No Implementation-Vendor set.");
        } else {
            if (mainSection.getAttribute("Implementation-Title") == null) {
                message.append("No Implementation-Title set.");
            }
            if (mainSection.getAttribute("Implementation-Version") == null) {
                message.append("No Implementation-Version set.");
            }
            if (mainSection.getAttribute("Implementation-Vendor") == null) {
                message.append("No Implementation-Vendor set.");
            }
        }

        if (message.length() > 0) {
View Full Code Here

        }
    }

    private void addSectionAttributesToAnt(Manifest antManifest) {
        for (Map.Entry<String, Attributes> entry : sections.entrySet()) {
            Section section = new Section();
            section.setName(entry.getKey());
            try {
                antManifest.addConfiguredSection(section);
                for (Map.Entry<String, Object> attributeEntry : entry.getValue().entrySet()) {
                    section.addConfiguredAttribute(new Attribute(attributeEntry.getKey(), attributeEntry.getValue().toString()));
                }
            } catch (ManifestException e) {
                throw new org.gradle.api.java.archives.ManifestException(e.getMessage(), e);
            }
        }
View Full Code Here

  @SuppressWarnings("unchecked")
  private java.util.jar.Manifest createJarManifest() {
    java.util.jar.Manifest newManifest = new java.util.jar.Manifest();
    newManifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
   
    Section mainSection = mft.getMainSection();
    Enumeration<String> mainAttributes = mainSection.getAttributeKeys()
    while (mainAttributes.hasMoreElements()) {
      String aname = mainAttributes.nextElement();
      String avalue = mainSection.getAttributeValue(aname);
      newManifest.getMainAttributes().putValue(aname, avalue);
    }
   
    // OSGI Export-Package
    if (!StringUtils.isEmpty(version)) {
      String vString = MessageFormat.format(";version=\"{0}\",", version);
      StringBuilder packages = new StringBuilder();
      for (String packageName : exportedPackages) {
        packages.append(packageName);
        packages.append(vString);
      }
      if (packages.length() > 0) {
        packages.setLength(packages.length() - 1);
        newManifest.getMainAttributes().putValue("Export-Package", packages.toString());
      }
    }

//    for (Map.Entry<Object, Object> entry : newManifest.getMainAttributes().entrySet()) {
//      System.out.println(entry.getKey() + "=" + entry.getValue());
//    }

    Enumeration<String> sections = mft.getSectionNames();
    while (sections.hasMoreElements()) {
      String sname = sections.nextElement();
      Section section = mft.getSection(sname);
     
      Attributes newAttributes = new Attributes();
      newManifest.getEntries().put(sname, newAttributes);
     
      Enumeration<String> attributes = section.getAttributeKeys()
      while (attributes.hasMoreElements()) {
        String aname = attributes.nextElement();
        String avalue = section.getAttributeValue(aname);
        newAttributes.putValue(aname, avalue);
      }
     
//      for (Map.Entry<Object, Object> entry : newManifest.getAttributes(sname).entrySet()) {
//        System.out.println(entry.getKey() + "=" + entry.getValue());
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.taskdefs.Manifest.Section

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.