Compiling your own javascript source

This page teaches you how to compile your own javascript source.

Before you begin

You need to get dojo source code, btt source code and btt.profile.js from BTTInstallpackaging/lib/JSsource.
And make sure two things:

Procedure

  1. Copy btt.profile.js and btt source code to the same directory of dojo source code folder.
    The table below lists several variables in btt.profile.js file with relative descriptions .
    Option Description
    name the name of the generated file
    dependencies the dependent dojo package
    layerDependencies the dependent js file, used to delete repeated code
    prefixed set the directory of prefixes
  2. Then open util\buildscripts\jslib\i18nUtil.js file and edit the 66th line to fix custom code i18n exception.
    original:
    var requireStatements = fileContents.match(/dojo\.requireLocalization\(.*\)\;/g);
    	if(requireStatements){
    		eval(requireStatements.join(";"));
    edited:
    var requireStatements = fileContents.match(/dojo\.requireLocalization\(.*\)\;/g);
    	if(/com\.ibm\.btt/.test(fileContents)) {
    		requireStatements = null;
    	}
    	if(requireStatements){
    		eval(requireStatements.join(";"));
  3. Start dos and input the following command.
    1. cd C:\jsBuild\util\buildscripts
    2. build.bat profile=../../../btt action=release releaseName=btt optimize=shrinksafe removeDefaultNameSpaces=true
    Option Description
    profile=../../../btt to configure the location of files. The root directory is \util\buildscripts\.
    action=release the compression directory
    releaseName=btt the package name after compression
    optimize=shrinksafe the way to compress
    removeDefaultNameSpaces=true set the value to true to fix the exception of Can't serialize DOM nodes
  4. And finally, compare with previous dojo package and remove useless files.
    • Remain: com package which contains the compressed dojo file, nls js file, resource package/css, picture