Skip to content

Infrastructure to filter commandline arguments - #5237

Merged
merijn merged 3 commits into
haskell:masterfrom
merijn:filter-flags
Apr 17, 2018
Merged

merijn merged 3 commits into
haskell:masterfrom
merijn:filter-flags

Conversation

@merijn

@merijn merijn commented Mar 28, 2018

Copy link
Copy Markdown
Collaborator

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

merijn commented Mar 28, 2018

Copy link
Copy Markdown
Collaborator Author

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]

@hvr hvr Mar 28, 2018 •

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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

merijn commented Apr 6, 2018

Copy link
Copy Markdown
Collaborator Author

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

@merijn

merijn commented Apr 9, 2018

Copy link
Copy Markdown
Collaborator Author

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

@merijn

merijn commented Apr 10, 2018

Copy link
Copy Markdown
Collaborator Author

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

@merijn

merijn commented Apr 16, 2018

Copy link
Copy Markdown
Collaborator Author

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