8 Nov 2012 8:20 AM #1
Compile only dependencies?
Is it possible to collect with sencha compile only the dependencies for an application?
I set the classpaths to the src files of my app and with --sdk-path the path to the ExtJS-src.
After compile, the compiled file has all classes from my src and the sdk-src, although not all sdk-src files are necessary.
Can I set an option like the Ext.Loader. that knows who the sdk-files are and includes only a a file, if it's required?
8 Nov 2012 5:50 PM #2
Can you post the command you are running? In general, the "--sdk-path" option is only used to generate app command and has some issues when used in application calls. The way the compiler works is based on a classpath, so the command you are using will help clarify what you are running into.
9 Nov 2012 12:47 AM #3
I try to concatenate my src folder without to create my app with the "sencha generate app" command . The structure of my project don't match with the from from "sencha generate app" created structure. All my ExtJS logic lies in this src folder and I need compile to compress and concatenate all these, to save loading time and size.
sencha compile -classpath= /develop/htdocs/res/jsdev/ concatenate -out=out.js
[INF] Processing classPath entry : /develop/htdocs/sencha-compile-temp-dir [INF] Processing classPath entry : /develop/htdocs/res/jsdev/ [INF] Processing class inheritance graph [ERR] Failed to resolve dependency Ext.data.Model for file mb2c.models.SliderStoreModel [ERR] com.sencha.exceptions.ExNotFound: Unknown definition for dependency : Ext.data.Model
sencha -sdk-path=/develop/ext-4.1.2a/ compile -classpath= /develop/htdocs/res/jsdev/ concatenate -out=out.js
9 Nov 2012 10:30 AM #4
We need the classpath in your second example to know that we have a complete app, but you can exclude whatever you want from the concat using the set operations provided by the compiler.
See http://docs.sencha.com/ext-js/4-1/#!...mmand_compiler for coverage of this topic.
In your case, try something like this:
sencha -sdk-path=/develop/ext-4.1.2a/ \ compile \ -classpath=/develop/htdocs/res/jsdev/ \ exclude \ -namespace=Ext \ and \ concatenate \ -out=out.js
9 Nov 2012 2:01 PM #5
I am having similar trouble getting only dependencies to be included in the all-classes.js output file. In my old build process with sencha-sdk-2.0.0 I could issue this command:
sencha create jsb -a index-dev.html -p app.jsb3
sencha build -p app.jsb3 -d build
Today I upgraded to the sencha-sdk-126.96.36.199 build and I am trying to craft a similar command. I have come up with:
sencha compile -classpath=ext/src,app-config.js,app.js,app \ -option=debug:false \ page -yui -in=index-dev.html -out=build/index.html
The "Trimming the Excess" section from http://docs.sencha.com/ext-js/4-1/#!...and_app_single says:
The page command then determines the subset of files used by "index.php".
As it is the sencha-sdk-188.8.131.52 command generates an all-classes.js file that is 25% larger than the sencha-sdk-2.0.0.
9 Nov 2012 2:33 PM #6
The page command looks for the x-compile section of your markup file to make this determination, so if you could post that here I would be glad to see if there is anything ado there.
9 Nov 2012 2:37 PM #7
Another useful thing is to use "sencha -debug compile ..." to get a log of the dependency scan to get blow-by-blow on what is being determined. This can be a lot of output but if you are looking for specific files you can always search to see where they show up.
9 Nov 2012 5:23 PM #8
Thanks for the debug tip, Don. I will give that a look later. For my index-dev.html page I copied the x-compile section from the Sencha cmd Single Page Apps Guide:
10 Nov 2012 9:05 AM #9
10 Nov 2012 9:56 AM #10
I realize now my issue is that I was executing the sencha cmd against ExtJS 4.1.2 and not ExtJS 4.1.1a or ExtJS 4.1.2a ... I started from scratch with one of the 'a' sdks and everything seems to be working great.