(lang: LanguageKey)
| 76 | } |
| 77 | |
| 78 | async getCompilerInfo(lang: LanguageKey): Promise<DotNetCompilerInfo> { |
| 79 | const sdkDirs = await fs.readdir(this.sdkBaseDir); |
| 80 | const sdkVersion = sdkDirs[0]; |
| 81 | |
| 82 | const parts = sdkVersion.split('.'); |
| 83 | const targetFramework = `net${parts[0]}.${parts[1]}`; |
| 84 | const sdkMajorVersion = Number(parts[0]); |
| 85 | |
| 86 | switch (lang) { |
| 87 | case 'csharp': { |
| 88 | return { |
| 89 | targetFramework: targetFramework, |
| 90 | sdkVersion: sdkVersion, |
| 91 | sdkMajorVersion: sdkMajorVersion, |
| 92 | compilerPath: path.join(this.sdkBaseDir, sdkVersion, 'Roslyn', 'bincore', 'csc.dll'), |
| 93 | }; |
| 94 | } |
| 95 | case 'vb': { |
| 96 | return { |
| 97 | targetFramework: targetFramework, |
| 98 | sdkVersion: sdkVersion, |
| 99 | sdkMajorVersion: sdkMajorVersion, |
| 100 | compilerPath: path.join(this.sdkBaseDir, sdkVersion, 'Roslyn', 'bincore', 'vbc.dll'), |
| 101 | }; |
| 102 | } |
| 103 | case 'fsharp': { |
| 104 | return { |
| 105 | targetFramework: targetFramework, |
| 106 | sdkVersion: sdkVersion, |
| 107 | sdkMajorVersion: sdkMajorVersion, |
| 108 | compilerPath: path.join(this.sdkBaseDir, sdkVersion, 'FSharp', 'fsc.dll'), |
| 109 | }; |
| 110 | } |
| 111 | case 'il': { |
| 112 | return { |
| 113 | targetFramework: targetFramework, |
| 114 | sdkVersion: sdkVersion, |
| 115 | sdkMajorVersion: sdkMajorVersion, |
| 116 | compilerPath: path.join(this.clrBuildDir, 'ilasm'), |
| 117 | }; |
| 118 | } |
| 119 | default: { |
| 120 | throw new Error(`Unsupported language: ${lang}`); |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | setCompilerExecOptions(execOptions: ExecutionOptionsWithEnv, programDir: string) { |
| 126 | if (!execOptions) { |
no test coverage detected