Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Static Javascript Aggregation

Carlos Manias Díez edited this page Dec 13, 2013 · 1 revision

In order to build the AMD modules in the Social SDK we are using Dojo Build Tool.

The Dojo Build Tool needs some files:

  • A build profile. For now we have sbt-dojo-amd.profile.js
  • A package.json for each package declared on the build profile. We have sbt/package.json
  • A main.js for each layer which includes all of the modules to be included (along with its dependencies) in a layer. We havesbt/main.js and sbt/control-main.js

To run the build we call a script in the dojo sources /util/buildscript/build.bat or /util/buildscript/build.sh with a parameter -p to specify the build profile.

The whole process is automated with an ANT script called by the Maven build.

On RTC there is the project in /src/eclipse/plugins/com.ibm.sbt.layer. That project has a pom.xml which executes the ANT script build.xml.

As part of the build, the repo in GitHub will be cloned into the folder gitbuild.

The ANT script copies the SBT Javascript sources from the gitbuild folder. Then it copies _bridges/dojo-amd to sbt/_bridge and dojo2 to sbt/widget. There are two targets unused for now which do the same for the jquery and dojo non-amd versions of the bridge. It also copies the build profile. Then it executes the dojo build tool on these sources and outputs two layers: the core sbt and the controls. Both layers have two aggregated versions, one compressed and one uncompressed.

IMPORTANT: When a new javascript file is created, it must be added to either main.js or control-main.js, depending if the file belongs to the controls or not.

There are some shell script files which, when run under a *nix environment, generate the main.js and the control-main.js respectively.

The resulting layers are sbt-core-dojo-amd.jswith its sbt-core-dojo-amd.js.uncompressed.js, and sbt-extra-controls-dojo-amd.js with its sbt-extra-controls-dojo-amd.js.uncompressed.js.