Compare commits

..
36 changed files with 383 additions and 139 deletions

No files matched your search

+10
View File
@@ -8,6 +8,16 @@ This is the log of notable changes to EAS CLI and related packages.
### 🎉 New features
### 🐛 Bug fixes
### 🧹 Chores
- Upgrade [`eas-build`](https://github.com/expo/eas-build) dependencies. ([#2229](https://github.com/expo/eas-cli/pull/2229) by [@expo-bot](https://github.com/expo-bot))
## [7.2.0](https://github.com/expo/eas-cli/releases/tag/v7.2.0) - 2024-02-11
### 🎉 New features
- Support configuring a Google Service Account Key via eas credentials, for sending Android Notifications via FCM V1. ([#2197](https://github.com/expo/eas-cli/pull/2197) by [@christopherwalter](https://github.com/christopherwalter))
### 🐛 Bug fixes
+3 -2
View File
@@ -13,8 +13,9 @@
"@expo/config": "8.5.4",
"@expo/config-plugins": "7.8.4",
"@expo/config-types": "50.0.0",
"@expo/eas-build-job": "1.0.61",
"@expo/eas-build-job": "1.0.70",
"@expo/eas-json": "7.1.3",
"@expo/fingerprint": "0.6.0",
"@expo/json-file": "8.2.37",
"@expo/multipart-body-parser": "1.1.0",
"@expo/osascript": "2.0.33",
@@ -27,7 +28,7 @@
"@expo/results": "1.0.0",
"@expo/rudder-sdk-node": "1.1.1",
"@expo/spawn-async": "1.7.0",
"@expo/steps": "1.0.67",
"@expo/steps": "1.0.70",
"@expo/timeago.js": "1.0.0",
"@oclif/core": "^1.26.2",
"@oclif/plugin-autocomplete": "^2.3.10",
@@ -24,7 +24,9 @@ export async function syncProjectConfigurationAsync({
localAutoIncrement?: AndroidVersionAutoIncrement;
vcsClient: Client;
}): Promise<void> {
const workflow = await resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient);
const workflow = await resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
const versionBumpStrategy = resolveVersionBumpStrategy(localAutoIncrement ?? false);
if (workflow === Workflow.GENERIC) {
@@ -100,7 +100,9 @@ export async function maybeResolveVersionsAsync(
buildProfile: BuildProfile<Platform.ANDROID>,
vcsClient: Client
): Promise<{ appVersion?: string; appBuildVersion?: string }> {
const workflow = await resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient);
const workflow = await resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
if (workflow === Workflow.GENERIC) {
const buildGradle = await getAppBuildGradleAsync(projectDir);
try {
+3 -1
View File
@@ -61,7 +61,9 @@ export async function createBuildContextAsync<T extends Platform>({
const { exp, projectId } = await getDynamicPrivateProjectConfigAsync({ env: buildProfile.env });
const projectName = exp.slug;
const account = await getOwnerAccountForProjectIdAsync(graphqlClient, projectId);
const workflow = await resolveWorkflowAsync(projectDir, platform, vcsClient);
const workflow = await resolveWorkflowAsync(projectDir, platform, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
const accountId = account.id;
const runFromCI = getenv.boolish('CI', false);
const developmentClient =
@@ -22,7 +22,9 @@ export async function syncProjectConfigurationAsync({
localAutoIncrement?: IosVersionAutoIncrement;
vcsClient: Client;
}): Promise<void> {
const workflow = await resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient);
const workflow = await resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
const versionBumpStrategy = resolveVersionBumpStrategy(localAutoIncrement ?? false);
if (workflow === Workflow.GENERIC) {
+6 -2
View File
@@ -114,7 +114,9 @@ export async function readShortVersionAsync(
buildSettings: XCBuildConfiguration['buildSettings'],
vcsClient: Client
): Promise<string | undefined> {
const workflow = await resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient);
const workflow = await resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
if (workflow === Workflow.GENERIC) {
const infoPlist = await readInfoPlistAsync(projectDir, buildSettings);
@@ -136,7 +138,9 @@ export async function readBuildNumberAsync(
buildSettings: XCBuildConfiguration['buildSettings'],
vcsClient: Client
): Promise<string | undefined> {
const workflow = await resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient);
const workflow = await resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
if (workflow === Workflow.GENERIC) {
const infoPlist = await readInfoPlistAsync(projectDir, buildSettings);
return (
@@ -43,7 +43,11 @@ export async function ensureExpoDevClientInstalledForDevClientBuildsAsync({
);
const workflowPerPlatformList = await Promise.all(
platformsToCheck.map(platform => resolveWorkflowAsync(projectDir, platform, vcsClient))
platformsToCheck.map(platform =>
resolveWorkflowAsync(projectDir, platform, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
})
)
);
Log.newLine();
@@ -107,7 +107,9 @@ export async function makeProjectTarballAsync(
startTimer(compressTimerLabel);
try {
await vcsClient.makeShallowCopyAsync(shallowClonePath);
await vcsClient.makeShallowCopyAsync(shallowClonePath, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
await tar.create({ cwd: shallowClonePath, file: tarPath, prefix: 'project', gzip: true }, [
'.',
]);
+3 -1
View File
@@ -32,7 +32,9 @@ export async function checkGoogleServicesFileAsync<T extends Platform>(
if (
(await fs.pathExists(absGoogleServicesFilePath)) &&
(!isInsideDirectory(absGoogleServicesFilePath, rootDir) ||
(await ctx.vcsClient.isFileIgnoredAsync(path.relative(rootDir, absGoogleServicesFilePath))))
(await ctx.vcsClient.isFileIgnoredAsync(path.relative(rootDir, absGoogleServicesFilePath), {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
})))
) {
Log.warn(
`File specified via "${ctx.platform}.googleServicesFile" field in your app.json is not checked in to your repository and won't be uploaded to the builder.`
@@ -72,14 +72,18 @@ export default class BuildConfigure extends EasCommand {
// configure expo-updates
if (expoUpdatesIsInstalled) {
if ([RequestedPlatform.Android, RequestedPlatform.All].includes(platform)) {
const workflow = await resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient);
const workflow = await resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
if (workflow === Workflow.GENERIC) {
await syncAndroidUpdatesConfigurationAsync(projectDir, exp);
}
}
if ([RequestedPlatform.Ios, RequestedPlatform.All].includes(platform)) {
const workflow = await resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient);
const workflow = await resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
if (workflow === Workflow.GENERIC) {
await syncIosUpdatesConfigurationAsync(vcsClient, projectDir, exp);
}
@@ -94,7 +94,9 @@ export default class BuildInspect extends EasCommand {
if (flags.stage === InspectStage.ARCHIVE) {
await vcsClient.ensureRepoExistsAsync();
await vcsClient.makeShallowCopyAsync(tmpWorkingdir);
await vcsClient.makeShallowCopyAsync(tmpWorkingdir, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
await this.copyToOutputDirAsync(tmpWorkingdir, outputDirectory);
} else {
try {
@@ -109,7 +109,9 @@ export default class BuildVersionSyncView extends EasCommand {
toAppPlatform(profileInfo.platform),
applicationIdentifier
);
const workflow = await resolveWorkflowAsync(projectDir, profileInfo.platform, vcsClient);
const workflow = await resolveWorkflowAsync(projectDir, profileInfo.platform, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
if (!remoteVersions?.buildVersion) {
Log.warn(
`Skipping versions sync for ${platformDisplayName}. There are no versions configured on Expo servers, use "eas build:version:set" or run a build to initialize it.`
+6 -2
View File
@@ -50,8 +50,12 @@ export default class Diagnostics extends EasCommand {
}
private async printWorkflowAsync(projectDir: string, vcsClient: Client): Promise<void> {
const androidWorkflow = await resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient);
const iosWorkflow = await resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient);
const androidWorkflow = await resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
const iosWorkflow = await resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
if (androidWorkflow === iosWorkflow) {
Log.log(` Project workflow: ${androidWorkflow}`);
@@ -359,12 +359,13 @@ export default class UpdatePublish extends EasCommand {
throw e;
}
const runtimeVersions = await getRuntimeVersionObjectAsync(
const runtimeVersions = await getRuntimeVersionObjectAsync({
exp,
realizedPlatforms,
platforms: realizedPlatforms,
projectDir,
vcsClient
);
vcsClient,
nonInteractive,
});
const runtimeToPlatformMapping =
getRuntimeToPlatformMappingFromRuntimeVersions(runtimeVersions);
@@ -201,12 +201,13 @@ export default class UpdateRollBackToEmbedded extends EasCommand {
const gitCommitHash = await vcsClient.getCommitHashAsync();
const isGitWorkingTreeDirty = await vcsClient.hasUncommittedChangesAsync();
const runtimeVersions = await getRuntimeVersionObjectAsync(
const runtimeVersions = await getRuntimeVersionObjectAsync({
exp,
realizedPlatforms,
platforms: realizedPlatforms,
projectDir,
vcsClient
);
vcsClient,
nonInteractive,
});
let newUpdates: UpdatePublishMutation['updateBranch']['publishUpdateGroups'];
const publishSpinner = ora('Publishing...').start();
@@ -23,12 +23,16 @@ describe(resolveWorkflowAsync, () => {
projectDir
);
await expect(resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient)).resolves.toBe(
Workflow.GENERIC
);
await expect(resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient)).resolves.toBe(
Workflow.GENERIC
);
await expect(
resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
})
).resolves.toBe(Workflow.GENERIC);
await expect(
resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
})
).resolves.toBe(Workflow.GENERIC);
});
test('bare workflow for single platform', async () => {
@@ -39,12 +43,16 @@ describe(resolveWorkflowAsync, () => {
projectDir
);
await expect(resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient)).resolves.toBe(
Workflow.MANAGED
);
await expect(resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient)).resolves.toBe(
Workflow.GENERIC
);
await expect(
resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
})
).resolves.toBe(Workflow.MANAGED);
await expect(
resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
})
).resolves.toBe(Workflow.GENERIC);
});
test('android/ios directories are ignored', async () => {
@@ -57,12 +65,16 @@ describe(resolveWorkflowAsync, () => {
projectDir
);
await expect(resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient)).resolves.toBe(
Workflow.MANAGED
);
await expect(resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient)).resolves.toBe(
Workflow.MANAGED
);
await expect(
resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
})
).resolves.toBe(Workflow.MANAGED);
await expect(
resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
})
).resolves.toBe(Workflow.MANAGED);
});
});
@@ -80,7 +92,11 @@ describe(resolveWorkflowPerPlatformAsync, () => {
projectDir
);
await expect(resolveWorkflowPerPlatformAsync(projectDir, vcsClient)).resolves.toEqual({
await expect(
resolveWorkflowPerPlatformAsync(projectDir, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
})
).resolves.toEqual({
android: Workflow.GENERIC,
ios: Workflow.GENERIC,
});
@@ -35,7 +35,9 @@ export async function ensureApplicationIdIsDefinedForManagedProjectAsync({
exp: ExpoConfig;
vcsClient: Client;
}): Promise<string> {
const workflow = await resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient);
const workflow = await resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
assert(workflow === Workflow.MANAGED, 'This function should be called only for managed projects');
try {
@@ -101,7 +103,9 @@ export async function getApplicationIdAsync(
vcsClient: Client,
gradleContext?: GradleBuildContext
): Promise<string> {
const workflow = await resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient);
const workflow = await resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
if (workflow === Workflow.GENERIC) {
warnIfAndroidPackageDefinedInAppConfigForBareWorkflowProject(projectDir, exp);
@@ -16,7 +16,9 @@ export async function resolveGradleBuildContextAsync(
buildProfile: BuildProfile<Platform.ANDROID>,
vcsClient: Client
): Promise<GradleBuildContext | undefined> {
const workflow = await resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient);
const workflow = await resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
if (workflow === Workflow.GENERIC) {
try {
if (buildProfile.gradleCommand) {
@@ -36,7 +36,9 @@ export async function getApplicationIdentifierAsync({
}): Promise<string> {
if (platform === Platform.ANDROID) {
const profile = buildProfile as BuildProfile<Platform.ANDROID>;
const workflow = await resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient);
const workflow = await resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
if (workflow === Workflow.MANAGED) {
return await ensureApplicationIdIsDefinedForManagedProjectAsync({
@@ -51,7 +53,9 @@ export async function getApplicationIdentifierAsync({
const gradleContext = await resolveGradleBuildContextAsync(projectDir, profile, vcsClient);
return await getApplicationIdAsync(projectDir, exp, vcsClient, gradleContext);
} else {
const workflow = await resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient);
const workflow = await resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
const profile = buildProfile as BuildProfile<Platform.IOS>;
if (workflow === Workflow.MANAGED) {
return await ensureBundleIdentifierIsDefinedForManagedProjectAsync({
@@ -31,7 +31,11 @@ export async function validateCustomBuildConfigAsync({
`Custom build configuration file ${chalk.bold(relativeConfigPath)} does not exist.`
);
}
if (await vcsClient.isFileIgnoredAsync(relativeConfigPath)) {
if (
await vcsClient.isFileIgnoredAsync(relativeConfigPath, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
})
) {
throw new Error(
`Custom build configuration file ${chalk.bold(
relativeConfigPath
@@ -28,7 +28,9 @@ export async function ensureBundleIdentifierIsDefinedForManagedProjectAsync({
exp: ExpoConfig;
vcsClient: Client;
}): Promise<string> {
const workflow = await resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient);
const workflow = await resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
assert(workflow === Workflow.MANAGED, 'This function should be called only for managed projects');
try {
@@ -55,7 +57,9 @@ export async function getBundleIdentifierAsync(
vcsClient: Client,
xcodeContext?: { targetName?: string; buildConfiguration?: string }
): Promise<string> {
const workflow = await resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient);
const workflow = await resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
if (workflow === Workflow.GENERIC) {
warnIfBundleIdentifierDefinedInAppConfigForBareWorkflowProject(projectDir, exp);
@@ -28,7 +28,9 @@ export async function getManagedApplicationTargetEntitlementsAsync(
projectRoot: projectDir,
platforms: ['ios'],
introspect: true,
ignoreExistingNativeFiles: await hasIgnoredIosProjectAsync(projectDir, vcsClient),
ignoreExistingNativeFiles: await hasIgnoredIosProjectAsync(projectDir, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
}),
});
return expWithMods.ios?.entitlements || {};
} finally {
+3 -1
View File
@@ -24,7 +24,9 @@ export async function resolveXcodeBuildContextAsync(
}: { exp: ExpoConfig; projectDir: string; nonInteractive: boolean; vcsClient: Client },
buildProfile: BuildProfile<Platform.IOS>
): Promise<XcodeBuildContext> {
const workflow = await resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient);
const workflow = await resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
if (workflow === Workflow.GENERIC) {
const buildScheme =
buildProfile.scheme ??
+3 -1
View File
@@ -145,7 +145,9 @@ export async function resolveBareProjectTargetsAsync({
}
export async function resolveTargetsAsync(opts: ResolveTargetOptions): Promise<Target[]> {
const workflow = await resolveWorkflowAsync(opts.projectDir, Platform.IOS, opts.vcsClient);
const workflow = await resolveWorkflowAsync(opts.projectDir, Platform.IOS, opts.vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
if (workflow === Workflow.GENERIC) {
return await resolveBareProjectTargetsAsync(opts);
} else if (workflow === Workflow.MANAGED) {
+114 -38
View File
@@ -1,6 +1,7 @@
import { ExpoConfig, Platform } from '@expo/config';
import { Updates } from '@expo/config-plugins';
import { Platform as EASBuildJobPlatform, Workflow } from '@expo/eas-build-job';
import * as Fingerprint from '@expo/fingerprint';
import JsonFile from '@expo/json-file';
import assert from 'assert';
import chalk from 'chalk';
@@ -8,7 +9,6 @@ import crypto from 'crypto';
import fs from 'fs-extra';
import Joi from 'joi';
import mime from 'mime';
import nullthrows from 'nullthrows';
import path from 'path';
import promiseLimit from 'promise-limit';
@@ -22,7 +22,7 @@ import { PublishMutation } from '../graphql/mutations/PublishMutation';
import { PublishQuery } from '../graphql/queries/PublishQuery';
import Log, { learnMore } from '../log';
import { RequestedPlatform, requestedPlatformDisplayNames } from '../platform';
import { promptAsync } from '../prompts';
import { confirmAsync, promptAsync } from '../prompts';
import { getBranchNameFromChannelNameAsync } from '../update/getBranchNameFromChannelNameAsync';
import { formatUpdateMessage, truncateString as truncateUpdateMessage } from '../update/utils';
import { PresignedPost, uploadWithPresignedPostWithRetryAsync } from '../uploads';
@@ -675,47 +675,123 @@ export function getRequestedPlatform(
}
/** Get runtime versions grouped by platform. Runtime version is always `null` on web where the platform is always backwards compatible. */
export async function getRuntimeVersionObjectAsync(
exp: ExpoConfig,
platforms: Platform[],
projectDir: string,
vcsClient: Client
): Promise<{ platform: string; runtimeVersion: string }[]> {
export async function getRuntimeVersionObjectAsync({
exp,
platforms,
projectDir,
vcsClient,
nonInteractive,
}: {
exp: ExpoConfig;
platforms: Platform[];
projectDir: string;
vcsClient: Client;
nonInteractive: boolean;
}): Promise<{ platform: string; runtimeVersion: string }[]> {
const runtimeVersionObjects: { platform: string; runtimeVersion: string }[] = [];
// calculate these serially since in some cases (fingerprint) we need to prompt the user to confirm that
// the runtime version is ready to be calculated
for (const platform of platforms) {
if (platform === 'web') {
continue;
}
const isPolicy = typeof (exp[platform]?.runtimeVersion ?? exp.runtimeVersion) === 'object';
if (isPolicy) {
const isManaged =
(await resolveWorkflowAsync(projectDir, platform as EASBuildJobPlatform, vcsClient)) ===
Workflow.MANAGED;
if (!isManaged) {
throw new Error(
`You're currently using the bare workflow, where runtime version policies are not supported. You must set your runtime version manually. For example, define your runtime version as "1.0.0", not {"policy": "appVersion"} in your app config. ${learnMore(
'https://docs.expo.dev/eas-update/runtime-versions'
)}`
);
runtimeVersionObjects.push({
platform,
runtimeVersion: await getRuntimeVersionForPlatformAsync({
exp,
platform,
projectDir,
vcsClient,
nonInteractive,
}),
});
}
return runtimeVersionObjects;
}
async function getRuntimeVersionForPlatformAsync({
exp,
platform,
projectDir,
vcsClient,
nonInteractive,
}: {
exp: ExpoConfig;
platform: Platform;
projectDir: string;
vcsClient: Client;
nonInteractive: boolean;
}): Promise<string> {
if (platform === 'web') {
return 'UNVERSIONED';
}
const runtimeVersion = exp[platform]?.runtimeVersion ?? exp.runtimeVersion;
if (typeof runtimeVersion === 'object') {
const workflowIgnoringEASIgnoreToMatchExpoUpdatesDetection = await resolveWorkflowAsync(
projectDir,
platform as EASBuildJobPlatform,
vcsClient,
{ useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: false }
);
const policy = runtimeVersion.policy;
if (policy === 'fingerprintExperimental') {
if (workflowIgnoringEASIgnoreToMatchExpoUpdatesDetection === Workflow.GENERIC) {
if (nonInteractive) {
// log to inform the user that the fingerprint has been calculated
Log.warn(
`Calculating native fingerprint for platform ${platform} using current state of the "${platform}" directory.`
);
} else {
// prompt the user to confirm that their native projects are in a state that is ready
// for the fingerprint to be calculated
const confirm = await confirmAsync({
message: `Calculating native fingerprint for platform ${platform} using current state of the "${platform}" directory. Do you want to continue?`,
});
if (!confirm) {
throw new Error('Aborted');
}
}
return await Fingerprint.createProjectHashAsync(projectDir, {
platforms: [platform],
});
} else if (workflowIgnoringEASIgnoreToMatchExpoUpdatesDetection === Workflow.MANAGED) {
// ignore everything in native directories to ensure fingerprint is the same
// no matter whether project has been prebuilt
return await Fingerprint.createProjectHashAsync(projectDir, {
platforms: [platform],
ignorePaths: ['/android/**/*', '/ios/**/*'],
});
} else {
throw new Error('Unknown workflow');
}
}
const workflow = await resolveWorkflowAsync(
projectDir,
platform as EASBuildJobPlatform,
vcsClient,
{ useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true }
);
if (workflow !== Workflow.MANAGED) {
throw new Error(
`You're currently using the bare workflow, where runtime version policies are not supported. You must set your runtime version manually. For example, define your runtime version as "1.0.0", not {"policy": "appVersion"} in your app config. ${learnMore(
'https://docs.expo.dev/eas-update/runtime-versions'
)}`
);
}
}
return await Promise.all(
[...new Set(platforms)].map(async platform => {
if (platform === 'web') {
return { platform: 'web', runtimeVersion: 'UNVERSIONED' };
}
return {
platform,
runtimeVersion: nullthrows(
await Updates.getRuntimeVersionAsync(projectDir, exp, platform),
`Unable to determine runtime version for ${
requestedPlatformDisplayNames[platform]
}. ${learnMore('https://docs.expo.dev/eas-update/runtime-versions/')}`
),
};
})
);
const resolvedRuntimeVersion = await Updates.getRuntimeVersionAsync(projectDir, exp, platform);
if (!resolvedRuntimeVersion) {
throw new Error(
`Unable to determine runtime version for ${
requestedPlatformDisplayNames[platform]
}. ${learnMore('https://docs.expo.dev/eas-update/runtime-versions/')}`
);
}
return resolvedRuntimeVersion;
}
export function getRuntimeToPlatformMappingFromRuntimeVersions(
+16 -7
View File
@@ -8,7 +8,10 @@ import { Client } from '../vcs/vcs';
export async function resolveWorkflowAsync(
projectDir: string,
platform: Platform,
vcsClient: Client
vcsClient: Client,
options: {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: boolean;
}
): Promise<Workflow> {
let platformWorkflowMarkers: string[];
try {
@@ -27,7 +30,7 @@ export async function resolveWorkflowAsync(
for (const marker of platformWorkflowMarkers) {
if (
(await fs.pathExists(marker)) &&
!(await vcsClient.isFileIgnoredAsync(path.relative(vcsRootPath, marker)))
!(await vcsClient.isFileIgnoredAsync(path.relative(vcsRootPath, marker), options))
) {
return Workflow.GENERIC;
}
@@ -37,24 +40,30 @@ export async function resolveWorkflowAsync(
export async function resolveWorkflowPerPlatformAsync(
projectDir: string,
vcsClient: Client
vcsClient: Client,
options: {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: boolean;
}
): Promise<Record<Platform, Workflow>> {
const [android, ios] = await Promise.all([
resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient),
resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient),
resolveWorkflowAsync(projectDir, Platform.ANDROID, vcsClient, options),
resolveWorkflowAsync(projectDir, Platform.IOS, vcsClient, options),
]);
return { android, ios };
}
export async function hasIgnoredIosProjectAsync(
projectDir: string,
vcsClient: Client
vcsClient: Client,
options: {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: boolean;
}
): Promise<boolean> {
const vcsRootPath = path.normalize(await vcsClient.getRootPathAsync());
try {
const pbxProjectPath = IOSConfig.Paths.getPBXProjectPath(projectDir);
return await vcsClient.isFileIgnoredAsync(path.relative(vcsRootPath, pbxProjectPath));
return await vcsClient.isFileIgnoredAsync(path.relative(vcsRootPath, pbxProjectPath), options);
} finally {
return false;
}
+3 -1
View File
@@ -384,7 +384,9 @@ export async function ensureEASUpdateIsConfiguredAsync({
return;
}
const workflows = await resolveWorkflowPerPlatformAsync(projectDir, vcsClient);
const workflows = await resolveWorkflowPerPlatformAsync(projectDir, vcsClient, {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true,
});
const { projectChanged, exp: expWithUpdates } =
await ensureEASUpdatesIsConfiguredInExpoConfigAsync({
exp: expMaybeWithoutUpdates,
@@ -18,7 +18,7 @@ describe(Ignore, () => {
'/root'
);
const ignore = new Ignore('/root');
const ignore = new Ignore('/root', { useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true });
await ignore.initIgnoreAsync();
expect(ignore.ignores('aaa')).toBe(true);
expect(ignore.ignores('bbb')).toBe(false);
@@ -36,7 +36,7 @@ describe(Ignore, () => {
'/root'
);
const ignore = new Ignore('/root');
const ignore = new Ignore('/root', { useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true });
await ignore.initIgnoreAsync();
expect(ignore.ignores('aaa')).toBe(false);
expect(ignore.ignores('bbb')).toBe(false);
@@ -44,6 +44,25 @@ describe(Ignore, () => {
expect((ignore as any).ignoreMapping.map((i: any) => i[0])).toEqual(['', '']);
});
it('uses .gitignore files if .easignore is present but useEASIgnoreIfAvailableWhenEvaluatingFileIgnores is false', async () => {
vol.fromJSON(
{
'.gitignore': 'aaa',
'.easignore': 'ccc',
'dir/.gitignore': 'bbb',
},
'/root'
);
const ignore = new Ignore('/root', { useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: false });
await ignore.initIgnoreAsync();
expect(ignore.ignores('aaa')).toBe(true);
expect(ignore.ignores('bbb')).toBe(false);
expect(ignore.ignores('ccc')).toBe(false);
expect(ignore.ignores('dir/aaa')).toBe(true);
expect(ignore.ignores('dir/bbb')).toBe(true);
});
it('ignores .gitignore files in node_modules content', async () => {
vol.fromJSON(
{
@@ -54,7 +73,7 @@ describe(Ignore, () => {
'/root'
);
const ignore = new Ignore('/root');
const ignore = new Ignore('/root', { useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true });
await ignore.initIgnoreAsync();
expect(ignore.ignores('aaa')).toBe(true);
expect(ignore.ignores('bbb')).toBe(false);
@@ -72,7 +91,7 @@ describe(Ignore, () => {
'/root'
);
const ignore = new Ignore('/root');
const ignore = new Ignore('/root', { useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true });
await ignore.initIgnoreAsync();
expect(ignore.ignores('dir/ccc')).toBe(true);
});
@@ -80,7 +99,7 @@ describe(Ignore, () => {
it('ignores .git', async () => {
vol.fromJSON({}, '/root');
const ignore = new Ignore('/root');
const ignore = new Ignore('/root', { useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true });
await ignore.initIgnoreAsync();
expect(ignore.ignores('.git')).toBe(true);
});
@@ -93,7 +112,7 @@ describe(Ignore, () => {
'/root'
);
const ignore = new Ignore('/root');
const ignore = new Ignore('/root', { useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: true });
await ignore.initIgnoreAsync();
expect(() => ignore.ignores('dir/test')).not.toThrowError();
});
+12 -2
View File
@@ -120,7 +120,12 @@ export default class GitClient extends Client {
return (await spawnAsync('git', ['rev-parse', '--show-toplevel'])).stdout.trim();
}
public async makeShallowCopyAsync(destinationPath: string): Promise<void> {
public async makeShallowCopyAsync(
destinationPath: string,
_options: {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: boolean;
}
): Promise<void> {
if (await this.hasUncommittedChangesAsync()) {
// it should already be checked before this function is called, but in case it wasn't
// we want to ensure that any changes were introduced by call to `setGitCaseSensitivityAsync`
@@ -207,7 +212,12 @@ export default class GitClient extends Client {
);
}
public override async isFileIgnoredAsync(filePath: string): Promise<boolean> {
public override async isFileIgnoredAsync(
filePath: string,
_options: {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: boolean;
}
): Promise<boolean> {
try {
await spawnAsync('git', ['check-ignore', '-q', filePath], {
cwd: path.normalize(await this.getRootPathAsync()),
@@ -15,16 +15,26 @@ export default class GitNoCommitClient extends GitClient {
return (await spawnAsync('git', ['rev-parse', '--show-toplevel'])).stdout.trim();
}
public override async makeShallowCopyAsync(destinationPath: string): Promise<void> {
public override async makeShallowCopyAsync(
destinationPath: string,
options: {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: boolean;
}
): Promise<void> {
// normalize converts C:/some/path to C:\some\path on windows
const srcPath = path.normalize(await this.getRootPathAsync());
await makeShallowCopyAsync(srcPath, destinationPath);
await makeShallowCopyAsync(srcPath, destinationPath, options);
}
public override async isFileIgnoredAsync(filePath: string): Promise<boolean> {
public override async isFileIgnoredAsync(
filePath: string,
options: {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: boolean;
}
): Promise<boolean> {
// normalize converts C:/some/path to C:\some\path on windows
const rootPath = path.normalize(await this.getRootPathAsync());
const ignore = new Ignore(rootPath);
const ignore = new Ignore(rootPath, options);
await ignore.initIgnoreAsync();
return ignore.ignores(filePath);
}
+14 -4
View File
@@ -6,13 +6,23 @@ export default class NoVcsClient extends Client {
return getRootPath();
}
public async makeShallowCopyAsync(destinationPath: string): Promise<void> {
public async makeShallowCopyAsync(
destinationPath: string,
options: {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: boolean;
}
): Promise<void> {
const srcPath = getRootPath();
await makeShallowCopyAsync(srcPath, destinationPath);
await makeShallowCopyAsync(srcPath, destinationPath, options);
}
public override async isFileIgnoredAsync(filePath: string): Promise<boolean> {
const ignore = new Ignore(getRootPath());
public override async isFileIgnoredAsync(
filePath: string,
options: {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: boolean;
}
): Promise<boolean> {
const ignore = new Ignore(getRootPath(), options);
await ignore.initIgnoreAsync();
return ignore.ignores(filePath);
}
+23 -10
View File
@@ -32,16 +32,23 @@ export function getRootPath(): string {
export class Ignore {
private ignoreMapping: (readonly [string, SingleFileIgnore])[] = [];
constructor(private rootDir: string) {}
constructor(
private readonly rootDir: string,
private readonly options: {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: boolean;
}
) {}
public async initIgnoreAsync(): Promise<void> {
const easIgnorePath = path.join(this.rootDir, EASIGNORE_FILENAME);
if (await fs.pathExists(easIgnorePath)) {
this.ignoreMapping = [
['', createIgnore().add(DEFAULT_IGNORE)],
['', createIgnore().add(await fs.readFile(easIgnorePath, 'utf-8'))],
];
return;
if (this.options.useEASIgnoreIfAvailableWhenEvaluatingFileIgnores) {
const easIgnorePath = path.join(this.rootDir, EASIGNORE_FILENAME);
if (await fs.pathExists(easIgnorePath)) {
this.ignoreMapping = [
['', createIgnore().add(DEFAULT_IGNORE)],
['', createIgnore().add(await fs.readFile(easIgnorePath, 'utf-8'))],
];
return;
}
}
const ignoreFilePaths = (
await fg(`**/${GITIGNORE_FILENAME}`, {
@@ -74,8 +81,14 @@ export class Ignore {
}
}
export async function makeShallowCopyAsync(src: string, dst: string): Promise<void> {
const ignore = new Ignore(src);
export async function makeShallowCopyAsync(
src: string,
dst: string,
options: {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: boolean;
}
): Promise<void> {
const ignore = new Ignore(src, options);
await ignore.initIgnoreAsync();
await fs.copy(src, dst, {
filter: (srcFilePath: string) => {
+12 -2
View File
@@ -3,7 +3,12 @@ export abstract class Client {
// destination, folder created this way will be uploaded "as is", so implementation should skip
// anything that is not committed to the repository. Most optimal solution is to create shallow clone
// using tooling provided by specific VCS, that respects all ignore rules
public abstract makeShallowCopyAsync(destinationPath: string): Promise<void>;
public abstract makeShallowCopyAsync(
destinationPath: string,
options: {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: boolean;
}
): Promise<void>;
// Find root of the repository.
//
@@ -75,7 +80,12 @@ export abstract class Client {
//
// @param filePath has to be a relative normalized path pointing to a file
// located under the root of the repository
public async isFileIgnoredAsync(_filePath: string): Promise<boolean> {
public async isFileIgnoredAsync(
_filePath: string,
_options: {
useEASIgnoreIfAvailableWhenEvaluatingFileIgnores: boolean;
}
): Promise<boolean> {
return false;
}
+1 -1
View File
@@ -6,7 +6,7 @@
"bugs": "https://github.com/expo/eas-cli/issues",
"dependencies": {
"@babel/code-frame": "7.23.5",
"@expo/eas-build-job": "1.0.61",
"@expo/eas-build-job": "1.0.70",
"chalk": "4.1.2",
"env-string": "1.0.1",
"fs-extra": "11.2.0",
Generated
+9 -9
View File
@@ -1462,15 +1462,15 @@
slugify "^1.3.4"
sucrase "^3.20.0"
"@expo/[email protected].61":
version "1.0.61"
resolved "https://registry.yarnpkg.com/@expo/eas-build-job/-/eas-build-job-1.0.61.tgz#6dc3818e82787089027de02ba76b857eb5561e42"
integrity sha512-dlE88FLPShcJio7BYybuUilEgm41oxCkgGHET3PLvLRQsC3qCkV3jlSCQyQTxwCEamWKTlxS8pDMyb0s1OfqUA==
"@expo/[email protected].70":
version "1.0.70"
resolved "https://registry.yarnpkg.com/@expo/eas-build-job/-/eas-build-job-1.0.70.tgz#2ea8b7bc532735669568285adb7d0bbc028643d3"
integrity sha512-22DWjuCmd4ajax7+z9ojuv7/MsnAfC4rza31qJRgVV9q7HbxdUuBMt4pxtdTuZbZ/JA79xyCSrSjdRxFkXr2xw==
dependencies:
joi "^17.11.0"
semver "^7.5.4"
"@expo/fingerprint@^0.6.0":
"@expo/[email protected]", "@expo/fingerprint@^0.6.0":
version "0.6.0"
resolved "https://registry.yarnpkg.com/@expo/fingerprint/-/fingerprint-0.6.0.tgz#77366934673d4ecea37284109b4dd67f9e6a7487"
integrity sha512-KfpoVRTMwMNJ/Cf5o+Ou8M/Y0EGSTqK+rbi70M2Y0K2qgWNfMJ1gm6sYO9uc8lcTr7YSYM1Rme3dk7QXhpScNA==
@@ -1665,10 +1665,10 @@
dependencies:
cross-spawn "^7.0.3"
"@expo/[email protected].67":
version "1.0.67"
resolved "https://registry.yarnpkg.com/@expo/steps/-/steps-1.0.67.tgz#cde00c69fe9a1cd44d1d4041717877de33cfd31f"
integrity sha512-vgmCke1yNj9OjxzzQuTlAnNYI452X6s8VDmSe/olFsJfA+8F3g8coi7CJ3j+rzrpY+LvVYTC27/84Mno0uQSrg==
"@expo/[email protected]0":
version "1.0.70"
resolved "https://registry.yarnpkg.com/@expo/steps/-/steps-1.0.70.tgz#b8d9c7373dc6a247d9254bfcae9ae11a1932517a"
integrity sha512-Na2m9Scll5TWtm/MF2/mPDGRDWEI6NFpYR2W9jvjbJNOtidYxNjLvq+o4Jy8j9KXo8ofm201w3c9ckfkuvdu1w==
dependencies:
"@expo/logger" "1.0.57"
"@expo/spawn-async" "^1.7.2"