-
Notifications
You must be signed in to change notification settings - Fork 478
[expo-cli] Allow manually provided credentials when keytool is missing #2662
[expo-cli] Allow manually provided credentials when keytool is missing #2662
Conversation
eb24854
to
c203d03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC, we are passing in additional options into the UpdateKeystore
constructor because we expect different behaviours in credentials:manager
vs build:android
.
In the event the user doesn't have the keytool
binary, we want:
credentials:manager
to throw, because the user is specifically asking for client side generation of Keystorebuild:android
to return null, because we will generate a Keystore for the user on the Expo servers.
const providedKeystore = await askForUserProvided(keystoreSchema); | ||
if (providedKeystore) { | ||
return providedKeystore; | ||
} else if (this.options.optionalKeystoreGeneration && !(await keytoolCommandExists())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else if (this.options.optionalKeystoreGeneration && !(await keytoolCommandExists())) { | |
} | |
const userHasKeytoolCommand = await keytoolCommandExists(); | |
if (!userHasKeytoolCommand) { | |
if (this.options.bestEffortKeystoreGeneration) { | |
// we tried our best to generate the keystore on the client side | |
return null; | |
} | |
throw new Error('The keytool binary is not installed. A Keystore will be generated on the Expo servers during your next build.'); | |
} |
@@ -13,24 +14,48 @@ import { askForUserProvided } from '../actions/promptForCredentials'; | |||
import { Context, IView } from '../context'; | |||
import { Keystore, keystoreSchema } from '../credentials'; | |||
|
|||
interface UpdateKeystoreOptions { | |||
optionalKeystoreGeneration: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optionalKeystoreGeneration: boolean; | |
bestEffortKeystoreGeneration: boolean; // don't error if user doesn't have the binaries to generate a Keystore |
If I did not miss anything this code has the same exact behaviour as with your changes. The only difference is that I'm throwing an error when cli attempts to generate Keystore and with your changes, it's happening based on
|
c203d03
to
ec9726b
Compare
@wkozyra95 ok sounds good to me, just wanted to make sure we were not missing anything! |
Why
When keytool was missing update process was stopped before the user had a chance to select the option to manually provide credentials.
How
Move
keytool
check to later stageTest plan
Remove
keytool
and runexpo build:android -c