@@ -6,7 +6,7 @@ import { task } from "hereby";
6
6
import _glob from "glob" ;
7
7
import util from "util" ;
8
8
import 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" ;
10
10
import { runConsoleTests , refBaseline , localBaseline , refRwcBaseline , localRwcBaseline } from "./scripts/build/tests.mjs" ;
11
11
import { buildProject as realBuildProject , cleanProject , watchProject } from "./scripts/build/projects.mjs" ;
12
12
import { localizationDirectories } from "./scripts/build/localization.mjs" ;
@@ -81,20 +81,18 @@ export const generateLibs = task({
81
81
description : "Builds the library targets" ,
82
82
run : async ( ) => {
83
83
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" ) ;
97
93
}
94
+
95
+ await fs . promises . writeFile ( lib . target , output ) ;
98
96
}
99
97
} ,
100
98
} ) ;
@@ -108,9 +106,7 @@ export const generateDiagnostics = task({
108
106
name : "generate-diagnostics" ,
109
107
description : "Generates a diagnostic file in TypeScript based on an input JSON file" ,
110
108
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 ] ) ;
114
110
}
115
111
} ) ;
116
112
@@ -143,11 +139,7 @@ const localizationTargets = localizationDirectories
143
139
const localize = task ( {
144
140
name : "localize" ,
145
141
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 } ) ,
151
143
} ) ;
152
144
153
145
export const buildSrc = task ( {
@@ -558,11 +550,9 @@ export const generateTypesMap = task({
558
550
run : async ( ) => {
559
551
const source = "src/server/typesMap.json" ;
560
552
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 ) ;
566
556
}
567
557
} ) ;
568
558
@@ -575,11 +565,9 @@ const copyBuiltLocalDiagnosticMessages = task({
575
565
name : "copy-built-local-diagnostic-messages" ,
576
566
dependencies : [ generateDiagnostics ] ,
577
567
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 ) ;
583
571
}
584
572
} ) ;
585
573
0 commit comments