Skip to content

Commit

Permalink
Temporary Commit at 11/1/2024, 5:19:54 PM
Browse files Browse the repository at this point in the history
  • Loading branch information
quinlanj committed Nov 2, 2024
1 parent 4d838b9 commit 6e6ea65
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 28 deletions.
2 changes: 1 addition & 1 deletion packages/eas-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@expo/code-signing-certificates": "0.0.5",
"@expo/config": "8.5.4",
"@expo/config-plugins": "7.8.4",
"@expo/eas-build-job": "1.0.136",
"@expo/eas-build-job": "1.0.144",
"@expo/eas-json": "12.5.2",
"@expo/env": "^0.3.0",
"@expo/json-file": "8.2.37",
Expand Down
9 changes: 6 additions & 3 deletions packages/eas-cli/src/build/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import { maybeUploadFingerprintAsync } from '../project/maybeUploadFingerprintAs
import { resolveRuntimeVersionAsync } from '../project/resolveRuntimeVersionAsync';
import { uploadFileAtPathToGCSAsync } from '../uploads';
import { formatBytes } from '../utils/files';
import { fingerprintCommandAsync } from '../utils/fingerprintCli';
import { createFingerprintAsync } from '../utils/fingerprintCli';
import { printJsonOnlyOutput } from '../utils/json';
import { createProgressTracker } from '../utils/progress';
import { sleepAsync } from '../utils/promise';
Expand Down Expand Up @@ -181,7 +181,7 @@ export async function prepareBuildRequestForPlatformAsync<
const fingerprint = await computeAndMaybeUploadFingerprintWithoutExpoUpdatesAsync(ctx);
runtimeAndFingerprintMetadata = {
...runtimeAndFingerprintMetadata,
// TODO: generate fingerprint data here
...fingerprint,
};
}
const metadata = await collectMetadataAsync(ctx, runtimeAndFingerprintMetadata);
Expand Down Expand Up @@ -722,11 +722,14 @@ async function computeAndMaybeUploadFingerprintWithoutExpoUpdatesAsync<T extends
fingerprintHash?: string;
fingerprintSource?: FingerprintSource;
}> {
const fingerprint = await fingerprintCommandAsync(ctx.projectDir, {
const fingerprint = await createFingerprintAsync(ctx.projectDir, {
workflow: ctx.workflow,
platform: ctx.platform,
env: ctx.env,
});
if (!fingerprint) {
return {};
}
const uploadedFingerprint = await maybeUploadFingerprintAsync({
hash: fingerprint.hash,
fingerprint: {
Expand Down
36 changes: 15 additions & 21 deletions packages/eas-cli/src/utils/fingerprintCli.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Env, Workflow } from '@expo/eas-build-job';
import spawnAsync from '@expo/spawn-async';
import { silent as silentResolveFrom } from 'resolve-from';

export async function fingerprintCommandAsync(
export async function createFingerprintAsync(
projectDir: string,
options: {
workflow: Workflow;
Expand All @@ -14,29 +14,23 @@ export async function fingerprintCommandAsync(
hash: string;
sources: object[];
isDebugSource: boolean;
}> {
const args = ['@expo/fingerprint'];
} | null> {
// @expo/fingerprint is exported in the expo package for SDK 52+
const fingerprintPath = silentResolveFrom(projectDir, 'expo/fingerprint');
if (!fingerprintPath) {
return null;
}
const Fingerprint = require(fingerprintPath);
const fingerprintOptions: Record<string, any> = {};
if (options.platform) {
args.push('--platform', options.platform);
fingerprintOptions.platforms = [options.platform];
}
if (options.workflow === 'managed') {
args.push('--ignorePath', 'android/**/*');
args.push('--ignorePath', 'ios/**/*');
fingerprintOptions.ignorePaths = ['android/**/*', 'ios/**/*'];
}
if (options.debug) {
args.push('--debug');
fingerprintOptions.debug = true;
}
const fingerprintJsonResult = (
await spawnAsync('npx', [...args, projectDir], {
stdio: 'pipe',
env: { ...process.env, ...options.env },
cwd: options.cwd,
})
).stdout;
const fingerprintResult = JSON.parse(fingerprintJsonResult);
return {
hash: fingerprintResult.hash,
sources: fingerprintResult.fingerprintSources,
isDebugSource: options.debug ?? false,
};
// eslint-disable-next-line @typescript-eslint/return-await
return await Fingerprint.createFingerprintAsync(projectDir, fingerprintOptions);
}
41 changes: 38 additions & 3 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6e6ea65

Please sign in to comment.