Commit Graph

20 Commits

Author SHA1 Message Date
Dylan Baker 65b8c2663b modules/rust: fix initialize signature
So that it's accurate, and we don't need to use to use `#type: ignore`
declaration
2021-08-16 12:07:57 -07:00
Dylan Baker 8f3695fc53 modules/rust: use typed_kwargs for bindgen
This was the only function left in here that wasn't fully typed, so
let's fix that
2021-08-16 12:07:56 -07:00
Daniel Mensinger 7c757dff71 holders: Fix the remaining code to respect the holder changes 2021-06-18 23:48:33 +02:00
Daniel Mensinger 34c28dc92c holders: remove unholder 2021-06-18 23:48:33 +02:00
Dylan Baker 2bc7a1b3da modules/qt: fully annotate and check qt.has_tools 2021-06-15 12:36:05 -07:00
Dylan Baker e2266e8708 interpreter: use typed_*args for test and benchmark
this also requires some changes to the Rust module, as it calls into the
test code.
2021-06-14 12:30:02 -07:00
Dylan Baker 86704261a7 interpreter: use typed_pos_args for func_test and func_benchmark
Requires a few small changes to the Rust module, as it calls `func_test`
2021-06-14 12:30:02 -07:00
Xavier Claessens 8abbc5cc5d modules: Replace find_program_impl() by state.find_program() 2021-05-28 15:17:10 -04:00
Xavier Claessens 2e02ef6592 modules: Add methods dict everywhere
This fix calling random internal methods from meson.build as long as
they were not prefixed by underscore.
2021-05-28 15:17:10 -04:00
Xavier Claessens a734bcfc83 modules: Stop using ModuleReturnValue where it's not needed
It is only needed in functions that need to add targets to the
interpreter.
2021-05-28 15:17:10 -04:00
Dylan Baker f2ae92368a interpreter: Add docstring and fix types of source_strings_to_files 2021-05-19 23:28:17 +03:00
Xavier Claessens 7ffe1b4a66 interpreter: Split permitted_kwargs dict 2021-04-12 21:30:00 +03:00
Xavier Claessens 558a7bc6ff interpreter: Move to its own folder and split it 2021-04-01 14:26:33 -04:00
Dylan Baker 40e3577a65 split program related classes and functions out of dependencies
Dependencies is already a large and complicated package without adding
programs to the list. This also allows us to untangle a bit of spaghetti
that we have.
2021-03-19 08:47:10 -04:00
Xavier Claessens ba9bfd2bd8 Simplify module API
- ModuleState is now a real class that will have methods in the future
  for actions modules needs, instead of using interpreter internal API.
- New ModuleObject base class, similar to InterpreterObject, that should
  be used by all objects returned by modules. Its methods gets the
  ModuleState passed as first argument. It has a `methods` dictionary to
  define what is public API that can be called from build definition.
- Method return value is not required to be a ModuleReturnValue any
  more, it can be any type that interpreter can holderify, including
  ModuleObject.
- Legacy module API is maintained until we port all modules.

In the future modules should be updated:
- Use methods dict.
- Remove snippets.
- Custom objects returned by modules should all be subclass of
  ModuleObject to get the state iface in their methods.
- Modules should never call into interpreter directly and instead state
  object should have wrapper API.
- Stop using ModuleReturnValue in methods that just return simple
  objects like strings. Possibly remove ModuleReturnValue completely
  since all objects that needs to be processed by interpreter (e.g.
  CustomTarget) should be created through ModuleState API.
2021-03-04 11:33:22 -05:00
Dylan Baker b28235428d rust: Add a module wrapper for bindgen
This has a couple of advantages over rolling it by hand:
1. it correctly handles include_directories objects, which is always
   handy
2. it correctly generates a depfile for you, which makes it more
   reliable
3. it requires less typing
2021-02-06 10:27:04 -08:00
Dylan Baker 2db7e24dbd modules/rust: use typed_pos_args 2021-02-06 13:11:25 -05:00
Dylan Baker 3ae115b57a Replace NinjaBackend is_rust_target with build.uses_rust
we have two functions to do the exact same thing, and they're basically
implemented the same way. Instead, let's just use the BuildTarget one,
as it's more generally available.
2021-01-19 10:12:38 -08:00
Antonin Décimo 39ede12aa5 Fix misspells
Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
2021-01-13 12:53:10 -05:00
Dylan Baker 3d80a88bd3 modules: Add an unstable-rust module
Like other language specific modules this module is module for holding
rust specific helpers. This commit adds a test() function, which
simplifies using rust's internal unittest mechanism.

Rust tests are generally placed in the same code files as they are
testing, in contrast to languages like C/C++ and python which generally
place the tests in separate translation units. For meson this is
somewhat problematic from a repetition point of view, as the only
changes are generally adding --test, and possibly some dependencies.

The rustmod.test() method provides a mechanism to remove the repatition:
it takes a rust target, copies it, and then addes the `--test` option,
then creates a Test() target with the `rust` protocol. You can pass
additional dependencies via the `dependencies` keyword. This all makes
for a nice, DRY, test definition.
2021-01-05 15:10:50 -08:00