[ https://issues.apache.org/jira/browse/CB-6326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13943659#comment-13943659 ]
ASF GitHub Bot commented on CB-6326: ------------------------------------ Github user martincgg commented on the pull request: https://github.com/apache/cordova-blackberry/pull/151#issuecomment-38331316 the target-utils.js file is used at: list-emulator-images.js(no checks connection): https://github.com/apache/cordova-blackberry/blob/master/blackberry10/bin/templates/project/cordova/lib/list-emulator-images.js and list-started-emulators.js(it checks connection): https://github.com/apache/cordova-blackberry/blob/master/blackberry10/bin/templates/project/cordova/lib/list-started-emulators.js The first one, in my current environment, it stores 'emulator' not 'simulator', there it won't find any targets: https://github.com/apache/cordova-blackberry/blob/master/blackberry10/bin/templates/project/cordova/lib/target-utils.js#L51 In the .json file it's stored 'emulator' and when it try to compare: target[t].type === type target.type --> emulator type --> Sent as argument from when is called ---> 'simulator'. https://github.com/apache/cordova-blackberry/blob/master/blackberry10/bin/templates/project/cordova/lib/list-emulator-images.js#L19 So it will never get that information. The second one, list-started-emulators.js: https://github.com/apache/cordova-blackberry/blob/master/blackberry10/bin/templates/project/cordova/lib/list-started-emulators.js#L18 it gets a 'true' at pruneConnection, that one it will check, if one of the stored simulators is connected or not, it won't match, therefore it won't be located, even if it's started. The other one that it uses target-utils.js is run-utils.js. This one, as a matter of fact it uses type=emulator https://github.com/apache/cordova-blackberry/blob/master/blackberry10/bin/templates/project/cordova/lib/run-utils.js#L35 https://github.com/apache/cordova-blackberry/blob/master/blackberry10/bin/templates/project/cordova/lib/run-utils.js#L221 https://github.com/apache/cordova-blackberry/blob/master/blackberry10/bin/templates/project/cordova/lib/run-utils.js#L221 https://github.com/apache/cordova-blackberry/blob/master/blackberry10/bin/templates/project/cordova/lib/run-utils.js#L221 All over those function it assigns and it compares with 'emulator', and not with simulator. There are two functions that uses 'simulator', and analyzing those function are used to deploy the application: generateDeployOptions checkBuild In that case is 'simulator' used because it's part of the blackberry-deploy command. At runs function that provides the type to store in the blackberry10.json file, it provided by run-utils which returns 'emulator'. And the object based on tarjet-utils.js: https://github.com/apache/cordova-blackberry/blob/master/blackberry10/bin/templates/project/cordova/lib/run-utils.js#L20 Don't have any problem, because it uses functions as findConnectedDevice (gets IP), findConnectedSimulator (gets IP), and getDeviceInfo (gets information finding the device using a usbdiscover() function, that uses some patterns and look for in a range of ip address to search it). So, as far as I understand this, some functions are used to store and keep a record at .json file, and the other ones are to deploy to the native side (device or simulator). I don't really know, since when 'simulator', was replaced by 'emulator', and well I just have one question at last to clarify. If users have stored 'simulator', instead 'emulator', it won't be better replace it for good? Well, I've run a test. Having at the blackberry10.json file with this content: { "targets": { "All Touch [1280x768]-ffffa2e6": { "ip": "192.168.241.131", "pin": "ffffa2e6", "type": "simulator" } } } After that, I executed 'cordova emulate blackberry10', getting this output: C:\Users\Administrator\mob>cordova emulate blackberry10 Running command: cmd args=["/c","C:\\Users\\Administrator\\mob\\platforms\\black berry10\\cordova\\run","--emulator"] WARNING: Cannot sign applications. Author.p12 file cannot be found at default lo cation: C:\Users\Administrator\Local Settings\Application Data\Research In Motio n\author.p12 Searching for connected BlackBerry 10 Simulator (1/9)... Searching for connected BlackBerry 10 Simulator (2/9)... [INFO] Target All Touch [1280x768]-ffffa2e6 selected [INFO] WARNING: Cannot sign applications. Author.p12 file cannot be found at default location: C:\Users\Administrator\Local Settings\Application Data\Researc h In Motion\author.p12 [INFO] [BUILD] Populating application source [INFO] [BUILD] Parsing config.xml [INFO] [BUILD] Generating output files[WARN] Failed to find debug token. If you have an existing debug token, please copy it to C:\Users\Administrator/. cordova/blackberry10debugtoken.bar. To generate a new debug token, execute the ' run' command. [INFO] [INFO] Package created: C:\Users\ADMINI~1\mob\PLATFO~1\BLACKB~1\bui ld\simulator\bb10app.bar [INFO] [WARN] Failed to find debug token. If you have an existing debug to ken, please copy it to C:\Users\Administrator/.cordova/blackberry10debugtoken.ba r. To generate a new debug token, execute the 'run' command. [INFO] [INFO] Package created: C:\Users\ADMINI~1\mob\PLATFO~1\BLACKB~1\bui ld\device\bb10app.bar [INFO] [BUILD] BAR packaging complete [INFO] Sending request: UNINSTALL [INFO] Action: UninstallInfo: Uninstalling testDev_org_com_mobe2660409...Info : Processing 0 bytes [INFO] actual_dname::org.com.mob.testDev_org_com_mobe2660409actual_id::testDe v_org_com_mobe2660409actual_version::0.0.1.1result::success [INFO] Sending request: INSTALL_AND_LAUNCH [INFO] Action: Install and Launch [INFO] File size: 270667 [INFO] Installing org.com.mob.testDev_org_com_mobe2660409... [INFO] Processing 270667 bytes [INFO] Progress 100%... [INFO] _dname::org.com.mob.testDev_org_com_mobe2660409actual_id::testDev_org_ com_mobe2660409actual_version::0.0.1.1result::successInfo: Launching org.com.mob .testDev_org_com_mobe2660409... [INFO] result::92004500 [INFO] done As you could appreciate, the output clearly shows, that it looks for the emulator Searching for connected BlackBerry 10 Simulator (1/9)... Searching for connected BlackBerry 10 Simulator (2/9)... [INFO] Target All Touch [1280x768]-ffffa2e6 selected Until it's found, after deploy the application, I went to the the blackberry10.json file and as I suspected the value 'type: simulator' it was replaced by 'type: emulator': { "targets": { "All Touch [1280x768]-ffffa2e6": { "ip": "192.168.241.131", "pin": "ffffa2e6", "type": "emulator" } } } Well, those are my arguments, I think that nobody it has type as 'simulator' in the json file, so it would be worthless if we add support for both of them, if every time that an application is deployed to the emulator, and the json file it contains 'simulator' it will be replaced. > [cordova-blackberry] target-utils.js outdated > --------------------------------------------- > > Key: CB-6326 > URL: https://issues.apache.org/jira/browse/CB-6326 > Project: Apache Cordova > Issue Type: Bug > Components: BlackBerry > Affects Versions: 3.4.0 > Reporter: Martin Gonzalez > Assignee: Martin Gonzalez > Priority: Blocker > Labels: blackberry-utils, blackberry10, cordova-cli, cordova-info > Fix For: 3.5.0 > > > The file target-utils.js, located under cordova/lib, is used to get > information a about the devices, emulators, even if those are registered in > the blackberry10.json file. > When a cordova application is created, build and then deployed into the > blackberry emulator or device, all records stays at the blackberry10.json > file, that information include description, ip, pin, and type. When emulate, > it sets 'emulator', target-utils.js it looks for this file and check the > content, and it's looking for the word 'simulator', so it won't work anymore > if this word is not chaged, and replaced for 'emulator'. > Besides, from this change it depends this issue: > https://issues.apache.org/jira/browse/CB-6121 > The cordova info command it will use the target-utils.js, to add support for > blackberry10. -- This message was sent by Atlassian JIRA (v6.2#6252)