Opened 10 years ago

Closed 7 years ago

#10795 closed defect (worksforme)

Dojo build messes up flattened nls bundles for layers with prefix path duplication

Reported by: Jared Jurkiewicz Owned by: Rawld Gill
Priority: high Milestone: 1.8
Component: BuildSystem Version: 1.4.0
Keywords: Cc:
Blocked By: Blocking:

Description

From a co-worker:

Dojo has a problem getting the module path from a layer file that includes a partial path that is the same as another prefix. If you have a build profile that has prefixes that look like this:

prefixes: [

[ "net", "../net", "../../copyright.txt" ],

[ "org", "../org", "../../copyright.txt" ],

[ "dijit", "../dijit", "../../copyright.txt" ],

[ "dojox", "../dojox", "../../copyright.txt" ]

]

and you have a layer file definition like this:

layers: [

{

name: "../org/company/net/layer.js",

resourceName: "org.company.net.layer"...

the build process will give the flattened layer bundle a module name of net.layer like this:

dojo.i18n._preloadLocalizations("net.nls.layer", ...)

Once this gets executed when you include the layer file, it fails to find the resource bundle because it's actually in the org.company.net.nls.layer module name path.

The cause of this is in the buildUtil.mapResourceToPath function. It iterates over the prefixes and finds the one that matches the best. However, the test specifically finds the one whose prefix matches the latest in the layer file path. I played around with this a bit and got it working by modifying build.js and buildUtil.js to set up canonical paths to these resources and then stripping them off appropriately to find the one that matches according to the prefix path not the prefix name. In any case, my changes were a bit crazy, so I didn't submit them.

Change History (4)

comment:1 Changed 9 years ago by James Burke

Milestone: tbdfuture

comment:2 Changed 8 years ago by bill

Owner: changed from James Burke to Rawld Gill

Bulk update to assign BuildSystem? tickets to Rawld. Many of these are probably already fixed in 1.7.

comment:3 Changed 7 years ago by Rawld Gill

Milestone: future1.8
Status: newassigned

comment:4 Changed 7 years ago by Rawld Gill

Resolution: worksforme
Status: assignedclosed

The design of the 1.6- builder input that conflated module names and filenames in the input caused these kind of edge cases. There are no plans to fix the old builder.

The new builder (as of 1.7) should have no problem with this.

Note: See TracTickets for help on using tickets.