From 13230f15dbd65d8c0ed7836d73cf4e6033b12815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Tue, 25 Feb 2020 14:31:33 -0800 Subject: Execute ls --- package.yaml | 1 - src/Lib.hs | 9 ++++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/package.yaml b/package.yaml index fd12307..59b42e2 100644 --- a/package.yaml +++ b/package.yaml @@ -30,7 +30,6 @@ dependencies: - shake - split - library: source-dirs: src diff --git a/src/Lib.hs b/src/Lib.hs index d36ff27..f51f079 100644 --- a/src/Lib.hs +++ b/src/Lib.hs @@ -2,5 +2,12 @@ module Lib ( someFunc ) where +-- import Development.Shake (cmd) +import System.Process (callCommand) + + someFunc :: IO () -someFunc = putStrLn "someFunc" +someFunc = do + putStrLn "someFunc" + a <- callCommand "ls -l" + return () -- cgit v1.2.3 From 4fe447b38172b78a45e0b15277124f924b4bd29a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Tue, 25 Feb 2020 14:33:03 -0800 Subject: Call someFunc from the test --- test/Spec.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/Spec.hs b/test/Spec.hs index cd4753f..a1a07c6 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -1,2 +1,4 @@ +import Lib (someFunc) + main :: IO () -main = putStrLn "Test suite not yet implemented" +main = someFunc -- cgit v1.2.3 From 42a48dc4b2298ab8601b5df0554792d777f3d3f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Tue, 25 Feb 2020 14:41:33 -0800 Subject: Add a Fortran test code --- test/test1.f90 | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 test/test1.f90 diff --git a/test/test1.f90 b/test/test1.f90 new file mode 100644 index 0000000..f577b58 --- /dev/null +++ b/test/test1.f90 @@ -0,0 +1,8 @@ +program test1 +implicit none +integer :: i +i = 5+5 +print *, i +print *, "Fortran test code executed" +print *, "TESTS PASSED" +end program -- cgit v1.2.3 From 6a79e31d9b6eaffdca9ce0a5fe9471d60c20530f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Tue, 25 Feb 2020 14:44:04 -0800 Subject: Compile using Fortran --- src/Lib.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Lib.hs b/src/Lib.hs index f51f079..0717bf8 100644 --- a/src/Lib.hs +++ b/src/Lib.hs @@ -9,5 +9,6 @@ import System.Process (callCommand) someFunc :: IO () someFunc = do putStrLn "someFunc" - a <- callCommand "ls -l" + a <- callCommand "gfortran test/test1.f90 -o test1" + a <- callCommand "./test1" return () -- cgit v1.2.3 From 581f3990f9d722135c4ef738b86782c8e7edaeda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Tue, 25 Feb 2020 14:52:58 -0800 Subject: Use --- src/Lib.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Lib.hs b/src/Lib.hs index 0717bf8..cab1ccc 100644 --- a/src/Lib.hs +++ b/src/Lib.hs @@ -2,7 +2,7 @@ module Lib ( someFunc ) where --- import Development.Shake (cmd) +import Development.Shake.FilePath (()) import System.Process (callCommand) @@ -10,5 +10,5 @@ someFunc :: IO () someFunc = do putStrLn "someFunc" a <- callCommand "gfortran test/test1.f90 -o test1" - a <- callCommand "./test1" + a <- callCommand $ "." "test1" return () -- cgit v1.2.3 From 5641e3d44d07c49b8b68786f1b7578f4bbdccc3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Fri, 28 Feb 2020 08:17:33 -0800 Subject: Add a line --- package.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/package.yaml b/package.yaml index 59b42e2..fd12307 100644 --- a/package.yaml +++ b/package.yaml @@ -30,6 +30,7 @@ dependencies: - shake - split + library: source-dirs: src -- cgit v1.2.3 From 12020ca91a0adf04c9ba4675e0126f042da4c121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Fri, 28 Feb 2020 09:16:46 -0800 Subject: Test example_project --- src/Lib.hs | 9 ++++++++- test/Spec.hs | 6 ++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Lib.hs b/src/Lib.hs index cab1ccc..3d4aede 100644 --- a/src/Lib.hs +++ b/src/Lib.hs @@ -1,5 +1,6 @@ module Lib - ( someFunc + ( someFunc, + someFunc2 ) where import Development.Shake.FilePath (()) @@ -12,3 +13,9 @@ someFunc = do a <- callCommand "gfortran test/test1.f90 -o test1" a <- callCommand $ "." "test1" return () + +someFunc2 :: IO () +someFunc2 = do + putStrLn "example" + a <- callCommand "cd example_project && stack run -- build" + return () diff --git a/test/Spec.hs b/test/Spec.hs index a1a07c6..1c9fc48 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -1,4 +1,6 @@ -import Lib (someFunc) +import Lib (someFunc, someFunc2) main :: IO () -main = someFunc +main = do + someFunc + someFunc2 -- cgit v1.2.3 From 92923f59d36726a99f9bb8435805a41ac5ba1388 Mon Sep 17 00:00:00 2001 From: Richardson Date: Mon, 2 Mar 2020 21:01:58 -0800 Subject: Fix for windows --- src/Build.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Build.hs b/src/Build.hs index 813c10e..d4432bb 100644 --- a/src/Build.hs +++ b/src/Build.hs @@ -88,10 +88,11 @@ buildPrograms programDirectory libraryDirectories sourceExtensions buildDirector } $ do buildDirectory "*" <.> "o" %> \objectFile -> do - let - sourceFile = fromMaybe + let realObjectFile = foldl () "" $ splitDirectories objectFile + let sourceFile = fromMaybe undefined - (Map.lookup objectFile sourceFileLookupMap) + (Map.lookup realObjectFile sourceFileLookupMap + ) need [sourceFile] modulesUsed <- liftIO $ getModulesUsed sourceFile let @@ -139,10 +140,10 @@ buildLibrary libraryDirectory sourceExtensions buildDirectory compiler flags lib $ do map (\ext -> buildDirectory "*" <.> ext) ["o", "mod"] &%> \[objectFile, moduleFile] -> do - let - sourceFile = fromMaybe + let realObjectFile = foldl () "" $ splitDirectories objectFile + let sourceFile = fromMaybe undefined - (Map.lookup objectFile sourceFileLookupMap + (Map.lookup realObjectFile sourceFileLookupMap ) need [sourceFile] modulesUsed <- liftIO $ getModulesUsed sourceFile -- cgit v1.2.3 From a145a9fc1e7dffbacbb7151fa543267a86e90cde Mon Sep 17 00:00:00 2001 From: Brad Richardson Date: Tue, 3 Mar 2020 19:59:19 -0800 Subject: Fix building executables on windows --- src/Build.hs | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/Build.hs b/src/Build.hs index d4432bb..2febb87 100644 --- a/src/Build.hs +++ b/src/Build.hs @@ -88,11 +88,11 @@ buildPrograms programDirectory libraryDirectories sourceExtensions buildDirector } $ do buildDirectory "*" <.> "o" %> \objectFile -> do - let realObjectFile = foldl () "" $ splitDirectories objectFile + let realObjectFile = + foldl () "" $ splitDirectories objectFile let sourceFile = fromMaybe undefined - (Map.lookup realObjectFile sourceFileLookupMap - ) + (Map.lookup realObjectFile sourceFileLookupMap) need [sourceFile] modulesUsed <- liftIO $ getModulesUsed sourceFile let @@ -105,11 +105,14 @@ buildPrograms programDirectory libraryDirectories sourceExtensions buildDirector includeFlags flags ["-o", objectFile, sourceFile] - (`elem` executables) ?> \exe -> do - let objectFile = map toLower exe -<.> "o" - need [objectFile] - need archives - cmd compiler objectFile archives ["-o", exe] flags + (\file -> + foldl () "" (splitDirectories file) `elem` executables + ) + ?> \exe -> do + let objectFile = map toLower exe -<.> "o" + need [objectFile] + need archives + cmd compiler objectFile archives ["-o", exe] flags want executables buildLibrary @@ -140,10 +143,13 @@ buildLibrary libraryDirectory sourceExtensions buildDirectory compiler flags lib $ do map (\ext -> buildDirectory "*" <.> ext) ["o", "mod"] &%> \[objectFile, moduleFile] -> do - let realObjectFile = foldl () "" $ splitDirectories objectFile + let + realObjectFile = foldl () "" + $ splitDirectories objectFile let sourceFile = fromMaybe undefined - (Map.lookup realObjectFile sourceFileLookupMap + (Map.lookup realObjectFile + sourceFileLookupMap ) need [sourceFile] modulesUsed <- liftIO $ getModulesUsed sourceFile -- cgit v1.2.3