mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-15 22:32:19 +03:00
Merge pull request #1676 from edwinb/inc-fix
Need --script for incrementally compiled apps
This commit is contained in:
commit
b05ec6eff5
@ -19,6 +19,7 @@
|
||||
half as good. The `--whole-program` flag overrides incremental compilation,
|
||||
and reverts to whole program compilation. Incremental compilation is currently
|
||||
supported only by the Chez Scheme back end.
|
||||
This is currently supported only on Unix-like platforms (not yet Windows)
|
||||
|
||||
### Library Changes
|
||||
|
||||
|
@ -85,7 +85,9 @@ findLibs ds
|
||||
|
||||
schHeader : String -> List String -> Bool -> String
|
||||
schHeader chez libs whole
|
||||
= (if os /= "windows" then "#!" ++ chez ++ " --program\n\n" else "") ++
|
||||
= (if os /= "windows"
|
||||
then "#!" ++ chez ++ (if whole then " --program\n\n" else " --script\n\n")
|
||||
else "") ++
|
||||
"; " ++ (generatedString "Chez") ++ "\n" ++
|
||||
"(import (chezscheme))\n" ++
|
||||
"(case (machine-type)\n" ++
|
||||
@ -581,6 +583,8 @@ compileExpr : Bool -> Ref Ctxt Defs -> (tmpDir : String) -> (outputDir : String)
|
||||
compileExpr makeitso c tmpDir outputDir tm outfile
|
||||
= do s <- getSession
|
||||
if not (wholeProgram s) && (Chez `elem` incrementalCGs !getSession)
|
||||
-- Disable on Windows, for now, since it doesn't work!
|
||||
&& os /= "windows"
|
||||
then compileExprInc makeitso c tmpDir outputDir tm outfile
|
||||
else compileExprWhole makeitso c tmpDir outputDir tm outfile
|
||||
|
||||
@ -596,7 +600,12 @@ executeExpr c tmpDir tm
|
||||
incCompile : Ref Ctxt Defs ->
|
||||
(sourceFile : String) -> Core (Maybe (String, List String))
|
||||
incCompile c sourceFile
|
||||
= do ssFile <- getTTCFileName sourceFile "ss"
|
||||
= do -- Disable on Windows, for now, since it doesn't work!
|
||||
-- When re-enabling it, please also turn it back on in test chez033
|
||||
let True = os /= "windows"
|
||||
| False => pure Nothing
|
||||
|
||||
ssFile <- getTTCFileName sourceFile "ss"
|
||||
soFile <- getTTCFileName sourceFile "so"
|
||||
soFilename <- getObjFileName sourceFile "so"
|
||||
cdata <- getIncCompileData False Cases
|
||||
|
@ -213,7 +213,7 @@ chezTests = MkTestPool "Chez backend" [] (Just Chez)
|
||||
, "chez013", "chez014", "chez015", "chez016", "chez017", "chez018"
|
||||
, "chez019", "chez020", "chez021", "chez022", "chez023", "chez024"
|
||||
, "chez025", "chez026", "chez027", "chez028", "chez029", "chez030"
|
||||
, "chez031", "chez032"
|
||||
, "chez031", "chez032", "chez033"
|
||||
, "futures001"
|
||||
, "bitops"
|
||||
, "casts"
|
||||
|
4
tests/chez/chez033/Main.idr
Normal file
4
tests/chez/chez033/Main.idr
Normal file
@ -0,0 +1,4 @@
|
||||
import Mod
|
||||
|
||||
main : IO ()
|
||||
main = printLn (fn (100 * 100))
|
5
tests/chez/chez033/Mod.idr
Normal file
5
tests/chez/chez033/Mod.idr
Normal file
@ -0,0 +1,5 @@
|
||||
module Mod
|
||||
|
||||
export
|
||||
fn : Nat -> Nat
|
||||
fn x = S x
|
4
tests/chez/chez033/expected
Normal file
4
tests/chez/chez033/expected
Normal file
@ -0,0 +1,4 @@
|
||||
1/2: Building Mod (Mod.idr)
|
||||
2/2: Building Main (Main.idr)
|
||||
Main> 10001
|
||||
Main> Bye for now!
|
2
tests/chez/chez033/input
Normal file
2
tests/chez/chez033/input
Normal file
@ -0,0 +1,2 @@
|
||||
:exec main
|
||||
:q
|
9
tests/chez/chez033/run
Normal file
9
tests/chez/chez033/run
Normal file
@ -0,0 +1,9 @@
|
||||
if [ "$OS" = "windows" ]; then
|
||||
# incremental builds don't work on windows so we get lots of warnings,
|
||||
# but we still need the test output to be correct
|
||||
$1 --no-banner --no-color --console-width 0 Main.idr < input
|
||||
else
|
||||
$1 --no-banner --no-color --console-width 0 Main.idr --inc chez < input
|
||||
fi
|
||||
|
||||
rm -rf build
|
Loading…
Reference in New Issue
Block a user