aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter
AgeCommit message (Collapse)AuthorFilesLines
2021-06-22interpreter: use typed_kwargs for install_subdirDylan Baker2-41/+99
2021-06-22interpreter: use typed_pos_args for install_subdirDylan Baker1-7/+3
2021-06-22interpreter: add overload for source_strings_to_filesDylan Baker1-0/+4
when only passing strings or Files we only get back Files. This is useful for the install_* methods
2021-06-22interpreter: Replace manual kwarg validation in ↵Laurin-Luis Lehning1-6/+7
compiler.get_supported_arguments with @typed_kwargs
2021-06-21fix: Ensure that build targets have all methods from ExternalProgramDaniel Mensinger1-8/+17
As a side-effect from #8885 `find_program()` returns now `Executable` objects when `meson.override_find_program` is called with an executable target. To resolve this conflict the missing methods from `ExternalProgram` are added to `BuildTarget`.
2021-06-21interpreter: Move argument checks from add_*_arguments to ↵Laurin-Luis Lehning3-23/+18
compiler.get_supported_arguments
2021-06-21interpreter: Consider the compiler language before checking argumentsLaurin-Luis Lehning1-1/+4
2021-06-21interprter: Add required kwarg to add_(project|global)_argumentsLaurin-Luis Lehning2-2/+17
To avoid manual compiler support checks add_project_arguments and add_global_arguments receive a new keyword argument to perform them automatically.
2021-06-20fix: Fix strange holder_map bug in combination with subprojectsDaniel Mensinger1-9/+6
I was unable to reproduce this in a minimal test-case, so there is currently no new test :(
2021-06-20fix: Fix set_variable not holderifying (fixes #8904)Daniel Mensinger1-1/+1
2021-06-18holders: Fix the remaining code to respect the holder changesDaniel Mensinger5-413/+409
2021-06-18holders: remove unholderDaniel Mensinger3-81/+71
2021-06-18holders: Introduce BothLibrariesDaniel Mensinger2-69/+64
2021-06-18holders: Ensure that InterpreterBase is the sole instance for (un)holderifyingDaniel Mensinger2-60/+87
2021-06-18holders: Move get_version from directly to ExternalProgramDaniel Mensinger1-21/+0
2021-06-18holders: Introduce HoldableObjectDaniel Mensinger3-3/+3
2021-06-18interpreter: Add FileHolder and remove specical case for FileDaniel Mensinger2-5/+9
2021-06-18interpreter: Add a new MesonInterpreterObject for non-elementary objectsDaniel Mensinger3-11/+14
2021-06-18interpreter: Refactor interpreter.compiler to use ObjectHolderDaniel Mensinger1-15/+20
2021-06-18interpreter: Refactor ObjectHolder to extend InterpreterObjectDaniel Mensinger1-59/+37
2021-06-18typing: Import missing classes in interpreterobjects.pyDaniel Mensinger1-0/+2
2021-06-18interpreter: add type annotations to build_incdir_objectDylan Baker1-29/+30
and use textwrap.dedent to make the very large messages more readable and not break method folding.
2021-06-18dependency: Empty fallback is the same as allow_fallback: falseXavier Claessens1-0/+4
2021-06-16interpreter: Extract dependency() logic into its own helper classXavier Claessens2-299/+365
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-15interpreterobjects: Clean up GeneratedListHolderDylan Baker1-8/+3
Remove an unused method (that didn't work before this series), and remove the ability to pass a Generator to the GeneratedListHolder, it's never used and it's weird and not the way Meson generally works now. While we're here, finish the type annotations.
2021-06-15interpreterobjects|build: use typed_kwargs for generator.processDylan Baker2-16/+33
2021-06-15interpreter|build: use typed_pos_args and unholder in the interpreterDylan Baker1-27/+29
For generator.process_files. Just cleaner and nicer
2021-06-15interpreter|build: Do Generator keyword argument checking in the interpreterDylan Baker1-3/+15
For qt we already have all of the necissary checking in place. Now in the interpreter we have the same, the intrperter does all of the checking, then passed the arguments to the Generator initializer, which just assigns the passed values. This is nice, neat, and clean and fixes the layering violatino between build and interpreter.
2021-06-15interpreter: use typed_kwargs for func_generatorDylan Baker3-3/+22
Do the type checking in a nice tidy way
2021-06-15interpreter|build: Pass just the executable down to GeneratorDylan Baker1-2/+4
This requires that the interpreter has done the validation, which it now does at all callsites. This simplifies the Generator initializer.
2021-06-15interpreter: Do not create Generator in GeneratorHolderDylan Baker2-8/+10
This is an odd pattern, not the way most Holders work, and would be problematic if a method wanted to return a Generator.
2021-06-15modules/qt: fully annotate and check qt.has_toolsDylan Baker2-3/+26
2021-06-14interpreter: use typed_*args for test and benchmarkDylan Baker3-70/+85
this also requires some changes to the Rust module, as it calls into the test code.
2021-06-14interpreter: use typed_pos_args for func_test and func_benchmarkDylan Baker1-12/+14
Requires a few small changes to the Rust module, as it calls `func_test`
2021-06-10interpreter: Add missing FeatureNewKwarg for allow_fallbackXavier Claessens1-1/+1
2021-06-08Merge pull request #8512 from bonzini/feature-methodsJussi Pakkanen1-4/+46
Utility methods for feature objects
2021-06-08interpreter: make helper methods protectedDylan Baker1-15/+15
They really aren't meant to be called outside of the interpreter itself, so don't expose them as public
2021-06-08interpreter: Add type annotations for the add_*_arguments helpersDylan Baker1-9/+8
internally these all used a set of shared heleprs, add type annotations for those as well
2021-06-08interpreter: use typed_kwargs for the add_*_arguments familyDylan Baker2-20/+65
This makes use of the new convertor and validator arguments, so that we can check that the languages passed are in fact vaild, and then convert the native boolean into a MachineChoice internally.
2021-06-08interpreter: use typed_pos_args for add_*_argsDylan Baker1-12/+12
This just replaces stringArgs with the typed_pos_args, and it's better error message.
2021-06-08interpreter: add feature.disable_auto_if()Paolo Bonzini1-0/+9
Add a method to downgrade an option to disabled if it is not used. This is useful to avoid unnecessary search for dependencies; for example dep = dependency('dep', required: get_option('feature').disable_auto_if(not foo)) can be used instead of the more verbose and complex if get_option('feature').auto() and not foo then dep = dependency('', required: false) else dep = dependency('dep', required: get_option('feature')) endif or to avoid unnecessary dependency searches: dep1 = dependency('dep1', required: get_option('foo')) # dep2 is only used together with dep1 dep2 = dependency('dep2', required: get_option('foo').disable_auto_if(not dep1.found())) ``` Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-06-08interpreter: add feature.require()Paolo Bonzini1-2/+25
Add a method to perform a logical AND on a feature object. The method also takes care of raising an error if 'enabled' is ANDed with false. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-06-07Add C compiler when using CythonDylan Baker1-2/+3
Since cython transpiles to C.
2021-06-04interpreterobjects: Fix type annotation for CustomTargetHolderDylan Baker1-1/+1
2021-05-31interpreter: wrap access to Feature valuePaolo Bonzini1-4/+8
This will allow adding "forced-off" Feature objects in the next patch. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-05-31interpreter: add feature.allowed()Paolo Bonzini1-0/+6
This method simplifies the conversion of Feature objects to booleans. Often, one has to use the "not" operator in order to treat "auto" and "enabled" the same way. "allowed()" also works well in conjunction with the require method that is introduced in the next patch. For example, if get_option('foo').require(host_machine.system() == 'windows').allowed() then src += ['foo.c'] config.set10('HAVE_FOO', 1) endif can be used instead of if host_machine.system() != 'windows' if get_option('foo').enabled() error('...') endif endif if not get_option('foo').disabled() then src += ['foo.c'] config.set10('HAVE_FOO', 1) endif Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-05-28modules: Add methods dict everywhereXavier Claessens1-6/+1
This fix calling random internal methods from meson.build as long as they were not prefixed by underscore.
2021-05-28modules: Stop using InterpreterObjectXavier Claessens2-4/+13
Custom objects returned by modules must be subclass of ModuleObject and have the state argument in its methods. Add MutableModuleObject base class for objects that needs to be deep copied on assignation.
2021-05-28modules: Remove snippet methodsXavier Claessens1-14/+7
The only advantage they have is they have the interpreter in arguments, but it's already available as self.interpreter. We should discourage usage of the interpreter API and rely on ModuleState object instead in the future. This also lift the restriction that a module method cannot add build targets, but that was not enforced for snippet methods anyway (and some modules were doing it) and it's really loose restriction as it should check for many other things if we wanted to make it consistent.
2021-05-28Vala: Add missing FeatureNew() when C is missingXavier Claessens1-0/+1
It was previously an hard error, only permitted since 0.59.0.