Skip to content

Commit

Permalink
Use config introspection to get all entitlements (#419)
Browse files Browse the repository at this point in the history
* Use config introspection to get all entitlements

* Update CHANGELOG.md

* Updated getAppBuildGradle -> getAppBuildGradleFilePath

* Update RemoveProvisioningProfile.ts

* Update view.ts

* Update applicationId.ts

* Update entitlements.ts
  • Loading branch information
EvanBacon authored May 25, 2021
1 parent bfbe1e9 commit bd39b29
Show file tree
Hide file tree
Showing 9 changed files with 805 additions and 40 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ This is the log of notable changes to EAS CLI and related packages.

### 🎉 New features

- Support auto capabilities in managed workflow using Expo config plugin introspection. ([#419](https://github.com/expo/eas-cli/pull/419) by [@EvanBacon](https://github.com/EvanBacon))

### 🐛 Bug fixes

### 🧹 Chores
Expand All @@ -33,7 +35,7 @@ This is the log of notable changes to EAS CLI and related packages.

### 🐛 Bug fixes

- Fix failure when publishing without the platform flag. ([#415](https://github.com/expo/eas-cli/pull/415) by [@jkhales](https://github.com/jkhales))
- Fix failure when publishing without the platform flag. ([#415](https://github.com/expo/eas-cli/pull/415) by [@jkhales](https://github.com/jkhales))
- Pin versions in package.json. ([#399](https://github.com/expo/eas-cli/pull/399) by [@dsokal](https://github.com/dsokal))
- Revert [0ac2f](https://github.com/expo/eas-cli/commit/0ac2fb77a118df609381c4e350aa68609340c3cd) as the root cause of the issue has been fixed in [#399](https://github.com/expo/eas-cli/pull/399).
- Include development-client in valid buildType for internal distribution. ([#410](https://github.com/expo/eas-cli/pull/410) by [@brentvatne](https://github.com/brentvatne))
Expand Down
4 changes: 2 additions & 2 deletions packages/eas-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"@amplitude/identify": "1.5.0",
"@amplitude/node": "1.5.0",
"@expo/apple-utils": "0.0.0-alpha.20",
"@expo/config": "3.3.19",
"@expo/config-plugins": "1.0.31",
"@expo/config": "3.3.42",
"@expo/config-plugins": "1.0.32",
"@expo/eas-build-job": "0.2.35",
"@expo/eas-json": "^0.15.0",
"@expo/json-file": "8.2.25",
Expand Down
4 changes: 2 additions & 2 deletions packages/eas-cli/src/build/android/UpdatesModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ensureValidVersions } from '../utils/updates';
export async function configureUpdatesAsync(projectDir: string, exp: ExpoConfig): Promise<void> {
ensureValidVersions(exp);
const accountName = getProjectAccountName(exp, await ensureLoggedInAsync());
const buildGradlePath = AndroidConfig.Paths.getAppBuildGradle(projectDir);
const buildGradlePath = AndroidConfig.Paths.getAppBuildGradleFilePath(projectDir);
const buildGradleContents = await fs.readFile(buildGradlePath, 'utf8');

if (!AndroidConfig.Updates.isBuildGradleConfigured(projectDir, buildGradleContents)) {
Expand Down Expand Up @@ -70,7 +70,7 @@ export async function syncUpdatesConfigurationAsync(
}

async function ensureUpdatesConfiguredAsync(projectDir: string, exp: ExpoConfig): Promise<void> {
const buildGradlePath = AndroidConfig.Paths.getAppBuildGradle(projectDir);
const buildGradlePath = AndroidConfig.Paths.getAppBuildGradleFilePath(projectDir);
const buildGradleContents = await fs.readFile(buildGradlePath, 'utf8');

if (!AndroidConfig.Updates.isBuildGradleConfigured(projectDir, buildGradleContents)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/eas-cli/src/build/android/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function readVersionName(projectDir: string, exp: ExpoConfig): string | u
}

function readBuildGradle(projectDir: string): string | undefined {
const buildGradlePath = AndroidConfig.Paths.getAppBuildGradle(projectDir);
const buildGradlePath = AndroidConfig.Paths.getAppBuildGradleFilePath(projectDir);
if (!fs.pathExistsSync(buildGradlePath)) {
return undefined;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/eas-cli/src/commands/channel/view.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getConfig } from '@expo/config';
import { Command, flags } from '@oclif/command';
import assert from 'assert';
import chalk from 'chalk';
import Table from 'cli-table3';
import { assert } from 'console';
import gql from 'graphql-tag';

import { graphqlClient, withErrorHandlingAsync } from '../../graphql/client';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert } from '@expo/config';
import assert from 'assert';

import { AppleProvisioningProfileIdentifiersFragment } from '../../../graphql/generated';
import Log from '../../../log';
Expand Down
20 changes: 10 additions & 10 deletions packages/eas-cli/src/credentials/ios/appstore/entitlements.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getConfig } from '@expo/config';
import { IOSConfig } from '@expo/config-plugins';
import { getPrebuildConfig } from '@expo/config';
import { IOSConfig, compileModsAsync } from '@expo/config-plugins';
import { Workflow } from '@expo/eas-build-job';
import { JSONObject } from '@expo/json-file';
import plist from '@expo/plist';
Expand All @@ -16,14 +16,14 @@ function getEntitlementsJson(projectDir: string): JSONObject | null {
}

export async function getManagedEntitlementsJsonAsync(projectDir: string): Promise<JSONObject> {
// TODO: Support prebuild mods
const { exp } = getConfig(projectDir, { skipSDKVersionRequirement: true });
return (
exp.ios?.entitlements ?? {
// Always enable notifications...
'aps-environment': 'production',
}
);
let { exp } = getPrebuildConfig(projectDir, { platforms: ['ios'] });

exp = await compileModsAsync(exp, {
projectRoot: projectDir,
platforms: ['ios'],
introspect: true,
});
return exp.ios?.entitlements || {};
}

export async function resolveEntitlementsJsonAsync(
Expand Down
7 changes: 5 additions & 2 deletions packages/eas-cli/src/project/android/applicationId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ export function getApplicationId(projectDir: string, exp: ExpoConfig): string {
warnIfAndroidPackageDefinedInAppConfigForGenericProject(projectDir, exp);

const errorMessage = 'Could not read application id from Android project.';
const buildGradlePath = AndroidConfig.Paths.getAppBuildGradle(projectDir);
if (!fs.pathExistsSync(buildGradlePath)) {
let buildGradlePath = null;
try {
buildGradlePath = AndroidConfig.Paths.getAppBuildGradleFilePath(projectDir);
} catch {}
if (!buildGradlePath || !fs.pathExistsSync(buildGradlePath)) {
throw new Error(errorMessage);
}
const buildGradle = fs.readFileSync(buildGradlePath, 'utf8');
Expand Down
Loading

0 comments on commit bd39b29

Please sign in to comment.