project_loader: load build-environment after snapcraft environment
Metadata
Current evaluation
Merged PR #2744 (commit f3799a5dc) reordered project-loader evaluation so build-environment loads after Snapcraft's environment, enabling variables such as $SNAPCRAFT_PART_INSTALL.
Resolution: closed resolved
Reason: PR #2744 was merged, resolving the evaluation-order problem. Commit f3799a5dc contains the change that loads build-environment after Snapcraft's environment.
Evaluated by: mr-cal-bot
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`?
-----
Currently it's impossible to define a `build-environment` that uses variables defined by snapcraft itself (e.g. `$SNAPCRAFT_PART_INSTALL`), since the `build-environment` is evaluated before snapcraft's environment. Fix this by simply switching the order.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #2744 (commit f3799a5dc) reordered project-loader evaluation so build-environment loads after Snapcraft's environment, enabling variables such as $SNAPCRAFT_PART_INSTALL. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #2744 reordered project-loader evaluation so build-environments are loaded after Snapcraft's environment, enabling variables such as $SNAPCRAFT_PART_INSTALL. Resolved in commit f3799a5dc. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged fix to load the build-environment after the snapcraft environment, enabling access to internal variables like $SNAPCRAFT_PART_INSTALL. The change swaps the evaluation order in the project loader and was approved by maintainers. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Reordered environment loading so build-environment processes after snapcraft's environment, enabling use of snapcraft variables like $SNAPCRAFT_PART_INSTALL. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2322 project_loader: add build-environment part property | snapcraft | merged | Merged in snapcraft#2322 (commit d17b67d20), adding an ordered part-level build-environment property for lifecycle variables and resolving LP #1778174. | |
| #2534 Add SNAPCRAFT_PROJECT_DIR environment variable. | snapcraft | merged | Merged PR #2534 (commit 3d4483d6f, 'project loader: add SNAPCRAFT_PROJECT_DIR environment variable') by tonysimpson, fixing Launchpad bug 1824417; the var still ships in snapcraft/parts/lifecycle.py global environment. | |
| #1815658 snapcraft leaks build-environment across parts | snapcraft (launchpad) | closed | Fixed by snapcore/snapcraft PR #2472 (commit 8ca7dd7f2), preventing a part's build-environment from leaking into subsequently processed parts. | |
| #3414 project loader: export SNAPCRAFT_TARGET_ARCH in build environment | snapcraft | merged | Merged PR #3414 (commit ff2cd96bb) added SNAPCRAFT_TARGET_ARCH to the global build environment in set_global_environment() for core22, alongside SNAPCRAFT_ARCH_TRIPLET. | |
| #2472 project loader: do not leak a part's build-environment | snapcraft | merged | Merged #2472 as commit 8ca7dd7f2, preventing a part's build environment from leaking into parts declared with after and avoiding unintended concatenation. |