We can through an old mechanism that appears to be left from the
Apache Flex side that does just this.

Around line1192 of the root build.xml [1].  It specifically hunts down
files called "Version.as" and uses RegEx to update the version number
and build number.  So when the SDK is built for release, it will
automatically update the Version.as files using the "release.version"
property.  Meaning after we create the file(Version.as) having the
correct version format inside it.... it will be something that stays
up-to-date automatically.  Little tweaks needed it looks like, but it
should work.

build.xml lines look like this:

<target name="have-greptask" if="have.greptask">
<taskdef name="grep" classname="ise.antelope.tasks.Find"
classpathref="anttask.classpath"/>
<echo message="Updating all frameworks/projects/**/Version.as files
with version ${release.version}.${build.number.date}"/>
<!-- Update all Version.as files in the kit frameworks directory-->
<replaceregexp>
<regexp pattern='"[0-9].[0-9].[0-9].[0-9]";'/>
<substitution expression='"${release.version}.${build.number.date}";'/>
<fileset dir="${ROYALE_HOME}/temp/frameworks/projects">
<include name="**/Version.as"/>
</fileset>
</replaceregexp>
</target>


I won't have a chance to test the build.xml right now to finish it,
but here is what the rest of it would look like [2] (very short).

Usage for the end user:

import org.apache.royale.core.Version;

trace(Version.CURRENT_VERSION);


[1] https://github.com/apache/royale-asjs/blob/develop/build.xml
[2] 
https://github.com/KesslerConsulting/royale-asjs/commit/84262f3a2e56cc6b58ccdf283d039c94fb10cafb

-Mark K

On Tue, Apr 30, 2019 at 5:17 PM Carlos Rovira <carlosrov...@apache.org> wrote:
>
> Well,
> since others techs make that maybe it would be ok to have it baked. Right
> now I don't have a strong opinion about what to do maybe others could bring
> more light, but Version class seems ok to me, and hope we could have it get
> the version directly without manual modifications what will very cumbersome
> to manage for releases, niglhly builds, etc..
>

Reply via email to