plugins v2: add support for out of source tree builds
Metadata
Current evaluation
Merged. Introduces an out_of_source_build property to PluginV2, disabling automatic source copying. Applied to meson and cmake plugins, adjusted for consistency per review, and merged with 100% diff coverage.
Suggested action: —
No scores available.
Issue body
- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [x] Have you successfully run `./runtests.sh static`?
- [x] Have you successfully run `./runtests.sh tests/unit`?
-----
This is intended as an alternative to PR #3347. It adds an `out_of_source_build` property to `PluginV2`, which is interpreted the same way it would be on `PluginV1` implementations, in that it disables the automatic copying of a part's source code to the build directory. The default implementation of the property is `plugin.out_of_source_build == False`.
To demonstrate that this works, I've ported the meson and cmake plugins to use this mode. For what it is worth, the cmake plugin was already configuring the build to use the copy of the source in `part_source_dir`, ignoring the copy in `part_build_dir`.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged. Introduces an out_of_source_build property to PluginV2, disabling automatic source copying. Applied to meson and cmake plugins, adjusted for consistency per review, and merged with 100% diff coverage. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged to master. Adds an out_of_source_build property to PluginV2 to disable automatic source copying. The meson and cmake plugins were updated to use this feature, providing explicit control over build directory behavior. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Added an out_of_source_build property to PluginV2 to disable automatic source copying, updating meson and cmake plugins. The property was retained after discussion and merged to maintain consistency. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #250 parts: check for out of source builds | craft-parts | merged | Merged fix for out-of-source builds with the source-subdir parameter. Added missing out-of-source checks and corrected source directory selection for cmake and meson plugins. Approved, passed CI, and merged with 221 additions and 24 deletions across 22 files. | |
| #3405 [feature] ROS plugins v2 out of source tree builds | snapcraft | merged | Merged. Enables out-of-source-tree builds for ROS plugins v2, allowing snapcraft.yaml placement in the package root. Replaces PR #3348. Approved by two reviewers and passed CI. | |
| #248 fix: parts: check for out of source builds | craft-parts | closed | Merged to fix out-of-source build detection in cmake and meson plugins, resolving source directory selection issues with the source-subdir parameter. Addresses CRAFT-1185. |