Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24923] Windows: Unable to create a module with VS2017

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2017-08-21T09:53:34.000+0000
Affected Version/sRelease 6.2.0
Fix Version/sRelease 6.2.0
ComponentsTooling, Windows
Labelsn/a
ReporterEwan Harris
AssigneeKota Iguchi
Created2017-07-03T13:56:17.000+0000
Updated2017-08-22T09:30:00.000+0000

Description

Description

When creating a module with VS 2017 installed, it will throw the warning below and never create the cmake projects Note: ti cli does not throw an error, but appc cli does
Appcelerator Command-Line Interface, version 6.2.2
Copyright (c) 2014-2017, Appcelerator, Inc.  All Rights Reserved.

MobileWeb platform has been deprecated in 5.4.0 and will be removed in 7.0.0.
CMake Error: Could not create named generator undefined
Generators
  Visual Studio 15 2017 [arch] = Generates Visual Studio 2017 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 10 2010 [arch] = Generates Visual Studio 2010 project files.
                                 Optional [arch] can be "Win64" or "IA64".
  Visual Studio 9 2008 [arch]  = Generates Visual Studio 2008
project files.
                                 Optional [arch] can be "Win64" or "IA64".
  Visual Studio 8 2005 [arch]  = Generates Visual Studio 2005 project files.
                                 Optional [arch] can be "Win64".
  Visual Studio 7 .NET 2003    = Deprecated.  Generates Visual Studio .NET
                                 2003 project files.
  Borland Makefiles            = Generates Borland makefiles.
  NMake Makefiles              = Generates NMake makefiles.
  NMake Makefiles JOM
= Generates JOM makefiles.
  Green Hills MULTI            = Generates Green Hills MULTI files
                                 (experimental, work-in-progress).
  MSYS Makefiles               = Generates MSYS makefiles.
  MinGW Makefiles              = Generates a make file for use with
                                 mingw32-make.
  Unix Makefiles               = Generates standard UNIX makefiles.
  Ninja
= Generates build.ninja files.
  Watcom WMake                 = Generates Watcom WMake makefiles.
  CodeBlocks - MinGW Makefiles = Generates CodeBlocks project files.
  CodeBlocks - NMake Makefiles = Generates CodeBlocks project files.
  CodeBlocks - NMake Makefiles JOM
                               = Generates CodeBlocks project files.
  CodeBlocks - Ninja           = Generates CodeBlocks project files.
  CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
  CodeLite - MinGW Makefiles   = Generates CodeLite project files.
  CodeLite - NMake Makefiles   = Generates CodeLite project files.
  CodeLite - Ninja             = Generates CodeLite project files.
  CodeLite - Unix Makefiles    =
Generates CodeLite project files.
  Sublime Text 2 - MinGW Makefiles
                               = Generates Sublime Text 2 project files.
  Sublime Text 2 - NMake Makefiles
                               = Generates Sublime Text 2 project files.
  Sublime Text 2 - Ninja       = Generates Sublime Text 2 project files.
  Sublime Text 2 - Unix Makefiles
                               = Generates Sublime Text 2 project files.
  Kate - MinGW Makefiles       = Generates Kate project files.
  Kate - NMake Makefiles       = Generates Kate project files.
  Kate - Ninja                 = Generates Kate
project files.
  Kate - Unix Makefiles        = Generates Kate project files.
  Eclipse CDT4 - NMake Makefiles
                               = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - MinGW Makefiles
                               = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Ninja         = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.
2017-07-03T13:52:37.845Z | ERROR  | titanium exited with non-zero exit code (1)

Steps to reproduce

appc new -t timodule --name myawesomemodule --id com.foo

Actual

CLI will error with the above cmake projects not made

Expected

CLI should not error, cmake project should be made

Comments

  1. Ewan Harris 2017-07-03

    Just need to add logic to [here](https://github.com/appcelerator/titanium_mobile_windows/blob/master/templates/module/default/hooks/windows-module.js#L29-L49) to handle the name mapping like we do in other places
       //
       // Choose CMake generator based on selected Visual Studio
       //
       function chooseCMakeVSgenerator(logger, callback) {
       	var generators = {
       	    '12.0':'Visual Studio 12 2013',
       	    '14.0':'Visual Studio 14 2015',
       		'15.0': 'Visual Studio 15 2017'
       	};
       
       	windowslib.detect(function (err, results) {
       		if (err) {
       			logger.err(err);
       		}
       		var generator = generators['12.0'],
       			sdks = {
       				windows: results.windows,
       				windowsphone: results.windowsphone
       			};
       		console.log(results.selectedVisualStudio)
       
       		if (results.selectedVisualStudio) {
       			console.log('foo')
       			if (/^Visual Studio \w+ 2017/.test(results.selectedVisualStudio.version)) {
       				generator = generators['15.0'];
       			} else {
       				generator = generators[results.selectedVisualStudio.version];
       			}
       		}
       		callback(generator, sdks);
       	});
       }
       
  2. Ewan Harris 2017-07-03

    [~kiguchi] I have a fix for this above, which of the following would your prefer? - I pr it separately to https://github.com/appcelerator/titanium_mobile_windows/pull/959 - I pr it into your branch for https://github.com/appcelerator/titanium_mobile_windows/pull/959 (I don't mind if you just wanna commit it yourself too)
  3. Kota Iguchi 2017-07-03

    [~eharris] ok I see, I can handle that. (y)
  4. Kota Iguchi 2017-07-04

    Merged: https://github.com/appcelerator/titanium_mobile_windows/pull/959/commits/2e7c51ea030c74e8c5e77773f07c7fbdfed7eff7
  5. Ewan Harris 2017-08-22

    Verified changes in 6.2.0.v20170821203442

JSON Source