project_loader: load build-environment after snapcraft environment
Metadata
Current evaluation
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.
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`?
-----
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 |
|---|---|---|---|---|
| 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. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged a fix adjusting the project loader to evaluate build-environment after snapcraft's environment. This resolves a bug where build-environment could not reference snapcraft variables like $SNAPCRAFT_PART_INSTALL due to premature evaluation. |
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 into master. Adds a build-environment property to snapcraft parts for declarative environment variable definition. Resolves LP: #1778174. Approved and passed CI. | |
| #1141 parser: use the project loader code to find the origin's snapcraft.yaml | snapcraft | merged | Merged a refactor replacing custom snapcraft.yaml detection with existing project_loader code, resolving LP bug #1665007. The author addressed reviewer feedback on commit formatting and conventions before final approval. | |
| #3122 pluginhandler: make the build environment available to all steps | snapcraft | merged | Merged. Reviewer feedback refined scoping: build environment is now available across all plugin steps. SNAPCRAFT_STAGE stays global, build-environment stays on the build step. Changes affect 10 files. | |
| #2897 meta: include environment in hook wrappers | snapcraft | merged | Merged a fix restoring environment variable inclusion for Snapcraft hook wrappers, correcting a regression that limited it to apps. Approved, passed CI, and modified three files. Resolves LP #1824255. |