Skip to content

Run subproject commands in the type's compilation directory#2123

Merged
bbatsov merged 1 commit into
masterfrom
feature/subproject-compilation-dir
Jul 25, 2026
Merged

Run subproject commands in the type's compilation directory#2123
bbatsov merged 1 commit into
masterfrom
feature/subproject-compilation-dir

Conversation

@bbatsov

@bbatsov bbatsov commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Follow-up to #2121, from its review.

The subproject commands passed the subproject down by let-binding
projectile-project-compilation-dir to it, which replaces rather than
composes - so whatever the project type (or your .dir-locals.el) had put
there was discarded. In a Meson monorepo projectile-compile-subproject ran
ninja in sub/ instead of sub/build/, which is the one case the feature
exists for.

The subproject is now the directory the compilation directory is resolved
against: projectile-compilation-dir takes it as an optional argument, and the
lifecycle runner threads the result through to projectile--run-project-cmd
instead of that function recomputing it - so the command that gets looked up
and the directory it runs in can't diverge.

Doing it that way makes the remaining variants free, so configure, install
and package join compile, test and run (s-p c m o, s-p c m i,
s-p c m p), generated from the lifecycle phase table rather than hand-written.
The prompt now also says where the command will run - Test command in services/api/: - since nothing else distinguished a subproject build from a
whole-project one.

The subproject commands replaced projectile-project-compilation-dir with
the subproject's path, which discarded whatever the project type (or the
user's dir-locals) had put there: in a Meson monorepo compiling a
subproject ran ninja in sub/ rather than sub/build/.

The subproject is now the directory the compilation directory is
resolved against, which projectile-compilation-dir takes as an argument
and the lifecycle runner threads through to the command it runs. That
also makes the remaining three variants free, so configure, install and
package join compile, test and run, and the prompt can say which
subproject it is about to build.
@bbatsov
bbatsov merged commit 06c5483 into master Jul 25, 2026
10 checks passed
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