module System.Build.Scala.Scalac(
Fsc,
Scalac,
debug,
nowarn,
verbose,
deprecation,
unchecked,
classpath,
sourcepath,
bootclasspath,
extdirs,
directory,
encoding,
target,
print,
optimise,
explaintypes,
uniqid,
version,
help,
(?),
etc,
scalac,
scalac',
kscalac,
fscalac,
reset,
shutdown,
server,
flags,
fsc
) where
import Prelude hiding (print)
import System.Build.Args
import System.Build.Scala.Debug
import System.Build.Scala.Target
import System.Build.CompilePaths
import System.Build.Extensions
import System.Build.OutputDirectory
import System.Build.OutputReferenceSet
import System.Build.OutputReferenceGet
import System.Build.Command
import Control.Monad
import Data.List
import Data.Maybe
import System.FilePath
data Scalac = Scalac {
debug :: Maybe Debug,
nowarn :: Bool,
verbose :: Bool,
deprecation :: Bool,
unchecked :: Bool,
classpath :: [FilePath],
sourcepath :: [FilePath],
bootclasspath :: [FilePath],
extdirs :: [FilePath],
directory :: Maybe FilePath,
encoding :: Maybe String,
target :: Maybe Target,
print :: Bool,
optimise :: Bool,
explaintypes :: Bool,
uniqid :: Bool,
version :: Bool,
help :: Bool,
(?) :: Maybe FilePath,
etc :: Maybe String
}
scalac :: Scalac
scalac = Scalac Nothing False False False False [] [] [] [] Nothing Nothing Nothing False False False False False False Nothing Nothing
scalac' :: Maybe System.Build.Scala.Debug.Debug
-> Bool
-> Bool
-> Bool
-> Bool
-> [FilePath]
-> [FilePath]
-> [FilePath]
-> [FilePath]
-> Maybe FilePath
-> Maybe String
-> Maybe Target
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> Bool
-> Maybe FilePath
-> Maybe String
-> Scalac
scalac' = Scalac
kscalac :: Scalac -> [String]
kscalac (Scalac debug'
nowarn'
verbose'
deprecation'
unchecked'
classpath'
sourcepath'
bootclasspath'
extdirs'
directory'
encoding'
target'
print'
optimise'
explaintypes'
uniqid'
version'
help'
script'
etc') = ["g" -~> debug',
"nowarn" ~~ nowarn',
"verbose" ~~ verbose',
"deprecation" ~~ deprecation',
"unchecked" ~~ unchecked',
"classpath" ~: classpath',
"sourcepath" ~: sourcepath',
"bootclasspath" ~: bootclasspath',
"extdirs" ~: extdirs',
"d" ~~> directory',
"encoding" ~~> encoding',
"target" -~> target',
"print" ~~ print',
"optimise" ~~ optimise',
"explaintypes" ~~ explaintypes',
"uniqid" ~~ uniqid',
"version" ~~ version',
"help" ~~ help',
(:) '@' ~? script',
fromMaybe [] etc']
instance Show Scalac where
show s = kscalac s ^^^ " "
instance CompilePaths Scalac where
j =>> ps = show j ++ ' ' : space ps
instance Extensions Scalac where
exts _ = ["java", "scala"]
instance OutputDirectory Scalac where
outdir = directory
instance OutputReferenceSet Scalac where
setReference p j = j { classpath = p }
instance OutputReferenceGet Scalac where
getReference = classpath
instance Command Scalac where
command _ = let envs = [
("SCALA_HOME", (</> "bin" </> "scalac")),
("SCALAC", id)
]
in fromMaybe "scalac" `fmap` tryEnvs envs
data Fsc = Fsc {
fscalac :: Scalac,
reset :: Bool,
shutdown :: Bool,
server :: Maybe (String, String),
flags :: [String]
}
instance Show Fsc where
show (Fsc fscalac' reset' shutdown' server' flags') = (kscalac fscalac' ++ ["reset" ~~ reset', "shutdown" ~~ shutdown', maybe [] (uncurry (++)) server', intercalate " " (fmap ("-J" ++) flags')]) ^^^ " "
instance CompilePaths Fsc where
j =>> ps = show j ++ ' ' : space ps
instance Extensions Fsc where
exts _ = ["java", "scala"]
instance OutputDirectory Fsc where
outdir = directory . fscalac
instance OutputReferenceSet Fsc where
setReference p j = let s = fscalac j in j { fscalac = setReference p s }
instance OutputReferenceGet Fsc where
getReference = getReference . fscalac
instance Command Fsc where
command _ = let envs = [
("SCALA_HOME", (</> "bin" </> "fsc")),
("FSC", id)
]
in fromMaybe "fsc" `fmap` tryEnvs envs
fsc :: Fsc
fsc = Fsc scalac False False Nothing []