Open amundfjosne opened 3 years ago
FTR, April 28, 2021 4:16 PM:
the mistery is in https://github.com/VUnit/vunit/blob/master/vunit/ui/common.py#L60-L65. All the functions in the API are documented as receiving a single argument (https://github.com/VUnit/vunit/blob/859819f49a97b7096dd169088f9b5f72d133aac7/vunit/ui/library.py#L172) but when they call get_checked_file_names_from_globs, lists are supported too. See https://github.com/VUnit/vunit/search?q=get_checked_file_names_from_globs.
The documentation of the add_source_files method should be improved to reflect that you can pass iterables like sets and lists of file names. An example could also be added for how to handle special cases of adding a subset of files.
Gitter conversation on the topic: (Added for completeness) amundfjosne: _I would like to avoid the manual work of updating the script whenever a new module is made, so I'll probably use glob. Should be a fairly simple regex. Is this a special case, or could it be a nice addition to have a "lib.remove_sourcefiles()" function (or something similar) in vunit?
Lars Asplund: _I think we should probably avoid that. I'm thinking that there is a whole class of functions to manipulate the set of files to include and whatever we build into VUnit will be a copy of the functions available in pure Python. What I think we should do is to update the documentation because I don't think it says that you can pass iterables like sets and lists to the add_sourcefiles method. We could also give an example/clarify the path for handling special cases like these. Will you create an issue?