@@ -11,6 +11,7 @@ import Control.Monad.Catch (Exception (displayException), MonadThrow, throwM, tr
1111import Control.Monad.IO.Class (liftIO)
1212import Data.Bits
1313import Data.Default
14+import Data.List (isSuffixOf)
1415import qualified Data.Map as Map
1516import Data.Maybe
1617import qualified Data.Text as T
@@ -168,15 +169,20 @@ deployMobile platform mobileArgs = withProjectRoot "." $ \root -> do
168169 -- if it doesn't, create the directory and...
169170 liftIO $ createDirectoryIfMissing (not androidDirExist) signKeyDir
170171 liftIO $ print $ "starting keytool..."
171− -- TODO: ... run keytool command if there isn't a file (what should the name of the file be?) located at config/android
172− res <- liftIO $ readCreateProcess (proc "nix-shell"
173− [ ".obelisk/impl/default.nix"
174− , "-A"
175− , "nixpkgs.jdk"
176− , "--run"
177− , "\"keytool -genkey -v -keystore myandroidkey.jks -keyalg RSA -keysize 2048 -validity 10000 -alias myandroidalias\""
178− ]) ""
179− liftIO $ print res
172+ -- ... run keytool command if there isn't a file (what should the name of the file be?) located at config/android
173+ searchResults <- liftIO $ findFileWith (\fp -> return $ isSuffixOf ".jks" fp) [signKeyDir] "signKey"
174+ case searchResults of
175+ Nothing -> do
176+ let impl = toImplDir "."
177+ res <- liftIO $ readCreateProcess (proc "nix-shell"
178+ [ impl
179+ , "-A"
180+ , "nixpkgs.jdk"
181+ , "--run"
182+ , "\"keytool -genkey -v -keystore myandroidkey.jks -keyalg RSA -keysize 2048 -validity 10000 -alias myandroidalias\""
183+ ]) ""
184+ liftIO $ print res
185+ _ -> return ()
180186 result <- nixBuildAttrWithCache srcDir $ platform <> ".frontend"
181187 callProcessAndLogOutput (Notice, Error) $ proc (result </> "bin" </> "deploy") mobileArgs
182188