Skip to content

Commit 6f63cf6

Browse files
committed
Fixup remaining usage of downloadAndInstallPackages
1 parent 2f7cebe commit 6f63cf6

File tree

4 files changed

+36
-23
lines changed

4 files changed

+36
-23
lines changed

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { vscodeNetworkSettingsProvider } from './networkSettings';
1717
import createOptionStream from './shared/observables/createOptionStream';
1818
import { AbsolutePathPackage } from './packageManager/absolutePathPackage';
1919
import { downloadAndInstallPackages } from './packageManager/downloadAndInstallPackages';
20-
import IInstallDependencies from './packageManager/IInstallDependencies';
20+
import { IInstallDependencies } from './packageManager/IInstallDependencies';
2121
import { installRuntimeDependencies } from './installRuntimeDependencies';
2222
import { isValidDownload } from './packageManager/isValidDownload';
2323
import { MigrateOptions } from './shared/migrateOptions';

src/omnisharp/omnisharpDownloader.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,17 @@ export class OmnisharpDownloader {
5353
if (packagesToInstall.length > 0) {
5454
this.eventStream.post(new PackageInstallation(`OmniSharp Version = ${version}`));
5555
this.eventStream.post(new LogPlatformInfo(this.platformInfo));
56-
if (
57-
await downloadAndInstallPackages(
58-
packagesToInstall,
59-
this.networkSettingsProvider,
60-
this.eventStream,
61-
isValidDownload,
62-
this.reporter
63-
)
64-
) {
56+
const installationResults = await downloadAndInstallPackages(
57+
packagesToInstall,
58+
this.networkSettingsProvider,
59+
this.eventStream,
60+
isValidDownload,
61+
this.reporter
62+
);
63+
const failedPackages = Object.entries(installationResults)
64+
.filter(([, installed]) => !installed)
65+
.map(([name]) => name);
66+
if (failedPackages.length === 0) {
6567
this.eventStream.post(new InstallationSuccess());
6668
return true;
6769
}

src/razor/razorOmnisharpDownloader.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,17 @@ export class RazorOmnisharpDownloader {
3535
if (packagesToInstall.length > 0) {
3636
this.eventStream.post(new PackageInstallation(`Razor OmniSharp Version = ${version}`));
3737
this.eventStream.post(new LogPlatformInfo(this.platformInfo));
38-
if (
39-
await downloadAndInstallPackages(
40-
packagesToInstall,
41-
this.networkSettingsProvider,
42-
this.eventStream,
43-
isValidDownload,
44-
this.reporter
45-
)
46-
) {
38+
const installationResults = await downloadAndInstallPackages(
39+
packagesToInstall,
40+
this.networkSettingsProvider,
41+
this.eventStream,
42+
isValidDownload,
43+
this.reporter
44+
);
45+
const failedPackages = Object.entries(installationResults)
46+
.filter(([, installed]) => !installed)
47+
.map(([name]) => name);
48+
if (failedPackages.length === 0) {
4749
this.eventStream.post(new InstallationSuccess());
4850
return true;
4951
}

tasks/offlinePackagingTasks.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,19 @@ async function installPackageJsonDependency(
280280
codeExtensionPath
281281
);
282282
const provider = () => new NetworkSettings('', true);
283-
if (
284-
!(await downloadAndInstallPackages(packagesToInstall, provider, eventStream, isValidDownload, undefined, token))
285-
) {
286-
throw Error('Failed to download package.');
283+
const installationResults = await downloadAndInstallPackages(
284+
packagesToInstall,
285+
provider,
286+
eventStream,
287+
isValidDownload,
288+
undefined,
289+
token
290+
);
291+
const failedPackages = Object.entries(installationResults)
292+
.filter(([, installed]) => !installed)
293+
.map(([name]) => name);
294+
if (failedPackages.length > 0) {
295+
throw Error('The following packages failed to install: ' + failedPackages.join(', '));
287296
}
288297
}
289298

0 commit comments

Comments
 (0)