1. #1
    Sencha User mberrie's Avatar
    Join Date
    Feb 2011
    Location
    Bangkok, Thailand
    Posts
    506
    Vote Rating
    14
    mberrie will become famous soon enough mberrie will become famous soon enough

      0  

    Default 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)
    Code:
    sencha -d compile -cl=ext/src,app union -r -c app.MyClass and metadata -f -o bundle1.txt
    But this is not (using include/union with a file) = the result file is empty
    Code:
    sencha -d compile -cl=ext/src,app union -r -f bundle1.js and metadata -f -o bundle1.txt
    bundle1.js only includes this as a test
    Code:
    //@require app.MyClass

    Shouldn't this work?

  2. #2
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,347
    Vote Rating
    134
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      0  

    Default


    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.
    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!"

  3. #3
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,347
    Vote Rating
    134
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      0  

    Default


    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:

    Code:
       //@tag foo,bar,jazz
    
       Ext.define(...
    Then you can use "union -r -tag foo" to get all classes with the 'foo' tag and their dependencies.

    Of course, the approach you are trying should also work
    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!"

  4. #4
    Sencha User mberrie's Avatar
    Join Date
    Feb 2011
    Location
    Bangkok, Thailand
    Posts
    506
    Vote Rating
    14
    mberrie will become famous soon enough mberrie will become famous soon enough

      0  

    Default


    This is the log output

    Code:
    Sencha Cmd v3.0.0.181
    [DEBUG]        found sencha.cfg at C:\project\support\sencha\Cmd\3.0.0.181
    [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\3.0.0.181\plugins\ext\current'
    [DEBUG]        using framework config override 'C:\project\support\sencha\Cmd\3.0.0.181\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\3.0.0.181\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.

    Thx!

  5. #5
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,347
    Vote Rating
    134
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      0  

    Default


    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.
    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!"

  6. #6
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,347
    Vote Rating
    134
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      0  

    Default


    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.
    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!"

  7. #7
    Sencha User mberrie's Avatar
    Join Date
    Feb 2011
    Location
    Bangkok, Thailand
    Posts
    506
    Vote Rating
    14
    mberrie will become famous soon enough mberrie will become famous soon enough

      0  

    Default


    Huh!

    Not sure why I didn't notice the docs.

    Could have saved me an hour or two yesterday LOL

  8. #8
    Sencha User mberrie's Avatar
    Join Date
    Feb 2011
    Location
    Bangkok, Thailand
    Posts
    506
    Vote Rating
    14
    mberrie will become famous soon enough mberrie will become famous soon enough

      0  

    Default


    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!

  9. #9
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,347
    Vote Rating
    134
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      0  

    Default


    Quote Originally Posted by mberrie View Post
    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.
    That is great news.

    Quote Originally Posted by mberrie View Post
    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.
    Good suggestion. Sorry that wasn't there already - kind of an obvious diagnostic.

    Quote Originally Posted by mberrie View Post
    Btw, I am really impressed so far!
    Thanks
    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!"

  10. #10
    Sencha - Ext JS Dev Team dongryphon's Avatar
    Join Date
    Jul 2009
    Posts
    1,347
    Vote Rating
    134
    dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all dongryphon is a name known to all

      0  

    Default


    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.
    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!"

Thread Participants: 1