Skip to content

Conversation

@thymikee
Copy link
Contributor

@thymikee thymikee commented Apr 14, 2025

Summary

This PR refactors the build cache system to be more modular and platform-agnostic.

Key Changes:

  • Centralized fetchCachedBuild and make it platform agnostic:

    • Removed platform-specific fetchCachedBuild functions.
    • Introduced a single, unified fetchCachedBuild function in packages/tools/src/lib/build-cache/fetchCachedBuild.ts with updated signature
    • Removed findBinary, as downloaded artifact has only one file/directory inside
  • Updated RemoteBuildCache Interface to be accept object to avoid breaking changes when adding new stuff there

    • The RemoteBuildCache interface (in packages/tools/src/lib/build-cache/common.ts) no longer includes platform-specific details like detectRepoDetails.
      // packages/tools/src/lib/build-cache/common.ts
      export interface RemoteBuildCache {
        name: string;
        query({
          artifactName,
        }: {
          artifactName: string;
        }): Promise<RemoteArtifact | null>;
        download({
          artifact,
          loader,
        }: {
          artifact: RemoteArtifact;
          loader: ReturnType<typeof spinner>;
        }): Promise<LocalArtifact>;
      }
    • Updated schema
  • Platform Package Updates

    • The platform run commands (e.g., runAndroid, createRun for iOS) now calculate the artifact name.
    • Updated formatArtifactName signature:
      // packages/tools/src/lib/build-cache/common.ts
      export async function formatArtifactName({
        platform,
        traits, // Replaces separate distribution/build args
        root,
        fingerprintOptions,
      }: {
        platform: "ios" | "android";
        traits: string[];
        root: string;
        fingerprintOptions: { extraSources: string[]; ignorePaths: string[] };
      }): Promise<string> {
        /* Includes fingerprinting */
      }

Fixes #249

@vercel
Copy link

vercel bot commented Apr 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
rnef ⬜️ Ignored (Inspect) Visit Preview Apr 28, 2025 2:10am

@thymikee thymikee force-pushed the refactor/remote-cache branch from df80f35 to a9d1999 Compare April 18, 2025 14:57
@thymikee thymikee force-pushed the refactor/remote-cache branch from a9d1999 to a4c4390 Compare April 25, 2025 19:56
@thymikee thymikee force-pushed the refactor/remote-cache branch from a4c4390 to a96287b Compare April 28, 2025 02:07
@thymikee thymikee merged commit 0be7484 into main Apr 28, 2025
4 checks passed
@thymikee thymikee deleted the refactor/remote-cache branch April 28, 2025 02:57
thymikee added a commit that referenced this pull request Apr 28, 2025
* origin/main:
  feat: refactor and expose remote cache provider (#260)
  fix: move start from @react-native/community-cli-plugin (#288)
  fix: update gradle-wrapper (#287)
  fix: always use udid from matched device (#281)
  chore: v0.7.2 (#279)
  docs: Update migrating-from-community-cli.mdx (#284)
  docs: attribute @expo/fingerprint (#285)
  fix: support plugin in create-app
  chore: v0.7.1 (#278)
  fix: autolinking config missing project (#277)
  fix: bump template to v0.7.0
  chore: cleanup ios brownfield android mention
  chore: v0.7.0 (#274)
  feat: upgrade templates to 0.79 (#275)
  fix: incorrectly resolving root (#276)
  chore: simplify welcome message and improve prompts (#273)
  docs: add logo (#272)
  chore: v0.6.2 (#268)
  fix: resolve project root to absolute path (#269)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change remoteCacheProvider to cacheProvider and accept a function

2 participants