(
compiler: string,
options: string[],
inputFilename: string,
execOptions: ExecutionOptionsWithEnv,
filters?: ParseFiltersAndOutputOptions,
)
| 55 | } |
| 56 | |
| 57 | override async runCompiler( |
| 58 | compiler: string, |
| 59 | options: string[], |
| 60 | inputFilename: string, |
| 61 | execOptions: ExecutionOptionsWithEnv, |
| 62 | filters?: ParseFiltersAndOutputOptions, |
| 63 | ): Promise<CompilationResult> { |
| 64 | if (!execOptions) { |
| 65 | execOptions = this.getDefaultExecOptions(); |
| 66 | } |
| 67 | |
| 68 | const tmpDir = path.dirname(inputFilename); |
| 69 | |
| 70 | if (!execOptions.customCwd) { |
| 71 | execOptions.customCwd = tmpDir; |
| 72 | } |
| 73 | |
| 74 | const fullResult: CompilationResult = { |
| 75 | code: 0, |
| 76 | timedOut: false, |
| 77 | stdout: [], |
| 78 | stderr: [], |
| 79 | buildsteps: [], |
| 80 | inputFilename, |
| 81 | }; |
| 82 | |
| 83 | const sailResult = await this.doBuildstepAndAddToResult( |
| 84 | fullResult, |
| 85 | 'Sail to C', |
| 86 | compiler, |
| 87 | [...options, '-o', this.outputFilebase], |
| 88 | execOptions, |
| 89 | ); |
| 90 | |
| 91 | const binary = filters?.binary === true; |
| 92 | |
| 93 | if (sailResult.code !== 0 || !binary) { |
| 94 | return fullResult; |
| 95 | } |
| 96 | |
| 97 | const outputFilenameC = this.getOutputFilename(tmpDir, this.outputFilebase); |
| 98 | const outputFilenameExe = outputFilenameC + '.exe'; |
| 99 | |
| 100 | fullResult.executableFilename = outputFilenameExe; |
| 101 | |
| 102 | // Query the sail compiler via `sail -dir` to find out where the |
| 103 | // C runtime files are (`sail.c` etc). |
| 104 | const sailDirResult = await this.doBuildstepAndAddToResult( |
| 105 | fullResult, |
| 106 | 'Get Sail dir', |
| 107 | compiler, |
| 108 | ['-dir'], |
| 109 | execOptions, |
| 110 | ); |
| 111 | |
| 112 | if (sailDirResult.code !== 0) { |
| 113 | return fullResult; |
| 114 | } |
nothing calls this directly
no test coverage detected