Eclipse / Ant Build Number into metadata.xml
I am working on an extension package but am fairly new to Eclipse and Ant. I am looking for a way to add a build number into the build process, which ultimately will update the JAR and the metadata.xml file before including it in the zip.
I think I have step one working right - added this line to my build-extension.xml script
<buildnumber file="${config.dir}/build.number"/>
Now that there is the Eclipse extension which seems to control that top line based on the project properties, I would think this isn't that hard to do but I'm at a loss as to how to do it. I am guessing it has something to do with the manifest portion:
<manifest>
<attribute name="Built-By" value="${extension.package.vendor}"/>
<attribute name="Build-Date" value="${NOW}"/>
<section name="${extension.package.name}">
<attribute name="Package-Title" value="${extension.package.title}"/>
<attribute name="Package-Version" value="${extension.package.version}"/>
<attribute name="Package-Vendor" value="${extension.package.vendor}"/>
</section>
</manifest>
Worth noting that it appears that this is not working right anyway, as if you look at the compiled JAR's manifest, you see this
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.9.4
Created-By: 1.8.0_66-b18 (Oracle Corporation)
Built-By: ${extension.package.vendor}
Build-Date: 2016-01-08 09:41:43
Name: ${extension.package.name}
Package-Title: ${extension.package.title}
Package-Version: ${extension.package.version}
Package-Vendor: ${extension.package.vendor}
If I add the following properties to my build-extensions.xml then this cleans up, but it's not tied to the project in any way that I can tell, this is just cheating.
<property name="extension.package.vendor" value="Me"/>
<property name="extension.package.title" value="MyPackageName"/>
<property name="extension.package.name" value="MyPackageName"/>
<property name="extension.package.version" value="0.0"/>
But once thats working, I can change the one line for the manifest to do this to get my build number in the manifest. So that's good, but again, it's not wired to anything.
<attribute name="Package-Version" value="${extension.package.version}.b${build.number}"/>
That makes the Manifest look ok but, again, it does not appear to be connected to the project itself, nor does the metadata.xml get updated by any means so as far as ThWx is concerned it's unchanged.
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.9.4
Created-By: 1.8.0_66-b18 (Oracle Corporation)
Built-By: Devicify
Build-Date: 2016-01-08 09:44:08
Name: MyPackageName
Package-Title: MyPackageName
Package-Version: 0.0.b82
Package-Vendor: Me
So none of that is really glued together automatically, and then I am still missing how to possibly update the "packageVersion" property in the metadata.xml file
<ExtensionPackage dependsOn="" description="whatever" minimumThingWorxVersion="6.6.0" name="MyPackageName" packageVersion="0.0.1" vendor="Me">
What I would hope exists is some ability to write/adjust the Version property in the package using the build number, which would hopefully just magically change the metadata.xml as it seems to do, and then be able to use those project properties to write to the JAR manifest.
Any thoughts anyone?
