casey / casey/just

Can't add dependencies to a specific invocation of a recipe with arguments

Open
#1,357 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
35.8k
Forks
846
Avg merge
27m
Merged PRs (30d)
3

Description

I'm playing with just for the first time and decided to experiment by rewriting this simple Makefile I'm currently using:

```Makefile
default: ign/cluster-1.ign

ign/cluster-1.ign: ign/system.ign ign/ssh.ign ign/k8s.ign
ign/%.ign: %.butane | igndir
butane -s $< -d $(@D) > $@

.PHONY: igndir
igndir:
mkdir -p ign
```

This generates ignition files from butane files. It also encapsulates the dependency that the cluster-1 ignition imports the system, ssh, and k8s ignitions, so they must be built first. This was my Justfile attempt:

```
default: (ign cluster-1)

ign cluster-1: (ign system) (ign ssh) (ign k8s)
ign IGN: igndir
butane -s "{{IGN}}.butane" -d . > "ign/{{IGN}}.ign"

@igndir:
mkdir -p ign
```

Unfortunately this dies with:

```
error: Recipe `ign` first defined on line 3 is redefined on line 4
|
4 | ign IGN: igndir
| ^^^
```

This is idiomatic and very powerful in make, and consequently I use it extensively. I couldn't see an obvious way to do this in just. I don't want a new recipe; I want to declare that when this recipe is called for 'cluster-1' specifically it has some additional dependencies.

Is there some other more idiomatic way of doing this in just?

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests. Start by tracing how just parses recipe definitions and handles dependencies for parameterized invocations, then look for related parser or dependency tests. Done means the requested invocation-specific dependency behavior is supported with coverage, or the limitation and idiomatic alternative are clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.