Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add dependencies of cradles #39

Closed
wants to merge 3 commits into from
Closed

Conversation

fendor
Copy link
Collaborator

@fendor fendor commented Sep 13, 2019

closes #35
Adds a new record-field for files that are dependencies of the cradle.
cc @ndmitchell

@fendor fendor changed the title Add dependencies of cradles WIP: Add dependencies of cradles Sep 13, 2019
src/HIE/Bios/Cradle.hs Outdated Show resolved Hide resolved
cradleRootDir = wdir
, cradleDependencies = ["cabal.project", "cabal.project.local"] ++ cabalFiles
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are there any overlooked special cases?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not work if the cabal file is in some sub-directory.
We could recursively search all sub-directories for cabal files, or parse "cabal.project" and "stack.yaml" respectively to get the subdirectories we are interested in.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's close. Ideally stack and cabal would spit this information out themselves.

@@ -267,6 +280,7 @@ rulesHaskellCradle :: FilePath -> Cradle
rulesHaskellCradle wdir =
Cradle {
cradleRootDir = wdir
, cradleDependencies = ["BUILD.bazel", "WORKSPACE"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont use rules_haskell, so I am not sure if these are all cradle dependencies

Copy link
Contributor

@ndmitchell ndmitchell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks awesome!

src/HIE/Bios/Cradle.hs Outdated Show resolved Hide resolved
src/HIE/Bios/Types.hs Outdated Show resolved Hide resolved
Copy link
Contributor

@ndmitchell ndmitchell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While thinking about how Cabal/Stack could be persuaded to support it, I realised that they can't in this form. They would have to do so in the IO of returning flags also say what files they consulted. Not sure this is worth addressing now, because it's not something we can use, and this solution is the simpler and effective for most instances.

@fendor
Copy link
Collaborator Author

fendor commented Sep 14, 2019

Another idea that works around most of the problems: Add a field to hie.yaml "cradle-deps" where a user can specify the deps for a cradle.

@fendor
Copy link
Collaborator Author

fendor commented Sep 14, 2019

@mpickering suggested that it should be possible to query the build tool for cradle dependencies, e.g. then the signature would be cradleDependencies :: IO [FilePath].

@ndmitchell
Copy link
Contributor

Would it be cheaper to query the build tool for cradle dependencies simultaneously with querying it for flags? In which case an extra field in the return of CradleAction might work best.

@fendor fendor mentioned this pull request Sep 16, 2019
2 tasks
@fendor
Copy link
Collaborator Author

fendor commented Sep 16, 2019

Closed in favour of #42

@fendor fendor closed this Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Report what files are dependencies of the Cradle
2 participants