Commit Graph

94 Commits

Author SHA1 Message Date
Dylan Baker 11f9638035 build: replace kwargs in CustomTarget initializer
Because we don't want to pass the Interpreter kwargs into the build
layer. This turned out to be a mega commit, as there's really on elegant
way to make this change in an incremental way. On the nice side, mypy
made this change super easy, as nearly all of the calls to
`CustomTarget` are fully type checked!

It also turns out that we're not handling install_tags in custom_target
correctly, since we're not converting the boolean values into Optional
values!
2022-01-28 15:53:20 -05:00
Dylan Baker 4f0c5af390 modules/qt: compeil_resources allow name to be unset
Originally name should have been set to required=True, but since then
the requirement to name CustomTargets (which compile_resources is a
wrapper around) has been dropped. As such we just need to allow the
default value of None through.

Fixes: #9698
2021-12-05 08:33:32 -08:00
Eli Schwartz 5163a02fec
qt module: fix stupid copy-paste error
As evidenced by the warning message immediately below this, I meant to
write "5.15" here. As is, this will enable depfile support on too-old
versions of moc.
2021-11-22 16:28:13 -05:00
Eli Schwartz 32821be623
add location nodes to some Feature calls 2021-11-20 20:48:30 -05:00
Eli Schwartz 0bc0905210
qt module: add depfile support to moc as well
We currently enable this only for rcc (where this really really matters)
but it can often matter for moc as well, and is just generally more
correct.

Really, this should have been added in #7451 too, but I neglected it
since the module warned about inaccurate dependencies only for rcc...
2021-11-13 23:28:59 -05:00
Eli Schwartz 8947352889 fix various flake8 whitespace errors 2021-10-27 09:51:52 -04:00
Christian Clauss a5020857f3 Fix typos discovered by codespell 2021-10-10 16:12:25 -04:00
Dylan Baker c3c30d4b06 interpreter: Use typed_kwargs for func_custom_target
This does not convert the build side, or remove any of the checking it
does. We still need that for other callers of custom target. What we'll
do for those is add an internal interface that defaults things, then
we'll be able to have those callers do their own validation, and the
CustomTarget validation machinary can be removed.

Fixes #9096
2021-09-30 21:01:38 +02:00
Dylan Baker 9795323b86 pylint: check for duplicate imports
I ran into one of these from LGTM, and it would be nice if pylint could
warn me as part of my local development process instead of waiting for
the CI to tell me.
2021-09-24 10:36:05 -07:00
Eli Schwartz f291b637b1
qt module: consolidate on one list of bins 2021-09-10 17:57:28 -04:00
Eli Schwartz d2bf77342e
qt module: fix regression in building translations via qresource
In commit 3c4c7d0429 the qresource
variable stopped being overwritten with a mesonlib.File, which is
reasonable. However, one call site for it which relied on being a built
file did not get renamed when needed.

Make the build target use the built file.
2021-09-10 17:57:28 -04:00
Eli Schwartz 7171d22f5f
qt module: correctly register a found tool and stop looking for it
Regression in commit d7ac2f1065 since
self.{tool_name} is not how it used to be tracked, and the "found"
dictionary is a legacy of the old location.
2021-09-10 17:57:28 -04:00
Dylan Baker 11fbaf29d8 interpreter: fix cases of `KwargInfo(..., T, default=None)`
The correct way to mark these is `KwargInfo(..., (T, type(None)))`.
There's also a few cases of `(T, None)` which is invalid, as `None`
isn't a type
2021-08-27 14:54:29 -07:00
Dylan Baker a7f3703440 modules/qt: Allow using generated sources for compile_translations ts_files 2021-08-18 19:47:07 -07:00
Dylan Baker a16335a958 modules/qt: Allow Generated sources in compile_resources 2021-08-18 19:46:47 -07:00
Dylan Baker ff573620b0 modules/qt: allow passing generated targets to compile_ui 2021-08-18 19:46:47 -07:00
Dylan Baker 965fcf2883 modules/qt: Allow generated sources for arguemnts to compile_moc 2021-08-18 19:46:47 -07:00
Xavier Claessens 8c5aa031b5 Add install tags
Fixes: #7007.
2021-08-17 15:19:18 -04:00
Dylan Baker 5583e44826 qt: Allow CustomTargets for qt.preprocess source arguments
This works for `moc_*` and `ui_files`, but it never could have worked
for `qresources` due to the implementation assuming a `str` or `File`.
To restore previous compatibility I've added `CustomTarget` where it
would have worked, but not where it would have failed, the former would
raised an exception along the lines anyway.

Fixes #9007
2021-07-23 00:46:22 +05:30
Dylan Baker 3e66bd4035 modules/qt: use _impl private methods to avoid incorrect FeatureNew
`qt.preprocess` dispatches to the individual methods instead of
duplicating all of the logic itself, but this means that it goes through
the type checking, and feature checking a second time. To avoid this we
need to use a private helper method instead.

