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 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
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 @@ -48,7 +48,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 @@ -82,7 +82,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
2 changes: 2 additions & 0 deletions packages/eas-cli/src/build/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export async function collectMetadataAsync<T extends Platform>(
fingerprintSource: runtimeMetadata?.fingerprintSource,
reactNativeVersion: await getReactNativeVersionAsync(ctx.projectDir),
...channelObject,
//TODO: needs to be updated in @expo/eas-build-job
//@ts-expect-error
distribution,
appName: ctx.exp.name,
appIdentifier: resolveAppIdentifier(ctx),
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 @@ -15,6 +15,7 @@ export enum BuildStatus {
}

export enum BuildDistributionType {
DEVELOPMENT = 'development',
STORE = 'store',
INTERNAL = 'internal',
/** @deprecated Use simulator flag instead */
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 @@ -92,7 +92,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
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 @@ -297,7 +297,7 @@ export default class BuildResign extends EasCommand {
json: false,
},
filter: {
distribution: DistributionType.Internal,
distribution: DistributionType.Internal || DistributionType.Development,
platform: toAppPlatform(platform),
status: BuildStatus.Finished,
buildProfile,
Expand All @@ -316,8 +316,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
23 changes: 18 additions & 5 deletions packages/eas-cli/src/credentials/ios/IosCredentialsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,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';
import { CommonIosAppCredentialsFragment } from '../../graphql/generated';
import Log from '../../log';
import { findApplicationTarget } from '../../project/ios/target';
Expand All @@ -36,10 +40,7 @@ enum PushNotificationSetupOption {
export default class IosCredentialsProvider {
public readonly platform = Platform.IOS;

constructor(
private readonly ctx: CredentialsContext,
private readonly options: Options
) {}
constructor(private readonly ctx: CredentialsContext, private readonly options: Options) {}

public async getCredentialsAsync(
src: CredentialsSource.LOCAL | CredentialsSource.REMOTE
Expand Down Expand Up @@ -153,6 +154,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
Loading