From 421fe3f5343079054ecb4cbe8298eb1ab2731c8d Mon Sep 17 00:00:00 2001 From: Brad Richardson Date: Sun, 31 May 2020 19:58:20 -0700 Subject: Add dev-dependencies --- src/Fpm.hs | 10 ++++++++-- test/example_packages/circular_example/fpm.toml | 8 ++------ test/example_packages/circular_example/test/main.f90 | 7 +++++++ test/example_packages/circular_example/tests/main.f90 | 7 ------- 4 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 test/example_packages/circular_example/test/main.f90 delete mode 100644 test/example_packages/circular_example/tests/main.f90 diff --git a/src/Fpm.hs b/src/Fpm.hs index 417b6ed..970f178 100644 --- a/src/Fpm.hs +++ b/src/Fpm.hs @@ -60,6 +60,7 @@ data TomlSettings = TomlSettings { , tomlSettingsExecutables :: [Executable] , tomlSettingsTests :: [Executable] , tomlSettingsDependencies :: (Map.Map String Version) + , tomlSettingsDevDependencies :: (Map.Map String Version) } data AppSettings = AppSettings { @@ -71,6 +72,7 @@ data AppSettings = AppSettings { , appSettingsExecutables :: [Executable] , appSettingsTests :: [Executable] , appSettingsDependencies :: (Map.Map String Version) + , appSettingsDevDependencies :: (Map.Map String Version) } data Library = Library { librarySourceDir :: String } @@ -196,6 +198,7 @@ build settings = do ((map snd executableDepends) ++ (map snd localDependencies)) ) executables + devDependencies <- fetchExecutableDependencies maybeTree (appSettingsDevDependencies settings) >>= buildDependencies buildPrefix compiler flags mapM_ (\Executable { executableSourceDir = sourceDir, executableMainFile = mainFile, executableName = name, executableDependencies = dependencies } -> do @@ -204,14 +207,14 @@ build settings = do >>= buildDependencies buildPrefix compiler flags buildProgram sourceDir - ((map fst executableDepends) ++ (map fst localDependencies)) + ((map fst executableDepends) ++ (map fst devDependencies) ++ (map fst localDependencies)) [".f90", ".f", ".F", ".F90", ".f95", ".f03"] (buildPrefix sourceDir) compiler flags name mainFile - ((map snd executableDepends) ++ (map snd localDependencies)) + ((map snd executableDepends) ++ (map snd devDependencies) ++ (map snd localDependencies)) ) tests @@ -263,6 +266,7 @@ settingsCodec = .= tomlSettingsTests <*> Toml.tableMap Toml._KeyString versionCodec "dependencies" .= tomlSettingsDependencies + <*> Toml.tableMap Toml._KeyString versionCodec "dev-dependencies" .= tomlSettingsDevDependencies libraryCodec :: TomlCodec Library libraryCodec = Library <$> Toml.string "source-dir" .= librarySourceDir @@ -346,6 +350,7 @@ toml2AppSettings tomlSettings release = do testSettings <- getTestSettings $ tomlSettingsTests tomlSettings buildPrefix <- makeBuildPrefix compiler release let dependencies = tomlSettingsDependencies tomlSettings + let devDependencies = tomlSettingsDevDependencies tomlSettings return AppSettings { appSettingsCompiler = compiler , appSettingsProjectName = projectName @@ -377,6 +382,7 @@ toml2AppSettings tomlSettings release = do , appSettingsExecutables = executableSettings , appSettingsTests = testSettings , appSettingsDependencies = dependencies + , appSettingsDevDependencies = devDependencies } getLibrarySettings :: Maybe Library -> IO (Maybe Library) diff --git a/test/example_packages/circular_example/fpm.toml b/test/example_packages/circular_example/fpm.toml index 034ec57..c524ce5 100644 --- a/test/example_packages/circular_example/fpm.toml +++ b/test/example_packages/circular_example/fpm.toml @@ -1,8 +1,4 @@ name = "circular_example" -[[test]] - name = "test" - source-dir = "tests" - main = "main.f90" - [test.dependencies] - circular_test = { path = "../circular_test" } +[dev-dependencies] +circular_test = { path = "../circular_test" } diff --git a/test/example_packages/circular_example/test/main.f90 b/test/example_packages/circular_example/test/main.f90 new file mode 100644 index 0000000..5b7d803 --- /dev/null +++ b/test/example_packages/circular_example/test/main.f90 @@ -0,0 +1,7 @@ +program run_tests + use hello_test, only: run_test + + implicit none + + call run_test +end program run_tests diff --git a/test/example_packages/circular_example/tests/main.f90 b/test/example_packages/circular_example/tests/main.f90 deleted file mode 100644 index 5b7d803..0000000 --- a/test/example_packages/circular_example/tests/main.f90 +++ /dev/null @@ -1,7 +0,0 @@ -program run_tests - use hello_test, only: run_test - - implicit none - - call run_test -end program run_tests -- cgit v1.2.3