@@ -52,9 +52,7 @@ func CommandLine(sys System, commandLineArgs []string, testing bool) CommandLine
5252 // !!! build mode
5353 switch strings .ToLower (commandLineArgs [0 ]) {
5454 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 )
5856 // case "-f":
5957 // return fmtMain(sys, commandLineArgs[1], commandLineArgs[1])
6058 }
@@ -89,6 +87,79 @@ func fmtMain(sys System, input, output string) ExitStatus {
8987 return ExitStatusSuccess
9088}
9189
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+
92163func tscCompilation (sys System , commandLine * tsoptions.ParsedCommandLine , testing bool ) CommandLineResult {
93164 configFileName := ""
94165 reportDiagnostic := createDiagnosticReporter (sys , commandLine .CompilerOptions ())
0 commit comments