You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My project is a big monorepo, with hundreds of libraries and a few executable sharing those libraries. meson works very well for handling build and link dependencies among those targets. However, There are other parts of the project that need the same hierarchy of dependencies, but that are not link dependencies. For instance, I use a custom_target to extract translations from source files, and I need to merge the resulting translation template file with the translation templates from all dependent libraries. And other example is that when I run the unit tests for a given executable, I need to also run the unit tests from all dependent libraries.
What solution do I propose?
My idea would be to use a datastructure to keep tract of all logical dependencies between the components of my project, and to use that datastructure to build the arguments for the different meson functions I use.
Here is what the proposition could looks like:
ds = import('datastructure')
dependencies = {'dep1': dependency('dep1'), 'dep2': dependency('dep2'), ...}
translations = {'lib1': custom_target(...), 'lib2': custom_target(..), ...}
relations = {'lib1': ['lib2', 'lib3', ...], 'lib2': [...], ...} # direct dependencies for each target
deptree = ds.tree(relations)
# Assign library dependencies from the structure.
# The `map` function takes a list of strings, and return a list of associated values from the provided dict
lib1_dependencies = ds.map(relations['lib1'], dependencies) # returns a list of dep objects
lib1 = library(..., dependencies: lib1_dependencies, ...)
# Merge all dependent translation files
# The `deps` function returns the list of dependencies for the given key, recursively
# If a second argument is provided, it acts like the `map` function, by returning associated values from the given dict
my_exe_pot = custom_target(..., input: deptree.deps('my_exe', translations), ...) # map translations to recursive deps of 'my_exe'
foreach target: relations.keys()
test(target, ..., suite: deptree.children(target) + target) # all items depending on 'target'
# The `children` function is the opposite of the `deps` function. It returns the list of key that depends on the provided target
# With a second argument, it would `map` those keys on the provided dict.
endforeach
What is the next step?
I'd like to gather feedback from my proposition, before taking time to implement it. Is it something that looks like useful? Is it something that could belong to meson? Is there a better way to achieve my goals?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
What is the problem I want to solve?
My project is a big monorepo, with hundreds of libraries and a few executable sharing those libraries. meson works very well for handling build and link dependencies among those targets. However, There are other parts of the project that need the same hierarchy of dependencies, but that are not link dependencies. For instance, I use a custom_target to extract translations from source files, and I need to merge the resulting translation template file with the translation templates from all dependent libraries. And other example is that when I run the unit tests for a given executable, I need to also run the unit tests from all dependent libraries.
What solution do I propose?
My idea would be to use a datastructure to keep tract of all logical dependencies between the components of my project, and to use that datastructure to build the arguments for the different meson functions I use.
Here is what the proposition could looks like:
What is the next step?
I'd like to gather feedback from my proposition, before taking time to implement it. Is it something that looks like useful? Is it something that could belong to meson? Is there a better way to achieve my goals?
Beta Was this translation helpful? Give feedback.
All reactions