Skip to content

Move structured sources handling to Build - #15900

Open
bonzini wants to merge 26 commits into
mesonbuild:masterfrom
bonzini:structured-sources-no-backend
Open

Move structured sources handling to Build#15900
bonzini wants to merge 26 commits into
mesonbuild:masterfrom
bonzini:structured-sources-no-backend

Conversation

@bonzini

@bonzini bonzini commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Move the handling of structured sources from the backend to the Build object; structured sources are now lowered to GeneratedLists. This removes all the special casing of structured sources, only leaving a small lowering pass before process_compilers().

I chose to allow using structured sources for non-Rust programs. This can be done or not independent of the new implementation. If it is undesirable, I can remove it - but it's simpler to basically treat structured_sources() as syntactic sugar for generators, which they are now.

@bonzini
bonzini force-pushed the structured-sources-no-backend branch from 351415d to 2cc7f4a Compare June 5, 2026 15:18
@bonzini
bonzini marked this pull request as ready for review June 5, 2026 16:07
@bonzini
bonzini requested review from dcbaker and jpakkane as code owners June 5, 2026 16:07
@bonzini
bonzini force-pushed the structured-sources-no-backend branch from 2cc7f4a to b4334da Compare June 5, 2026 17:02
@bonzini

bonzini commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

One note: moving directly to Interpreter seems trivial/obvious, but there's a wrinkle, in that the check for mixed structured/unstructured sources (which this patch places in process_structured_sources()) must run after add_deps(). The interpreter does not see the full set of sources, only BuildTarget does.

@bonzini
bonzini force-pushed the structured-sources-no-backend branch from 3302c47 to 90925a9 Compare June 8, 2026 03:15
@bonzini bonzini added this to the 1.12 milestone Jun 11, 2026
@bonzini bonzini modified the milestones: 1.12, 1.13 Jun 19, 2026
@bonzini

bonzini commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

More or less fixes #3023.

bonzini added 3 commits July 14, 2026 13:17
Continue the job started by commit 687cb97 ("backends:
use Build.get_project_args", 2026-01-16).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Make this more consistent with get_project_*args.  Either way the arguments
are only used together with a build target.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Per-machine compiler arguments (whether global or project) are separated
for "native: true" and "native: false" targets.  This means that it is
incorrect to simply drop them for "native: true" targets when not cross
compiling.

Instead, the BuildTarget needs to know the *original* value of native and
use it to apply the correct set of arguments.

Start by adding all the infrastructure and handling project arguments.
Global arguments need more care; they are not yet fully fixed.
bonzini added 14 commits July 15, 2026 08:58
Reduced from QEMU.

Reported-by: Katalin Rebhan <me@dblsaiko.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Per-machine compiler arguments (whether global or project) are separated
for "native: true" and "native: false" targets.  This means that it is
incorrect to simply drop them for "native: true" targets when not cross
compiling.

For global arguments, the BuildTarget needs to whether "native: true"
appeared in the *original* value of native as well as in any subproject
call.
Only apply machine map in the leaf functions, which are _dependency_method_impl
and Interpreter.build_target.  dependency_method was not applying it while
extension_module_method was doing it too early (resulting in double application
later in build_target).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Commits 8035ea6 and 0fea57b were not backported to 1.11.2,
as was intended to happen when the commit was written.  Change
the version number in the KwargInfo and move them to the 1.12.0
release notes.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This was fixed as a result of the effort to clean up typing of the
Ninja backend.  Detect the situation and raise a FeatureNew for it,
so that users get a notice that they are relying on something that
never worked prior to commit 8e705ad.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This reverts commit 7d4c05a.
The correct fix is to check for the version number, since
-object_path_lto was added in ld64 123.2.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Bound its inclusion using the same scheme as export_dynamic_args.
Use _apply_prefix for consistency.

Fixes: mesonbuild#15808
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
For xtools ld64, Meson currently passes the xtools version
(e.g. 2.2.4) instead of the linker version.  Fix this so that
all the features are available.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Information on which generated files are handled as mere orderdeps
is split between ninjabackend and vs2010backend.  Create a single
function for that.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
List both the output (if only one) and the source.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This simplifies debugging, since all the interesting information is
added to these fields by Generator.process_files.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
bonzini added 9 commits July 19, 2026 16:01
Prepare for adding structured_sources support to backends other
than ninja.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This is not exposed via generator.process(), but it can be used by
the conversion of StructuredSources to GeneratedLists.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Apply it to any language that does not support separate compilation.
This is still only Rust, but it provides the foundation for
transforming structured sources into normal ones.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Similar to CustomTargets, and likewise not exposed by the Meson DSL.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Use GeneratedLists to copy all resources into the root
of the jar file.  No resources argument is treated simply
as an empty list.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Remove the duplicated code to find the main .rs file across
both structured and normal sources, as well as the code to
generate copy targets: instead just reuse the GeneratedList
mechanism.  This provides support across multiple backends,
makes Rust less of a special case, and in fact makes
structured sources themselves less of a special case.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
@bonzini
bonzini force-pushed the structured-sources-no-backend branch from 90925a9 to b63b088 Compare July 19, 2026 14:03
@bonzini
bonzini requested a review from mensinda as a code owner July 19, 2026 14:03
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.

1 participant