29import java.util.Iterator;
31import java.util.jar.Attributes;
32import java.util.jar.Manifest;
34import org.jau.sys.AndroidUtil;
35import org.jau.sys.PlatformProps;
57 private static final String packageNameFAT =
"org.jau";
59 private final String packageName;
60 private final Manifest mf;
61 private final int hash;
62 private final Attributes mainAttributes;
63 private final Set<?> mainAttributeNames;
65 private final String androidPackageVersionName;
67 protected JauVersion(
final String packageName,
final Manifest mf) {
71 this.packageName = packageName;
78 this.packageName = packageNameFAT;
81 this.mf =
new Manifest();
82 this.packageName = packageName;
85 this.hash = this.mf.hashCode();
86 mainAttributes = this.mf.getMainAttributes();
87 mainAttributeNames = mainAttributes.keySet();
97 public final boolean equals(
final Object o) {
112 public final String
getAttribute(
final Attributes.Name attributeName) {
113 return (
null != attributeName) ? (String) mainAttributes.get(attributeName) :
null;
121 for (
final Iterator<?> iter = mainAttributeNames.iterator(); iter.hasNext();) {
122 final Attributes.Name an = (Attributes.Name) iter.next();
123 if (an.toString().equals(attributeName)) {
134 return mainAttributeNames;
138 if(
null != androidPackageVersionName) {
141 return this.
getAttribute(Attributes.Name.EXTENSION_NAME);
201 return this.
getAttribute(Attributes.Name.IMPLEMENTATION_TITLE);
205 return this.
getAttribute(Attributes.Name.IMPLEMENTATION_VENDOR);
216 return this.
getAttribute(Attributes.Name.IMPLEMENTATION_VERSION);
220 return androidPackageVersionName;
224 return this.
getAttribute(Attributes.Name.SPECIFICATION_TITLE);
228 return this.
getAttribute(Attributes.Name.SPECIFICATION_VENDOR);
232 return this.
getAttribute(Attributes.Name.SPECIFICATION_VERSION);
241 sb =
new StringBuilder();
268 sb =
new StringBuilder();
static final String getPackageInfoVersionName(final String packageName)
static final Attributes.Name IMPLEMENTATION_SHA_SOURCES
See getImplementationSHASources().
final String getImplementationVersion()
Returns the IMPLEMENTATION_VERSION.
final boolean equals(final Object o)
static final Attributes.Name IMPLEMENTATION_SHA_CLASSES_THIS
See getImplementationSHAClassesThis().
static final Attributes.Name IMPLEMENTATION_BRANCH
See getImplementationBranch().
StringBuilder getManifestInfo(StringBuilder sb)
final Manifest getManifest()
final String getImplementationTitle()
final String getImplementationBranch()
Returns the SCM branch name.
final String getSpecificationVendor()
final String getSpecificationVersion()
final String getImplementationSHANatives()
Returns the SHA of all concatenated native library files of all build libs.
JauVersion(final String packageName, final Manifest mf)
final String getAttribute(final String attributeName)
final Set<?> getAttributeNames()
final String getAndroidPackageVersionName()
static final Attributes.Name IMPLEMENTATION_SHA_NATIVES_THIS
See getImplementationSHANativesThis().
final String getSpecificationTitle()
static final Attributes.Name IMPLEMENTATION_COMMIT
See getImplementationCommit().
final String getImplementationVendor()
final String getImplementationSHAClasses()
Returns the SHA of all concatenated class files of all build classes.
final StringBuilder getFullManifestInfo(final StringBuilder sb)
final String getPackageName()
final String getImplementationSHAClassesThis()
Returns the SHA of all concatenated class files of the local (jar) package subset.
final String getImplementationSHASources()
Returns the SHA of all concatenated source files of the whole project.
final Attributes.Name getAttributeName(final String attributeName)
final String getAttribute(final Attributes.Name attributeName)
static final Attributes.Name IMPLEMENTATION_BUILD
See getImplementationBuild().
final String getImplementationCommit()
Returns the SCM version of the last commit, e.g.
static final Attributes.Name IMPLEMENTATION_SHA_CLASSES
See getImplementationSHAClasses().
final String getImplementationBuild()
Returns the implementation build number, e.g.
static final Attributes.Name IMPLEMENTATION_SHA_NATIVES
See getImplementationSHANatives().
final String getImplementationSHANativesThis()
Returns the SHA of all concatenated native library files of the local (jar) package subset.
StringBuilder toString(StringBuilder sb)
final String getExtensionName()
static final String SEPERATOR
static StringBuilder getFullManifestInfo(final Manifest mf, StringBuilder sb)
static Manifest getManifest(final ClassLoader cl, final String extension)
Returns the manifest of the jar which contains the specified extension.