Skip to content

Commit f4b8611

Browse files
committed
feat: add skipCache parameter to buildApp, packageIosAction and installPodsIfNeeded
1 parent 9b9caa6 commit f4b8611

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

packages/platform-apple-helpers/src/lib/utils/buildApp.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type SharedBuildAppOptions = {
3030
reactNativePath: string;
3131
binaryPath?: string;
3232
usePrebuiltRNCore?: number;
33+
skipCache?: boolean;
3334
};
3435

3536
export async function buildApp({
@@ -47,6 +48,7 @@ export async function buildApp({
4748
fingerprintOptions,
4849
deviceOrSimulator,
4950
usePrebuiltRNCore,
51+
skipCache,
5052
}:
5153
| ({
5254
brownfield?: false;
@@ -88,6 +90,7 @@ export async function buildApp({
8890
reactNativePath,
8991
brownfield,
9092
usePrebuiltRNCore,
93+
skipCache,
9194
);
9295
// When the project is not a workspace, we need to get the project config again,
9396
// because running pods install might have generated .xcworkspace project.

packages/platform-apple-helpers/src/lib/utils/pods.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export async function installPodsIfNeeded(
2929
reactNativePath: string,
3030
brownfield?: boolean,
3131
usePrebuiltRNCore?: number,
32+
skipCache?: boolean,
3233
) {
3334
const podsPath = path.join(sourceDir, 'Pods');
3435
const podfilePath = path.join(sourceDir, 'Podfile');
@@ -37,7 +38,9 @@ export async function installPodsIfNeeded(
3738
const nativeDependencies = await getNativeDependencies(platformName);
3839

3940
const cacheKey = `pods-dependencies`;
40-
const cachedDependenciesHash = cacheManager.get(cacheKey);
41+
const cachedDependenciesHash = skipCache
42+
? undefined
43+
: cacheManager.get(cacheKey);
4144
const podsDirExists = fs.existsSync(podsPath);
4245
const hashChanged = cachedDependenciesHash
4346
? !compareMd5Hashes(
@@ -56,10 +59,12 @@ export async function installPodsIfNeeded(
5659
brownfield,
5760
usePrebuiltRNCore,
5861
});
59-
cacheManager.set(
60-
cacheKey,
61-
calculateCurrentHash({ podfilePath, podsPath, nativeDependencies }),
62-
);
62+
if (!skipCache) {
63+
cacheManager.set(
64+
cacheKey,
65+
calculateCurrentHash({ podfilePath, podsPath, nativeDependencies }),
66+
);
67+
}
6368
return true;
6469
}
6570
return false;

packages/plugin-brownfield-ios/src/lib/pluginBrownfieldIos.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,13 @@ export const packageIosAction = async (
2929
reactNativePath,
3030
reactNativeVersion,
3131
usePrebuiltRNCore,
32+
skipCache,
3233
}: {
3334
projectRoot: string;
3435
reactNativePath: string;
3536
reactNativeVersion: string;
3637
usePrebuiltRNCore: number | undefined;
38+
skipCache?: boolean;
3739
},
3840
pluginConfig?: IOSProjectConfig,
3941
) => {
@@ -59,6 +61,8 @@ export const packageIosAction = async (
5961
reactNativePath,
6062
brownfield: true,
6163
usePrebuiltRNCore,
64+
pluginConfig,
65+
skipCache,
6266
});
6367
logger.log(`Build available at: ${colorLink(relativeToCwd(appPath))}`);
6468

0 commit comments

Comments
 (0)