@@ -6,7 +6,7 @@ import { task } from "hereby";
66import _glob from "glob" ;
77import util from "util" ;
88import chalk from "chalk" ;
9- import { exec , readJson , needsUpdate , getDiffTool , getDirSize , memoize } from "./scripts/build/utils.mjs" ;
9+ import { exec , readJson , getDiffTool , getDirSize , memoize } from "./scripts/build/utils.mjs" ;
1010import { runConsoleTests , refBaseline , localBaseline , refRwcBaseline , localRwcBaseline } from "./scripts/build/tests.mjs" ;
1111import { buildProject as realBuildProject , cleanProject , watchProject } from "./scripts/build/projects.mjs" ;
1212import { localizationDirectories } from "./scripts/build/localization.mjs" ;
@@ -81,20 +81,18 @@ export const generateLibs = task({
8181 description : "Builds the library targets" ,
8282 run : async ( ) => {
8383 await fs . promises . mkdir ( "./built/local" , { recursive : true } ) ;
84- const allSources = libs ( ) . flatMap ( ( lib ) => lib . sources ) ;
85- const allTargets = libs ( ) . flatMap ( ( lib ) => lib . target ) ;
86- if ( needsUpdate ( [ copyrightFilename , ...allSources ] , allTargets ) ) {
87- for ( const lib of libs ( ) ) {
88- let output = await copyright ( ) ;
89-
90- for ( const source of lib . sources ) {
91- const contents = await fs . promises . readFile ( source , "utf-8" ) ;
92- // TODO(jakebailey): "\n\n" is for compatibility with our current tests; our test baselines
93- // are sensitive to the positions of things in the lib files. Eventually remove this,
94- // or remove lib.d.ts line numbers from our baselines.
95- output += "\n\n" + contents . replace ( / \r \n / g, "\n" ) ;
96- }
84+ for ( const lib of libs ( ) ) {
85+ let output = await copyright ( ) ;
86+
87+ for ( const source of lib . sources ) {
88+ const contents = await fs . promises . readFile ( source , "utf-8" ) ;
89+ // TODO(jakebailey): "\n\n" is for compatibility with our current tests; our test baselines
90+ // are sensitive to the positions of things in the lib files. Eventually remove this,
91+ // or remove lib.d.ts line numbers from our baselines.
92+ output += "\n\n" + contents . replace ( / \r \n / g, "\n" ) ;
9793 }
94+
95+ await fs . promises . writeFile ( lib . target , output ) ;
9896 }
9997 } ,
10098} ) ;
@@ -108,9 +106,7 @@ export const generateDiagnostics = task({
108106 name : "generate-diagnostics" ,
109107 description : "Generates a diagnostic file in TypeScript based on an input JSON file" ,
110108 run : async ( ) => {
111- if ( needsUpdate ( diagnosticMessagesJson , [ diagnosticMessagesGeneratedJson , diagnosticInformationMapTs ] ) ) {
112- await exec ( process . execPath , [ "scripts/processDiagnosticMessages.mjs" , diagnosticMessagesJson ] ) ;
113- }
109+ await exec ( process . execPath , [ "scripts/processDiagnosticMessages.mjs" , diagnosticMessagesJson ] ) ;
114110 }
115111} ) ;
116112
@@ -143,11 +139,7 @@ const localizationTargets = localizationDirectories
143139const localize = task ( {
144140 name : "localize" ,
145141 dependencies : [ generateDiagnostics ] ,
146- run : async ( ) => {
147- if ( needsUpdate ( diagnosticMessagesGeneratedJson , generatedLCGFile ) ) {
148- return exec ( process . execPath , [ "scripts/generateLocalizedDiagnosticMessages.mjs" , "src/loc/lcl" , "built/local" , diagnosticMessagesGeneratedJson ] , { ignoreExitCode : true } ) ;
149- }
150- }
142+ run : ( ) => exec ( process . execPath , [ "scripts/generateLocalizedDiagnosticMessages.mjs" , "src/loc/lcl" , "built/local" , diagnosticMessagesGeneratedJson ] , { ignoreExitCode : true } ) ,
151143} ) ;
152144
153145export const buildSrc = task ( {
@@ -558,11 +550,9 @@ export const generateTypesMap = task({
558550 run : async ( ) => {
559551 const source = "src/server/typesMap.json" ;
560552 const target = "built/local/typesMap.json" ;
561- if ( needsUpdate ( source , target ) ) {
562- const contents = await fs . promises . readFile ( source , "utf-8" ) ;
563- JSON . parse ( contents ) ;
564- await fs . promises . writeFile ( target , contents ) ;
565- }
553+ const contents = await fs . promises . readFile ( source , "utf-8" ) ;
554+ JSON . parse ( contents ) ; // Validates that the JSON parses.
555+ await fs . promises . writeFile ( target , contents ) ;
566556 }
567557} ) ;
568558
@@ -575,11 +565,9 @@ const copyBuiltLocalDiagnosticMessages = task({
575565 name : "copy-built-local-diagnostic-messages" ,
576566 dependencies : [ generateDiagnostics ] ,
577567 run : async ( ) => {
578- if ( needsUpdate ( diagnosticMessagesGeneratedJson , builtLocalDiagnosticMessagesGeneratedJson ) ) {
579- const contents = await fs . promises . readFile ( diagnosticMessagesGeneratedJson , "utf-8" ) ;
580- JSON . parse ( contents ) ;
581- await fs . promises . writeFile ( builtLocalDiagnosticMessagesGeneratedJson , contents ) ;
582- }
568+ const contents = await fs . promises . readFile ( diagnosticMessagesGeneratedJson , "utf-8" ) ;
569+ JSON . parse ( contents ) ; // Validates that the JSON parses.
570+ await fs . promises . writeFile ( builtLocalDiagnosticMessagesGeneratedJson , contents ) ;
583571 }
584572} ) ;
585573
0 commit comments