Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-14641

Blackberry: Not specifying a "target" throws unhelpful error in CLI

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Low
    • Resolution: Fixed
    • Affects Version/s: Release 3.1.1
    • Fix Version/s: Backlog
    • Component/s: BlackBerry
    • Labels:
      None
    • Environment:

      TiSDK 3.1.1
      Ti CLI 3.1.1
      BB NDK 10.0.1.1020

      Description

      problem

      Executing a titanium build without the --target option throws an error that the 99% of developers will have no idea how to work with, seen here:

      /usr/local/lib/node_modules/titanium/node_modules/longjohn/dist/longjohn.js:181
              throw e;
                    ^
      TypeError: Cannot read property '0' of undefined
          at BlackberryNDK.self.build (/Users/tlukasavage/Library/Application Support/Titanium/mobilesdk/osx/3.1.1.GA/blackberry/cli/common/blackberryndk.js:233:62)
          at build.<anonymous> (/Users/tlukasavage/Library/Application Support/Titanium/mobilesdk/osx/3.1.1.GA/blackberry/cli/commands/_build.js:140:15)
          at /usr/local/lib/node_modules/titanium/lib/cli.js:116:18
          at /usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:190:13
          at /usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:116:25
          at /usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:187:17
          at /usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:491:34
          at /usr/local/lib/node_modules/titanium/lib/cli.js:112:8
          at ChildProcess.<anonymous> (/Users/tlukasavage/Development/alloy/test/projects/Harness/plugins/ti.alloy/hooks/alloy.js:149:6)
      ---------------------------------------------
          at /Users/tlukasavage/Development/alloy/test/projects/Harness/plugins/ti.alloy/hooks/alloy.js:142:11
          at /usr/local/lib/node_modules/titanium/node_modules/node-appc/lib/async.js:14:6
          at /usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:190:13
          at /usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:94:25
          at /usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:187:17
          at /usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:459:34
          at /Users/tlukasavage/Development/alloy/test/projects/Harness/plugins/ti.alloy/hooks/alloy.js:90:9
          at exithandler (child_process.js:635:7)
      

      It appears it happens because the --target option is not explicitly set.

      test case

      In any Titanium app, execute the following:

      titanium build -p blackberry
      

      and you will get the above error. Just as an additional note, you get the same error if you explicitly define the BB NDK path (-n) and the ip address of the simulator (-A), which should obviously indicate that the target would be "simulator".

      expected

      There's a few possible solutions, listed in my preferential order:

      1. Make the default target "simulator" like with all other platforms
      2. Do better bounds checking around the line mentioned in the exception. Specifically, the length of the builder.type2variantCpu[this.builder.target] array needs to be validated before attempting to access index zero. If the array is empty, an informative error should be thrown, not the current stack trace.

      Workaround

      Explicitly specify the --target in your command:

      titanium build -p blackberry -T simulator -A XXX.XXX.XXX.XXX
      

        Attachments

          Activity

            People

            • Assignee:
              rmcmahon Russell McMahon
              Reporter:
              tlukasavage Tony Lukasavage
              Reviewer:
              Pedro Enrique (Inactive)
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-17058
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration