Home > Uncategorized > Version from git in a Netbeans Platform application

Version from git in a Netbeans Platform application

To set the main window and about version of your Netbeans Platform application, redefine the branding target in your suite build.xml file, this way:

<target name="branding" depends="suite.branding">
    <exec executable="git" failifexecutionfails="false" logError="true" outputproperty="app.git.version">
        <arg line="describe --tags --always"/>
    </exec>
    <tstamp>
        <format property="app.git.version" pattern="yyyyMMddHHmmss"/>
    </tstamp>           
    <tempfile property="temp.dir"/>
    <unjar src="${cluster}/modules/locale/org-netbeans-core-windows_${branding.token}.jar" dest="${temp.dir}">
        <patternset>
            <include name="org/netbeans/core/windows/view/ui/Bundle_${branding.token}.properties"/>
        </patternset>
    </unjar>
    <propertyfile file="${temp.dir}/org/netbeans/core/windows/view/ui/Bundle_${branding.token}.properties">
        <entry  key="CTL_MainWindow_Title_No_Project" value="Schematic ${app.git.version}"/>
    </propertyfile>
    <jar jarfile="${cluster}/modules/locale/org-netbeans-core-windows_${branding.token}.jar" update="true" basedir="${temp.dir}"/>
    <delete dir="${temp.dir}"/>
    <unjar src="${cluster}/core/locale/core_${branding.token}.jar" dest="${temp.dir}">
        <patternset>
            <include name="org/netbeans/core/startup/Bundle_${branding.token}.properties"/>
        </patternset>
    </unjar>
    <propertyfile file="${temp.dir}/org/netbeans/core/startup/Bundle_${branding.token}.properties">
        <entry  key="currentVersion" value="Schematic ${app.git.version}"/>
    </propertyfile>
    <jar jarfile="${cluster}/core/locale/core_${branding.token}.jar" update="true" basedir="${temp.dir}"/>
    <delete dir="${temp.dir}"/>
</target>
Advertisements
Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: