29 Sep 2012 8:42 AM #1
sencha compile and include -r option
sencha compile and include -r option
The new compiler is pretty neat!
I am trying to build custom application 'bundles' using 'sencha compile'.
This is working (using include/union with a class)
sencha -d compile -cl=ext/src,app union -r -c app.MyClass and metadata -f -o bundle1.txt
sencha -d compile -cl=ext/src,app union -r -f bundle1.js and metadata -f -o bundle1.txt
Shouldn't this work?
29 Sep 2012 12:41 PM #2
That looks about right yes. What does the debug log look like? Using "sencha -d ..." or "sencha -debug ..." you should get some helpful output to see what might be going on internally.
29 Sep 2012 12:44 PM #3
You might also consider using tags to create bundles (if namespaces don't work).
Adding tags is similar but they are added to the source:
//@tag foo,bar,jazz Ext.define(...
Of course, the approach you are trying should also work
29 Sep 2012 6:09 PM #4
This is the log output
Sencha Cmd v188.8.131.52 [DEBUG] found sencha.cfg at C:\project\support\sencha\Cmd\184.108.40.206 [DEBUG] found workspace at C:\project\client\.sencha\workspace [DEBUG] found app at C:\project\client\.sencha\app [DEBUG] loading framework config from C:\project\client/extjs [DEBUG] found cmd at C:\project\client\extjs\cmd [DEBUG] Checking for framework config overrides [DEBUG] resolving framework config overrides for 'ext' [DEBUG] Detected framework version 4.1.1 [DEBUG] detected framework override at 'C:\project\support\sencha\Cmd\220.127.116.11\plugins\ext\current' [DEBUG] using framework config override 'C:\project\support\sencha\Cmd\18.104.22.168\plugins\ext\current' [DEBUG] Creating temporary directory C:\project\client\sencha-compile-temp-dir [DEBUG] loading class paths... [INFO ] Processing classPath entry : C:\project\client\sencha-compile-temp-dir [INFO ] Processing classPath entry : ext\src [INFO ] Processing classPath entry : app [INFO ] Processing classPath entry : C:\project\client\extjs\src [INFO ] Processing classPath entry : C:\project\client\classes [DEBUG] calculating dependency graph... [DEBUG] Loading implicit dependencies file C:\project\support\sencha\Cmd\22.214.171.124\plugins\ext\current\implicitClassDependencies.json [DEBUG] Adding implicit dependency for Ext.Component [DEBUG] Adding implicit dependency for Ext.container.AbstractContainer [DEBUG] Adding implicit dependency for Ext.data.Model [DEBUG] Adding implicit dependency for Ext.data.proxy.Proxy [DEBUG] Adding implicit dependency for Ext.data.proxy.Proxy ... [INFO ] Processing class inheritance graph [INFO ] Processing instantiation refereces to classes and aliases [DEBUG] Detected instantiation reference to widget.tbfill in file C:\project\client\extjs\src\toolbar\Toolbar.js ... [INFO ] Processing source dependencies [DEBUG] processing 656 source files [DEBUG] Processing dependencies for file: AbstractComponent.js [DEBUG] Processing dependencies for file: ComponentQuery.js [DEBUG] Processing dependencies for file: ComponentManager.js [DEBUG] Processing dependencies for file: AbstractManager.js [DEBUG] Processing dependencies for file: HashMap.js [DEBUG] Processing dependencies for file: Ext.js [DEBUG] Processing dependencies for file: Base.js [DEBUG] Processing dependencies for file: Date.js [DEBUG] Processing dependencies for file: Object.js [DEBUG] Processing dependencies for file: Function.js ... [DEBUG] Processing dependencies for file: Application.js [DEBUG] Processing dependencies for file: AbstractApplication.js [DEBUG] Processing dependencies for file: Tools.js ... [DEBUG] Processing dependencies for file: ToolbarItemFactory.js [DEBUG] Processing dependencies for file: Widget.js [DEBUG] Processing dependencies for file: YearField.js [DEBUG] dependency graph calculated [DEBUG] loading cache filters [DEBUG] filtering cache [DEBUG] enabling transitive dependencies [INFO ] Concatenating output to file bundle1.txt [DEBUG] removing tempdir C:\project\client\sencha-compile-temp-dir
Thx for the suggestion to use tags. I think I can make good use of it.
The tag tags the entire file, not just the Ext.define that follows, right?
Are there other compiler macros available? I have seen '@require' and '@define'.
Can we mark parts of a file to be ignored (excluded) by the compiler, maybe based on tags?
Can we tell the compiler to ignore certain 'require' statements that are only used during development to instruct Ext.Loader?
I guess we could use Ext.require statements that are not supported by the compiler (e.g. Ext.require(varName), but maybe there is a better way.
Also, we used JsBuilder statements like //<debug> and also added our own statement to include/exclude profiling code via //<profile>. I see the new compiler still supports //<debug> but does it also support //<if option>?
I think we can implement most of our requirements to use tags and file based selection. It would still be nice to get some feedback on the details of the new compiler.
29 Sep 2012 7:34 PM #5
For details on the compiler, see the http://docs.sencha.com/ext-js/4-1/#!...mmand_compiler guide. There are some TODO's in there to wrap up before GA, but I think it covers what you are asking.
The directives like "//<debug>" and "//<if>" can eliminate code during compilation, but not (currently) dependencies. So using these in a "requires" array won't have the desired effect.
We are migrating as much of the build process as possible out of the internals of Sencha Cmd and into build scripts that you can see and/or edit (plus configure via properties). At present we don't have a way for you to inject "excludes" into the application compile step, but we plan to address this part before GA. This piece is logged as SDKTOOLS-176.
If the guide does not answer your question(s), please feel free to start a thread and describe what is wrong/missing in the guide so we can fix those bugs as well. It is obviously a critical aspect to such an endeavor to have reliable documentation. We have really stressed that in this version.
29 Sep 2012 7:39 PM #6
Looking at the log output it is not really apparent why you aren't getting any files in your compilation. You can try the "--trace" option to get even more output but please be prepared for a flood of messages... in fact you will surely want to direct it to a file
Kevin (the "compiler guy") may have some ideas next week.
29 Sep 2012 8:11 PM #7
Not sure why I didn't notice the docs.
Could have saved me an hour or two yesterday LOL
29 Sep 2012 11:46 PM #8
Back to my original problem, the "include -r -f bundle1.js" not working.
Problem/solution: bundle1.js was not on the classpath! It worked once I added it.
I thought the compiler would pick it up relative to the working directory.
It makes sense to me now that it doesn't and that it exclusively works on the classpath.
It would be helpful to get some kind of hint in debug output. Maybe a warning if an include filter does not match anything?
But in the end it was just a conceptual misunderstanding on my part due to a lack of experience with the tool.
Btw, I am really impressed so far!
30 Sep 2012 12:40 AM #9
30 Sep 2012 12:46 AM #10
I've logged SDKTOOLS-177 to get better diagnostic support for compiler set criteria that don't match anything in the classpath.
Thanks for your patience for getting to the bottom of the issue and for replying with the details - much appreciated.