This is all really good stuff --- we should update the README with the thinking in this thread.
On Thu, Mar 22, 2012 at 8:42 AM, Drew Walters <[email protected]> wrote: >> I would agree that we don't folks overriding a lot of the common stuff, but >> it's nice to have a safety valve. The safety valve is now testable, >> because I'm shipping exec.js and platform.js in common, which throw errors. >> So these files are EXPECTED to be overridden. For Smalltalkers, this is >> "self subclassResponsibility" all over again (codifying that something is >> meant to be overrriden). > > Cool. > >> Overriding exec.js is the way to do this, right? In fact, the 'test' and >> 'errgen' platforms already do this today. Or am I missing something? > > In essence, yes. Playbook essentially does this though not in a > modular way. We need to come up with a common way of doing this > modularly. Beginning discussions were here: > > http://markmail.org/search/?q=proxy+exec&q=list%3Aorg.apache.incubator.callback-dev#query:proxy%20exec%20list%3Aorg.apache.incubator.callback-dev+page:1+mid:p4v5bvri77qtbkpm+state:results > >> I don't think the previous packager.js had any special magic foo to do >> these merges, so I don't think anything has changed in this regard. Or >> maybe I'm misunderstanding. Can you point me to the place in the old >> packager.js where "merges" are happening: > > It probably could/should be done by packager but right now this is > done at runtime. The bootstrap file handles the merges > (platform.merges) at initialization. > > https://github.com/apache/incubator-cordova-js/blob/master/lib/bootstrap.js > > At any rate, I was misinterpreting what the build process would do. I > thought the build was copying modules from the platform specific sub > directory (lib/blackberry/plugin/blackberry/*) to the common plugin > directory. I now see that it is copying from the platforms plugin > directory (lib/blackberry/plugin/*). > > So, in summary, ignore me, looks good. > > On Thu, Mar 22, 2012 at 10:06 AM, Patrick Mueller <[email protected]> wrote: >> On Thu, Mar 22, 2012 at 09:48, Drew Walters <[email protected]> wrote: >> >>> 'platform specific' files overwrite any 'common' files, >>> per the order of the cp commands above. >>> >>> This makes sense though we need to strive for platforms not overriding >>> 'common' files since that negates the benefit of cordova-js common >>> API. >>> >> >> I would agree that we don't folks overriding a lot of the common stuff, but >> it's nice to have a safety valve. The safety valve is now testable, >> because I'm shipping exec.js and platform.js in common, which throw errors. >> So these files are EXPECTED to be overridden. For Smalltalkers, this is >> "self subclassResponsibility" all over again (codifying that something is >> meant to be overrriden). >> >> >>> We do however need to provide mechanisms for the following: >>> ...3. Platforms need to be able to proxy exec to a javascript >> >> implementation as opposed to native. This feature does not yet exist, >>> so platforms are using the "merges" object which overrides existing >>> API definition. >>> >> >> Overriding exec.js is the way to do this, right? In fact, the 'test' and >> 'errgen' platforms already do this today. Or am I missing something? >> >> >>> The reason I am mentioning the above is that if we refactored the code >>> as shown in your commit, then we need to rename files currently using >>> the "merges" approach as they would override common when they are >>> intended to augment common. >>> >> >> I don't think the previous packager.js had any special magic foo to do >> these merges, so I don't think anything has changed in this regard. Or >> maybe I'm misunderstanding. Can you point me to the place in the old >> packager.js where "merges" are happening: >> >> >> https://github.com/apache/incubator-cordova-js/blob/master/build/packager.js >> >> -- >> Patrick Mueller >> http://muellerware.org
