Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23864] CLI: Build process does not exit if using an incompatible module based on apiversion

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-09-19T17:12:02.000+0000
Affected Version/sRelease 6.0.0
Fix Version/sRelease 6.0.0, node-appc 0.2.37
ComponentsAndroid, CLI, Tooling
Labelsqe-6.0.0
ReporterEwan Harris
AssigneeFeon Sua Xin Miao
Created2016-09-05T10:02:09.000+0000
Updated2016-09-19T18:33:20.000+0000

Description

Description

When building using a 6.0.0 SDK and an old module that is incompatible with this SDK i.e the apiversion of the module is 2 the build process will not error out on the module check and the app will build and attempt to launch on device, but will not open. *Notes* The inverse of the situation does not happen as the CLI only enforces the minsdk value from the manifest and not the apiversion

Steps to reproduce

*These steps assume you have the same versions on your machine, correct as needed*

Edit the tiapp.xml modules section to include the following <module platform="android" version="2.3.10">ti.map</module>

Include ti.map in your project by adding var map = require('ti.map')

Ensure you are building with a 6.0.0 SDK

Build the project using appc run -p android -T device

Actual result

The project will build successfully, the app will attempt to launch on device but fail

Expected result

As the module is incompatible with 6.0.0, the build process should fail

Comments

  1. Chris Barber 2016-09-07

    node-appc PR: https://github.com/appcelerator/node-appc/pull/118
  2. Feon Sua Xin Miao 2016-09-07

    Master: https://github.com/appcelerator/titanium_mobile/pull/8325 6_0_X: https://github.com/appcelerator/titanium_mobile/pull/8324
  3. Lokesh Choudhary 2016-09-15

    [~fmiao], I get the debug log
     [DEBUG] Found incompatible Titanium module id=ti.map version=2.3.10 platform=android deploy-type=test
       
    if an incompatible module is used. But should we use more vocal log like warn/error. Also, I get this error, Not sure where this comes from:
    [ERROR] :  Could not find all required Titanium Modules:
       [ERROR] :     id: ti.map	 version: 2.3.10	 platform: android	 deploy-type: test
    This defeats the purpose of showing the debug log. Full log:
       [DEBUG] :  Looking for Titanium module id=ti.map version=2.3.10 platform=android deploy-type=test
       [DEBUG] :  Found incompatible Titanium module id=ti.map version=2.3.10 platform=android deploy-type=test
       [DEBUG] :  Module ti.map has apiversion=2, but the selected SDK supports module apiversion=3 on platform=android
       [WARN] :   Could not find a valid Titanium module id=ti.map version=2.3.10 platform=android deploy-type=test
       [ERROR] :  Could not find all required Titanium Modules:
       [ERROR] :     id: ti.map	 version: 2.3.10	 platform: android	 deploy-type: test
       
  4. Chris Barber 2016-09-15

    So, all that we need to do is edit builder.js and in validateTiModules(), add the api-version to the error output. First we need to do:
       var moduleAPIVersion = ti.manifest.moduleAPIVersion && ti.manifest.moduleAPIVersion[platformName];
       
    Then add the following to the missing and incompatible module list console.log() calls:
       (moduleAPIVersion ? '\t api-version: ' + moduleAPIVersion : '')
       
  5. Feon Sua Xin Miao 2016-09-15

    The error output is from [modules.missing.length](https://github.com/appcelerator/titanium_mobile/blob/master/node_modules/titanium-sdk/lib/builder.js#L355), although under this case it should go into [modules.incompatible.length](https://github.com/appcelerator/titanium_mobile/blob/master/node_modules/titanium-sdk/lib/builder.js#L364).
  6. Chris Barber 2016-09-15

    [~fmiao] You did put it under incompatible modules. :) https://github.com/appcelerator/node-appc/blob/dfd8dc5cab6f4978c9d4d5da85a8fd1b9ef1a79a/lib/timodule.js#L304
  7. Feon Sua Xin Miao 2016-09-19

    Fixed node-appc@0.2.38. Build should fail with following message:
       [ERROR] :  Found incompatible Titanium Modules:
       [ERROR] :     id: hyperloop	 version: 1.2.7	 platform: android	 min sdk: 5.4.0
       
  8. Lokesh Choudhary 2016-09-19

    Verified the fix. Closing. Environment: Appc Studio : 4.8.0.201609101003 Ti SDK : 6.0.0.v20160919100523 Ti CLI : 5.0.9 Alloy : 1.9.1 MAC El Capitan : 10.11.6 Appc NPM : 4.2.8-6 Appc CLI : 6.0.0-46 Node: 4.4.4 Nexus 6 - Android 6.0.1

JSON Source