Commit Graph

17 Commits

Author SHA1 Message Date
Eli Schwartz 95b03f7930 avoid clearing the dependency cache unnecessarily based on wrap-mode
We actually do not and should not care about wrap-mode at all for this.
We want to cache dependency lookups whenever humanly possible, but only
use them in cases where we would anyways be using them -- which in
particular means if we said to force a subproject fallback for this dep,
we want to bypass the cache.

Currently, we handle this by always looking up the cache for all
dependencies, but clearing the cache at startup if a reconfigure means
we are changing our resolution strategy. This is bad -- we might have
many dependencies that are worth caching, and only one dependency that
should stop being cached and use a subproject instead.

The simple solution is to handle the forcefallback case when doing a
cache lookup, and not do a cache lookup at all. Now we don't have to
nuke the entire cache. In fact, if a future reconfigure changes the
forcefallback state back to not being forced, we can reuse the original
cached dependency, which is still there.

Closes #11828
2023-05-29 15:04:34 -04:00
Xavier Claessens 39d825fabf Get fallback varname from wrap file after it has been configured
When _subproject_impl() is called the wrap file could not have been
downloaded form wrapdb yet, it is done when fetching the subproject.
Delay getting the variable name to when we actually need it, at that
point we are sure the wrap file has been downloaded.
2022-10-09 13:04:04 -04:00
Michael Mera 9b21428006 fix parameter expansion in several error messages
At several points in the code base, f-strings are not correctly expanded
due to missing 'f' string prefix. This fixes all the occurrences I could
find.
2022-06-17 12:16:42 -04:00
Eli Schwartz c9938f8f60
move a bunch of imports into TYPE_CHECKING blocks
These are only used for type checking, so don't bother importing them at
runtime.

Generally add future annotations at the same time, to make sure that
existing uses of these imports don't need to be quoted.
2022-03-29 16:44:54 -04:00
Dylan Baker 4a2058cb83 interpreter: use typed_kwargs for subproject() 2022-03-03 10:29:14 -08:00
Dylan Baker ae8fb74e57 interpreter/dependencyfallbacks: fix a number of low hanging type issues 2022-03-03 10:29:14 -08:00
Dylan Baker f4ae32c2ad modules/cmake: add type annotations for subproject method
This will be used to handle the interpreter subproject as well
2022-03-03 10:29:14 -08:00
Thomas Heijligen ecdf192f46 dep.name(): return dependency name even if dependency is not found
The dep.name() function schould always return the name of the
dependency as documented. No matter if it was found or not.
https://mesonbuild.com/Reference-manual_returned_dep.html#depfound
2021-10-26 09:36:22 -04:00
Xavier Claessens 30f24bfa32 dependency: If cached version is outdated, look on system again
Fixes: #9271
2021-09-20 16:42:11 -04:00
Xavier Claessens e9386e80ae dependencyfallbacks: Use default_options for implicit fallbacks
This removes the warning when using default_options without fallback
kwarg completely because a subproject does not know if the main project
has an implicit fallback or not, so it could set default_options even if
not fallback is available at all.

Fixes: #9278
2021-09-20 13:42:07 -04:00
Xavier Claessens d67850b45e dependency: fallback and allow_fallback are mutually exclusive
That used to abort in previous Meson versions but 0.59 stopped
forbidding that by mistake.
2021-09-01 22:29:48 +03:00
Xavier Claessens e646130ef1 interpreter: Fix dependency(..., static: true) fallback
It should build the fallback subprject with default_library=static and
override the dependency for both static=True and static kwarg not given.

Fixes: #8050.
2021-08-23 10:52:18 -04:00
Xavier Claessens 943596abbb Fix --force-fallack-for with --wrap-mode=nofallback
Fixes: #9065
2021-08-07 11:20:57 +02:00
Xavier Claessens 0183954ea1 Fix meson.version().version_compare() regression in subproject 2021-07-21 13:33:06 -04:00
Daniel Mensinger 34c28dc92c holders: remove unholder 2021-06-18 23:48:33 +02:00
Xavier Claessens 5f3b73beb5 dependency: Empty fallback is the same as allow_fallback: false 2021-06-18 12:47:41 -04:00
Xavier Claessens b6d754a40c interpreter: Extract dependency() logic into its own helper class
The dependency lookup is a lot of complex code. This refactor it all
into a single file/class outside of interpreter main class. This new
design allows adding more fallbacks candidates in the future (e.g. using
cc.find_library()) but does not yet add any extra API.
2021-06-16 19:04:03 -04:00