jdx / mise

dev tools, env vars, task runner
https://mise.jdx.dev
MIT License
10.11k stars 291 forks source link

mise not skipping tasks #1857

Open hofstee opened 7 months ago

hofstee commented 7 months ago

Describe the bug mise doesn't appear to be respecting the sources and outputs to skip running a task.

To Reproduce I have this in my mise.toml

[tasks.bundle_id]
sources = ['*.xcodeproj']
outputs = ['.bundle_id']
run = """
#!/usr/bin/env bash
xcodebuild -showBuildSettings | grep PRODUCT_BUNDLE_IDENTIFIER | awk -F ' = ' '{print $2}' > .bundle_id
"""

[tasks.reload]
alias = "default"
depends = ["bundle_id"]
# ...

Expected behavior The docs seem to suggest that bundle_id should be skipped if .bundle_id is newer than any .xcodeproj file, but it's running every time I run the reload task. Running mise run bundle_id also re-runs the command (though maybe that last bit is intentional?). It's also worth noting that .xcodeproj files are really directories.

mise doctor output

version: 2024.4.0 macos-arm64 (2024-04-02)
activated: yes
shims_on_path: no

build_info:
  Target: aarch64-apple-darwin
  Features: DEFAULT, NATIVE_TLS
  Built: Tue, 2 Apr 2024 01:55:39 +0000
  Rust Version: rustc 1.77.1 (7cf61ebde 2024-03-27) (Homebrew)
  Profile: release

shell:
  /opt/homebrew/bin/fish
  fish, version 3.7.0

dirs:
  data: ~/.local/share/mise
  config: ~/.config/mise
  cache: ~/Library/Caches/mise
  state: ~/.local/state/mise
  shims: ~/.local/share/mise/shims

config_files:
  ~/.tool-versions
  ~/.config/mise/config.toml
  ~/scratch/xcode/ariadne/.mise.toml

plugins:
  bun        (core)
  deno       (core)
  erlang     (core)
  go         (core)
  java       (core)
  node       (core)
  python     (core)
  ruby       (core)
  usage      https://github.com/jdx/mise-usage.git#fe3888a
  watchexec  https://github.com/nyrst/asdf-watchexec.git#b667a08

toolset:
  usage@0.1.17
  watchexec@1.25.1
  direnv@2.32.3     (missing)
  python@3.12.0     (missing)

env_vars:
  MISE_SHELL=fish

settings:
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf_compat = false
  cargo_binstall = true
  color = true
  disable_default_shorthands = false
  disable_tools = []
  experimental = true
  go_default_packages_file = "~/.default-go-packages"
  go_download_mirror = "https://dl.google.com/go"
  go_repo = "https://github.com/golang/go"
  go_set_gopath = false
  go_set_goroot = true
  go_skip_checksum = false
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  node_compile = false
  not_found_auto_install = true
  paranoid = false
  plugin_autoupdate_last_check_duration = "7d"
  python_compile = false
  python_default_packages_file = "/Users/hofstee/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  raw = false
  trusted_config_paths = []
  quiet = false
  verbose = false
  yes = false
  ci = false
  debug = false
  trace = false
  log_level = "info"
  python_venv_auto_create = false

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false

No problems found

Additional context I was originally trying to figure out how to get an [env] variable from the mise.toml into the task run command, but since the command takes a couple seconds to run and there's no caching for environment variables (as mentioned in https://github.com/jdx/mise/issues/1261) I tried to make it output to a file instead so I could skip the task when the dependencies weren't modified.

Ernest0-Production commented 1 month ago

The main problem seems to be that it only works for files. Not for directories

I can't guess why this decision was made, but I also encountered this problem and the need to rely on the directory modification date, since files can be added/removed in it. https://github.com/jdx/mise/blob/230897c41210502f69ed5c4270f13d6efc416f89/src/cli/run.rs#L513-L514