Skip to content

Bug: sources are checked before running deps #1494

@Dom324

Description

@Dom324

Hello,
firstly thanks for making such a great tool!
I believe I found a bug where sources are checked before deps complete:

  compile_sources:
    deps: [preprocess_sources]
    sources:
      - "./build/**/*.cc"
    generates:
      - "./build/**/*.o"
    cmds:
      - for: sources
        cmd: '{{.CXX}} {{.CPPFLAGS}} -c -o $(basename {{.ITEM}} .cc).o {{.ITEM}}'

  preprocess_sources:
    sources:
      - "./src/**/*.cc"
    generates:
      - "./build/**/*.cc"
    cmds:
      # Preprocess src/**/*.cc into build/**/*.cc
      - cp src/main.cc build/main.cc     # dummy command

The preprocess_sources task generates sources for compile_sources. But this is the output that I get:

❯ ls build                                                 # empty dir
❯ task compile_sources
task: [preprocess_sources] cp src/main.cc build/main.cc    # compile_sources does not run at all
❯ ls build
main.cc                                                    # no main.o
❯ task -f compile_sources                                  # force run
task: [preprocess_sources] cp src/main.cc build/main.cc
task: [compile_sources] clang++ .....                      # compile_sources is run
❯ ls build
main.cc  main.o                                            # main.o exists

What I believe is happening is:

  1. compile_sources is called
  2. compile_sources checks it's sources, generates checksum
  3. Call dependencies
    3.1 preprocess_sources generates .cc files in build/
  4. compile_sources does not generate .o files in build/, because build/ was empty when sources were checked

Expected behavior:

  1. compile_sources is called
  2. Call dependencies
    2.1 preprocess_sources generates .cc files in build/
  3. compile_sources checks it's sources, generates checksum
  4. compile_sources generates .o files from sources in build/
  • Task version: 3.34.1
  • Operating system: Ubuntu
  • Experiments enabled: No

Metadata

Metadata

Assignees

No one assigned

    Labels

    state: needs triageWaiting to be triaged by a maintainer.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions