on master help sign in
Handle apk signing on ob deploy

by setting releaseKey values from auto generated keystore and config values

commitaa0f44d9390568a2ce05348695b8ef89875fb3ea authorLuigy Leon <luichi.19@gmail.com> dateMon 5 Nov 2018, 20:08 (8 years ago) parent785c9cc
1 file changed+14−2
lib/command/src/Obelisk/Command/Deploy.hs+14−2
lib/command/src/Obelisk/Command/Deploy.hs+14−2
@@ -169,8 +169,20 @@ deployMobile platform mobileArgs = withProjectRoot "." $ \root -> do
169169 , _keytoolConfig_storepass = "obelisk"
170170 , _keytoolConfig_dname = "CN=mqttserver.ibm.com, OU=ID, O=IBM, L=Hursley, S=Hants, C=GB" -- TODO Read these from config?
171171 }
172− result <- nixBuildAttrWithCache srcDir $ platform <> ".frontend"
173− callProcessAndLogOutput (Notice, Error) $ proc (result </> "bin" </> "deploy") mobileArgs
172+ let releaseKey = renderAttrset $ Map.fromList
173+ [ ("storeFile", NValue_Path keystorePath)
174+ , ("storePassword", NValue_Text "obelisk")
175+ , ("keyAlias", NValue_Text "obelisk")
176+ , ("keyPassword", NValue_Text "obelisk")
177+ ]
178+ result <- nixCmd $ NixCmd_Build $ def
179+ & nixBuildConfig_outLink .~ OutLink_None
180+ & nixCmdConfig_target .~ Target
181+ { _target_path = Nothing
182+ , _target_attr = Nothing
183+ , _target_expr = Just $ "with (import " <> srcDir <> " {}); " <> platform <> ".frontend.override (drv: { releaseKey = (if builtins.isNull drv.releaseKey then {} else drv.releaseKey) // " <> T.unpack releaseKey <> "; })"
184+ }
185+ callProcessAndLogOutput (Notice, Error) $ proc (result </> "bin" </> "deploy") mobileArgs
174186
175187data KeytoolConfig = KeytoolConfig
176188 { _keytoolConfig_keystore :: FilePath