Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run: once not working with hierarchies of includes #1864

Open
postlund opened this issue Oct 14, 2024 · 0 comments
Open

run: once not working with hierarchies of includes #1864

postlund opened this issue Oct 14, 2024 · 0 comments
Labels
state: needs triage Waiting to be triaged by a maintainer.

Comments

@postlund
Copy link

  • Task version: Task version: v3.39.2 (h1:Zt7KXHmMNq5xWZ1ihphDb+n2zYLCo4BdRe09AnMMIgA=)
  • Operating system: WSL2 (5.15.153.1-microsoft-standard-WSL2)
  • Experiments enabled: none

This is an extension of #1498. It is more or less the same case where I have software components, e.g, libs, depending on a "tool". The tool Taskfile.yaml will download and set itself up automatically, but should only be run once no matter how many libraries that are using/including it. My difference is that I have a Taskfile.yaml file in the lib directory that forwards tasks to each library, so I can tell task to for instance build/test/lint just all apps or libraries and move includes closer to where each component lives (instead of including everything from the main taskfile). An example looks like this:

./tools/Compiler.yaml
version: "3"

tasks:
  setup:
    run: once
    sources:
      - ./input
    generates:
      - ./output
    cmds:
      - touch output
 
./lib/a/Taskfile.yaml
version: "3"

includes:
  compiler:
    taskfile: ../../tools/Compiler.yaml
    dir: ../../tools
    internal: true

tasks:
  build:
    deps:
      - compiler:setup
    cmds:
      - touch a
 
./lib/b/Taskfile.yaml
version: "3"

includes:
  compiler:
    taskfile: ../../tools/Compiler.yaml
    dir: ../../tools
    internal: true

tasks:
  build:
    deps:
      - compiler:setup
    cmds:
      - touch b

./lib/Taskfile.yaml     # <--- THIS FILE IS NEW HERE
version: "3"

includes:
  a:
    taskfile: a
    dir: ./a
  b:
    taskfile: b
    dir: ./b

tasks:
  build:
    deps: [a:build, b:build]

./Taskfile.yaml
version: "3"

includes:
  lib:
    taskfile: ./lib/
    dir: ./lib/

tasks:
  build:
    deps: [lib:build]

Running this setup looks like this:

$ ../.work/task build
task: [lib:b:compiler:setup] touch output
task: [lib:a:compiler:setup] touch output
task: [lib:b:build] touch b
task: [lib:a:build] touch a
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: needs triage Waiting to be triaged by a maintainer.
Projects
None yet
Development

No branches or pull requests

2 participants