@@ -84,23 +84,19 @@ export const generateLibs = task({
8484 description : "Builds the library targets" ,
8585 run : async ( ) => {
8686 await fs . promises . mkdir ( "./built/local" , { recursive : true } ) ;
87- const allSources = libs . flatMap ( ( lib ) => lib . sources ) ;
88- const allTargets = libs . flatMap ( ( lib ) => lib . target ) ;
89- if ( needsUpdate ( [ copyright , ...allSources ] , allTargets ) ) {
90- for ( const lib of libs ) {
91- let output = getCopyrightHeader ( ) ;
92-
93- await fs . promises . writeFile ( lib . target , getCopyrightHeader ( ) ) ;
94- for ( const source of lib . sources ) {
95- const contents = await fs . promises . readFile ( source , "utf-8" ) ;
96- // TODO(jakebailey): "\n\n" is for compatibility with our current tests; our test baselines
97- // are sensitive to the positions of things in the lib files. Eventually remove this,
98- // or remove lib.d.ts line numbers from our baselines.
99- output += "\n\n" + contents . replace ( / \r \n / g, "\n" ) ;
100- }
101-
102- await fs . promises . writeFile ( lib . target , output ) ;
87+ for ( const lib of libs ) {
88+ let output = getCopyrightHeader ( ) ;
89+
90+ await fs . promises . writeFile ( lib . target , getCopyrightHeader ( ) ) ;
91+ for ( const source of lib . sources ) {
92+ const contents = await fs . promises . readFile ( source , "utf-8" ) ;
93+ // TODO(jakebailey): "\n\n" is for compatibility with our current tests; our test baselines
94+ // are sensitive to the positions of things in the lib files. Eventually remove this,
95+ // or remove lib.d.ts line numbers from our baselines.
96+ output += "\n\n" + contents . replace ( / \r \n / g, "\n" ) ;
10397 }
98+
99+ await fs . promises . writeFile ( lib . target , output ) ;
104100 }
105101 } ,
106102} ) ;
@@ -121,9 +117,7 @@ export const generateDiagnostics = task({
121117 name : "generate-diagnostics" ,
122118 description : "Generates a diagnostic file in TypeScript based on an input JSON file" ,
123119 run : async ( ) => {
124- if ( needsUpdate ( diagnosticMessagesJson , [ diagnosticMessagesGeneratedJson , diagnosticInformationMapTs ] ) ) {
125- await exec ( process . execPath , [ "scripts/processDiagnosticMessages.mjs" , diagnosticMessagesJson ] ) ;
126- }
120+ await exec ( process . execPath , [ "scripts/processDiagnosticMessages.mjs" , diagnosticMessagesJson ] ) ;
127121 }
128122} ) ;
129123
@@ -156,9 +150,11 @@ const localizationTargets = localizationDirectories
156150
157151const localize = task ( {
158152 name : "localize" ,
153+ dependencies : [ generateDiagnostics ] ,
159154 run : async ( ) => {
160- await fs . promises . mkdir ( "./built/local" , { recursive : true } ) ;
155+ await fs . promises . mkdir ( "./built/local" , { recursive : true } ) ; // TODO(jakebailey): needed?
161156 if ( needsUpdate ( diagnosticMessagesGeneratedJson , generatedLCGFile ) ) {
157+ // TODO(jakebailey): slow; need needsUpdate to not block the builds
162158 return exec ( process . execPath , [ "scripts/generateLocalizedDiagnosticMessages.mjs" , "src/loc/lcl" , "built/local" , diagnosticMessagesGeneratedJson ] , { ignoreExitCode : true } ) ;
163159 }
164160 }
@@ -535,11 +531,9 @@ export const generateTypesMap = task({
535531 run : async ( ) => {
536532 const source = "src/server/typesMap.json" ;
537533 const target = "built/local/typesMap.json" ;
538- if ( needsUpdate ( source , target ) ) {
539- const contents = await fs . promises . readFile ( source , "utf-8" ) ;
540- JSON . parse ( contents ) ;
541- await fs . promises . writeFile ( target , contents ) ;
542- }
534+ const contents = await fs . promises . readFile ( source , "utf-8" ) ;
535+ JSON . parse ( contents ) ; // Validates that the JSON parses.
536+ await fs . promises . writeFile ( target , contents ) ;
543537 }
544538} ) ;
545539
@@ -554,15 +548,13 @@ cleanTasks.push(cleanTypesMap);
554548// it to be synced to the Azure DevOps repo, so that it can get picked up by the build
555549// pipeline that generates the localization artifacts that are then fed into the translation process.
556550const builtLocalDiagnosticMessagesGeneratedJson = "built/local/diagnosticMessages.generated.json" ;
557- const copyBuiltLocalDiagnosticMessages = task ( {
551+ export const copyBuiltLocalDiagnosticMessages = task ( {
558552 name : "copy-built-local-diagnostic-messages" ,
559553 dependencies : [ generateDiagnostics ] ,
560554 run : async ( ) => {
561- if ( needsUpdate ( diagnosticMessagesGeneratedJson , builtLocalDiagnosticMessagesGeneratedJson ) ) {
562- const contents = await fs . promises . readFile ( diagnosticMessagesGeneratedJson , "utf-8" ) ;
563- JSON . parse ( contents ) ;
564- await fs . promises . writeFile ( builtLocalDiagnosticMessagesGeneratedJson , contents ) ;
565- }
555+ const contents = await fs . promises . readFile ( diagnosticMessagesGeneratedJson , "utf-8" ) ;
556+ JSON . parse ( contents ) ; // Validates that the JSON parses.
557+ await fs . promises . writeFile ( builtLocalDiagnosticMessagesGeneratedJson , contents ) ;
566558 }
567559} ) ;
568560
0 commit comments