1. #1
    Sencha User
    Join Date
    Jun 2009
    Posts
    410
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default Deployment question - custom class includes

    Deployment question - custom class includes


    Hi,

    Sorry if this should be in the Cmd forum, but thought I'd start here as I think this may be more related to ST...

    I have recently upgraded my 2.0.1 application to the 2.1.0.b3 and am using Sencha Cmd v3.0.0.141 for the first time.

    I am attempting to produce a testing build and am running into the following issue:

    Code:
    C:\Sencha\Projects\PPTouch>sencha app build testing
    Sencha Cmd v3.0.0.141
    [INFO ]         init-properties:
    [INFO ]         init-antcontrib:
    [INFO ]         init-sencha-command:
    [INFO ]         init:
    [INFO ]         -before-app-build:
    [INFO ]         app-build-impl:
    [INFO ]         building application
    [INFO ]         Deploying your application to C:\Sencha\Projects\PPTouch\build\P
    PTouch\testing
    [INFO ]         Copied touch/sencha-touch.js
    [INFO ]         Copied Lib/InfoBubble.js
    [INFO ]         Copied Lib/markerwithlabel.js
    [INFO ]         Copied Lib/markermanager.js
    [INFO ]         Copied Scripts/HistoryMarkerManager.js
    [INFO ]         Copied app.js
    [INFO ]         Copied resources/css/app.css
    [INFO ]         Copied resources/css/pptouch.css
    [INFO ]         Copied C:\Sencha\Projects\PPTouch\resources\images
    [INFO ]         Copied C:\Sencha\Projects\PPTouch\resources\icons
    [INFO ]         Copied C:\Sencha\Projects\PPTouch\resources\loading
    [INFO ]         Resolving your application dependencies (file:///C:/Sencha/Proje
    cts/PPTouch/index.html)
    [INFO ]         Compiling app.js and dependencies
    [INFO ]         Processing classPath entry : C:\Sencha\Projects\PPTouch\sencha-c
    ompile-temp-dir
    [INFO ]         Processing classPath entry : C:\Sencha\Projects\PPTouch\touch\sr
    c
    [INFO ]         Processing classPath entry : C:\Sencha\Projects\PPTouch\app.js
    [INFO ]         Processing classPath entry : C:\Sencha\Projects\PPTouch\app
    [INFO ]         Processing class inheritance graph
    [INFO ]         Processing source dependencies
    [ERROR]         Failed to find file for HistoryMarkerManager
     required by C:\Sencha\Projects\PPTouch\app\view\GMap.js
    [ERROR]         Exception running app build : JavaException: com.sencha.exceptio
    ns.BasicException: com.sencha.exceptions.BasicException: com.sencha.exceptions.E
    xBuild: Failed to find any files for HistoryMarkerManager
    [ERROR]         javax.script.ScriptException: JavaException: com.sencha.exceptio
    ns.BasicException: com.sencha.exceptions.BasicException: com.sencha.exceptions.E
    xBuild: Failed to find any files for HistoryMarkerManager in <Unknown source> at
     line number 709
    The HistoryMarkerManger class this error refers to is defined in a 'lib' folder in the root of my application folder structure and is referenced in a view file like so:

    Code:
    Ext.define('PinpointersTouch.view.GMap', {
        extend: 'Ext.Map',
        xtype: 'gmap',
        requires: [
            'HistoryMarkerManager'
        ],
        ...
    I also have the class file referenced in my app.json config file like this:

    Code:
    "js": [
            {
                "path": "touch/sencha-touch.js",
                "update": "delta"
            },
            {
                "path": "Lib/InfoBubble.js",
                "update": "delta"
            },
            {
                "path": "Lib/markerwithlabel.js",
                "update": "delta"
            },
            {
                "path": "Lib/markermanager.js",
                "update": "delta"
            },
            {
                "path": "Scripts/HistoryMarkerManager.js",
                "update": "delta"
            },
            {
                "path": "app.js",
                "bundle": true,  /* Indicates that all class dependencies are concatenated into this file when build */
                "update": "delta"
            }
        ],
    As you can see, I have some other custom js files here too, no doubt these will need to be also addressed as part of this issue I have.

    I have see how the dynamic loading of classes works in the development version of my application, why is the build process not figuring out that this is a required class and adding it in the correct order? Or have I missed something here?

  2. #2
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,361
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    Update to version 181 and see if this problem still exists. If so, post in the Cmd forums!

  3. #3
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,361
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    Moved to Sencha Cmd forums.

  4. #4
    Sencha - Ext JS Dev Team
    Join Date
    Jan 2012
    Posts
    34
    Vote Rating
    6
    kkrohe is on a distinguished road

      0  

    Default


    A possible issue here could be the classpath settings used by the compiler.

    The app.json file from SDK Tools v2 apps is currently only used for packaging level operations (delta calculations, cache manifest generation, native packager, etc.).

    The compiler from Sencha Cmd v3 doesn't use the app.json file for class path purposes. It only uses values from the sencha.cfg files located in the .sencha/application and .sencha/workspace folders.

    For touch applications, there are two entries by default for the applications, the 'app' folder and 'app.js' at the root of the application directory. From what you're describing, it also sounds like you have a 'Lib' folder at the application root, but that won't be on the class path by default.

    To add it, you'll need to edit the app.classpath setting in <AppRoot>/.sencha/application/sencha.cfg and add this folder there (the value of the property is a comma separated list).

    Once this folder is on the classpath for the app, the compiler should start scanning it. Without it, it'll ignore that folder for compilation purposes, which looks like the issue you're having.

  5. #5
    Sencha User
    Join Date
    Jun 2009
    Posts
    410
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default


    Hi kkrohe

    Thanks, I tried this suggestion and can see the compiler is scanning those folders now in the output console:

    Code:
    C:\Sencha\Projects\PPTouch>sencha app build testing
    Sencha Cmd v3.0.0.141
    [INFO ]         init-properties:
    [INFO ]         init-antcontrib:
    [INFO ]         init-sencha-command:
    [INFO ]         init:
    [INFO ]         -before-app-build:
    [INFO ]         app-build-impl:
    [INFO ]         building application
    [INFO ]         Deploying your application to C:\Sencha\Projects\PPTouch\build\P
    PTouch\testing
    [INFO ]         Copied touch/sencha-touch.js
    [INFO ]         Copied Lib/InfoBubble.js
    [INFO ]         Copied Lib/markerwithlabel.js
    [INFO ]         Copied Lib/markermanager.js
    [INFO ]         Copied Scripts/HistoryMarkerManager.js
    [INFO ]         Copied app.js
    [INFO ]         Copied resources/css/app.css
    [INFO ]         Copied resources/css/pptouch.css
    [INFO ]         Copied C:\Sencha\Projects\PPTouch\resources\images
    [INFO ]         Copied C:\Sencha\Projects\PPTouch\resources\icons
    [INFO ]         Copied C:\Sencha\Projects\PPTouch\resources\loading
    [INFO ]         Resolving your application dependencies (file:///C:/Sencha/Proje
    cts/PPTouch/index.html)
    [INFO ]         Compiling app.js and dependencies
    [INFO ]         Processing classPath entry : C:\Sencha\Projects\PPTouch\sencha-c
    ompile-temp-dir
    [INFO ]         Processing classPath entry : C:\Sencha\Projects\PPTouch\touch\sr
    c
    [INFO ]         Processing classPath entry : C:\Sencha\Projects\PPTouch\app.js
    [INFO ]         Processing classPath entry : C:\Sencha\Projects\PPTouch\app
    [INFO ]         Processing classPath entry : C:\Sencha\Projects\PPTouch\lib
    [INFO ]         Processing classPath entry : C:\Sencha\Projects\PPTouch\scripts
    [INFO ]         Processing class inheritance graph
    [INFO ]         Processing source dependencies
    [INFO ]         Concatenating output to file C:\Sencha\Projects\PPTouch\build\PP
    Touch\testing\app.js
    [INFO ]         Completed compilation.
    [INFO ]         Processed local file touch/sencha-touch.js
    [INFO ]         Processed local file Lib/InfoBubble.js
    [INFO ]         Processed local file Lib/markerwithlabel.js
    [INFO ]         Processed local file Lib/markermanager.js
    [INFO ]         Processed local file Scripts/HistoryMarkerManager.js
    [INFO ]         Processed local file app.js
    [INFO ]         Generated app.json
    [INFO ]         Embedded microloader into index.html
    [INFO ]         -after-app-build:
    [INFO ]         app-build:
    
    
    
    
    C:\Sencha\Projects\PPTouch>
    But, I thought it would concatenate these into the app.js file, or am I mistaken here? They are just getting copied into the same folder structure (so a lib and scripts folder in the built application root)

    Also, this compile only works if I remove the requires config items from the classes they are used in, for example I have a MarkerManager and HistoryMarkerManager (one is in a lib and the other is a scripts folder at the appication root).

    If I add the requires config like so:

    Code:
    Ext.define('PinpointersTouch.view.GMap', {
        extend: 'Ext.Map',
        xtype: 'gmap',
    	requires: [
    		'MarkerManager',
    		'HistoryMarkerManager'
    	],
    Then I get compile errors:

    Code:
    [INFO ]         Processing classPath entry : C:\Sencha\Projects\PPTouch\app.js
    [INFO ]         Processing classPath entry : C:\Sencha\Projects\PPTouch\app
    [INFO ]         Processing classPath entry : C:\Sencha\Projects\PPTouch\lib
    [INFO ]         Processing classPath entry : C:\Sencha\Projects\PPTouch\scripts
    [INFO ]         Processing class inheritance graph
    [INFO ]         Processing source dependencies
    [ERROR]         Failed to find file for MarkerManager
     required by C:\Sencha\Projects\PPTouch\app\view\GMap.js
    [ERROR]         Exception running app build : JavaException: com.sencha.exceptio
    ns.BasicException: com.sencha.exceptions.BasicException: com.sencha.exceptions.E
    xBuild: Failed to find any files for MarkerManager
    [ERROR]         javax.script.ScriptException: JavaException: com.sencha.exceptio
    ns.BasicException: com.sencha.exceptions.BasicException: com.sencha.exceptions.E
    xBuild: Failed to find any files for MarkerManager in <Unknown source> at line n
    umber 709
    
    
    C:\Sencha\Projects\PPTouch>
    Any more thoughts?

    Thanks

  6. #6
    Sencha - Ext JS Dev Team
    Join Date
    Jan 2012
    Posts
    34
    Vote Rating
    6
    kkrohe is on a distinguished road

      0  

    Default


    Sounds like the new files don't have any Ext.define() calls that the compiler can parse.

    When the compiler scans the .js files in the class path, the primary thing it does is map out declarations of classes by parsing Ext.define calls and tracking the source file they originate in.

    In this case, the files have been added to the class path, so they are getting scanned properly, but it seems like the compiler is not finding any classes defined through Ext.define() calls, so those names are not getting associated with those files. That's why the requires entries are causing failures.

    There are a couple of options to correct it. One is to verify if there are any Ext.define created classes in those files and, if so, that they are in a form that the compiler can parse. To help with this, we added some warnings in build 181 that should generate 'warn' messages if the compiler encounters a call to Ext.define that it cannot process correctly.

    Another options is to use comment directives. For files that are more just helper scripts and don't have any classes created through Ext.define, you can use a comment directive at the top of the file to declare a name for the file that the compiler can process. For example, in this case you could add:

    Code:
    //@define MarkerManager
    to the Lib/markermanager.js file. That will indicate to the compiler that this name should be associated to this file on disk, so when a requirement this name is found, it will cause this file to be loaded.

    However, from looking that the command output, this appears to be a Sencha Touch application, so there will be some other updates required.

    With the options above, the compiler will begin dealing with file concatenation, rather than delegating script loading to the microloader through the app.json file, which means two things:
    • You'll probably want to remove the script assets from the app.json file, as both the app.json processor and compiler, so you'll have those files included multiple times.
    • Since the compiler will deal with the concatenation, it will need to place those files in the same order that the app.json file was specifying (Basically, the core files from sencha-touch.js need to be sorted first by the compiler, then these files). To achieve this, you can use a special tag that has been added to all of the core framework files that go into sencha-touch.js by placing the following directive at the top of the new files to include
      • //@require @core
      • adding this to each of the 4 new files will indicate to the compiler that they need to be included after the core framework, so the classes from sencha-touch.js should be included first. This way, the dependency scan for app.js should produce the correct order.

  7. #7
    Sencha User
    Join Date
    Jun 2009
    Posts
    410
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default


    Perfect answers kkrohe!

    I have added the @define {classname} and @require @core to the top of these files and removed them from the script assets in the app.json and the application is now building and compiling just fine.

    I have got a testing build running fine from my local web server, but I am encountering issues with the production version.

    Code:
    Creating Application Cache with manifest http://pptouch.pinpointers.com/build/PPTouch/production/cache.appcache
    Application Cache Checking event
    GET http://pptouch.pinpointers.com/build/PPTouch/production/PinpointersTouch/view/GMapContainer.js?_dc=1349278331133 404 (Not Found) GMapContainer.js:1
    Application Cache Error event: Manifest fetch failed (404) http://pptouch.pinpointers.com/build/PPTouch/production/cache.appcache
    GET http://pptouch.pinpointers.com/build/PPTouch/production/MarkerManager.js?_dc=1349278331128 404 (Not Found) MarkerManager.js:1
    GET http://pptouch.pinpointers.com/build/PPTouch/production/PinpointersTouch/view/GMap.js?_dc=1349278331129 404 (Not Found) GMap.js:1
    Malformed delta content received for http://pptouch.pinpointers.com/build/PPTouch/production/app.js index.html:72
    Something up with the appcache and deltas?? Should I be asking the Touch guys about this?

  8. #8
    Sencha User
    Join Date
    Jun 2009
    Posts
    410
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default


    OK, realised I need to add a mime type entry to my locall IIS to serve up the .appcache file correctly. But even after doing this, restart web server, I still get these errors:


    Code:
    Document was loaded from Application Cache with manifest http://pptouch.pinpointers.com/build/PPTouch/production/cache.appcache
    Application Cache Checking event
    Application Cache NoUpdate event
    GET http://pptouch.pinpointers.com/build/PPTouch/production/PinpointersTouch/view/GMap.js?_dc=1349279647735 404 (Not Found) GMap.js:1
    GET http://pptouch.pinpointers.com/build/PPTouch/production/PinpointersTouch/view/GMapContainer.js?_dc=1349279647739 404 (Not Found) GMapContainer.js:1
    GET http://pptouch.pinpointers.com/build/PPTouch/production/MarkerManager.js?_dc=1349279647734 404 (Not Found) MarkerManager.js:1
    Malformed delta content received for http://pptouch.pinpointers.com/build/PPTouch/production/app.js index.html:72

  9. #9
    Sencha - Ext JS Dev Team
    Join Date
    Jan 2012
    Posts
    34
    Vote Rating
    6
    kkrohe is on a distinguished road

      0  

    Default


    You might need to clear the cache / local storage on the client browser. Looks like it's having problems resolving all the changes to the production build and the initial production load didn't happen correctly, then subsequent loads think they have all the data locally so it isn't getting reloaded from the server.

  10. #10
    Sencha User
    Join Date
    Jun 2009
    Posts
    410
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default


    Yeah I should have figured that out myself! Thanks for answering my questions so far

    Ok, so I am seeing some different results when trying to run the production build in Chrome:

    Code:
    Document was loaded from Application Cache with manifest http://pptouch.pinpointers.com/build/PPTouch/production/cache.appcache
    Application Cache Checking event
    Application Cache NoUpdate event
    GET http://pptouch.pinpointers.com/build/PPTouch/production/MarkerWithLabel.js?_dc=1349290510283 404 (Not Found) MarkerWithLabel.js:1
    GET http://pptouch.pinpointers.com/build/PPTouch/production/PinpointersTouch/view/GMap.js?_dc=1349290510284 404 (Not Found) GMap.js:1
    GET http://pptouch.pinpointers.com/build/PPTouch/production/PinpointersTouch/view/GMapContainer.js?_dc=1349290510289 404 (Not Found) GMapContainer.js:1
    GET http://pptouch.pinpointers.com/build/PPTouch/production/MarkerManager.js?_dc=1349290510280 404 (Not Found) MarkerManager.js:1
    So I can see the Application Cache events are being fired, but now it's giving 404 errors.