This document summarizes ambra's:

  • dojo implementation
  • custom dojo build process
  • dojo build automation via Maven

dojo Implementation

  • A snapshot of the entire dojo library lives under the <AMBRA_SOURCE_ROOT>/plos/libs/js/src/main/scripts/dojo directory. The version is indicated in the version.txt file under this directory and must be manually updated when the dojo library is updated.

IMPT: In order to perform custom dojo builds, the source version of the dojo library must be used rather than the standard pre-built version. See dojo's instructions on performing custom builds.

  • All dojo custom widgets used by ambra are defined in the <AMBRA_SOURCE_ROOT>/plos/libs/js/src/main/scripts/ambra directory.

dojo build process

  • The dojo and ambra libraries identified above are both referenced when performing dojo custom builds.
  • ambra-profile.js under the <AMBRA_SOURCE_ROOT>/plos/libs/js/src/main/scripts/ directory is the makefile for the dojo build. Refer to The Package System and Custom Builds for instructions on composing this file.
  • dojoBuild.groovy is a groovy script that executes the dojo custom build _from a Maven context_.
    It performs in the following order:
    • Invokes dojo's build tool which depends on ambra-profile.js and incorporates:
      • the stock dojo library
      • ambra defined custom widgets
    • Injects interned locale data into the built js files. This avoids ad-hoc http requests for locale strings when web pages that reference dojo are initially loaded.
  • The output dir of the dojo build is, by maven convention, the target directory of the js project.

packaging

Once the dojo build invocation is complete, only a certain sub-set of built files are packaged:

dojo.jsThe aggregated and compressed dojo library in one file. The contents of this file is not the entire dojo library rather only what is called out in our profile file: ambra.profile.js.
dojo.js.uncompressed.jsJust like dojo.js but un-compressed.
ambra.jsThe aggregated and compressed ambra dojo widgets.
ambra.js.uncompressed.jsSame as ambra.js but un-compressed.
_firebug dirThis is necessary for debug mode as the dojo library will make ad hoc http requests for firebug related resources.
resources dirCore dojo resources used by the core of the dojo library
dijit dirNeeded CSS resources for dojo widgets including ambra's custom ones

IMPT: The directory structure of the build output conforms to dojo's dir structure and is important that it be maintained upon deployment.

Maven integration

The dojo build and subsequent packaging is automated through Maven by: