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

[WIP][do not merge][RFC] feat: support for development provisioning profiles (iOS) #2071

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
7 changes: 5 additions & 2 deletions packages/eas-cli/src/build/android/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ export async function createAndroidContextAsync(
): Promise<AndroidBuildContext> {
const { buildProfile } = ctx;

if (buildProfile.distribution === 'internal' && buildProfile.gradleCommand?.match(/bundle/)) {
if (
(buildProfile.distribution === 'internal' || buildProfile.distribution === 'development') &&
buildProfile.gradleCommand?.match(/bundle/)
) {
Log.addNewLineIfNone();
Log.warn(
`You're building your Android app for internal distribution. However, we've detected that the Gradle command you defined (${chalk.underline(
`You're building your Android app for internal or development distribution. However, we've detected that the Gradle command you defined (${chalk.underline(
buildProfile.gradleCommand
)}) includes string 'bundle'.
This means that it will most likely produce an AAB and you will not be able to install it on your Android devices straight from the Expo website.`
Expand Down
6 changes: 5 additions & 1 deletion packages/eas-cli/src/build/android/prepareJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ export async function prepareJobAsync(
: {};

let buildType = buildProfile.buildType;
if (!buildType && !buildProfile.gradleCommand && buildProfile.distribution === 'internal') {
if (
!buildType &&
!buildProfile.gradleCommand &&
(buildProfile.distribution === 'internal' || buildProfile.distribution === 'development')
) {
buildType = Android.BuildType.APK;
}

Expand Down
6 changes: 5 additions & 1 deletion packages/eas-cli/src/build/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ function transformCredentialsSource(
}

function transformDistribution(distribution: Metadata['distribution']): DistributionType {
if (distribution === 'internal') {
//TODO: remove when change is added upstream to eas-build-job
//@ts-ignore
if (distribution === 'development') {
return DistributionType.Development;
} else if (distribution === 'internal') {
return DistributionType.Internal;
} else if (distribution === 'simulator') {
return DistributionType.Simulator;
Expand Down
1 change: 1 addition & 0 deletions packages/eas-cli/src/build/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export enum BuildStatus {
}

export enum BuildDistributionType {
DEVELOPMENT = 'development',
STORE = 'store',
INTERNAL = 'internal',
SIMULATOR = 'simulator',
Expand Down
5 changes: 4 additions & 1 deletion packages/eas-cli/src/build/utils/printBuildInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ function printBuildResult(build: BuildFragment): void {
return;
}

if (build.distribution === DistributionType.Internal) {
if (
build.distribution === DistributionType.Internal ||
build.distribution === DistributionType.Development
) {
Log.addNewLineIfNone();
const logsUrl = getBuildLogsUrl(build);
// It's tricky to install the .apk file directly on Android so let's fallback
Expand Down
1 change: 1 addition & 0 deletions packages/eas-cli/src/commands/build/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default class BuildList extends EasCommand {
distribution: Flags.enum({
options: [
BuildDistributionType.STORE,
BuildDistributionType.DEVELOPMENT,
BuildDistributionType.INTERNAL,
BuildDistributionType.SIMULATOR,
],
Expand Down
9 changes: 6 additions & 3 deletions packages/eas-cli/src/commands/build/resign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export default class BuildResign extends EasCommand {
json: false,
},
filter: {
distribution: DistributionType.Internal,
distribution: DistributionType.Internal || DistributionType.Development,
platform: toAppPlatform(platform),
status: BuildStatus.Finished,
},
Expand All @@ -280,8 +280,11 @@ export default class BuildResign extends EasCommand {
): Promise<BuildFragment | undefined> {
if (maybeBuildId) {
const build = await BuildQuery.byIdAsync(graphqlClient, maybeBuildId);
if (build.distribution !== DistributionType.Internal) {
throw new Error('This is not an internal distribution build.');
if (
build.distribution !== DistributionType.Internal &&
build.distribution !== DistributionType.Development
) {
throw new Error('This is not an internal or development distribution build.');
}
if (build.status !== BuildStatus.Finished) {
throw new Error('Only builds that finished successfully can be re-signed.');
Expand Down
18 changes: 17 additions & 1 deletion packages/eas-cli/src/credentials/ios/IosCredentialsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ import { getAppFromContextAsync } from './actions/BuildCredentialsUtils';
import { SetUpBuildCredentials } from './actions/SetUpBuildCredentials';
import { SetUpPushKey } from './actions/SetUpPushKey';
import { App, IosCredentials, Target } from './types';
import { isAdHocProfile, isEnterpriseUniversalProfile } from './utils/provisioningProfile';
import {
isAdHocProfile,
isDevelopmentProfile,
isEnterpriseUniversalProfile,
} from './utils/provisioningProfile';

interface Options {
app: App;
Expand Down Expand Up @@ -144,6 +148,18 @@ export default class IosCredentialsProvider {
private assertProvisioningProfileType(provisioningProfile: string, targetName?: string): void {
const isAdHoc = isAdHocProfile(provisioningProfile);
const isEnterprise = isEnterpriseUniversalProfile(provisioningProfile);
const isDevelopment = isDevelopmentProfile(provisioningProfile);

if (this.options.distribution === 'development') {
if (!isDevelopment) {
throw new Error(
`You must use a development provisioning profile${
targetName ? ` (target '${targetName})'` : ''
} for development distribution.`
);
}
}

if (this.options.distribution === 'internal') {
if (this.options.enterpriseProvisioning === 'universal' && !isEnterprise) {
throw new Error(
Expand Down
Loading