@@ -139,29 +139,31 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
139
139
const { compilationJobsPerFile, indexedIndividualJobs } =
140
140
compilationJobsResult ;
141
141
142
- const compilationJobs = [ ...new Set ( compilationJobsPerFile . values ( ) ) ] ;
142
+ const runnableCompilationJobs = [
143
+ ...new Set ( compilationJobsPerFile . values ( ) ) ,
144
+ ] ;
143
145
144
146
// NOTE: We precompute the build ids in parallel here, which are cached
145
147
// internally in each compilation job
146
148
await Promise . all (
147
- compilationJobs . map ( async ( compilationJob ) =>
148
- compilationJob . getBuildId ( ) ,
149
+ runnableCompilationJobs . map ( async ( runnableCompilationJob ) =>
150
+ runnableCompilationJob . getBuildId ( ) ,
149
151
) ,
150
152
) ;
151
153
152
154
const runCompilationJobOptions : RunCompilationJobOptions = {
153
155
quiet : options ?. quiet ,
154
156
} ;
155
157
const results : CompilationResult [ ] = await pMap (
156
- compilationJobs ,
157
- async ( compilationJob ) => {
158
+ runnableCompilationJobs ,
159
+ async ( runnableCompilationJob ) => {
158
160
const compilerOutput = await this . runCompilationJob (
159
- compilationJob ,
161
+ runnableCompilationJob ,
160
162
runCompilationJobOptions ,
161
163
) ;
162
164
163
165
return {
164
- compilationJob,
166
+ compilationJob : runnableCompilationJob ,
165
167
compilerOutput,
166
168
cached : false ,
167
169
} ;
@@ -276,7 +278,7 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
276
278
277
279
if ( options ?. quiet !== true ) {
278
280
if ( isSuccessfulBuild ) {
279
- await this . #printCompilationResult( compilationJobs ) ;
281
+ await this . #printCompilationResult( runnableCompilationJobs ) ;
280
282
}
281
283
}
282
284
@@ -348,7 +350,7 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
348
350
349
351
// build job for each root file. At this point subgraphsWithConfig are 1 root file each
350
352
const indexedIndividualJobs : Map < string , CompilationJob > = new Map ( ) ;
351
- const contentHashes = new Map < string , string > ( ) ;
353
+ const sharedContentHashes = new Map < string , string > ( ) ;
352
354
await Promise . all (
353
355
subgraphsWithConfig . map ( async ( [ config , subgraph ] ) => {
354
356
const solcLongVersion = solcVersionToLongVersion . get ( config . version ) ;
@@ -358,15 +360,15 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
358
360
"solcLongVersion should not be undefined" ,
359
361
) ;
360
362
361
- const compilationJob = new CompilationJobImplementation (
363
+ const individualJob = new CompilationJobImplementation (
362
364
subgraph ,
363
365
config ,
364
366
solcLongVersion ,
365
367
this . #hooks,
366
- contentHashes ,
368
+ sharedContentHashes ,
367
369
) ;
368
370
369
- await compilationJob . getBuildId ( ) ; // precompute
371
+ await individualJob . getBuildId ( ) ; // precompute
370
372
371
373
assertHardhatInvariant (
372
374
subgraph . getRoots ( ) . size === 1 ,
@@ -375,7 +377,7 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
375
377
376
378
const rootFilePath = Array . from ( subgraph . getRoots ( ) . keys ( ) ) [ 0 ] ;
377
379
378
- indexedIndividualJobs . set ( rootFilePath , compilationJob ) ;
380
+ indexedIndividualJobs . set ( rootFilePath , individualJob ) ;
379
381
} ) ,
380
382
) ;
381
383
@@ -483,18 +485,18 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
483
485
"solcLongVersion should not be undefined" ,
484
486
) ;
485
487
486
- const compilationJob = new CompilationJobImplementation (
488
+ const runnableCompilationJob = new CompilationJobImplementation (
487
489
subgraph ,
488
490
solcConfig ,
489
491
solcLongVersion ,
490
492
this . #hooks,
491
- contentHashes ,
493
+ sharedContentHashes ,
492
494
) ;
493
495
494
496
for ( const [ userSourceName , root ] of subgraph . getRoots ( ) . entries ( ) ) {
495
497
compilationJobsPerFile . set (
496
498
formatRootPath ( userSourceName , root ) ,
497
- compilationJob ,
499
+ runnableCompilationJob ,
498
500
) ;
499
501
}
500
502
}
@@ -503,34 +505,37 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
503
505
}
504
506
505
507
public async runCompilationJob (
506
- compilationJob : CompilationJob ,
508
+ runnableCompilationJob : CompilationJob ,
507
509
options ?: RunCompilationJobOptions ,
508
510
) : Promise < CompilerOutput > {
509
511
await this . #downloadConfiguredCompilers( options ?. quiet ) ;
510
512
511
513
let numberOfFiles = 0 ;
512
- for ( const _ of compilationJob . dependencyGraph . getAllFiles ( ) ) {
514
+ for ( const _ of runnableCompilationJob . dependencyGraph . getAllFiles ( ) ) {
513
515
numberOfFiles ++ ;
514
516
}
515
517
516
- const numberOfRootFiles = compilationJob . dependencyGraph . getRoots ( ) . size ;
518
+ const numberOfRootFiles =
519
+ runnableCompilationJob . dependencyGraph . getRoots ( ) . size ;
517
520
518
- const compiler = await getCompiler ( compilationJob . solcConfig . version ) ;
521
+ const compiler = await getCompiler (
522
+ runnableCompilationJob . solcConfig . version ,
523
+ ) ;
519
524
520
525
log (
521
- `Compiling ${ numberOfRootFiles } root files and ${ numberOfFiles - numberOfRootFiles } dependency files with solc ${ compilationJob . solcConfig . version } using ${ compiler . compilerPath } ` ,
526
+ `Compiling ${ numberOfRootFiles } root files and ${ numberOfFiles - numberOfRootFiles } dependency files with solc ${ runnableCompilationJob . solcConfig . version } using ${ compiler . compilerPath } ` ,
522
527
) ;
523
528
524
529
assertHardhatInvariant (
525
- compilationJob . solcLongVersion === compiler . longVersion ,
530
+ runnableCompilationJob . solcLongVersion === compiler . longVersion ,
526
531
"The long version of the compiler should match the long version of the compilation job" ,
527
532
) ;
528
533
529
- return compiler . compile ( await compilationJob . getSolcInput ( ) ) ;
534
+ return compiler . compile ( await runnableCompilationJob . getSolcInput ( ) ) ;
530
535
}
531
536
532
537
public async remapCompilerError (
533
- compilationJob : CompilationJob ,
538
+ runnableCompilationJob : CompilationJob ,
534
539
error : CompilerOutputError ,
535
540
shouldShortenPaths : boolean = false ,
536
541
) : Promise < CompilerOutputError > {
@@ -544,7 +549,7 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
544
549
/ ( - - > \s + ) ( [ ^ \s : \n ] + ) / g,
545
550
( _match , prefix , inputSourceName ) => {
546
551
const file =
547
- compilationJob . dependencyGraph . getFileByInputSourceName (
552
+ runnableCompilationJob . dependencyGraph . getFileByInputSourceName (
548
553
inputSourceName ,
549
554
) ;
550
555
@@ -563,17 +568,17 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
563
568
}
564
569
565
570
public async emitArtifacts (
566
- compilationJob : CompilationJob ,
571
+ runnableCompilationJob : CompilationJob ,
567
572
compilerOutput : CompilerOutput ,
568
573
) : Promise < EmitArtifactsResult > {
569
574
const artifactsPerFile = new Map < string , string [ ] > ( ) ;
570
575
const typeFilePaths = new Map < string , string > ( ) ;
571
- const buildId = await compilationJob . getBuildId ( ) ;
576
+ const buildId = await runnableCompilationJob . getBuildId ( ) ;
572
577
573
578
// We emit the artifacts for each root file, first emitting one artifact
574
579
// for each contract, and then one declaration file for the entire file,
575
580
// which defines their types and augments the ArtifactMap type.
576
- for ( const [ userSourceName , root ] of compilationJob . dependencyGraph
581
+ for ( const [ userSourceName , root ] of runnableCompilationJob . dependencyGraph
577
582
. getRoots ( )
578
583
. entries ( ) ) {
579
584
const fileFolder = path . join ( this . #options. artifactsPath , userSourceName ) ;
@@ -648,15 +653,15 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
648
653
// concurrently, and keep their lifetimes separated and small.
649
654
await Promise . all ( [
650
655
( async ( ) => {
651
- const buildInfo = await getBuildInfo ( compilationJob ) ;
656
+ const buildInfo = await getBuildInfo ( runnableCompilationJob ) ;
652
657
653
658
// TODO: Maybe formatting the build info is slow, but it's mostly
654
659
// strings, so it probably shouldn't be a problem.
655
660
await writeJsonFile ( buildInfoPath , buildInfo ) ;
656
661
} ) ( ) ,
657
662
( async ( ) => {
658
663
const buildInfoOutput = await getBuildInfoOutput (
659
- compilationJob ,
664
+ runnableCompilationJob ,
660
665
compilerOutput ,
661
666
) ;
662
667
@@ -923,13 +928,13 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
923
928
}
924
929
}
925
930
926
- async #printCompilationResult( compilationJobs : CompilationJob [ ] ) {
931
+ async #printCompilationResult( runnableCompilationJobs : CompilationJob [ ] ) {
927
932
const jobsPerVersionAndEvmVersion = new Map <
928
933
string ,
929
934
Map < string , CompilationJob [ ] >
930
935
> ( ) ;
931
936
932
- for ( const job of compilationJobs ) {
937
+ for ( const job of runnableCompilationJobs ) {
933
938
const solcVersion = job . solcConfig . version ;
934
939
const solcInput = await job . getSolcInput ( ) ;
935
940
const evmVersion =
0 commit comments