-
6 Nov 2012 3:44 AM #1
Compile process grabbing files that are unrelated
Compile process grabbing files that are unrelated
I have a multi-page MVC ext-js 4.12a application that was not built using sencha Cmd, I'm now trying to alter the application so that is it capable of compilation under sencha Cmd ( v3.0.0.190)
The app is multi-page with many of the classed being shared between the pages, I was intending to use intersect to generate common bundles but that is currently not working so I'm simply trying to compile a single bundle for the main page as a starting point.
My directory structure is thus:
Each pageX.html looks like this:Code:root page1.html page2.html page3.html app controller model util view page1.js page2.js page3.js overrides.js lang.js
pageX.js is the application start-up code, depending on the page, sometimes this is an actual Ext.application sometimes it's just a bare viewport. However during compilation I see that sencha Cmd parses and includes _all_ of the pageX.js files for no reason I can determine. My stripped down plugin.xml looks like this:Code:<!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <title>XXXX</title> <link rel="stylesheet" href="resources/css/default/app.css"> <!-- <x-compile> --> <!-- <x-bootstrap> --> <script src="ext/ext-debug.js"></script> <script src="bootstrap.js"></script> <!-- </x-bootstrap> --> <script src="app/overrides.js"></script> <script src="app/pageX.js"></script> <!-- </x-compile> --> </head> <body></body> </html>
page1[.html/.js] in _no way_ refers to page2.js (or page3.js etc) and yet they get included in the build/js/page1.js bundle. Why does sencha Cmd even look at that file, is there any way to determine why it's reading that file at all?Code:<project basedir="."> <import file="${workspace.config.dir}/plugin.xml"/> <target name="app-build-impl"> <local name="build.dir"/> <property name="build.dir" location="${workspace.build.dir}"/> <x-sencha-command> compile page -name=page1 -in=page1.html -out=${build.dir}/page1.html and concat ${build.dir}/js/page1.js </x-sencha-command> </target> </project>
-
6 Nov 2012 11:00 PM #2
By the looks of it, you appear to have some scaffolding in place (perhaps in a ".sencha" folder) but your post does not mention where plugin.xml is located. The snippet makes me think you are editing ".sencha/app/plugin.xml".
So a couple things here.
First is the use of plugin.xml. The role of plugin.xml in apps and workspaces is to provide before/after hooks for various commands. The "app-build-impl" target is intended for the framework (Ext JS or Sencha Touch) to provide the exact meaning of "sencha app build" and should probably not be replaced.
The ideal location for application build processes would be a build.xml file, which is what Cmd would generate.
Second, and more directly to your question, your compile command has an oops around the use of the current set. At the time your concat command executes, the current set is "all files". This is the default for the current set tracked by the compiler. This would fix your command:
The "-classes" option lets you change the name of the "all-classes.js" script that will be written to the html file.Code:compile page -name=page1 -in=page1.html -out=${build.dir}/page1.html -classes=page1.js and restore page1 and concat ${build.dir}/page1.js
Since you are building just one page, you can use the short-hand form of the page command, which is enabled by not naming the page's file set. For example:
Or you can build all of your pages in one compile command (for faster builds):Code:compile page -in=page1.html -out=${build.dir}/page1.html -classes=page1.js
Code:compile page -name=page1 -in=page1.html -out=${build.dir}/page1.html -classes=page1.js and page -name=page2 -in=page2.html -out=${build.dir}/page2.html -classes=page2.js and page -name=page3 -in=page3.html -out=${build.dir}/page3.html -classes=page3.js and restore page1 and concat ${build.dir}/page1.js and restore page2 and concat ${build.dir}/page2.js and restore page3 and concat ${build.dir}/page3.jsDon Griffin
Ext JS Development Team Lead
Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue
"Use the source, Luke!"
-
7 Nov 2012 3:21 AM #3
Thanks for the reply.
I created the scaffolding by moving my app out of the way and creating a new scaffold in what was the app directory (thus creating the .sencha directory) then removing the ./app and html scaffold and copying my app back into the directory.
The plugin.xml I provided was indeed .sencha/app/plugin.xml this was under the advice of kkrohe here http://www.sencha.com/forum/showthread.php?244917-3.0.0.181-Ext-JS-4.1.1a-unable-to-disable-yui-compression
As it stands I've actually given up on using sencha cmd, instead I'm using ext-all and a perl script that concats my app classes in a sensible order and runs the yui-compressor on it if needed. I'll probably look at it again when it's much more stable.
-
7 Nov 2012 9:52 AM #4
That makes sense. I was just double checking there since you didn't mention the presence of these in your OP... and they greatly effect the process.

OK, I see. I think the workaround Kevin recommended can be removed since that bug is fixed. The fact that the command was (slightly) incorrect is why you were getting all files vs the files for only the page you wanted.
In this case, because you have 3 "apps" in one folder structure, you will likely need to be calling the compiler directly to get the result you are after rather than try to use "sencha app build".
Certainly sorry to hear that - especially in this case as it seems the issue you are having is now just in how to craft the command you need to isolate the respective pieces of your 3 pages. I understand that you don't have unlimited time, however.
Good luck either way you go.
Don Griffin
Ext JS Development Team Lead
Check the docs. Learn how to (properly) report a framework issue and a Sencha Cmd issue
"Use the source, Luke!"
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote