Skip to content

Infrastructure to filter commandline arguments #5237

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

Merged
merged 3 commits into from
Apr 17, 2018

Conversation

merijn
Copy link
Collaborator

@merijn merijn commented Mar 28, 2018

This piggybacks any filters on Cabal's support for known programs, it allows us to specify a version specific argument filtering function for each program Cabal knows about.

See #4247.

…grams from

the new-build hash input to reduce redundant recompilation.

See haskell#4247.
@merijn
Copy link
Collaborator Author

merijn commented Mar 28, 2018

Some example usage code: merijn@b3e55d9

Probably the filters should be written in program specific modules, but moving them into the Program.GHC module leads to a recursive import I couldn't be arsed working around right now.

-- | A function that filters any arguments that don't impact the output
-- from a commandline. Used to limit the volatility of dependency hashes
-- when using new-build.
programFilterArgs :: Maybe Version -> [String] -> [String]
Copy link
Member

@hvr hvr Mar 28, 2018

Choose a reason for hiding this comment

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

name bikeshedding: I'd rather call this something like programNormalizeArgs to emphasize this is about normalizing; "filter" would imply that we're only ever going to remove args (i.e. in the sense that the output [String] would only be a sub-sequence of the original [String]); but it's conceivable we may at some point do a bit more.

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 don't have a strong preference for the name, but I hate trying to come up with them, so I'm fine with whatever the majority wants.

Copy link
Member

Choose a reason for hiding this comment

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

I am with Herbert regarding the name.

Changed the name of the `Program` field to hvr's suggestion.

Added a `PackageDescription` argument so we have access to all the options
specified in .cabal files and revisions.
@merijn
Copy link
Collaborator Author

merijn commented Apr 6, 2018

Updated to deal with -Werror issues and changed the name.

@merijn
Copy link
Collaborator Author

merijn commented Apr 9, 2018

Updated this to match the naming issue and deal with -Werror

@merijn
Copy link
Collaborator Author

merijn commented Apr 10, 2018

Now updated so that is actually looks at the list of builtin programs Cabal knows about...

@merijn
Copy link
Collaborator Author

merijn commented Apr 16, 2018

Last call for comments or I'm merging this!

@merijn merijn merged commit 2a9cf8e into haskell:master Apr 17, 2018
@merijn merijn deleted the filter-flags branch April 17, 2018 08:39
@merijn merijn restored the filter-flags branch April 17, 2018 08:41
@merijn merijn deleted the filter-flags branch April 17, 2018 08:41
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.

3 participants