Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove stalePods checks from dependency manager to fix rebuild issues #684

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions packages/vscode-extension/src/dependency/DependencyManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import semver, { SemVer } from "semver";
import { Logger } from "../Logger";
import { EMULATOR_BINARY } from "../devices/AndroidEmulatorDevice";
import { command, lineReader } from "../utilities/subprocess";
import { extensionContext, getAppRootFolder } from "../utilities/extensionContext";
import { getAppRootFolder } from "../utilities/extensionContext";
import { getIosSourceDir } from "../builders/buildIOS";
import { isExpoGoProject } from "../builders/expoGo";
import {
Expand All @@ -27,11 +27,8 @@ import { CancelToken } from "../builders/cancelToken";
import { getAndroidSourceDir } from "../builders/buildAndroid";
import { Platform } from "../utilities/platform";

const STALE_PODS = "stalePods";

export class DependencyManager implements Disposable, DependencyManagerInterface {
// React Native prepares build scripts based on node_modules, we need to reinstall pods if they change
private stalePods = extensionContext.workspaceState.get<boolean>(STALE_PODS) ?? false;
private eventEmitter = new EventEmitter();
private packageManagerInternal: PackageManagerInfo | undefined;

Expand Down Expand Up @@ -140,8 +137,6 @@ export class DependencyManager implements Disposable, DependencyManagerInterface
return false;
}

await this.setStalePodsAsync(true);

this.emitEvent("nodeModules", { status: "installing", isOptional: false });

// all managers support the `install` command
Expand Down Expand Up @@ -183,17 +178,10 @@ export class DependencyManager implements Disposable, DependencyManagerInterface
return;
}

await this.setStalePodsAsync(false);

this.emitEvent("pods", { status: "installed", isOptional: false });
Logger.debug("Project pods installed");
}

private async setStalePodsAsync(stale: boolean) {
this.stalePods = stale;
await extensionContext.workspaceState.update(STALE_PODS, stale);
}

private async getPackageManager() {
if (!this.packageManagerInternal) {
this.packageManagerInternal = await resolvePackageManager();
Expand Down Expand Up @@ -273,11 +261,6 @@ export class DependencyManager implements Disposable, DependencyManagerInterface
return true;
}

if (requiresNativeBuild && this.stalePods) {
this.emitEvent("pods", { status: "notInstalled", isOptional: false });
return false;
}

const appRootFolder = getAppRootFolder();
const iosDirPath = getIosSourceDir(appRootFolder);

Expand Down