Search code examples
extjsgradlesencha-cmd

How can I display in my ExtJS web-app the sencha app build timestamp


I am currently building my sencha application using sencha app build inside of gradle.

When the build occurs I want to set information such as the timestamp of the build so that it can be referenced and outputted in the built web application. I presumed that sencha cmd would store some details about the state of the build however can not find where to reference that information in any documentation.

If build information is not saved by Sencha Cmd, I presume that this information should be passed in from the Gradle build process?

Thank you for any help.

James


Solution

  • Have a look at the deeper dive into Sencha cmd here In your build.xml add an -after-page task to append it to the generated javascript file Try the following which will put the timestamp string and then you can use it:

    <target name="-after-page">
        <tstamp>
            <format property="APP_TIMESTAMP" pattern="MM/dd/yyyy hh:mm aa"
        </tstamp>
    
        <!--
        The build.classes.file property holds the full path to the "all-classes.js"
        file so we use that variable rather than hard-code the name.
        -->
        <move file="${build.classes.file}" tofile="${build.classes.file}.tmp"/>
    
        <concat destfile="${build.classes.file}">
            <header filtering="no" trimleading="yes">
                var applicationTimestamp = "${THISYEAR}";
            </header>
            <fileset file="${build.classes.file}.tmp"/>
        </concat>
    
        <delete file="${build.classes.file}.tmp" />
    </target>