clients/android: handle missing keystore.properties in docker-based build

Signed-off-by: Sebastien Binet <binet@cern.ch>
This commit is contained in:
Sebastien Binet 2022-06-01 13:54:06 +02:00 committed by Brad Fitzpatrick
parent e5fbf88029
commit 60bd47b272
1 changed files with 16 additions and 2 deletions

View File

@ -65,8 +65,22 @@ func buildApp() {
}
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
log.Fatalf("Error building Android app: %v", err)
if _, err := os.ReadFile("./keystore.properties"); err != nil {
// no keystore.
// generate one that's in line with the one from devenv/Dockerfile.
const keystore = `## Code generated by perkeep; DO NOT EDIT.
storeFile=/home/gopher/keystore
storePassword=gopher
keyAlias=perkeep
keyPassword=gopher
`
err = os.WriteFile("./keystore.properties", []byte(keystore), 0644)
if err != nil {
log.Fatalf("could not write default keystore.properties: %+v", err)
}
defer os.Remove("./keystore.properties")
}
}