Package aQute.bnd.build
Class PackageInfo
- java.lang.Object
-
- aQute.bnd.build.PackageInfo
-
class PackageInfo extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.regex.Pattern
CLASSIC_P
private static java.util.regex.Pattern
MODERN_P
private static java.util.regex.Pattern
MODERN_PACKAGE_P
private static java.lang.String
PACKAGE_INFO_JAVA
private static java.lang.String
PACKAGEINFO
private Project
project
-
Constructor Summary
Constructors Constructor Description PackageInfo(Project project)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.String
getContent(boolean modern, java.lang.String packageName, Version version)
private java.io.File
getFile(java.lang.String packageName)
Version
getPackageInfo(java.lang.String packageName)
Get the version for a package name.private java.util.regex.Pattern
getPattern(java.io.File target)
private Version
getVersion(java.io.File source, java.util.regex.Pattern pattern)
private java.lang.String
getVersionAnnotation()
Check what version annotation to use for new content: not set -> use packageinfo osgi -> use the OSGi Version ann.private boolean
isModern(java.io.File target)
private boolean
replace(Version newVersion, java.lang.String content, java.util.regex.Matcher m, java.io.File target)
private boolean
replace(java.io.File target, Version newVersion, java.util.regex.Pattern pattern)
boolean
setPackageInfo(java.lang.String packageName, Version version)
Sets the package version on an exported package.
-
-
-
Field Detail
-
PACKAGE_INFO_JAVA
private static final java.lang.String PACKAGE_INFO_JAVA
- See Also:
- Constant Field Values
-
PACKAGEINFO
private static final java.lang.String PACKAGEINFO
- See Also:
- Constant Field Values
-
MODERN_P
private static final java.util.regex.Pattern MODERN_P
-
CLASSIC_P
private static final java.util.regex.Pattern CLASSIC_P
-
MODERN_PACKAGE_P
private static final java.util.regex.Pattern MODERN_PACKAGE_P
-
project
private final Project project
-
-
Constructor Detail
-
PackageInfo
PackageInfo(Project project)
-
-
Method Detail
-
getPackageInfo
public Version getPackageInfo(java.lang.String packageName) throws java.lang.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:
java.lang.Exception
-
setPackageInfo
public boolean setPackageInfo(java.lang.String packageName, Version version) throws java.lang.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 nameversion
- The new package version- Throws:
java.lang.Exception
-
getVersionAnnotation
private java.lang.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 java.lang.String getContent(boolean modern, java.lang.String packageName, Version version)
-
getPattern
private java.util.regex.Pattern getPattern(java.io.File target)
-
isModern
private boolean isModern(java.io.File target)
-
replace
private boolean replace(java.io.File target, Version newVersion, java.util.regex.Pattern pattern) throws java.io.IOException
- Throws:
java.io.IOException
-
replace
private boolean replace(Version newVersion, java.lang.String content, java.util.regex.Matcher m, java.io.File target) throws java.io.IOException
- Throws:
java.io.IOException
-
getFile
private java.io.File getFile(java.lang.String packageName) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getVersion
private Version getVersion(java.io.File source, java.util.regex.Pattern pattern) throws java.io.IOException
- Throws:
java.io.IOException
-
-