message: Be tolerant of tasks.json files with no 'tasks' node or with an os-specific node
diff: @@ -346,6 +346,35 @@ function getOperations(generator: AssetGenerator) {
  getLaunchOperations(generator.launchJsonPath, operations));
  }
  +function getBuildTasks(tasksConfiguration: tasks.TaskConfiguration) {
  + let result: tasks.TaskDescription[] = [];
  +
  + function findBuildTask(tasksDescriptions: tasks.TaskDescription[]) {
  + if (tasksDescriptions) {
  + const buildTask = tasksDescriptions.find(td => td.taskName === 'build');
  + if (buildTask !== undefined) {
  + result.push(buildTask);
  + }
  + }
  + }
  +
  + findBuildTask(tasksConfiguration.tasks);
  +
  + if (tasksConfiguration.windows) {
  + findBuildTask(tasksConfiguration.windows.tasks);
  + }
  +
  + if (tasksConfiguration.osx) {
  + findBuildTask(tasksConfiguration.osx.tasks);
  + }
  +
  + if (tasksConfiguration.linux) {
  + findBuildTask(tasksConfiguration.linux.tasks);
  + }
  +
  + return result;
  +}
  +
  function getBuildOperations(tasksJsonPath: string) {
  return new Promise<Operations>((resolve, reject) => {
  fs.exists(tasksJsonPath, exists => {
  @@ -356,19 +385,18 @@ function getBuildOperations(tasksJsonPath: string) {
  }
  const text = buffer.toString();
  -
  - let buildTask: tasks.TaskDescription;
  + let tasksConfiguration: tasks.TaskConfiguration;
  try {
  - const tasksJson: tasks.TaskConfiguration = tolerantParse(text);
  - buildTask = tasksJson.tasks.find(td => td.taskName === 'build');
  + tasksConfiguration = tolerantParse(text);
  }
  catch (error) {
  vscode.window.showErrorMessage(`Failed to parse tasks.json file`);
  - buildTask = undefined;
  }
  - resolve({ updateTasksJson: (buildTask === undefined) });
  + let buildTasks = getBuildTasks(tasksConfiguration);
  +
  + resolve({ updateTasksJson: (buildTasks.length > 0) });
  });
  }
  else {
  