From 01a724398331ae8bd51a6e37a9121c35ce488549 Mon Sep 17 00:00:00 2001 From: vvakame Date: Mon, 11 May 2015 00:40:05 +0900 Subject: [PATCH 1/3] Change --project option resolution --- src/compiler/tsc.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 15cc665e35177..d865f5ff5ef16 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -174,7 +174,13 @@ module ts { reportDiagnostic(createCompilerDiagnostic(Diagnostics.The_current_host_does_not_support_the_0_option, "--project")); return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); } - configFileName = normalizePath(combinePaths(commandLine.options.project, "tsconfig.json")); + if (sys.directoryExists(commandLine.options.project)) { + configFileName = normalizePath(combinePaths(commandLine.options.project, "tsconfig.json")); + } + else { + configFileName = normalizePath(commandLine.options.project); + } + if (commandLine.fileNames.length !== 0) { reportDiagnostic(createCompilerDiagnostic(Diagnostics.Option_project_cannot_be_mixed_with_source_files_on_a_command_line)); return sys.exit(ExitStatus.DiagnosticsPresent_OutputsSkipped); From 32cd077c6b488cc795f5979be9ec7e4485ccf4b3 Mon Sep 17 00:00:00 2001 From: vvakame Date: Mon, 11 May 2015 01:02:49 +0900 Subject: [PATCH 2/3] Fix error message when `--project `'s FILE is not exists. --- src/compiler/commandLineParser.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 6a055aebf6a5a..d804e449bdf79 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -308,7 +308,10 @@ module ts { * Read tsconfig.json file * @param fileName The path to the config file */ - export function readConfigFile(fileName: string): { config?: any; error?: Diagnostic } { + export function readConfigFile(fileName: string): { config?: any; error?: Diagnostic } { + if (!sys.fileExists(fileName)) { + return { error: createCompilerDiagnostic(Diagnostics.Unable_to_open_file_0, fileName) }; + } try { var text = sys.readFile(fileName); } From 22a9def432f46aed9cb204330c7c0789a50e6321 Mon Sep 17 00:00:00 2001 From: vvakame Date: Mon, 11 May 2015 22:50:43 +0900 Subject: [PATCH 3/3] Change --project description message in --help option --- src/compiler/commandLineParser.ts | 4 ++-- src/compiler/diagnosticInformationMap.generated.ts | 3 ++- src/compiler/diagnosticMessages.json | 6 +++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index d804e449bdf79..557e86bf613f0 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -126,8 +126,8 @@ module ts { shortName: "p", type: "string", isFilePath: true, - description: Diagnostics.Compile_the_project_in_the_given_directory, - paramType: Diagnostics.DIRECTORY + description: Diagnostics.Compile_the_project_by_specifying_a_project_file_or_its_directory, + paramType: Diagnostics.PATH }, { name: "removeComments", diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 52718c6ddc403..f3de70920a00f 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -472,7 +472,7 @@ module ts { Specify_module_code_generation_Colon_commonjs_amd_system_or_umd: { code: 6016, category: DiagnosticCategory.Message, key: "Specify module code generation: 'commonjs', 'amd', 'system' or 'umd'" }, Print_this_message: { code: 6017, category: DiagnosticCategory.Message, key: "Print this message." }, Print_the_compiler_s_version: { code: 6019, category: DiagnosticCategory.Message, key: "Print the compiler's version." }, - Compile_the_project_in_the_given_directory: { code: 6020, category: DiagnosticCategory.Message, key: "Compile the project in the given directory." }, + Compile_the_project_by_specifying_a_project_file_or_its_directory: { code: 6020, category: DiagnosticCategory.Message, key: "Compile the project by specifying a project file or its directory." }, Syntax_Colon_0: { code: 6023, category: DiagnosticCategory.Message, key: "Syntax: {0}" }, options: { code: 6024, category: DiagnosticCategory.Message, key: "options" }, file: { code: 6025, category: DiagnosticCategory.Message, key: "file" }, @@ -486,6 +486,7 @@ module ts { VERSION: { code: 6036, category: DiagnosticCategory.Message, key: "VERSION" }, LOCATION: { code: 6037, category: DiagnosticCategory.Message, key: "LOCATION" }, DIRECTORY: { code: 6038, category: DiagnosticCategory.Message, key: "DIRECTORY" }, + PATH: { code: 6039, category: DiagnosticCategory.Message, key: "PATH" }, Compilation_complete_Watching_for_file_changes: { code: 6042, category: DiagnosticCategory.Message, key: "Compilation complete. Watching for file changes." }, Generates_corresponding_map_file: { code: 6043, category: DiagnosticCategory.Message, key: "Generates corresponding '.map' file." }, Compiler_option_0_expects_an_argument: { code: 6044, category: DiagnosticCategory.Error, key: "Compiler option '{0}' expects an argument." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index d7446907d232c..2dcfbe9851109 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1878,7 +1878,7 @@ "category": "Message", "code": 6019 }, - "Compile the project in the given directory.": { + "Compile the project by specifying a project file or its directory.": { "category": "Message", "code": 6020 }, @@ -1934,6 +1934,10 @@ "category": "Message", "code": 6038 }, + "PATH": { + "category": "Message", + "code": 6039 + }, "Compilation complete. Watching for file changes.": { "category": "Message", "code": 6042