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

TASKFILE_DIR is incorrect #894

Closed
nfam opened this issue Oct 12, 2022 · 1 comment
Closed

TASKFILE_DIR is incorrect #894

nfam opened this issue Oct 12, 2022 · 1 comment

Comments

@nfam
Copy link

nfam commented Oct 12, 2022

  • Task version: v3.16.0 (h1:z7yz6yjWHOkt2/K8x4sEi709VKyHtsuQLwy2Jb9GEpw=)
  • Operating System: macOS Monterey

Case 1

# Taskfile.yml

version: '3'

includes:
  sub1: sub1

tasks:
  default:
    cmds:
      - echo "root ROOT_DIR     {{.ROOT_DIR}}"
      - echo "root TASKFILE_DIR {{.TASKFILE_DIR}}"
      - echo "root pwd          `pwd`"
      - task: sub1:echo
      - task: sub1:sub2:echo
    silent: true
# sub1/Taskfile.yml

version: '3'

includes:
  sub2: sub2

tasks:
  echo:
    cmds:
      - echo "sub1 ROOT_DIR     {{.ROOT_DIR}}"
      - echo "sub1 TASKFILE_DIR {{.TASKFILE_DIR}}"
      - echo "sub1 pwd          `pwd`"
    silent: true
# sub1/sub2/Taskfile.yml

version: '3'

tasks:
  echo:
    cmds:
      - echo "sub2 ROOT_DIR     {{.ROOT_DIR}}"
      - echo "sub2 TASKFILE_DIR {{.TASKFILE_DIR}}"
      - echo "sub2 pwd          `pwd`"
    silent: true

Then run task at the first Taskfile.yml directory

Result

root ROOT_DIR     /Volumes/data/test/case1
root TASKFILE_DIR /Volumes/data/test/case1
root pwd          /Volumes/data/test/case1
sub1 ROOT_DIR     /Volumes/data/test/case1
sub1 TASKFILE_DIR /Volumes/data/test/case1
sub1 pwd          /Volumes/data/test/case1
sub2 ROOT_DIR     /Volumes/data/test/case1
sub2 TASKFILE_DIR /Volumes/data/test/case1
sub2 pwd          /Volumes/data/test/case1

Expect

root ROOT_DIR     /Volumes/data/test/case1
root TASKFILE_DIR /Volumes/data/test/case1
root pwd          /Volumes/data/test/case1
sub1 ROOT_DIR     /Volumes/data/test/case1
sub1 TASKFILE_DIR /Volumes/data/test/case1/sub1
sub1 pwd          /Volumes/data/test/case1
sub2 ROOT_DIR     /Volumes/data/test/case1
sub2 TASKFILE_DIR /Volumes/data/test/case1/sub1/sub2
sub2 pwd          /Volumes/data/test/case1

As you can see, TASKFILE_DIR is incorrect for both sub1 and sub2


Case 2

# Taskfile.yml

version: '3'

includes:
  sub1:
    taskfile: sub1/Taskfile.yml
    dir: sub1

tasks:
  default:
    cmds:
      - echo "root ROOT_DIR     {{.ROOT_DIR}}"
      - echo "root TASKFILE_DIR {{.TASKFILE_DIR}}"
      - echo "root pwd          `pwd`"
      - task: sub1:echo
      - task: sub1:sub2:echo
    silent: true
# sub1/Taskfile.yml

version: '3'

includes:
  sub2:
    taskfile: sub2/Taskfile.yml
    dir: sub2

tasks:
  echo:
    cmds:
      - echo "sub1 ROOT_DIR     {{.ROOT_DIR}}"
      - echo "sub1 TASKFILE_DIR {{.TASKFILE_DIR}}"
      - echo "sub1 pwd          `pwd`"
    silent: true
# sub1/sub2/Taskfile.yml
version: '3'

tasks:
  echo:
    cmds:
      - echo "sub2 ROOT_DIR     {{.ROOT_DIR}}"
      - echo "sub2 TASKFILE_DIR {{.TASKFILE_DIR}}"
      - echo "sub2 pwd          `pwd`"
    silent: true

Then run task at the first Taskfile.yml directory

Result

root ROOT_DIR     /Volumes/data/test/case2
root TASKFILE_DIR /Volumes/data/test/case2
root pwd          /Volumes/data/test/case2
sub1 ROOT_DIR     /Volumes/data/test/case2
sub1 TASKFILE_DIR /Volumes/data/test/case2/sub1
sub1 pwd          /Volumes/data/test/case2/sub1
sub2 ROOT_DIR     /Volumes/data/test/case2
sub2 TASKFILE_DIR /Volumes/data/test/case2/sub1
sub2 pwd          /Volumes/data/test/case2/sub1/sub2

Expect

root ROOT_DIR     /Volumes/data/test/case2
root TASKFILE_DIR /Volumes/data/test/case2
root pwd          /Volumes/data/test/case2
sub1 ROOT_DIR     /Volumes/data/test/case2
sub1 TASKFILE_DIR /Volumes/data/test/case2/sub1
sub1 pwd          /Volumes/data/test/case2/sub1
sub2 ROOT_DIR     /Volumes/data/test/case2
sub2 TASKFILE_DIR /Volumes/data/test/case2/sub1/sub2
sub2 pwd          /Volumes/data/test/case2/sub1/sub2

In this case, TASKFILE_DIR is incorrect for sub2

@pd93
Copy link
Member

pd93 commented May 10, 2024

This works as expected in the latest version.

@pd93 pd93 closed this as completed May 10, 2024
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

No branches or pull requests

2 participants