(gitExecutable: string, workingDirectory: string)
| 268 | } |
| 269 | |
| 270 | private async cloneFlutterWithProgress(gitExecutable: string, workingDirectory: string): Promise<GitOperationResult> { |
| 271 | const gitUrl = "https://github.com/flutter/flutter.git"; |
| 272 | |
| 273 | return await window.withProgress({ |
| 274 | cancellable: true, |
| 275 | location: ProgressLocation.Notification, |
| 276 | title: cloningFlutterMessage, |
| 277 | }, async (_, cancellationToken): Promise<GitOperationResult> => { |
| 278 | try { |
| 279 | const gitProc = await runToolProcess(this.logger, workingDirectory, gitExecutable, ["clone", "-b", "stable", gitUrl], undefined, cancellationToken); |
| 280 | if (cancellationToken.isCancellationRequested) |
| 281 | return GitOperationResult.cancelled; |
| 282 | |
| 283 | if (gitProc.exitCode !== 0) { |
| 284 | this.logger.error(`Failed to run "git clone" to download Flutter, so skipping "clone Flutter SDK" workflow:\n` |
| 285 | + `Exit code: ${gitProc.exitCode}\n` |
| 286 | + `stdout: ${gitProc.stdout}\n` |
| 287 | + `stderr: ${gitProc.stderr}\n`); |
| 288 | |
| 289 | if (!cancellationToken.isCancellationRequested) |
| 290 | void window.showErrorMessage(`Failed to clone Flutter: ${gitProc.stderr}`); |
| 291 | |
| 292 | return GitOperationResult.error; |
| 293 | } |
| 294 | |
| 295 | return GitOperationResult.success; |
| 296 | } catch (e) { |
| 297 | if (cancellationToken.isCancellationRequested) |
| 298 | return GitOperationResult.cancelled; |
| 299 | this.logger.error(`Failed to run "git clone" to download Flutter, so skipping "clone Flutter SDK" workflow: ${e}`); |
| 300 | return GitOperationResult.error; |
| 301 | } |
| 302 | }); |
| 303 | } |
| 304 | |
| 305 | public async scanWorkspace(): Promise<WorkspaceContext> { |
| 306 | this.logger.info("Searching for SDKs..."); |
no test coverage detected