cometd / cometd-dojo

CometD's Dojo Bindings
13 stars 5 forks source link

Building cometd into a custom Dojo build #4

Open rich-frost opened 11 years ago

rich-frost commented 11 years ago

I'm struggling to see how we can include the cometd code in a custom build process for Dojo 1.8, can you give any suggestions? Your README doesn't cover it.

I've added the following to a build profile, it builds, but it doesn't include it in the layer file.

packages:[ 
       {name: "dojox/cometd", location: "../cometd-dojo/cometd"},
       {name: "org/cometd", location: "../cometd-dojo/org/cometd"),

..... ..... ]

stemey commented 11 years ago

I have the same issue. But my profile looks like this:

dependencies = {

layers: [{
    name: "../app/restclient.js",
    dependencies: [
                    "app/ServiceController"
    ]
}
,
prefixes: [
    [ "dojox/cometd", "../cometd-dojo/cometd" ],
    [ "org/cometd", "../cometd-dojo/org/cometd" ],
    [ "dijit", "../dijit" ],
    [ "gridx", "../gridx" ],
    [ "dojox", "../dojox" ],
    [ "gform", "../gform" ],
            [ "app", "../app" ]
]

};

The issue seems to be, that only top level modules may be mapped.

rich-frost commented 11 years ago

Did you manage to find a resolution to this? Thanks

stemey commented 11 years ago

I did not work on the issue. But I think that the project layout simply does not permit a proper build.

sbordet commented 11 years ago

I don't use/know the Dojo build system; I was told to put things in the current layout by Dojo guys, and they were happy with the result.

I am all for modifying things if they don't work, but I need help/guidance on how to modify things.

Thanks

stemey commented 11 years ago

I am also not an authority in the field, soI asked on the dojo mailing list for support.

clmath commented 11 years ago

I think the paths config should be used for that. Try adding something like that in your build profile:

paths: { 
     'dojox/cometd': '../cometd-dojo/cometd' , 
     'org/cometd': '../cometd-dojo/org/cometd' 
}
stemey commented 11 years ago

What's the difference to the prefixes that I added. Those are meant for aliasing but only support laiasing of top-level modules.

rich-frost commented 11 years ago

clmath - I've tried adding in the paths to the build profile - but doesn't seem to notice/pickup the configuration.

sbordet commented 11 years ago

@stemey if you get an answer in the Dojo ML, please report it here. Thanks !

rich-frost commented 11 years ago

I've not been able to find a way to get paths to work within a Dojo build. When developing an application in its un-built state it seems fine to use paths. For the build process however it seems paths/alias's don't register, so when the packages are pulled in they can't resolve the location of the alternative directories/files. I feel there must be something within the build profile that would do this, but I haven't had any luck finding anything and not had any responses on Dojo ML.

Subsequently, my work-around has been to overwrite the Dojo dojox code to include the cometd/ folder and cometd.js file (https://github.com/dojo/dojox/blob/master/cometd.js), and put the org/ folder at the same level as dojox/

This way I can at least get it building properly.

stemey commented 11 years ago

clmath's comment is the only feedback from the mailing list.

One possible solution is to change the module names to top-level names. Something like this:

paths: { 'cometd': '../cometd-dojo/cometd' , 'comet-org': '../cometd-dojo/org/cometd' }

Also, there are a lot of global objects. Convertinhg all the code to AMD would be useful.