only one more source file to go before the android webapp links.. but not tonight

This commit is contained in:
Joey Hess 2013-04-17 01:32:05 -04:00
parent 9fdca995de
commit 82dfd632af
4 changed files with 198 additions and 140 deletions

View file

@ -174,7 +174,7 @@ android: Build/EvilSplicer
# and not overwritten.)
cp -uR tmp/splices/* tmp/androidtree
# Some additional dependencies needed by the expanded splices.
sed -i 's/^ Build-Depends: / Build-Depends: yesod-routes, yesod-core, shakespeare-css, shakespeare-js, shakespeare, blaze-markup, /' tmp/androidtree/git-annex.cabal
sed -i 's/^ Build-Depends: / Build-Depends: yesod-routes, yesod-core, shakespeare-css, shakespeare-js, shakespeare, blaze-markup, file-embed, wai-app-static, /' tmp/androidtree/git-annex.cabal
# Avoid warnings due to sometimes unused imports added for the splices.
sed -i 's/-Wall/-Wall -fno-warn-unused-imports/' tmp/androidtree/git-annex.cabal
# Cabal cannot cross compile with custom build type, so workaround.

View file

@ -6,6 +6,7 @@
- ** DO NOT COMMIT **
-}
import qualified Data.Monoid
import qualified Data.Map
import qualified Data.Foldable
import qualified Data.Text
import qualified Data.Text.Lazy.Builder
@ -16,6 +17,9 @@ import qualified Text.Css
import qualified "blaze-markup" Text.Blaze.Internal
import qualified Yesod.Widget
import qualified Yesod.Routes.TH.Types
import qualified Yesod.Routes.Dispatch
import qualified WaiAppStatic.Storage.Embedded
import qualified Data.FileEmbed
{- End EvilSplicer headers. -}

View file

@ -0,0 +1,193 @@
From 256ff157005f44c97fa5affe2ed9655815b3788e Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@kitenet.net>
Date: Mon, 15 Apr 2013 12:38:22 -0400
Subject: [PATCH] remove TH and export one symbol used by TH
---
Data/.FileEmbed.hs.swp | Bin 16384 -> 0 bytes
Data/FileEmbed.hs | 80 +++----------------------------------------------
2 files changed, 4 insertions(+), 76 deletions(-)
delete mode 100644 Data/.FileEmbed.hs.swp
diff --git a/Data/.FileEmbed.hs.swp b/Data/.FileEmbed.hs.swp
deleted file mode 100644
index 1b2ddbfaa71697e9df3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t(zeFDmK?6|dF8x(Pv&6-7o7z1H^=
zp6{&cwkmJVy<FA2MmHEb1$q6m6XD@QA8E7YE00EW0TI_bq#a>o6NW|1E4~>r)#MRJ
zMs<S%zBC7Z9QQSC1tU_;QFbbuCq3#WvdOJL2+xhDgx~}mEu$Wk^qov(%qEezmx$W1
zARZXtyuDeML&nADtV`s|bt>2LC=hGcn)&p|kwa&PDJQgEt$EO3jZUuIaqSKi^9_lz
z9hWDvK4Heq9I<p$5b<H0AC0Nv(9@6J#<6O?9MBhJS$c?1$`2tJ({qyV`Zg=dz?jDA
zI%FLM82bu1%(xZ5BBIDW(h77&6yq6+*+fEI<Dg6&2a2*eNY0hd>f<{sAr2sLAk_D|
z`qc+J6D-CzXMwU2H^e;Cr|*ba{SoCH#C(s9#asr$L<aeZ%jg>#<yG9U%QsA@jlbq-
zVmD{{!*M8LFw8#`bk_k6DC6o_$TW{HhA_3Xr+|~_=du%-O(ufrT|dkaU2AGbJCF*)
k07GoDCUU!rsE!Us=xSj*161jGRmD&g5~lU!(k&JL0(zanmH+?%
diff --git a/Data/FileEmbed.hs b/Data/FileEmbed.hs
index 66f7004..f8c98c9 100644
--- a/Data/FileEmbed.hs
+++ b/Data/FileEmbed.hs
@@ -1,31 +1,15 @@
-{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE CPP #-}
module Data.FileEmbed
( -- * Embed at compile time
- embedFile
- , embedDir
- , getDir
+ getDir
-- * Inject into an executable
-#if MIN_VERSION_template_haskell(2,5,0)
- , dummySpace
-#endif
, inject
, injectFile
+
+ -- used by TH (pointlessly)
+ , stringToBs
) where
-import Language.Haskell.TH.Syntax
- ( Exp (AppE, ListE, LitE, TupE, SigE)
-#if MIN_VERSION_template_haskell(2,5,0)
- , Lit (StringL, StringPrimL, IntegerL)
-#else
- , Lit (StringL, IntegerL)
-#endif
- , Q
- , runIO
-#if MIN_VERSION_template_haskell(2,7,0)
- , Quasi(qAddDependentFile)
-#endif
- )
import System.Directory (doesDirectoryExist, doesFileExist,
getDirectoryContents)
import Control.Monad (filterM)
@@ -37,51 +21,12 @@ import Data.ByteString.Unsafe (unsafePackAddressLen)
import System.IO.Unsafe (unsafePerformIO)
import System.FilePath ((</>))
--- | Embed a single file in your source code.
---
--- > import qualified Data.ByteString
--- >
--- > myFile :: Data.ByteString.ByteString
--- > myFile = $(embedFile "dirName/fileName")
-embedFile :: FilePath -> Q Exp
-embedFile fp =
-#if MIN_VERSION_template_haskell(2,7,0)
- qAddDependentFile fp >>
-#endif
- (runIO $ B.readFile fp) >>= bsToExp
-
--- | Embed a directory recusrively in your source code.
---
--- > import qualified Data.ByteString
--- >
--- > myDir :: [(FilePath, Data.ByteString.ByteString)]
--- > myDir = $(embedDir "dirName")
-embedDir :: FilePath -> Q Exp
-embedDir fp = do
- typ <- [t| [(FilePath, B.ByteString)] |]
- e <- ListE <$> ((runIO $ fileList fp) >>= mapM (pairToExp fp))
- return $ SigE e typ
-
-- | Get a directory tree in the IO monad.
--
-- This is the workhorse of 'embedDir'
getDir :: FilePath -> IO [(FilePath, B.ByteString)]
getDir = fileList
-pairToExp :: FilePath -> (FilePath, B.ByteString) -> Q Exp
-pairToExp _root (path, bs) = do
-#if MIN_VERSION_template_haskell(2,7,0)
- qAddDependentFile $ _root ++ '/' : path
-#endif
- exp' <- bsToExp bs
- return $! TupE [LitE $ StringL path, exp']
-
-bsToExp :: B.ByteString -> Q Exp
-bsToExp bs = do
- helper <- [| stringToBs |]
- let chars = B8.unpack bs
- return $! AppE helper $! LitE $! StringL chars
-
stringToBs :: String -> B.ByteString
stringToBs = B8.pack
@@ -123,23 +68,6 @@ padSize i =
let s = show i
in replicate (sizeLen - length s) '0' ++ s
-#if MIN_VERSION_template_haskell(2,5,0)
-dummySpace :: Int -> Q Exp
-dummySpace space = do
- let size = padSize space
- let start = magic ++ size
- let chars = LitE $ StringPrimL $
-#if MIN_VERSION_template_haskell(2,6,0)
- map (toEnum . fromEnum) $
-#endif
- start ++ replicate space '0'
- let len = LitE $ IntegerL $ fromIntegral $ length start + space
- upi <- [|unsafePerformIO|]
- pack <- [|unsafePackAddressLen|]
- getInner' <- [|getInner|]
- return $ getInner' `AppE` (upi `AppE` (pack `AppE` len `AppE` chars))
-#endif
-
inject :: B.ByteString -- ^ bs to inject
-> B.ByteString -- ^ original BS containing dummy
-> Maybe B.ByteString -- ^ new BS, or Nothing if there is insufficient dummy space
--
1.8.2.rc3

View file

@ -1,139 +0,0 @@
From 2e6f4a373fc05968e6dadcc49185d64a69eeddf4 Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@kitenet.net>
Date: Mon, 15 Apr 2013 12:38:22 -0400
Subject: [PATCH] remove TH
---
Data/.FileEmbed.hs.swp | Bin 4096 -> 0 bytes
Data/FileEmbed.hs | 77 +------------------------------------------------
2 files changed, 1 insertion(+), 76 deletions(-)
delete mode 100644 Data/.FileEmbed.hs.swp
diff --git a/Data/.FileEmbed.hs.swp b/Data/.FileEmbed.hs.swp
deleted file mode 100644
index 7570045ca90875097c2d56ba885d26dcf344bc27..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 4096
zcmYc?2=nw+FxN9?00IF9h8Ufkz&R6G7!1T17_#zHD?!49Kzd#&Athk>I*@_-X_+~x
zx~aKIsVTY!dIowXdgl5ri6x2pZa{HYkg#4xF;T{iDjE%e(GVau1WHTNbS-!pjExKp
sl$8_}goQ$h)j6teGz3ONU^E0qLtr!nMnhmU1V%$(Gz3ONV3>pe0P*q}cmMzZ
diff --git a/Data/FileEmbed.hs b/Data/FileEmbed.hs
index 66f7004..b15e331 100644
--- a/Data/FileEmbed.hs
+++ b/Data/FileEmbed.hs
@@ -1,31 +1,12 @@
-{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE CPP #-}
module Data.FileEmbed
( -- * Embed at compile time
- embedFile
- , embedDir
- , getDir
+ getDir
-- * Inject into an executable
-#if MIN_VERSION_template_haskell(2,5,0)
- , dummySpace
-#endif
, inject
, injectFile
) where
-import Language.Haskell.TH.Syntax
- ( Exp (AppE, ListE, LitE, TupE, SigE)
-#if MIN_VERSION_template_haskell(2,5,0)
- , Lit (StringL, StringPrimL, IntegerL)
-#else
- , Lit (StringL, IntegerL)
-#endif
- , Q
- , runIO
-#if MIN_VERSION_template_haskell(2,7,0)
- , Quasi(qAddDependentFile)
-#endif
- )
import System.Directory (doesDirectoryExist, doesFileExist,
getDirectoryContents)
import Control.Monad (filterM)
@@ -37,51 +18,12 @@ import Data.ByteString.Unsafe (unsafePackAddressLen)
import System.IO.Unsafe (unsafePerformIO)
import System.FilePath ((</>))
--- | Embed a single file in your source code.
---
--- > import qualified Data.ByteString
--- >
--- > myFile :: Data.ByteString.ByteString
--- > myFile = $(embedFile "dirName/fileName")
-embedFile :: FilePath -> Q Exp
-embedFile fp =
-#if MIN_VERSION_template_haskell(2,7,0)
- qAddDependentFile fp >>
-#endif
- (runIO $ B.readFile fp) >>= bsToExp
-
--- | Embed a directory recusrively in your source code.
---
--- > import qualified Data.ByteString
--- >
--- > myDir :: [(FilePath, Data.ByteString.ByteString)]
--- > myDir = $(embedDir "dirName")
-embedDir :: FilePath -> Q Exp
-embedDir fp = do
- typ <- [t| [(FilePath, B.ByteString)] |]
- e <- ListE <$> ((runIO $ fileList fp) >>= mapM (pairToExp fp))
- return $ SigE e typ
-
-- | Get a directory tree in the IO monad.
--
-- This is the workhorse of 'embedDir'
getDir :: FilePath -> IO [(FilePath, B.ByteString)]
getDir = fileList
-pairToExp :: FilePath -> (FilePath, B.ByteString) -> Q Exp
-pairToExp _root (path, bs) = do
-#if MIN_VERSION_template_haskell(2,7,0)
- qAddDependentFile $ _root ++ '/' : path
-#endif
- exp' <- bsToExp bs
- return $! TupE [LitE $ StringL path, exp']
-
-bsToExp :: B.ByteString -> Q Exp
-bsToExp bs = do
- helper <- [| stringToBs |]
- let chars = B8.unpack bs
- return $! AppE helper $! LitE $! StringL chars
-
stringToBs :: String -> B.ByteString
stringToBs = B8.pack
@@ -123,23 +65,6 @@ padSize i =
let s = show i
in replicate (sizeLen - length s) '0' ++ s
-#if MIN_VERSION_template_haskell(2,5,0)
-dummySpace :: Int -> Q Exp
-dummySpace space = do
- let size = padSize space
- let start = magic ++ size
- let chars = LitE $ StringPrimL $
-#if MIN_VERSION_template_haskell(2,6,0)
- map (toEnum . fromEnum) $
-#endif
- start ++ replicate space '0'
- let len = LitE $ IntegerL $ fromIntegral $ length start + space
- upi <- [|unsafePerformIO|]
- pack <- [|unsafePackAddressLen|]
- getInner' <- [|getInner|]
- return $ getInner' `AppE` (upi `AppE` (pack `AppE` len `AppE` chars))
-#endif
-
inject :: B.ByteString -- ^ bs to inject
-> B.ByteString -- ^ original BS containing dummy
-> Maybe B.ByteString -- ^ new BS, or Nothing if there is insufficient dummy space
--
1.8.2.rc3