Results 1 to 5 of 5

Thread: Specify source files for non-ExtJS classes on command line

  1. #1
    Sencha Premium Member
    Join Date
    Apr 2013
    Posts
    19
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Vote Rating
    1272
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha Premium Member
    Join Date
    Apr 2013
    Posts
    19
    Vote Rating
    0
      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
    56
    Vote Rating
    1
      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
    19
    Vote Rating
    0
      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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •