1. #1
    Sencha User
    Join Date
    Apr 2011
    Posts
    15
    Vote Rating
    0
    nvoxland is on a distinguished road

      0  

    Default Can you run SDK commands via rhino?

    Can you run SDK commands via rhino?


    I'm looking to auto-generate combined/compressed javascript within my java application when the all-classes.js URL is first requested (sort of like how jsp files are parsed and compiled when first executed).

    So basically, I am needing to automate a call to "sencha create jsb -a http://localhost/path/to/application/index.php -p app.jsb3" and "sencha build -p app.jsb3 -d ." server-side.

    It sort of works by executing the jsdb directly, but I am having problems with the process not actually exiting consistently.

    Since it is a java application, I think it would be nice to simply be able to use the rhino javascript engine to execute the command/sencha.js directly since it would be running in-process and so I would have better control over how it is executing and will not have to worry about platform differences.

    Does anyone know if rhino would be able to run the create and build commands? Or is there jsdb-specific javascript in there?

    Nathan

  2. #2
    Sencha User kite's Avatar
    Join Date
    Jun 2010
    Location
    Lugans'k, Hohland
    Posts
    25
    Vote Rating
    0
    kite is on a distinguished road

      0  

    Default


    Sencha SDK Tools uses Phantom JS (http://www.phantomjs.org/) to get dependencies list, this is "headless WebKit with JavaScript API" and this isn't java-application.
    I don't think ExtJS 4.0 works correctly with Rhino js-engine... even more - Phino isn't HTML parser, so it's impossible to pass index.html to it.

    To compress javascript you can use YUI compressor directly from Java. To get dependency list of js-files - you need to run phantomjs or any similar tool (it's not so hard to do this through System.exec or ProcessBuilder).

  3. #3
    Sencha - Community Support Team mschwartz's Avatar
    Join Date
    Nov 2008
    Location
    San Diego, Peoples' Republic of California
    Posts
    2,053
    Vote Rating
    17
    mschwartz will become famous soon enough mschwartz will become famous soon enough

      0  

    Default


    Quote Originally Posted by kite View Post
    Sencha SDK Tools uses Phantom JS (http://www.phantomjs.org/) to get dependencies list, this is "headless WebKit with JavaScript API" and this isn't java-application.
    I don't think ExtJS 4.0 works correctly with Rhino js-engine... even more - Phino isn't HTML parser, so it's impossible to pass index.html to it.

    To compress javascript you can use YUI compressor directly from Java. To get dependency list of js-files - you need to run phantomjs or any similar tool (it's not so hard to do this through System.exec or ProcessBuilder).
    Rhino has E4X, so it could deal with HTML documents just fine.

  4. #4
    Sencha User kite's Avatar
    Join Date
    Jun 2010
    Location
    Lugans'k, Hohland
    Posts
    25
    Vote Rating
    0
    kite is on a distinguished road

      0  

    Default


    Quote Originally Posted by mschwartz View Post
    Rhino has E4X, so it could deal with HTML documents just fine.
    HTML != XML and even HTML != XHTML. And API for XML in JavaScript isn't what we need - to receive full dependency list it's need to create full DOM and run whole JavaScript, like in browser.
    Have you tried to run ExtJS application under Rhino?

  5. #5
    Sencha User
    Join Date
    Apr 2011
    Posts
    15
    Vote Rating
    0
    nvoxland is on a distinguished road

      0  

    Default


    I don't need the whole ExtJS application to run under rhino, all I would need is the ability to get the "create jsb" and "build" commands to run. It does appear that the "create jsb" does run the all the initialization javascript, so we may need to be careful about what is in the init methods, but it seems like it should be possible.

    ext-app-builder.bat uses phantomjs, but command and jsbuilder both use jsdb. Any idea why the difference? Are they using jsdb just as a javascript engine? Or are there calls in there to jsdb-specific functions like Stream and Process?

    Nathan

    Nathan

  6. #6
    Sencha - Community Support Team mschwartz's Avatar
    Join Date
    Nov 2008
    Location
    San Diego, Peoples' Republic of California
    Posts
    2,053
    Vote Rating
    17
    mschwartz will become famous soon enough mschwartz will become famous soon enough

      0  

    Default


    Quote Originally Posted by kite View Post
    HTML != XML and even HTML != XHTML. And API for XML in JavaScript isn't what we need - to receive full dependency list it's need to create full DOM and run whole JavaScript, like in browser.
    Have you tried to run ExtJS application under Rhino?
    Rhino is just a JavaScript interpreter, it does not have the DOM implementation of a browser. So of course ExtJS won't run in it without adding something like JSDOM or env.js.

    But I didn't see that as an issue... See this:

    Quote Originally Posted by nvoxland View Post
    I don't need the whole ExtJS application to run under rhino, all I would need is the ability to get the "create jsb" and "build" commands to run. It does appear that the "create jsb" does run the all the initialization javascript, so we may need to be careful about what is in the init methods, but it seems like it should be possible.

    ext-app-builder.bat uses phantomjs, but command and jsbuilder both use jsdb. Any idea why the difference? Are they using jsdb just as a javascript engine? Or are there calls in there to jsdb-specific functions like Stream and Process?

    Nathan

    Nathan
    Not sure why you'd want to use Rhino, since it's 30x to 100x slower than the major browsers' JS engines. What it does have is threading, so you could do things in parallel...

  7. #7
    Sencha User kite's Avatar
    Join Date
    Jun 2010
    Location
    Lugans'k, Hohland
    Posts
    25
    Vote Rating
    0
    kite is on a distinguished road

      0  

    Default


    Quote Originally Posted by nvoxland View Post
    I don't need the whole ExtJS application to run under rhino, all I would need is the ability to get the "create jsb"
    "create jsb" in order to get dependency list runs whole ExtJS application inside PhantomJS (using WebKit engine).
    So only with Rhino you cannot do "create jsb", if you will use PhantomJS - you don't need Rhino (PhantomJS can do everything that Rhino can).
    I don't why Sencha use jsdb for for parsing argument and printing help instead of phantomjs, like as I don't know why they include Hammer JS and don't use it at all.
    As for me, for building I created a simple js-script that returns deps list (a few lines from ext-app-builder.js), and in other shell script run it under phantomjs, create single file and compress with Yahoo js-compressor - result the same as after "sencha create jsb" && "sencha build", but everything is simple and works without problems everywhere (including Linux x64).

  8. #8
    Sencha User
    Join Date
    Apr 2011
    Posts
    15
    Vote Rating
    0
    nvoxland is on a distinguished road

      0  

    Default


    The reason I was looking at rhino is because I am already running inside a java environment, and I am trying to avoid forking a new process even at the expense of having a slow JS interpreter.

    I hadn't realized ext did as much execution of your app in order to do "create jsb", and I see that ext-app-builder.js has references to phantom.fs, so it looks like rhino is not going to be an option.

    I'll probably just have to see if I can do a better job of external-process management from java.

    Nathan

  9. #9
    Sencha User kite's Avatar
    Join Date
    Jun 2010
    Location
    Lugans'k, Hohland
    Posts
    25
    Vote Rating
    0
    kite is on a distinguished road

      0  

    Default


    Quote Originally Posted by nvoxland View Post
    I hadn't realized ext did as much execution of your app in order to do "create jsb", and I see that ext-app-builder.js has references to phantom.fs, so it looks like rhino is not going to be an option.
    This isn't big problem - you can write own ext-app-builder.js and use stdout instead of file i/o. The main problem in that fact, that you need to fully load your page like browsers do this, and only after this you can retrieve object Ext.Loader.history. Only in this case and if you correctly setup "require"d classes you will get full dependency list. Rhino can't do this. You should use js-engine only from one of supported by ExtJS browsers.
    Execute external process in Java is very simple - good luck.

  10. #10
    Sencha User
    Join Date
    Jun 2008
    Posts
    157
    Vote Rating
    0
    wiznia is on a distinguished road

      0  

    Default


    So is it possible to not use jsdb and use phantom instead???<br>Does someone knows how it's done?

Thread Participants: 3

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar