-
Notifications
You must be signed in to change notification settings - Fork 698
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
Replace new-build's call to sdist with new command which lists sources of things that will be built #3401
Comments
Improving the robustness of |
So, I actually figured out what the problem is: we need a variant of |
As I said in #3786 we should just produce the globs ourselves from the .cabal file description, and not bother with sdist at all. |
@dcoutts So what are you going to do about packages which use Custom setup to register extra preprocessors? That information is not in the Cabal file, so you are screwed! There needs to be a Cabal API. |
IIRC in general sdist hooks can arbitrarily modify the list of included files. It'd be nice to disallow this and force usage of |
I'm working on this. |
…ing. New module Distribution.Client.SourceFiles implements 'needElaboratedConfiguredPackage', which if run in the 'Rebuild' monad is sufficient to ensure all source files that participate in a build are monitored. Fixes haskell#3401. It also fixes the "we didn't detect a new file appearing" problem. Signed-off-by: Edward Z. Yang <[email protected]>
…ing. New module Distribution.Client.SourceFiles implements 'needElaboratedConfiguredPackage', which if run in the 'Rebuild' monad is sufficient to ensure all source files that participate in a build are monitored. Fixes haskell#3401. It also fixes the "we didn't detect a new file appearing" problem. Signed-off-by: Edward Z. Yang <[email protected]>
…ing. New module Distribution.Client.SourceFiles implements 'needElaboratedConfiguredPackage', which if run in the 'Rebuild' monad is sufficient to ensure all source files that participate in a build are monitored. Fixes haskell#3401. It also fixes the "we didn't detect a new file appearing" problem. Signed-off-by: Edward Z. Yang <[email protected]>
…ing. New module Distribution.Client.SourceFiles implements 'needElaboratedConfiguredPackage', which if run in the 'Rebuild' monad is sufficient to ensure all source files that participate in a build are monitored. Fixes haskell#3401. It also fixes the "we didn't detect a new file appearing" problem. Signed-off-by: Edward Z. Yang <[email protected]>
…ing. New module Distribution.Client.SourceFiles implements 'needElaboratedConfiguredPackage', which if run in the 'Rebuild' monad is sufficient to ensure all source files that participate in a build are monitored. Fixes haskell#3401. It also fixes the "we didn't detect a new file appearing" problem. Signed-off-by: Edward Z. Yang <[email protected]>
…ing. New module Distribution.Client.SourceFiles implements 'needElaboratedConfiguredPackage', which if run in the 'Rebuild' monad is sufficient to ensure all source files that participate in a build are monitored. Fixes haskell#3401. It also fixes the "we didn't detect a new file appearing" problem. Signed-off-by: Edward Z. Yang <[email protected]>
Summary by @ezyang. For Nix-local build recompilation avoidance, we need a variant of
sdist --list-sources
mode which prints the list of files which will be used by./Setup build
under the current./Setup configure
parameters. It would be implemented in the following way:LocalBuildInfo
(unlikesdist
, we require the package to be configured.)PackageDescription
fromLocalBuildInfo
--list-sources
code to get all of the sources.I don't know if this should be a flag on
sdist
: thesdist
commands can be run without configuring, but we require configuration for this command. Perhaps we can introduce a new subcommand like./Setup query sources
which lets us interrogate Setup.hs for more information.New
Setup
commands live in [Cabal/Distribution/Simple.hs]. The list-sources code is inlistPackageSources
in [Cabal/Distribution/Simple/SrcDist.hs]. The place where Nix-local-builds would hook in is the call toallPackageSourceFiles
in [cabal-install/Distribution/Client/ProjectBuilding.hs]Testing strategy:
cabal new-build
cabal new-build
and verify that no work was necessaryFor recompilation avoidance, new-build invokes
cabal sdist --list-sources
to get a list of files that are ostensibly participate in the compilation (any file that isn't packaged up in an sdist shouldn't affect compilation, since it won't be put in a tarball that gets distributed to others!)Here's the problem: we shouldn't assume that
cabal sdist --list-sources
will always succeed. For example, suppose that a non-buildable section of Cabal file refers to a module that does not actually exist.Setup build
will work just fine (since it won't actually try to access any of these modules) butcabal sdist --list-sources
will fail (very unclearly; there's no visual indication that we were list-source'ing) because it will attempt to sdist all modules. Arguably,sdist --list-sources
should also get a list of targets likebuild
, and it will list sources only for those targets; however, because we have to supportCustom
on old Cabal we have to accept that this may happen.Now, suppose that we can't
list-sources
to get an accurate picture about what files need to be tracked. What should we do in this case? We shouldn't pass an empty list of files to the monitor; then we'll never rebuild when a user (legitimately) edits a file. So we need some kind of fallback. Here are a few obvious possibilities:sdist
to take targets and to also be "robust to errors" (i.e., if the Cabal claims something should be there which isn't, roll with it, and do as good a job as you can.)What do people think?
The text was updated successfully, but these errors were encountered: