Skip to content

Latest commit

 

History

History
154 lines (102 loc) · 3.06 KB

@calls.md

File metadata and controls

154 lines (102 loc) · 3.06 KB

@calls

Why do we need new directive? See issue 171.

[x] Naming: @call vs @calls

For consistency with @depends_on and for better declarativity let's use @calls:

@goal a
@calls b

[x] Do we allow both @calls and @depends_on on the same level?

@goal a
@calls b
@depends_on c

We could but the execution model would be this (@depends_on goes first):

@goal a
@depends_on c
"$MAKESURE" b

Answer: yes, why not. But we need to make clear in the docs the semantics. Dependencies will run BEFORE calls.

[x] Detect loops

@goal a
@calls b

@goal b
@depends_on a

[x] Do we allow both @calls and non-empty goal body?

@goal a
@calls b
  echo 'a body'

Should be relatively easy. Don't see any good reason against.

Answer: yes.

[x] Do we allow @calls goal_name @args 'arg'?

Let's allow. The goal will be instantiated the same way as for @depends_on

What about

@goal pg1 @params P1 P2
 echo "pg1: $P1 $P2"

@goal pg @params A
@calls pg1 @args A "A=$A"

Answer: interpolation rules should apply the same as for @depends_on, i.e. all works as expected.

Can we implement it more efficient than just running more makesure processes?

Maybe, but let's do the easiest for the first iteration

[x] How do we output the dependency tree (-d,--resolved)

In the first iteration let's not generate a subtree.

[x] @calls operational semantics

Let's implement the simplest strategy of passthrough to ./makesure invocation

@goal a
@calls b

desugars to

@goal a
"$MAKESURE" [--define ...] b

Do we need --file 'path/to/Makesurefile'?

No. Even if we run ./makesure -f path/to/Makesurefile path resolution is relative to the Makesurefile location, so internal makesure invocation now doesn't need explicit Makesurefile reference. But let's add a test for this case.

Yes, we must add --file because it can be ./makesure -f path/to/anyname.

Are there other options to passthrough (Usage)?

Yes:

 -s,--silent     silent mode - only output what goals output
 -t,--timing     display execution times for goals and total
 -x,--tracing    enable tracing in bash/sh via `set -x`

For -s and -x it's easy - just replicate.

For -t it's trickier, probably we need to find a way to suppress the total time for called goals.

  • Solution. Let's use a special internal --timing-skip-total CLI option

[x] the @define inheritance

Since we implement this in terms of running the external ./makesure we need to repeat the variables passed via -D.

@define A 'a'

@goal a1
  echo "a1: $A"
  
@goal a2
  echo "a2: $A"
  
@goal b
@calls a1 
@calls a2 

@goal c
@calls a1 a2 

desugars to

@define A 'a'

@goal a1
  echo "a1: $A"
  
@goal a2
  echo "a2: $A"
  
@goal b
  "$MAKESURE" --define A="$A" a1
  "$MAKESURE" --define A="$A" a2
  
@goal c
  "$MAKESURE" --define A="$A" a1
  "$MAKESURE" --define A="$A" a2