@@ -5,7 +5,7 @@ import del from "del";
5
5
import { task } from "hereby" ;
6
6
import _glob from "glob" ;
7
7
import 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" ;
9
9
import { runConsoleTests , refBaseline , localBaseline , refRwcBaseline , localRwcBaseline } from "./scripts/build/tests.mjs" ;
10
10
import { buildProject as realBuildProject , cleanProject } from "./scripts/build/projects.mjs" ;
11
11
import { localizationDirectories } from "./scripts/build/localization.mjs" ;
@@ -80,20 +80,18 @@ export const generateLibs = task({
80
80
description : "Builds the library targets" ,
81
81
run : async ( ) => {
82
82
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" ) ;
96
92
}
93
+
94
+ await fs . promises . writeFile ( lib . target , output ) ;
97
95
}
98
96
} ,
99
97
} ) ;
@@ -107,9 +105,7 @@ export const generateDiagnostics = task({
107
105
name : "generate-diagnostics" ,
108
106
description : "Generates a diagnostic file in TypeScript based on an input JSON file" ,
109
107
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 ] ) ;
113
109
}
114
110
} ) ;
115
111
@@ -142,11 +138,7 @@ const localizationTargets = localizationDirectories
142
138
const localize = task ( {
143
139
name : "localize" ,
144
140
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 } ) ,
150
142
} ) ;
151
143
152
144
export const buildSrc = task ( {
@@ -510,11 +502,9 @@ export const generateTypesMap = task({
510
502
run : async ( ) => {
511
503
const source = "src/server/typesMap.json" ;
512
504
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 ) ;
518
508
}
519
509
} ) ;
520
510
@@ -527,11 +517,9 @@ const copyBuiltLocalDiagnosticMessages = task({
527
517
name : "copy-built-local-diagnostic-messages" ,
528
518
dependencies : [ generateDiagnostics ] ,
529
519
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 ) ;
535
523
}
536
524
} ) ;
537
525
0 commit comments