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>

#ant, #netbeans