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

[ENG-1396] change default ios image for sdk <= 41 #479

Merged
merged 2 commits into from
Jun 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
2 changes: 2 additions & 0 deletions 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

- Change default iOS image for projects with Expo SDK <= 41 (SDK 41 won't build with Xcode 12.5). ([#479](https://github.com/expo/eas-cli/pull/479) by [@dsokal](https://github.com/dsokal))

### 🐛 Bug fixes

### 🧹 Chores
Expand Down
14 changes: 13 additions & 1 deletion packages/eas-cli/src/build/ios/prepareJob.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ArchiveSource, Cache, Ios, Job, Workflow, sanitizeJob } from '@expo/eas-build-job';
import { IosGenericBuildProfile, IosManagedBuildProfile } from '@expo/eas-json';
import path from 'path';
import semver from 'semver';

import { IosCredentials, TargetCredentials } from '../../credentials/ios/types';
import { getUsername } from '../../project/projectUtils';
Expand Down Expand Up @@ -59,7 +60,7 @@ async function prepareJobCommonAsync(
projectArchive,
distribution: ctx.buildProfile.distribution,
builderEnvironment: {
image: ctx.buildProfile.image,
image: resolveImage(ctx),
node: ctx.buildProfile.node,
yarn: ctx.buildProfile.yarn,
bundler: ctx.buildProfile.bundler,
Expand All @@ -78,6 +79,17 @@ async function prepareJobCommonAsync(
};
}

function resolveImage(ctx: BuildContext<Platform.IOS>): Ios.BuilderEnvironment['image'] {
// see https://linear.app/expo/issue/ENG-1396/make-default-image-dependent-on-sdk-version
if (!ctx.buildProfile.image && ctx.commandCtx.exp.sdkVersion) {
const majorSdkVersion = semver.major(ctx.commandCtx.exp.sdkVersion);
if (majorSdkVersion <= 41) {
return 'macos-catalina-10.15-xcode-12.4';
}
}
return ctx.buildProfile.image ?? 'default';
}

function prepareTargetCredentials(targetCredentials: TargetCredentials): Ios.TargetCredentials {
return {
provisioningProfileBase64: targetCredentials.provisioningProfile,
Expand Down
6 changes: 4 additions & 2 deletions packages/eas-json/src/Config.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface AndroidGenericBuildProfile extends Android.BuilderEnvironment {
cache: Cache;
}

export interface IosManagedBuildProfile extends Ios.BuilderEnvironment {
export interface IosManagedBuildProfile extends Omit<Ios.BuilderEnvironment, 'image'> {
workflow: Workflow.MANAGED;
credentialsSource: CredentialsSource;
buildType?: Ios.ManagedBuildType;
Expand All @@ -45,9 +45,10 @@ export interface IosManagedBuildProfile extends Ios.BuilderEnvironment {
enterpriseProvisioning?: IosEnterpriseProvisioning;
autoIncrement: VersionAutoIncrement;
cache: Cache;
image?: Ios.BuilderEnvironment['image'];
}

export interface IosGenericBuildProfile extends Ios.BuilderEnvironment {
export interface IosGenericBuildProfile extends Omit<Ios.BuilderEnvironment, 'image'> {
workflow: Workflow.GENERIC;
credentialsSource: CredentialsSource;
scheme?: string;
Expand All @@ -59,6 +60,7 @@ export interface IosGenericBuildProfile extends Ios.BuilderEnvironment {
enterpriseProvisioning?: IosEnterpriseProvisioning;
autoIncrement: VersionAutoIncrement;
cache: Cache;
image?: Ios.BuilderEnvironment['image'];
}

export type AndroidBuildProfile = AndroidManagedBuildProfile | AndroidGenericBuildProfile;
Expand Down
10 changes: 3 additions & 7 deletions packages/eas-json/src/EasJsonSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ const AndroidBuilderEnvironmentSchema = Joi.object({
});

const IosBuilderEnvironmentSchema = Joi.object({
image: Joi.string()
.valid(...Ios.builderBaseImages)
.default('default'),
image: Joi.string().valid(...Ios.builderBaseImages),
node: Joi.string().empty(null).custom(semverSchemaCheck),
yarn: Joi.string().empty(null).custom(semverSchemaCheck),
bundler: Joi.string().empty(null).custom(semverSchemaCheck),
Expand Down Expand Up @@ -100,7 +98,7 @@ const IosManagedSchema = Joi.object({
cache: CacheSchema.default(),
}).concat(IosBuilderEnvironmentSchema);

const schemaBuildProfileMap: Record<string, Record<string, Joi.Schema>> = {
export const schemaBuildProfileMap: Record<string, Record<string, Joi.Schema>> = {
android: {
generic: AndroidGenericSchema,
managed: AndroidManagedSchema,
Expand All @@ -111,7 +109,7 @@ const schemaBuildProfileMap: Record<string, Record<string, Joi.Schema>> = {
},
};

const EasJsonSchema = Joi.object({
export const EasJsonSchema = Joi.object({
builds: Joi.object({
android: Joi.object().pattern(
Joi.string(),
Expand All @@ -127,5 +125,3 @@ const EasJsonSchema = Joi.object({
),
}),
});

export { EasJsonSchema, schemaBuildProfileMap };
3 changes: 0 additions & 3 deletions packages/eas-json/src/__tests__/EasJsonReader-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ test('minimal valid ios eas.json', async () => {
autoIncrement: false,
env: {},
cache: { disabled: false, cacheDefaultPaths: true, customPaths: [] },
image: 'default',
},
},
}).toEqual(easJson);
Expand Down Expand Up @@ -94,7 +93,6 @@ test('minimal valid eas.json for both platforms', async () => {
autoIncrement: false,
env: {},
cache: { disabled: false, cacheDefaultPaths: true, customPaths: [] },
image: 'default',
},
},
}).toEqual(easJson);
Expand Down Expand Up @@ -165,7 +163,6 @@ test('valid eas.json for development client builds', async () => {
distribution: 'store',
autoIncrement: false,
env: {},
image: 'default',
cache: { disabled: false, cacheDefaultPaths: true, customPaths: [] },
buildType: 'development-client',
},
Expand Down
7 changes: 0 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1924,13 +1924,6 @@
dependencies:
"@hapi/joi" "^17.1.1"

"@expo/eas-build-job@0.2.37":
version "0.2.37"
resolved "https://registry.yarnpkg.com/@expo/eas-build-job/-/eas-build-job-0.2.37.tgz#fd6cb911e33774239d1ab7662c0ccc8efa22f7a2"
integrity sha512-B9gahwTTYs0pWQP2HnfYWcbsqmUIAdnr+iwounVqpcxHhERxGJby2JEw+Vxtl2+VMARM4w9RLgNduP5Vk/zeQw==
dependencies:
"@hapi/joi" "^17.1.1"

"@expo/image-utils@0.3.14":
version "0.3.14"
resolved "https://registry.yarnpkg.com/@expo/image-utils/-/image-utils-0.3.14.tgz#eea0d59c5845e8b19504011c20afd837c5d044c5"
Expand Down