@@ -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,8 +150,10 @@ const localizationTargets = localizationDirectories
156150
157151const localize = task ( {
158152 name : "localize" ,
153+ dependencies : [ generateDiagnostics ] ,
159154 run : async ( ) => {
160155 if ( needsUpdate ( diagnosticMessagesGeneratedJson , generatedLCGFile ) ) {
156+ // TODO(jakebailey): slow; need needsUpdate to not block the builds
161157 return exec ( process . execPath , [ "scripts/generateLocalizedDiagnosticMessages.mjs" , "src/loc/lcl" , "built/local" , diagnosticMessagesGeneratedJson ] , { ignoreExitCode : true } ) ;
162158 }
163159 }
@@ -534,11 +530,9 @@ export const generateTypesMap = task({
534530 run : async ( ) => {
535531 const source = "src/server/typesMap.json" ;
536532 const target = "built/local/typesMap.json" ;
537- if ( needsUpdate ( source , target ) ) {
538- const contents = await fs . promises . readFile ( source , "utf-8" ) ;
539- JSON . parse ( contents ) ;
540- await fs . promises . writeFile ( target , contents ) ;
541- }
533+ const contents = await fs . promises . readFile ( source , "utf-8" ) ;
534+ JSON . parse ( contents ) ; // Validates that the JSON parses.
535+ await fs . promises . writeFile ( target , contents ) ;
542536 }
543537} ) ;
544538
@@ -553,15 +547,13 @@ cleanTasks.push(cleanTypesMap);
553547// it to be synced to the Azure DevOps repo, so that it can get picked up by the build
554548// pipeline that generates the localization artifacts that are then fed into the translation process.
555549const builtLocalDiagnosticMessagesGeneratedJson = "built/local/diagnosticMessages.generated.json" ;
556- const copyBuiltLocalDiagnosticMessages = task ( {
550+ export const copyBuiltLocalDiagnosticMessages = task ( {
557551 name : "copy-built-local-diagnostic-messages" ,
558552 dependencies : [ generateDiagnostics ] ,
559553 run : async ( ) => {
560- if ( needsUpdate ( diagnosticMessagesGeneratedJson , builtLocalDiagnosticMessagesGeneratedJson ) ) {
561- const contents = await fs . promises . readFile ( diagnosticMessagesGeneratedJson , "utf-8" ) ;
562- JSON . parse ( contents ) ;
563- await fs . promises . writeFile ( builtLocalDiagnosticMessagesGeneratedJson , contents ) ;
564- }
554+ const contents = await fs . promises . readFile ( diagnosticMessagesGeneratedJson , "utf-8" ) ;
555+ JSON . parse ( contents ) ; // Validates that the JSON parses.
556+ await fs . promises . writeFile ( builtLocalDiagnosticMessagesGeneratedJson , contents ) ;
565557 }
566558} ) ;
567559
0 commit comments