Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2386 closed defect (fixed)

Provide additional rollup files in addition to dojo.js

Reported by: James Burke Owned by: James Burke
Priority: high Milestone:
Component: BuildSystem Version: 0.4.1
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by alex)

Allow the build system to generate multiple roll up files that contain a set of modules, in addition to dojo.js. The other rollup files should not include modules that are in dojo.js.

The work for this was started in a previous commit (forget which one), but was not fully fleshed out.

Some complications:

  • How to dynamically load these rollup files? Allow mapping the modules in the rollup file via djConfig.modulePaths (could be verbose) or create the rollup module with a specific resource name (like dojo.rollup1), and have the application change their code to use dojo.require("rollup1") instead of the other requires? That goes against the idea of the build system where you don't need to modify your code (except top level djConfig/dojo.js script line). So favor configuration via djConfig.modulePaths.
  • Need to divine the correct subset of modules that should be in dojo.js. For instance if rollup1.js has a dependency on dojo.foo and so does rollup2.js, then we should include dojo.foo in dojo.js even if they don't explicitly mention that module for dojo.js.

Attachments (2)

2386.patch (11.8 KB) - added by James Burke 12 years ago.
In progress patch, does not include i18n flattening or compression.
layers.profile.js (856 bytes) - added by James Burke 12 years ago.
Example profile with layers in it.

Download all attachments as: .zip

Change History (20)

comment:1 Changed 12 years ago by robert.coup@…

I think we could use a simpler approach: Rather than specifying what goes into dojo.js by combining rollups, why not just have the rollup be defined based on what is not already in dojo.js?

Calculate the dependencies for the profile, then remove those that are already in the base (eg. ajax) profile. What's left over needs to go in the rollup.

Since getDependencyList() just prints a list of strings (well, last time I looked) this filtering could happen later in the process and so we wouldn't need to change the profile format. Specifying -DbaseProfile="ajax" to Ant could let the base profile dependencies be calculated, followed by the actual profile, then change the resulting dependency list.

In the page the files could be loaded using normal script tags:

<script src="js/dojo/dojo-ajax.js" type="text/javascript"></script>
<script src="js/my-rollup.js" type="text/javascript"></script>

Future enhancements - specifying the base profile in the profile js file (is this even a good idea?), module paths, resource names, multiple base profiles, ...

Rob :)

comment:2 Changed 12 years ago by James Burke

Just uploaded a patch that gets the basic mechanism working. It supports creating "dojoLayerN.js" files. intern-strings also works for these files, but some things that do not:

  • compression via Dojo Compressor
  • Including flattened i18n bundles for these files at the top-level nls folder. Not sure we would want this anyway, but something to talk about.

If this patch holds up, we can get rid of:

  • buildscripts/buildUtilExt.js
  • buildscripts/profiles/multi.*.js

The patch was created against the 0.4 branch, but it should be applicable to the trunk too.

comment:3 Changed 12 years ago by James Burke

Removed old patches since they are against old code, and inferior. New patch and profile structure allows specifying which other layers a layer depends on. Still need to work out the proper thing for i18n bundle flattening and for compression, and it hasn't been tested, but an improvement over the old patch approach.

Changed 12 years ago by James Burke

Attachment: 2386.patch added

In progress patch, does not include i18n flattening or compression.

comment:4 Changed 12 years ago by James Burke

Just updated the patch to something that actually works. Patch was done against 0.4 branch.

It does not flatten i18n bundles for the layered files or compress them. But if strip-resource-comments ant task is run, the files do get minified.

Changed 12 years ago by James Burke

Attachment: layers.profile.js added

Example profile with layers in it.

comment:5 Changed 12 years ago by alex

Description: modified (diff)

comment:6 Changed 12 years ago by James Burke

Milestone: 0.90.4.3

comment:7 Changed 12 years ago by James Burke

(In [7738]) Refs #2386: Can do layered builds. No support for compression or i18n bundle matching, but still useful.

comment:8 Changed 12 years ago by James Burke

(In [7739]) (merge from 0.4 branch) Refs #2386: Can do layered builds. No support for compression or i18n bundle matching, but still useful.

comment:9 Changed 12 years ago by James Burke

(In [7907]) Fixes #2407 and Refs #2386. dojo compressing now works over multiple files in the same process. Layer files are now compressed, and it is possible to compress all files in the src directory via the strip-resource-comments ant task. Specify that task and a -Dstrip_and_compress=true to ant.

comment:10 Changed 12 years ago by James Burke

(In [7908]) (merge from 0.4 branch) Fixes #2407 and Refs #2386. dojo compressing now works over multiple files in the same process. Layer files are now compressed, and it is possible to compress all files in the src directory via the strip-resource-comments ant task. Specify that task and a -Dstrip_and_compress=true to ant.

comment:11 Changed 12 years ago by James Burke

(In [7909]) (merge from 0.4 branch) Fixes #2407 and Refs #2386. dojo compressing now works over multiple files in the same process. Layer files are now compressed, and it is possible to compress all files in the src directory

comment:12 Changed 12 years ago by James Burke

(In [7911]) Refs #2386. Create xd files for layered files.

comment:13 Changed 12 years ago by James Burke

(In [7912]) (merge from 0.4 branch) Refs #2386. Create xd files for layered files.

comment:14 Changed 12 years ago by James Burke

(In [7920]) Refs #2386. Copyright parsing is flawed and takes way too much time. A copyright text is passed in to this method, so there is a way to set a specific copyright.

comment:15 Changed 12 years ago by James Burke

(In [7921]) (merge from 0.4 branch) Refs #2386. Copyright parsing is flawed and takes way too much time. A copyright text is passed in to this method, so there is a way to set a specific copyright.

comment:16 Changed 12 years ago by James Burke

(In [7922]) (merge from 0.4 branch) Refs #2386. Copyright parsing is flawed and takes way too much time. A copyright text is passed in to this method, so there is a way to set a specific copyright.

comment:17 Changed 12 years ago by James Burke

Resolution: fixed
Status: newclosed

Marking fixed now. Basic support in there now. Layered support might be expanded, but that work will happen in 0.9.

comment:18 Changed 12 years ago by (none)

Milestone: 0.4.3

Milestone 0.4.3 deleted

Note: See TracTickets for help on using tickets.