Class PackageInfo

java.lang.Object
aQute.bnd.build.PackageInfo

class PackageInfo extends Object
  • Field Details

  • Constructor Details

    • PackageInfo

      PackageInfo(Project project)
  • Method Details

    • getPackageInfo

      public Version getPackageInfo(String packageName) throws Exception
      Get the version for a package name. This traverse the source paths and will stop at the first source directory that has a packageinfo or
      Parameters:
      packageName -
      Throws:
      Exception
    • setPackageInfo

      public boolean setPackageInfo(String packageName, Version version) throws Exception
      Sets the package version on an exported package. If package-info.java exists then we use that one, otherwise we try the packageinfo file. If neither exists, we create a package-info.java file. You can set the annotation to use. Default is bnd. setting it to 'osgi' sets it to the OSGi annotations.
      Parameters:
      packageName - The package name
      version - The new package version
      Throws:
      Exception
    • getVersionAnnotation

      private String getVersionAnnotation()
      Check what version annotation to use for new content:
      • not set -> use packageinfo
      • osgi -> use the OSGi Version ann.
      • bnd -> use the bnd version ann.
      • other -> use the content as the version annotation, must have the same prototype as the bnd/osgi ann.
    • getContent

      private String getContent(boolean modern, String packageName, Version version)
    • getPattern

      private Pattern getPattern(File target)
    • isModern

      private boolean isModern(File target)
    • replace

      private boolean replace(File target, Version newVersion, Pattern pattern) throws IOException
      Throws:
      IOException
    • replace

      private boolean replace(Version newVersion, String content, Matcher m, File target) throws IOException
      Throws:
      IOException
    • getFile

      private File getFile(String packageName) throws Exception
      Throws:
      Exception
    • getVersion

      private Version getVersion(File source, Pattern pattern) throws IOException
      Throws:
      IOException