(baseTools: Record<string, string>)
| 235 | } |
| 236 | |
| 237 | parseTools(baseTools: Record<string, string>) { |
| 238 | const tools: Record<string, Record<string, BaseTool>> = {}; |
| 239 | for (const [lang, forLang] of Object.entries(baseTools)) { |
| 240 | if (lang && forLang) { |
| 241 | tools[lang] = {}; |
| 242 | for (const tool of forLang.split(':')) { |
| 243 | const toolBaseName = `tools.${tool}`; |
| 244 | const className = this.compilerProps<string>(lang, toolBaseName + '.class'); |
| 245 | const Tool = getToolTypeByKey(className); |
| 246 | |
| 247 | const toolPath = this.compilerProps<string>(lang, toolBaseName + '.exe'); |
| 248 | if (fs.existsSync(toolPath)) { |
| 249 | tools[lang][tool] = new Tool( |
| 250 | { |
| 251 | id: tool, |
| 252 | name: this.compilerProps<string>(lang, toolBaseName + '.name'), |
| 253 | type: this.compilerProps<string>(lang, toolBaseName + '.type') as ToolTypeKey, |
| 254 | exe: toolPath, |
| 255 | exclude: splitIntoArray(this.compilerProps<string>(lang, toolBaseName + '.exclude')), |
| 256 | includeKey: this.compilerProps<string>(lang, toolBaseName + '.includeKey'), |
| 257 | options: splitArguments(this.compilerProps<string>(lang, toolBaseName + '.options')), |
| 258 | args: this.compilerProps<string>(lang, toolBaseName + '.args'), |
| 259 | languageId: this.compilerProps<string>( |
| 260 | lang, |
| 261 | toolBaseName + '.languageId', |
| 262 | ) as LanguageKey, |
| 263 | stdinHint: this.compilerProps<string>(lang, toolBaseName + '.stdinHint'), |
| 264 | monacoStdin: this.compilerProps<boolean>(lang, toolBaseName + '.monacoStdin'), |
| 265 | icon: this.compilerProps<string>(lang, toolBaseName + '.icon'), |
| 266 | darkIcon: this.compilerProps<string>(lang, toolBaseName + '.darkIcon'), |
| 267 | compilerLanguage: lang as LanguageKey, |
| 268 | }, |
| 269 | { |
| 270 | ceProps: this.ceProps, |
| 271 | compilerProps: (propname: string) => this.compilerProps(lang, propname), |
| 272 | }, |
| 273 | ); |
| 274 | } else { |
| 275 | logger.warn(`Unable to stat ${toolBaseName} tool binary`); |
| 276 | } |
| 277 | } |
| 278 | } |
| 279 | } |
| 280 | return tools; |
| 281 | } |
| 282 | |
| 283 | discoverLibIdsFromProperties(lang: string): string[] { |
| 284 | const allKeys = this.compilerPropsInstance.getKeysStartingWith(lang, 'libs.'); |
no test coverage detected