on master help sign in
WIP: add apk key creation during 'ob deploy test android'
commit09499b8a3761db93a22c5b81a671c00038baa5ab authorhsloan <ishaqsloan@gmail.com> dateWed 24 Oct 2018, 21:07 (8 years ago) parent8156480
1 file changed+17−1
lib/command/src/Obelisk/Command/Deploy.hs+17−1
lib/command/src/Obelisk/Command/Deploy.hs+17−1
@@ -19,7 +19,7 @@ import System.Directory
1919import System.Environment (getEnvironment)
2020import System.FilePath
2121import System.Posix.Files
22−import System.Process (delegate_ctlc, env, proc)
22+import System.Process (delegate_ctlc, env, proc, readCreateProcess)
2323import Text.URI (URI)
2424import qualified Text.URI as URI
2525import Text.URI.Lens
@@ -161,6 +161,22 @@ deployMobile platform mobileArgs = withProjectRoot "." $ \root -> do
161161 let srcDir = root </> "src"
162162 exists <- liftIO $ doesDirectoryExist srcDir
163163 unless exists $ failWith "ob test should be run inside of a deploy directory"
164+ when (platform == "android") $ do
165+ let signKeyDir = root </> "config/android"
166+ -- check to see if config/android/...jks exist
167+ androidDirExist <- liftIO $ doesDirectoryExist srcDir
168+ -- if it doesn't, create the directory and...
169+ liftIO $ createDirectoryIfMissing (not androidDirExist) signKeyDir
170+ 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
164180 result <- nixBuildAttrWithCache srcDir $ platform <> ".frontend"
165181 callProcessAndLogOutput (Notice, Error) $ proc (result </> "bin" </> "deploy") mobileArgs
166182