Commit Graph

69 Commits

Author SHA1 Message Date
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
Dylan Baker d7ac2f1065 qt: move compilers_detect to the qt module
It's a method on the QtDependeny that exists purely for the consumption
of the qt module (in the form, return some stuff the module makes into
an instance variable). So put it where it actually belongs, and pass the
qt dependency into it.
2021-03-22 16:54:01 -07: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
Eli Schwartz 6a0fabc647
mass rewrite of string formatting to use f-strings everywhere
performed by running "pyupgrade --py36-plus" and committing the results
2021-03-04 17:16:11 -05:00
Luca Weiss 398df56298 Add Qt6 module 2021-02-07 22:43:00 +02:00
Eli Schwartz 478feb39ed qt module: fix error message typo, translation qresource accepts qm not ts
Fixes #7925
2020-11-04 17:23:34 +02:00
Dylan Baker f342efd080 pylint: turn on bad-indentation error
and fix all of the bad indentation
2020-09-22 17:57:03 -07:00
Eli Schwartz 1de1cc22e2 qt module: add qresource support to compile_translations
A common pattern in Qt5 applications is to embed translations in the
executable using the qresource system. In this case, the list of
translation files is already available in the .qrc file and there's no
good reason to duplicate this info in meson.build.

Let compile_translations optionally take a qrc input, in which case it
will go straight to generating the relevant translations and
rcc-generated .cpp, and directly return the thing users actually care
about -- the .cpp for linking.
2020-08-25 23:46:45 +03:00
Eli Schwartz f2dad788e7 qt module: rcc supports depfiles now, given a recent enough version of Qt5
Add depfile support to generated targets for Qt >= 5.14.

Move warning into the module init itself, to check if the version is too
old before issuing. Also tweak the wording itself, to advise upgrading
to a suitable version of Qt5 instead of advising to wait for a Qt bug to
be fixed.
2020-07-13 22:28:58 +00:00
Xavier Claessens f66c8c35da qt: Fix has_tools() when required=False
Improve logs by making it clear when the program is found but has
wrong version.
2020-07-04 13:57:08 +03:00
Jussi Pakkanen 44ff3e6c7d
Merge pull request #6736 from dcbaker/mesonlib-type-annotations
Mesonlib type annotations
2020-03-08 14:49:23 +02:00
Xavier Claessens ecb076ba00 qt5: Add has_tools() method 2020-03-08 13:48:27 +02:00
Dylan Baker 06b1a317d2 Make use of unholder
We have a lot of cases of code like:
```python
if hasattr(var, 'held_object'):
    var = var.held_object`
```

replace that with the unholder function.
2020-03-05 09:58:52 -08:00
Dylan Baker 581d69a8d3 remove ability to pass multiple keys to extract_as_list
This makes the typing annotations basically impossible to get right, but
if we only have one key then it's easy. Fortunately python provides
comprehensions, so we don't even need the ability to pass multiple keys,
we can just [extract_as_list(kwargs, c) for c in ('a', 'b', 'c')] and
get the same result.
2020-03-05 09:58:52 -08:00
Marc Herbert adcd70861d modules/qt.py: friendlier "lrelease-qtN not found" error message
When lrelease-qtN is missing, upgrade the error message from the
cryptic:

  meson.build:75:4: ERROR: Tried to use not-found external program in "command"

to the meaningful:

  meson.build:75:4: ERROR: qt.compile_translations: lrelease-qt5 not found

Issue found and tested with "test cases/frameworks/4 qt/"
2019-11-27 02:28:20 +02:00
Dylan Baker 5678468c2c Don't use len() to test for container emptiness
I ran the numbers once before (it's in the meson history) but it's
*much* faster to *not* use len for testing if a container is empty or
not.
2019-04-25 12:28:51 -07:00
Luca Weiss 7c461582a2 Add feature warning for qt.compile_translations 2019-03-17 19:29:06 +02:00
Jon Turney d3f2172de8 lgtm: Too few arguments for string format.
Too few arguments for string format. Format "{0} sources specified and
couldn't find {1}, please check your qt{2} installation" requires at least
3, but 2 are provided.
This alert was introduced in f7f439c a year ago
2018-11-19 21:07:37 +02:00
Dylan Baker aa04147a4a dependencies/ui: Allow qt compilers and qmake to be specified in native file 2018-11-14 15:57:37 -08:00
xiannox 5b3192534c module-qt: add rcc_extra_arguments to pass extra arguments to rcc (#4406) 2018-10-24 19:11:08 +03:00
Salamandar 26a5e9a95f Add support for uic_extra_arguments to qt5 (#4178) 2018-09-28 13:01:27 -07:00
Alexey Rochev 862019e6de Qt: Allow passing dependency objects to preprocess method (#3470, #3875) 2018-09-03 21:13:03 +03:00
Salamandar c90885de6d Add 0.44.0 features 2018-06-01 14:23:24 +02:00
Salamandar fa6550b277 Add 0.40.0 features 2018-06-01 14:23:24 +02:00
Alexis Jeandet 4b98898c7c [Qt module] refactor b4cd949c48
Since relative path in qrc files are always relative to qrc file
itself then we just need to check that normpath(qrc file + resource)
doesn't start with build dir path, this would mean that the resource is
generated.

Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2018-04-04 09:36:45 +02:00
Alexis Jeandet b4cd949c48 [Qt module] More qrc fixes
When several qrc files are given all qrc files dependencies were mixed.
Fixed non working use case:
	When user try to guess build dir layout and add use a relative
	path between a generated qrc file and a generated resource.

Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2018-04-04 01:06:43 +02:00