Fixes #8920
2021-06-27 23:59:40 +03:00
Daniel Mensinger 7c757dff71 holders: Fix the remaining code to respect the holder changes 2021-06-18 23:48:33 +02:00
Dylan Baker 79fec1ce4e modules/qt: use append rather than extend in preprocess
Because that's what we need, of course
2021-06-18 09:52:23 -07:00
Dylan Baker f7eda0e822 modules/qt: allow string values for include_directories
This should have been supported before, but wasn't.
2021-06-18 09:52:23 -07:00
Dylan Baker bfaa529a7a modules/qt: sort and clean up dependencies 2021-06-15 12:48:53 -07:00
Dylan Baker 2a8a6bb881 modules/qt: Return GeneratedListHolder instead of GeneratedList
This really shouldn't be necissary, but fixing the typing annotations of
ModuleReturnValue is much harder than just returning the Holder
directly.
2021-06-15 12:48:53 -07:00
Dylan Baker c422621317 interpreterobjects|build: use typed_kwargs for generator.process 2021-06-15 12:48:53 -07:00
Dylan Baker 2043461b87 build: Pass name of generator to initializer
It's really a property of the Generator what name to use, not something
that should be passed to each call to process files.
2021-06-15 12:48:53 -07:00
Dylan Baker 35bdaada1d interpreter|build: Do Generator keyword argument checking in the interpreter
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-15 12:48:53 -07:00
Dylan Baker d2c1ab40a0 interpreter|build: Pass just the executable down to Generator
This requires that the interpreter has done the validation, which it now
does at all callsites. This simplifies the Generator initializer.
2021-06-15 12:48:53 -07:00
Dylan Baker d064466e8b modues/qt: Make use of typed_kwargs since/deprecation abiltiy 2021-06-15 12:48:52 -07:00
Dylan Baker 3824e30f7a modules/qt: fix remaining typing issues and add to run_mypy
This just ignores the fact taht Generator is unchecked. Generator needs
some real love in terms of type checking.
2021-06-15 12:36:05 -07:00
Dylan Baker 3c4c7d0429 modules/qt: use type checking and annotations for compile_translations 2021-06-15 12:36:05 -07:00
Dylan Baker 2bc7a1b3da modules/qt: fully annotate and check qt.has_tools 2021-06-15 12:36:05 -07:00
Dylan Baker 61ddceb3b9 modules/qt: Make use of the default=[] availability 2021-06-15 12:36:02 -07:00
Dylan Baker ffa83f7f8a modules/qt: Type anotations and cleanups
This adds a number of missing type annotations to existing functions,
and makes a few members protected instead of public, as they were never
meant to be public
2021-06-15 12:35:15 -07:00
Dylan Baker 118f70fede modules/qt: have pre-process dispatch to moc_compile
for ode sharing and simplicity
2021-06-15 12:35:15 -07:00
Dylan Baker 2322804a4d modules/qt: Add a compile_moc method
This method only compiles moc resources, nothing else
2021-06-15 12:35:15 -07:00
Dylan Baker ec592a4eca modules/qt: use the compile_ui method inside the preprocess method
for code deduplication
2021-06-15 12:35:15 -07:00
Dylan Baker fcdb0f9879 modules/qt: Add a compile_ui method
Which is the same functionality split out of preprocess
2021-06-15 12:35:15 -07:00
Dylan Baker ed06ae3db1 modules/qt: Dispatch the preprocess method to the compile_resources method
Which removes code duplication and makes our testing better
2021-06-15 12:35:15 -07:00
Dylan Baker d27948b1dc modules/qt: Add a `compile_resources` method
This is a separate method for just handling qrc resources.
2021-06-15 12:35:15 -07:00
Dylan Baker 4575ed3d31 modules/qt: Deprecated the preprocess sources keyword argument 2021-06-15 12:35:15 -07:00
Dylan Baker 0fe3dc6571 modules/qt: Deprecated the *sources variadic argument to preproccess
It's confusing, and it's a duplicate of the `sources` keyword argument,
which has always existed.
2021-06-15 12:35:15 -07:00
Daniel Mensinger 95b70bcb97 deps: Split dependencies.base
Split the Factory and dependency classes out
of the base.py script to improve maintainability.
2021-06-03 10:23:27 -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 723c5227a4 modules: Remove snippet methods
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-28 15:17:10 -04:00
Xavier Claessens 4e312c19e6 gnome: Fix gtkdoc generation
install_scripts used to replace @BUILD_ROOT@ and @SOURCE_ROOT@ but it
was not documented and got removed in Meson 0.58.0. gnome.gtkdoc() was
relying on that behaviour, but it has always been broken in the case the
source or build directory contains spaces.

Fix this by changing get_include_args() to substitue paths directly
which will then get escaped correctly.

Add a unit test that builds GObject documentation which is where this
issue has been spotted.

Fixes: #8744
2021-05-12 15:54:37 -04:00
Nellie Zhang 6033c0f0da Fix python exception thrown for invalid resource path
If an invalid resource path is specified, then an uncaught python
exception occurs, and a backtrace is shown. Throw a MesonException
instead to produce a cleaner error message.
2021-05-08 20:39:25 +03:00
Dylan Baker c211fea513 Refactor Qt Dependency into proper split classes with factories
Currently the Qt Dependencies still use the old "combined" method for
dependencies with multiple ways to be found. This is problematic as it
means that `get_variable()` and friends don't work, as the dependency
can't implement any of those methods. The correct solution is to make
use of multiple Dependency instances, and a factory to tie them
together. This does that.

To handle QMake, I've leveraged the existing config-tool mechanism,
which allows us to save a good deal of code, and use well tested code
instead of rolling more of our own code.

The one thing this doesn't do, but we probably should, is expose the
macOS ExtraFrameworks directly, instead of forcing them to be found
through QMake. That is a problem for another series, and someone who
cares more about macOS than I do.
2021-03-23 15:28:08 -07:00