1. #1
    Sencha Premium Member
    Join Date
    Apr 2013
    Posts
    18
    Vote Rating
    0
    yangman is on a distinguished road

      0  

    Default Specify source files for non-ExtJS classes on command line

    Specify source files for non-ExtJS classes on command line


    Sencha CMD provides a //@define directive for specifying source files that create objects not using ExtJS objects. This is, unfortunately, proving to be inadequate for our migration to CMD as we have third-party libraries that we wish to not modify for our project.

    Having these libraries included as a separate entry in index.html does not work because one of them provides a define-time dependency which CMD will order incorrectly. (http://www.sencha.com/forum/showthre...ithout-defined)

    Another library contains object that we extend into ExtJS classes, and does not work with the above method at all.

    Is there there any way to explicitly specify which source files contain non-ExtJS classes that are required in the dependency tree?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,074
    Vote Rating
    854
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Why couldn't you include the <script> in index.html? If it's within the x-compile comments it will get compiled otherwise it will be left alone and just included.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha Premium Member
    Join Date
    Apr 2013
    Posts
    18
    Vote Rating
    0
    yangman is on a distinguished road

      0  

    Default


    We'd like (at least some of) the libraries to get compiled in as well. Including it separately is non-ideal, although probably workable.

    This doesn't solve the extending the library case, though:

    Code:
    <!-- index.html -->
    <!DOCTYPE HTML>
    <html>
    <head>
        <meta charset="UTF-8">
        <title>test</title>
        <script src="lib/BigLibrary.js"></script>
        <!-- <x-compile> -->
            <!-- <x-bootstrap> -->
                <script src="ext/ext-dev.js"></script>
            <!-- </x-bootstrap> -->
            <script src="app/app.js"></script>
        <!-- </x-compile> -->
    </head>
    <body></body>
    </html>
    Code:
    // app/app.js
    Ext.application({
        name: 'test',
    
        requires: [
            'test.Test'
        ]
    });
    Code:
    // app/Test.js
    Ext.define('test.Test', {
        extend: 'BigLibrary'
    });
    Code:
    // lib/BigLibrary.js
    (function (root) {
        var BigLibrary = function() {
            this.foo = 'bar';
        };
    
        root.BigLibrary = new BigLibrary();
    })(this);
    Code:
    PS C:\workspace\test> sencha compile '-cla=ext/src,app,lib' page -in index.html -out build/index.html
    Sencha Cmd v3.1.1.274
    [INF] Including theme package ext-theme-classic for app.theme=ext-theme-classic build
    [INF] Compiling page null
    [INF] Loading classpath entry C:\workspace\test\ext\src
    [INF] Loading classpath entry C:\workspace\test\packages\ext-theme-base\overrides
    [INF] Loading classpath entry C:\workspace\test\packages\ext-theme-base\src
    [INF] Loading classpath entry C:\workspace\test\packages\ext-theme-neutral\overrides
    [INF] Loading classpath entry C:\workspace\test\packages\ext-theme-neutral\src
    [INF] Loading classpath entry C:\workspace\test\packages\ext-theme-classic\overrides
    [INF] Loading classpath entry C:\workspace\test\packages\ext-theme-classic\src
    [INF] Loading classpath entry C:\workspace\test\app
    [INF] Loading classpath entry C:\workspace\test\lib
    [ERR] Failed to resolve dependency BigLibrary for file test.Test
    [ERR] Error executing page compilation Unknown definition for dependency : BigLibrary
    [ERR] com.sencha.exceptions.ExNotFound: Unknown definition for dependency : BigLibrary

  4. #4
    Sencha Premium Member
    Join Date
    Oct 2012
    Posts
    55
    Vote Rating
    1
    vipul.suthar is on a distinguished road

      0  

    Default


    Quote Originally Posted by yangman View Post
    We'd like (at least some of) the libraries to get compiled in as well. Including it separately is non-ideal, although probably workable.

    This doesn't solve the extending the library case, though:

    Code:
    <!-- index.html -->
    <!DOCTYPE HTML>
    <html>
    <head>
        <meta charset="UTF-8">
        <title>test</title>
        <script src="lib/BigLibrary.js"></script>
        <!-- <x-compile> -->
            <!-- <x-bootstrap> -->
                <script src="ext/ext-dev.js"></script>
            <!-- </x-bootstrap> -->
            <script src="app/app.js"></script>
        <!-- </x-compile> -->
    </head>
    <body></body>
    </html>
    Code:
    // app/app.js
    Ext.application({
        name: 'test',
    
        requires: [
            'test.Test'
        ]
    });
    Code:
    // app/Test.js
    Ext.define('test.Test', {
        extend: 'BigLibrary'
    });
    Code:
    // lib/BigLibrary.js
    (function (root) {
        var BigLibrary = function() {
            this.foo = 'bar';
        };
    
        root.BigLibrary = new BigLibrary();
    })(this);
    Code:
    PS C:\workspace\test> sencha compile '-cla=ext/src,app,lib' page -in index.html -out build/index.html
    Sencha Cmd v3.1.1.274
    [INF] Including theme package ext-theme-classic for app.theme=ext-theme-classic build
    [INF] Compiling page null
    [INF] Loading classpath entry C:\workspace\test\ext\src
    [INF] Loading classpath entry C:\workspace\test\packages\ext-theme-base\overrides
    [INF] Loading classpath entry C:\workspace\test\packages\ext-theme-base\src
    [INF] Loading classpath entry C:\workspace\test\packages\ext-theme-neutral\overrides
    [INF] Loading classpath entry C:\workspace\test\packages\ext-theme-neutral\src
    [INF] Loading classpath entry C:\workspace\test\packages\ext-theme-classic\overrides
    [INF] Loading classpath entry C:\workspace\test\packages\ext-theme-classic\src
    [INF] Loading classpath entry C:\workspace\test\app
    [INF] Loading classpath entry C:\workspace\test\lib
    [ERR] Failed to resolve dependency BigLibrary for file test.Test
    [ERR] Error executing page compilation Unknown definition for dependency : BigLibrary
    [ERR] com.sencha.exceptions.ExNotFound: Unknown definition for dependency : BigLibrary
    Try to include the thirdparty libs inside the app class path in .sechan/app/sencha.cfg
    app.classpath=${app.dir}/src/atlsapp,${app.dir}/../thirdparty/src/BigLibrabry

    Try to compile using the sencha app build

  5. #5
    Sencha Premium Member
    Join Date
    Apr 2013
    Posts
    18
    Vote Rating
    0
    yangman is on a distinguished road

      0  

    Default


    Inclusion works with the given minimal-reproduction case if I include the //@define directive: claspath is not the issue.

    "app build" still relies on "compile". Using the former over the latter is irrelevant.