diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 75d18458903..23bbba5c6ca 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -326,13 +326,19 @@ module ts { } function getFiles(): string[] { - var references: string[] = json["references"] instanceof Array ? json["references"] : [] - var files = map(references, s => combinePaths(basePath, s)); - var sysFiles = sys.readDirectory(basePath, ".ts"); - for (var i = 0; i < sysFiles.length; i++) { - var name = sysFiles[i]; - if (!fileExtensionIs(name, ".d.ts") || !contains(sysFiles, name.substr(0, name.length - 5) + ".ts")) { - files.push(name); + var files: string[] = []; + if (hasProperty(json, "files")) { + if (json["files"] instanceof Array) { + var files = map(json["files"], s => combinePaths(basePath, s)); + } + } + else { + var sysFiles = sys.readDirectory(basePath, ".ts"); + for (var i = 0; i < sysFiles.length; i++) { + var name = sysFiles[i]; + if (!fileExtensionIs(name, ".d.ts") || !contains(sysFiles, name.substr(0, name.length - 5) + ".ts")) { + files.push(name); + } } } return files; diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 6a9b86399df..a3c28c42a49 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -380,10 +380,11 @@ module ts { Unknown_compiler_option_0: { code: 5023, category: DiagnosticCategory.Error, key: "Unknown compiler option '{0}'." }, Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: DiagnosticCategory.Error, key: "Compiler option '{0}' requires a value of type {1}." }, Could_not_write_file_0_Colon_1: { code: 5033, category: DiagnosticCategory.Error, key: "Could not write file '{0}': {1}" }, - Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: DiagnosticCategory.Error, key: "Option mapRoot cannot be specified without specifying sourcemap option." }, - Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: DiagnosticCategory.Error, key: "Option sourceRoot cannot be specified without specifying sourcemap option." }, - Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: DiagnosticCategory.Error, key: "Option noEmit cannot be specified with option out or outDir." }, - Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: DiagnosticCategory.Error, key: "Option noEmit cannot be specified with option declaration." }, + Option_mapRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5038, category: DiagnosticCategory.Error, key: "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_sourceRoot_cannot_be_specified_without_specifying_sourcemap_option: { code: 5039, category: DiagnosticCategory.Error, key: "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option." }, + Option_noEmit_cannot_be_specified_with_option_out_or_outDir: { code: 5040, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'out' or 'outDir'." }, + Option_noEmit_cannot_be_specified_with_option_declaration: { code: 5041, category: DiagnosticCategory.Error, key: "Option 'noEmit' cannot be specified with option 'declaration'." }, + Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: DiagnosticCategory.Error, key: "Option 'project' cannot be mixed with source files on a command line." }, Concatenate_and_emit_output_to_single_file: { code: 6001, category: DiagnosticCategory.Message, key: "Concatenate and emit output to single file." }, Generates_corresponding_d_ts_file: { code: 6002, category: DiagnosticCategory.Message, key: "Generates corresponding '.d.ts' file." }, Specifies_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: DiagnosticCategory.Message, key: "Specifies the location where debugger should locate map files instead of generated locations." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 00ac39bd0ec..896af943d9f 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1618,22 +1618,26 @@ "category": "Error", "code": 5033 }, - "Option mapRoot cannot be specified without specifying sourcemap option.": { + "Option 'mapRoot' cannot be specified without specifying 'sourcemap' option.": { "category": "Error", "code": 5038 }, - "Option sourceRoot cannot be specified without specifying sourcemap option.": { + "Option 'sourceRoot' cannot be specified without specifying 'sourcemap' option.": { "category": "Error", "code": 5039 }, - "Option noEmit cannot be specified with option out or outDir.": { + "Option 'noEmit' cannot be specified with option 'out' or 'outDir'.": { "category": "Error", "code": 5040 }, - "Option noEmit cannot be specified with option declaration.": { + "Option 'noEmit' cannot be specified with option 'declaration'.": { "category": "Error", "code": 5041 }, + "Option 'project' cannot be mixed with source files on a command line.": { + "category": "Error", + "code": 5042 + }, "Concatenate and emit output to single file.": { "category": "Message", "code": 6001 diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 13a1a8830d5..7fc57c8cf46 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -127,7 +127,7 @@ module ts { } function findConfigFile(): string { - var searchPath = sys.getCurrentDirectory(); + var searchPath = normalizePath(sys.getCurrentDirectory()); var filename = "tsconfig.json"; while (true) { if (sys.fileExists(filename)) { @@ -178,12 +178,16 @@ module ts { if (compilerOptions.project) { configFilename = normalizePath(combinePaths(compilerOptions.project, "tsconfig.json")); + if (filenames.length !== 0) { + reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line)); + return sys.exit(EmitReturnStatus.CompilerOptionsErrors); + } } else if (filenames.length === 0) { configFilename = findConfigFile(); } - if (commandLine.filenames.length === 0 && !configFilename) { + if (filenames.length === 0 && !configFilename) { printVersion(); printHelp(); return sys.exit(EmitReturnStatus.CompilerOptionsErrors);