Titanium Mobile
  1. Titanium Mobile
  2. TIMOB-14933

CLI: Builds where tiapp.xml sdk-version differs from selected SDK fail to properly fork in Windows

    Details

    • Story Points:
      1

      Description

      The CLI tries to strip the first argument if it's the actual "node" executable before parsing the args. The problem is on Windows the node executable can sometimes contain the .exe and the following line of code fails:

      // cli.js (line 218)
      args[0].slice(-4) === 'node' && args.shift();
      

      This line needs to look like this:

      args[0].replace(/\\/g, '/').split('/').pop() == process.execPath.replace(/\\/g, '/').split('/').pop().replace(/\.exe$/, '') && args.shift();
      

        Activity

        Hide
        Chris Barber added a comment -

        To test:

        1) Find a Windows machine
        2) Install the Titanium CLI 3.1.2
        3) Download Titanium SDK 3.1.1.GA and 3.1.2.GA
        4) Set Titanium SDK 3.1.2.GA the selected SDK (ti sdk select 3.1.2.GA)
        5) Apply the PR fix to titanium/lib/cli.js
        6) Create an app and set the app's <sdk-version> to 3.1.1.GA
        7) Build the app (ti build -p mobileweb)

        Show
        Chris Barber added a comment - To test: 1) Find a Windows machine 2) Install the Titanium CLI 3.1.2 3) Download Titanium SDK 3.1.1.GA and 3.1.2.GA 4) Set Titanium SDK 3.1.2.GA the selected SDK (ti sdk select 3.1.2.GA) 5) Apply the PR fix to titanium/lib/cli.js 6) Create an app and set the app's <sdk-version> to 3.1.1.GA 7) Build the app (ti build -p mobileweb)
        Hide
        Chris Barber added a comment -
        Show
        Chris Barber added a comment - Pull request: https://github.com/appcelerator/titanium/pull/54
        Hide
        Samuel Dowse added a comment -

        Verified fixed on:
        Windows 7
        Titanium Studio, build: 3.2.0.201311262027
        Titanium SDK, build: 3.2.0.v20131127194046
        CLI: 3.2.0-beta
        Alloy: 1.3.0-beta

        If tiapp.xml sdk differs from the selected sdk in CLI, then CLI will fork the correct SDK and build successfully.

        [INFO]  tiapp.xml <sdk-version> set to 3.2.0.v20131127194046, but current Titanium SDK set to 3.2.0.v20131203104847
        [INFO]  Forking correct SDK command: "C:\Program Files (x86)\nodejs\node.exe" "C:\Users\tester\AppData\Roaming\npm\node_modules\titanium\bin\titanium" "build" "--sdk" "3.2.0.v20131127194046" "--config-file" "C:\Users\tester\.titanium\config.json" "--
        platform" "mobileweb" "--project-dir" "C:\Users\tester\Documents\Titanium_Studio_Workspace\mobileweb" "--log-level" "trace" "--deploy-type" "development"

        Closing.

        Show
        Samuel Dowse added a comment - Verified fixed on: Windows 7 Titanium Studio, build: 3.2.0.201311262027 Titanium SDK, build: 3.2.0.v20131127194046 CLI: 3.2.0-beta Alloy: 1.3.0-beta If tiapp.xml sdk differs from the selected sdk in CLI, then CLI will fork the correct SDK and build successfully. [INFO] tiapp.xml <sdk-version> set to 3.2.0.v20131127194046, but current Titanium SDK set to 3.2.0.v20131203104847 [INFO] Forking correct SDK command: "C:\Program Files (x86)\nodejs\node.exe" "C:\Users\tester\AppData\Roaming\npm\node_modules\titanium\bin\titanium" "build" "--sdk" "3.2.0.v20131127194046" "--config-file" "C:\Users\tester\.titanium\config.json" "-- platform" "mobileweb" "--project-dir" "C:\Users\tester\Documents\Titanium_Studio_Workspace\mobileweb" "--log-level" "trace" "--deploy-type" "development" Closing.

          People

          • Assignee:
            Chris Barber
            Reporter:
            Chris Barber
            Reviewer:
            Bryan Hughes (Inactive)
          • Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development