Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use config introspection to get all entitlements #419

Merged
merged 7 commits into from
May 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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