()
| 306 | } |
| 307 | |
| 308 | override async getVersion() { |
| 309 | logger.info(`Gathering ${this.compiler.id} version information on ${this.compiler.exe}...`); |
| 310 | const versionFile = path.join(path.dirname(this.compiler.exe), 'r8-version.properties'); |
| 311 | const versionInfo = await utils.tryReadTextFile(versionFile); |
| 312 | const versionCode = (() => { |
| 313 | if (versionInfo !== undefined) { |
| 314 | for (const l of versionInfo.split(/\n/)) { |
| 315 | if (this.versionFromPropsRegex.test(l)) { |
| 316 | return l.match(this.versionFromPropsRegex)![1]; |
| 317 | } |
| 318 | } |
| 319 | throw new Error(`Unable to parse version info from ${versionFile}`); |
| 320 | } |
| 321 | // Non-latest R8 already has the version in the filename. |
| 322 | return this.compiler.exe.match(this.versionFromJarRegex)![1]; |
| 323 | })(); |
| 324 | return { |
| 325 | stdout: versionCode, |
| 326 | stderr: '', |
| 327 | code: 0, |
| 328 | }; |
| 329 | } |
| 330 | } |
no test coverage detected