(
compiler: string,
options: string[],
inputFilename: string,
execOptions: ExecutionOptionsWithEnv,
filters: ParseFiltersAndOutputOptions,
)
| 569 | |
| 570 | // eslint-disable-next-line max-statements |
| 571 | override async runCompiler( |
| 572 | compiler: string, |
| 573 | options: string[], |
| 574 | inputFilename: string, |
| 575 | execOptions: ExecutionOptionsWithEnv, |
| 576 | filters: ParseFiltersAndOutputOptions, |
| 577 | ): Promise<CompilationResult> { |
| 578 | const compilerInfo = await this.getCompilerInfo(this.lang.id); |
| 579 | const programDir = path.dirname(inputFilename); |
| 580 | const programOutputPath = path.join(programDir, 'bin', this.buildConfig, compilerInfo.targetFramework); |
| 581 | const programDllPath = path.join(programOutputPath, 'CompilerExplorer.dll'); |
| 582 | const envVarFileContents = ['DOTNET_EnableWriteXorExecute=0']; |
| 583 | const isIlDasm = this.compiler.group === 'dotnetildasm'; |
| 584 | const isIlSpy = this.compiler.group === 'dotnetilspy'; |
| 585 | const isCoreRun = this.compiler.group === 'dotnetcoreclr'; |
| 586 | const toolOptions: string[] = []; |
| 587 | const compilerOptions = this.extractCompilerOptions([...options]); |
| 588 | |
| 589 | let overrideDiffable = false; |
| 590 | let overrideDisasm = false; |
| 591 | let overrideAssembly = false; |
| 592 | let overrideTiered = false; |
| 593 | let isAot = this.compiler.group === 'dotnetnativeaot'; |
| 594 | let isMono = this.compiler.group === 'dotnetmono'; |
| 595 | let isCrossgen2 = |
| 596 | this.compiler.group === 'dotnetcrossgen2' || |
| 597 | (this.compiler.group === 'dotnetlegacy' && compilerInfo.sdkMajorVersion === 6); |
| 598 | let codegenArch = 'x64'; |
| 599 | |
| 600 | while (options.length > 0) { |
| 601 | const currentOption = options.shift(); |
| 602 | if (!currentOption) { |
| 603 | continue; |
| 604 | } |
| 605 | |
| 606 | // options before the input filename are user options |
| 607 | if (currentOption.includes(path.basename(inputFilename))) { |
| 608 | break; |
| 609 | } |
| 610 | |
| 611 | if (currentOption === '-compopt' || currentOption === '--compiler-options') { |
| 612 | options.shift(); // skip the value for this option, we don't need it |
| 613 | continue; |
| 614 | } |
| 615 | |
| 616 | if ((isCoreRun || isMono) && (currentOption === '-e' || currentOption === '--env')) { |
| 617 | const envVar = options.shift(); |
| 618 | if (envVar) { |
| 619 | const [name] = envVar.split('='); |
| 620 | const normalizedName = name.trim().toUpperCase(); |
| 621 | if (normalizedName === 'DOTNET_TIEREDCOMPILATION') { |
| 622 | overrideTiered = true; |
| 623 | } |
| 624 | if (normalizedName === 'DOTNET_JITDISASM') { |
| 625 | overrideDisasm = true; |
| 626 | } |
| 627 | if (normalizedName === 'DOTNET_JITDISASMASSEMBLIES') { |
| 628 | overrideAssembly = true; |
no test coverage detected