Skip to content

Commit 6fc4152

Browse files
committed
ENG-14518 Add keystoreName field to build profile
1 parent 6a55c65 commit 6fc4152

File tree

5 files changed

+39
-1
lines changed

5 files changed

+39
-1
lines changed

packages/eas-cli/src/build/android/build.ts

+1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ async function ensureAndroidCredentialsAsync(
151151
ctx.android.gradleContext
152152
);
153153
const provider = new AndroidCredentialsProvider(ctx.credentialsCtx, {
154+
name: ctx.buildProfile.keystoreName,
154155
app: {
155156
account: nullthrows(
156157
ctx.user.accounts.find(a => a.name === ctx.accountName),

packages/eas-cli/src/credentials/android/AndroidCredentialsProvider.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export interface AndroidCredentials {
1515

1616
interface Options {
1717
app: AppLookupParams;
18+
name?: string;
1819
}
1920

2021
export default class AndroidCredentialsProvider {
@@ -37,7 +38,7 @@ export default class AndroidCredentialsProvider {
3738
}
3839

3940
private async getRemoteAsync(): Promise<AndroidCredentials> {
40-
const setupBuildCredentialsAction = new SetUpBuildCredentials({ app: this.options.app });
41+
const setupBuildCredentialsAction = new SetUpBuildCredentials(this.options);
4142
const buildCredentials = await setupBuildCredentialsAction.runAsync(this.ctx);
4243
return this.toAndroidCredentials(buildCredentials);
4344
}

packages/eas-json/src/__tests__/buildProfiles-test.ts

+26
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,32 @@ test('valid eas.json with specified environment', async () => {
129129
});
130130
});
131131

132+
test('valid eas.json with specified keystoreName', async () => {
133+
const keystoreName = 'this-is-a-keystore-name';
134+
await fs.writeJson('/project/eas.json', {
135+
build: {
136+
development: {
137+
android: {
138+
keystoreName,
139+
},
140+
},
141+
},
142+
});
143+
144+
const accessor = EasJsonAccessor.fromProjectPath('/project');
145+
const androidProfile = await EasJsonUtils.getBuildProfileAsync(
146+
accessor,
147+
Platform.ANDROID,
148+
'development'
149+
);
150+
151+
expect(androidProfile).toEqual(
152+
expect.objectContaining({
153+
keystoreName,
154+
})
155+
);
156+
});
157+
132158
test('valid eas.json with top level withoutCredentials property', async () => {
133159
await fs.writeJson('/project/eas.json', {
134160
build: {

packages/eas-json/src/build/schema.ts

+8
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ const AndroidBuildProfileSchema = PlatformBuildProfileSchema.concat(
101101
Joi.boolean(),
102102
Joi.string().valid('version', 'versionCode')
103103
),
104+
105+
keystoreName: Joi.when('credentialsSource', {
106+
is: 'remote',
107+
then: Joi.string(),
108+
otherwise: Joi.forbidden().messages({
109+
'any.unknown': 'keystoreName is not allowed when credentialsSource is not remote',
110+
}),
111+
}),
104112
})
105113
);
106114

packages/eas-json/src/build/types.ts

+2
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ export interface AndroidBuildProfile extends PlatformBuildProfile {
9393

9494
// versions
9595
autoIncrement?: AndroidVersionAutoIncrement;
96+
97+
keystoreName?: string;
9698
}
9799

98100
export interface IosBuildProfile extends PlatformBuildProfile {

0 commit comments

Comments
 (0)