Compare commits

...
4 changed files with 60 additions and 7 deletions

No files matched your search

+2
View File
@@ -10,6 +10,8 @@ This is the log of notable changes to EAS CLI and related packages.
### 🐛 Bug fixes
- Load iOS entitlements from prebuild config when `./ios` is gitignored. ([#1852](https://github.com/expo/eas-cli/pull/1852) by [@byCedric](https://github.com/byCedric))
### 🧹 Chores
- Short format for selecting devices prompt. ([#1840](https://github.com/expo/eas-cli/pull/1840) by [@khamilowicz](https://github.com/khamilowicz))
@@ -169,4 +169,8 @@ describe(syncCapabilityIdentifiersForEntitlementsAsync, () => {
})
).rejects.toThrow(/is not available. Enter a different string/);
});
it(`ignores capabilities from "/ios" folder when gitignored`, async () => {
//
});
});
@@ -2,12 +2,15 @@ import { IOSConfig, compileModsAsync } from '@expo/config-plugins';
import { JSONObject } from '@expo/json-file';
import { getPrebuildConfigAsync } from '@expo/prebuild-config';
import Log from '../../log';
import { readPlistAsync } from '../../utils/plist';
import { getVcsClient } from '../../vcs';
interface Target {
buildConfiguration?: string;
targetName: string;
}
export async function getManagedApplicationTargetEntitlementsAsync(
projectDir: string,
env: Record<string, string>
@@ -43,3 +46,37 @@ export async function getNativeTargetEntitlementsAsync(
return null;
}
}
/**
* When users have the `./ios` folder ignored through gitignore,
* we should load the app entitlements as managed instead of native/bare workflow.
* Without this, the user's configuration through config plugins will be ignored.
* The gitignore check can be disabled by setting the `EAS_SYNC_NATIVE_CAPABILITIES=1` env variable.
*/
export async function getNativeTargetEntitlementsUnlessGitIgnoredAsync(
projectDir: string,
{
target,
env,
}: {
target: Target;
env: Record<string, string>;
}
): Promise<JSONObject | null> {
// Escape hatch to force syncing native capabilities from `/ios` folder
const useNativeCapabilities = process.env.EAS_SYNC_NATIVE_CAPABILITIES;
if (useNativeCapabilities) {
Log.log(
'Syncing native ios capabilities from `./ios` folder, EAS_SYNC_NATIVE_CAPABILITIES is defined.'
);
return getNativeTargetEntitlementsAsync(projectDir, target);
}
// Load the capabilities from the prebuild config, instead of the native project when gitignored
if (await getVcsClient().isFileIgnoredAsync('ios')) {
return getManagedApplicationTargetEntitlementsAsync(projectDir, env);
}
// Load the capabilities from the `./ios` native project
return getNativeTargetEntitlementsAsync(projectDir, target);
}
+17 -7
View File
@@ -11,7 +11,7 @@ import { resolveWorkflowAsync } from '../workflow';
import { getBundleIdentifierAsync } from './bundleIdentifier';
import {
getManagedApplicationTargetEntitlementsAsync,
getNativeTargetEntitlementsAsync,
getNativeTargetEntitlementsUnlessGitIgnoredAsync,
} from './entitlements';
import { XcodeBuildContext } from './scheme';
@@ -89,6 +89,7 @@ export async function resolveBareProjectTargetsAsync({
exp,
projectDir,
xcodeBuildContext,
env,
}: ResolveTargetOptions): Promise<Target[]> {
const { buildScheme, buildConfiguration } = xcodeBuildContext;
const result: Target[] = [];
@@ -102,9 +103,12 @@ export async function resolveBareProjectTargetsAsync({
targetName: applicationTarget.name,
buildConfiguration,
});
const entitlements = await getNativeTargetEntitlementsAsync(projectDir, {
targetName: applicationTarget.name,
buildConfiguration,
const entitlements = await getNativeTargetEntitlementsUnlessGitIgnoredAsync(projectDir, {
env: env ?? {},
target: {
targetName: applicationTarget.name,
buildConfiguration,
},
});
result.push({
targetName: applicationTarget.name,
@@ -151,6 +155,7 @@ async function resolveBareProjectDependenciesAsync({
target,
bundleIdentifier,
pbxProject,
env,
}: {
exp: ExpoConfig;
projectDir: string;
@@ -158,6 +163,7 @@ async function resolveBareProjectDependenciesAsync({
target: IOSConfig.Target.Target;
bundleIdentifier: string;
pbxProject: XcodeProject;
env?: ResolveTargetOptions['env'];
}): Promise<Target[]> {
const result: Target[] = [];
@@ -170,9 +176,12 @@ async function resolveBareProjectDependenciesAsync({
targetName: dependency.name,
buildConfiguration,
});
const entitlements = await getNativeTargetEntitlementsAsync(projectDir, {
targetName: target.name,
buildConfiguration,
const entitlements = await getNativeTargetEntitlementsUnlessGitIgnoredAsync(projectDir, {
env: env ?? {},
target: {
targetName: target.name,
buildConfiguration,
},
});
result.push({
targetName: dependency.name,
@@ -193,6 +202,7 @@ async function resolveBareProjectDependenciesAsync({
target: dependency,
bundleIdentifier: dependencyBundleIdentifier,
pbxProject,
env,
});
if (dependencyDependencies.length > 0) {
result.push(...dependencyDependencies);