Skip to content

Conversation

BenFordTytherington
Copy link
Owner

More testing

LeonMatthesKDAB and others added 30 commits July 16, 2024 12:18
…AB#999)

* refactor: Rename CXXQT_* variables to CXX_QT_*

This is more in line with our crate naming (cxx-qt, not cxxqt) and
is more consistent, as before we were using both.

Fix KDAB#996

* refactor: Rename cxxqt_ CMake functions to cxx_qt_

This is more consistent with all our other naming.

* fix: build: Use export_dir on final crate only

Cargo can sometimes build different configurations of the same crate in
parallel.
This caused some failures with our new build system.
However, we can solve this by reverting to the OUT_DIR again.
Using the OUT_DIR is the only supported way to write artifacts anyway.

However, we still need to export data for CMake.
Therefore, we define an additional flag for each exact crate that CMake
is trying to import.
Only this exact crate will then export its data.
As CMake should only build a single configuration at a time, this should
not conflict.

* book: Document user-facing changes to CMake build

* cmake: Resolve ${CRATE} and ${APP_NAME} variables

At least do so in `qml_minimal`. I got the feedback from Milian that
this is rather hard to read otherwise, which I agree with.
Especially as that's the code we include in our getting-started guide it
should be as simple as possible.

* book: Update internals documentation

This is now slightly different, as we're no longer using a shared export
directory
This adds support for three flags to the qproperty macro: `read`,`write`,`notify`.

If any of them is used, the user is in control of what is generated by CXX-Qt.
Using the flags without an argument will cause CXX-Qt to auto-generate that part of the property.
This means that `read, write, notify` is equivalent to the current behavior, which continues to be supported for convenience.

If the user specifies a value (e.g. `read=my_getter`), CXX-Qt will no longer auto-generate anything, but simply link to that function in the definition of the Q_PROPERTY macro in C++.
The corresponding function/signal must already be exported to C++ by the user with the correct name & signature.

This allows user complete control over their signals.

We will likely follow this up with the remaining valid flags on Q_PROPERTY.
* Remove use of deprecated CombinedIdent and refactor to use Name in its place
CombinedIdent had a rust and cpp field for Idents, which has now been better implemented in Name, so refactor to using that everywhere CombinedIdent was used
* Introduce name field into ParsedMethod
* Replace From with TryFrom for QMethodName and clean up some comments
This allows us to download a lot less data with FetchContent for
quickier deployment.
* Start refactor of methods and signals int o structuring phase.
ParsedCxxQtData now has method and signal fields, and StructuredQObject has a methods hashmap

* Assemble HashMap of methods from structure phase.
StructuredQObject now should have a correct HashMap of it's methods, as built in Structure

* Add signals HashMap to StructuredQObject.
* Refactor Structuring phase
Added a name check function to StructuredQObject for searching for matches with method definitions
Switched methods and signals to use a Vec instead of HashMap in StructuredQObject
Rewrite test in Structuring due to using Vec over HashMap

Related to KDAB#1004
The generators and tests should now be using StructuredQObject and its fields, methods and signals, in place of ParsedQobject and it's fields of the same name, this includes:

 - Rewriting some of the generate functions in order to accept &Vec<&T> where they used to accept &Vec and all the use of these to follow that
 - Rewriting the rust generators to accept StructuredQObject instead of ParsedQObject
 - Rewriting the generator functions to push methods from StructuredQObject
…old code

- Update tests with new order for doc and cxx_name
- Update test_outputs for new attribute parsing
- Add doc field to ParsedSignal for passthrough
- Update tests to ignore unknown attributes like #[my_attribute]
- Update from_property_method of ParsedSignal to accept docs
…e readable

- Parameters to token stream conversion is now a method of ParsedSignal / ParsedMethod to reduce size of generate function
- Parameters to Vec<CppNamedType> is now a method of ParsedMethod to simplify generation of methods
…methods

Also associate inherited methods from cxxqtdata with StructuredQObjects in structuring phase
Create grcov script and modify gitignore to exclude .profraw directories
* Introduce method lookup into NameState so that cxx_names can be used for generating cpp headers, and associated with rust_names
* StructuredQObject is now passed through various functions in order to get it to NameState, where a lookup method of StructuredQObject finds the correct method
* Add proper error propagation to method lookup
* Add mocking function for StructuredQObject (and ParsedQObject by necessity) to clean up some tests
* Factor out module construction to helper functions to clean up tests
Copy link

codecov bot commented Aug 5, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants