@@ -172,20 +172,6 @@ deployPush deployPath getNixBuilders = do
172172deployUpdate :: MonadObelisk m => FilePath -> m ()
173173deployUpdate deployPath = updateThunkToLatest (deployPath </> "src") Nothing
174174
175−keytoolToAndroidConfig :: KeytoolConfig -> HM.HashMap Text (NValue t Identity m)
176−keytoolToAndroidConfig conf =
177− let path = nvPath $ _keytoolConfig_keystore conf
178− fromStr = nvStr . principledMakeNixStringWithoutContext . T.pack
179− storepass = fromStr $ _keytoolConfig_storepass conf
180− alias = fromStr $ _keytoolConfig_alias conf
181− keypass = fromStr $ _keytoolConfig_keypass conf
182− in HM.fromList
183− [ ("storeFile", path)
184− , ("storePassword", storepass)
185− , ("keyAlias", alias)
186− , ("keyPassword", keypass)
187− ]
188−
189175data PlatformDeployment = Android | IOS
190176 deriving (Show, Eq)
191177
@@ -200,7 +186,7 @@ deployMobile platform mobileArgs = withProjectRoot "." $ \root -> do
200186 configDir = root </> "config"
201187 exists <- liftIO $ doesDirectoryExist srcDir
202188 unless exists $ failWith "ob test should be run inside of a deploy directory"
203− nixBuildTarget <- case platform of
189+ (nixBuildTarget, extraArgs) <- case platform of
204190 Android -> do
205191 let keystorePath = root </> "android_keystore.jks"
206192 keytoolConfPath = root </> "android_keytool_config.json"
@@ -225,38 +211,43 @@ deployMobile platform mobileArgs = withProjectRoot "." $ \root -> do
225211 unless checkKeytoolConfExist $ failWith "Missing android KeytoolConfig"
226212 keytoolConfContents <- liftIO $ BSL.readFile keytoolConfPath
227213 liftIO $ print keytoolConfContents
228− releaseKey :: String <- case eitherDecode keytoolConfContents :: Either String KeytoolConfig of
214+ keyArgs <- case eitherDecode keytoolConfContents :: Either String KeytoolConfig of
229215 Left err -> failWith $ T.pack err
230− Right conf -> return $
231− (printNix :: MonadObelisk m => NValue t Identity m -> String) $
232− nvSet (keytoolToAndroidConfig conf) HM.empty
233− let expr = mconcat
216+ Right conf -> [ "--sign"
217+ , "--store-file", _keytoolConfig_keystore conf
218+ , "--store-password", _keytoolConfig_storepass conf
219+ , "--key-alias", _keytoolConfig_alias conf
220+ , "--key-password", _keytoolConfig_keypass conf]
221+ let expr = unlines
234222 [ "with (import ", srcDir, " {});"
235− , "android.frontend.override (drv: { "
236− , "releaseKey = (if builtins.isNull drv.releaseKey then {} else drv.releaseKey) // " <> releaseKey <> "; "
237− , "staticSrc = (passthru.__androidWithConfig ", configDir, ").frontend.staticSrc;"
223+ , "android.frontend.override (drv: {"
224+ , " isRelease = true;"
225+ , " staticSrc = (passthru.__androidWithConfig ", configDir, ").frontend.staticSrc;"
238226 , "})"
239227 ]
240− return $ Target
228+ return (Target
241229 { _target_path = Nothing
242230 , _target_attr = Nothing
243231 , _target_expr = Just expr
244− }
232+ }, keyArgs)
245233 IOS -> do
246234 let expr = mconcat
247235 [ "with (import ", srcDir, " {});"
248236 , "ios.frontend.override (_: { staticSrc = (passthru.__iosWithConfig ", configDir, ").frontend.staticSrc; })"
249237 ]
250− return $ Target
238+ return (Target
251239 { _target_path = Nothing
252240 , _target_attr = Nothing
253241 , _target_expr = Just expr
254− }
242+ }, [])
255243 result <- nixCmd $ NixCmd_Build $ def
256244 & nixBuildConfig_outLink .~ OutLink_None
257245 & nixCmdConfig_target .~ nixBuildTarget
258− putLog Notice $ T.pack $ "Your recently built android apk can be found at the following path: " <> show result
259− callProcessAndLogOutput (Notice, Error) $ proc (result </> "bin" </> "deploy") mobileArgs
246+ let mobileArtifact = case platform of
247+ IOS -> "iOS App"
248+ Android -> "Android APK"
249+ in putLog Notice $ T.pack $ unwords ["Your recently built", mobileArtifact, "can be found at the following path:", show result]
250+ callProcessAndLogOutput (Notice, Error) $ proc (result </> "bin" </> "deploy") (mobileArgs ++ extraArgs)
260251 where
261252 withEcho showEcho f = do
262253 prevEcho <- hGetEcho stdin