@@ -52,9 +52,7 @@ func CommandLine(sys System, commandLineArgs []string, testing bool) CommandLine
52
52
// !!! build mode
53
53
switch strings .ToLower (commandLineArgs [0 ]) {
54
54
case "-b" , "--b" , "-build" , "--build" :
55
- fmt .Fprintln (sys .Writer (), "Build mode is currently unsupported." )
56
- sys .EndWrite ()
57
- return CommandLineResult {Status : ExitStatusNotImplemented }
55
+ return tscBuildCompilation (sys , tsoptions .ParseBuildCommandLine (commandLineArgs , sys ), testing )
58
56
// case "-f":
59
57
// return fmtMain(sys, commandLineArgs[1], commandLineArgs[1])
60
58
}
@@ -89,6 +87,79 @@ func fmtMain(sys System, input, output string) ExitStatus {
89
87
return ExitStatusSuccess
90
88
}
91
89
90
+ func tscBuildCompilation (sys System , buildCommand * tsoptions.ParsedBuildCommandLine , testing bool ) CommandLineResult {
91
+ reportDiagnostic := createDiagnosticReporter (sys , buildCommand .CompilerOptions )
92
+
93
+ // if (buildOptions.locale) {
94
+ // validateLocaleAndSetLanguage(buildOptions.locale, sys, errors);
95
+ // }
96
+
97
+ if len (buildCommand .Errors ) > 0 {
98
+ for _ , err := range buildCommand .Errors {
99
+ reportDiagnostic (err )
100
+ }
101
+ return CommandLineResult {Status : ExitStatusDiagnosticsPresent_OutputsSkipped }
102
+ }
103
+
104
+ if buildCommand .CompilerOptions .Help .IsTrue () {
105
+ printVersion (sys )
106
+ printBuildHelp (sys , tsoptions .BuildOpts )
107
+ return CommandLineResult {Status : ExitStatusSuccess }
108
+ }
109
+
110
+ // if (buildOptions.watch) {
111
+ // if (reportWatchModeWithoutSysSupport(sys, reportDiagnostic)) return;
112
+ // const buildHost = createSolutionBuilderWithWatchHost(
113
+ // sys,
114
+ // /*createProgram*/ undefined,
115
+ // reportDiagnostic,
116
+ // createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)),
117
+ // createWatchStatusReporter(sys, buildOptions),
118
+ // );
119
+ // buildHost.jsDocParsingMode = defaultJSDocParsingMode;
120
+ // const solutionPerformance = enableSolutionPerformance(sys, buildOptions);
121
+ // updateSolutionBuilderHost(sys, cb, buildHost, solutionPerformance);
122
+ // const onWatchStatusChange = buildHost.onWatchStatusChange;
123
+ // let reportBuildStatistics = false;
124
+ // buildHost.onWatchStatusChange = (d, newLine, options, errorCount) => {
125
+ // onWatchStatusChange?.(d, newLine, options, errorCount);
126
+ // if (
127
+ // reportBuildStatistics && (
128
+ // d.code === Diagnostics.Found_0_errors_Watching_for_file_changes.code ||
129
+ // d.code === Diagnostics.Found_1_error_Watching_for_file_changes.code
130
+ // )
131
+ // ) {
132
+ // reportSolutionBuilderTimes(builder, solutionPerformance);
133
+ // }
134
+ // };
135
+ // const builder = createSolutionBuilderWithWatch(buildHost, projects, buildOptions, watchOptions);
136
+ // builder.build();
137
+ // reportSolutionBuilderTimes(builder, solutionPerformance);
138
+ // reportBuildStatistics = true;
139
+ // return builder;
140
+ // }
141
+
142
+ // const buildHost = createSolutionBuilderHost(
143
+ // sys,
144
+ // /*createProgram*/ undefined,
145
+ // reportDiagnostic,
146
+ // createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)),
147
+ // createReportErrorSummary(sys, buildOptions),
148
+ // );
149
+ // buildHost.jsDocParsingMode = defaultJSDocParsingMode;
150
+ // const solutionPerformance = enableSolutionPerformance(sys, buildOptions);
151
+ // updateSolutionBuilderHost(sys, cb, buildHost, solutionPerformance);
152
+ // const builder = createSolutionBuilder(buildHost, projects, buildOptions);
153
+ // const exitStatus = buildOptions.clean ? builder.clean() : builder.build();
154
+ // reportSolutionBuilderTimes(builder, solutionPerformance);
155
+ // dumpTracingLegend(); // Will no-op if there hasn't been any tracing
156
+ // return sys.exit(exitStatus);
157
+
158
+ fmt .Fprintln (sys .Writer (), "Build mode is currently unsupported." )
159
+ sys .EndWrite ()
160
+ return CommandLineResult {Status : ExitStatusNotImplemented }
161
+ }
162
+
92
163
func tscCompilation (sys System , commandLine * tsoptions.ParsedCommandLine , testing bool ) CommandLineResult {
93
164
configFileName := ""
94
165
reportDiagnostic := createDiagnosticReporter (sys , commandLine .CompilerOptions ())
0 commit comments