@@ -5,7 +5,7 @@ import del from "del";
55import { task } from "hereby" ;
66import _glob from "glob" ;
77import util from "util" ;
8- import { exec , readJson , needsUpdate , getDiffTool , getDirSize , memoize } from "./scripts/build/utils.mjs" ;
8+ import { exec , readJson , getDiffTool , getDirSize , memoize } from "./scripts/build/utils.mjs" ;
99import { runConsoleTests , refBaseline , localBaseline , refRwcBaseline , localRwcBaseline } from "./scripts/build/tests.mjs" ;
1010import { buildProject as realBuildProject , cleanProject } from "./scripts/build/projects.mjs" ;
1111import { localizationDirectories } from "./scripts/build/localization.mjs" ;
@@ -80,20 +80,18 @@ export const generateLibs = task({
8080 description : "Builds the library targets" ,
8181 run : async ( ) => {
8282 await fs . promises . mkdir ( "./built/local" , { recursive : true } ) ;
83- const allSources = libs ( ) . flatMap ( ( lib ) => lib . sources ) ;
84- const allTargets = libs ( ) . flatMap ( ( lib ) => lib . target ) ;
85- if ( needsUpdate ( [ copyrightFilename , ...allSources ] , allTargets ) ) {
86- for ( const lib of libs ( ) ) {
87- let output = await copyright ( ) ;
88-
89- for ( const source of lib . sources ) {
90- const contents = await fs . promises . readFile ( source , "utf-8" ) ;
91- // TODO(jakebailey): "\n\n" is for compatibility with our current tests; our test baselines
92- // are sensitive to the positions of things in the lib files. Eventually remove this,
93- // or remove lib.d.ts line numbers from our baselines.
94- output += "\n\n" + contents . replace ( / \r \n / g, "\n" ) ;
95- }
83+ for ( const lib of libs ( ) ) {
84+ let output = await copyright ( ) ;
85+
86+ for ( const source of lib . sources ) {
87+ const contents = await fs . promises . readFile ( source , "utf-8" ) ;
88+ // TODO(jakebailey): "\n\n" is for compatibility with our current tests; our test baselines
89+ // are sensitive to the positions of things in the lib files. Eventually remove this,
90+ // or remove lib.d.ts line numbers from our baselines.
91+ output += "\n\n" + contents . replace ( / \r \n / g, "\n" ) ;
9692 }
93+
94+ await fs . promises . writeFile ( lib . target , output ) ;
9795 }
9896 } ,
9997} ) ;
@@ -107,9 +105,7 @@ export const generateDiagnostics = task({
107105 name : "generate-diagnostics" ,
108106 description : "Generates a diagnostic file in TypeScript based on an input JSON file" ,
109107 run : async ( ) => {
110- if ( needsUpdate ( diagnosticMessagesJson , [ diagnosticMessagesGeneratedJson , diagnosticInformationMapTs ] ) ) {
111- await exec ( process . execPath , [ "scripts/processDiagnosticMessages.mjs" , diagnosticMessagesJson ] ) ;
112- }
108+ await exec ( process . execPath , [ "scripts/processDiagnosticMessages.mjs" , diagnosticMessagesJson ] ) ;
113109 }
114110} ) ;
115111
@@ -142,11 +138,7 @@ const localizationTargets = localizationDirectories
142138const localize = task ( {
143139 name : "localize" ,
144140 dependencies : [ generateDiagnostics ] ,
145- run : async ( ) => {
146- if ( needsUpdate ( diagnosticMessagesGeneratedJson , generatedLCGFile ) ) {
147- return exec ( process . execPath , [ "scripts/generateLocalizedDiagnosticMessages.mjs" , "src/loc/lcl" , "built/local" , diagnosticMessagesGeneratedJson ] , { ignoreExitCode : true } ) ;
148- }
149- }
141+ run : ( ) => exec ( process . execPath , [ "scripts/generateLocalizedDiagnosticMessages.mjs" , "src/loc/lcl" , "built/local" , diagnosticMessagesGeneratedJson ] , { ignoreExitCode : true } ) ,
150142} ) ;
151143
152144export const buildSrc = task ( {
@@ -510,11 +502,9 @@ export const generateTypesMap = task({
510502 run : async ( ) => {
511503 const source = "src/server/typesMap.json" ;
512504 const target = "built/local/typesMap.json" ;
513- if ( needsUpdate ( source , target ) ) {
514- const contents = await fs . promises . readFile ( source , "utf-8" ) ;
515- JSON . parse ( contents ) ;
516- await fs . promises . writeFile ( target , contents ) ;
517- }
505+ const contents = await fs . promises . readFile ( source , "utf-8" ) ;
506+ JSON . parse ( contents ) ; // Validates that the JSON parses.
507+ await fs . promises . writeFile ( target , contents ) ;
518508 }
519509} ) ;
520510
@@ -527,11 +517,9 @@ const copyBuiltLocalDiagnosticMessages = task({
527517 name : "copy-built-local-diagnostic-messages" ,
528518 dependencies : [ generateDiagnostics ] ,
529519 run : async ( ) => {
530- if ( needsUpdate ( diagnosticMessagesGeneratedJson , builtLocalDiagnosticMessagesGeneratedJson ) ) {
531- const contents = await fs . promises . readFile ( diagnosticMessagesGeneratedJson , "utf-8" ) ;
532- JSON . parse ( contents ) ;
533- await fs . promises . writeFile ( builtLocalDiagnosticMessagesGeneratedJson , contents ) ;
534- }
520+ const contents = await fs . promises . readFile ( diagnosticMessagesGeneratedJson , "utf-8" ) ;
521+ JSON . parse ( contents ) ; // Validates that the JSON parses.
522+ await fs . promises . writeFile ( builtLocalDiagnosticMessagesGeneratedJson , contents ) ;
535523 }
536524} ) ;
537525
0 commit comments