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

mise not skipping tasks #1857

Closed
hofstee opened this issue Apr 4, 2024 · 1 comment · Fixed by #3488
Closed

mise not skipping tasks #1857

hofstee opened this issue Apr 4, 2024 · 1 comment · Fixed by #3488
Labels

Comments

@hofstee
Copy link

hofstee commented Apr 4, 2024

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 #1261) I tried to make it output to a file instead so I could skip the task when the dependencies weren't modified.

@hofstee hofstee added the bug label Apr 4, 2024
@Ernest0-Production
Copy link

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.

mise/src/cli/run.rs

Lines 513 to 514 in 230897c

.filter(|p| p.is_file());

jdx added a commit that referenced this issue Dec 12, 2024
I literally have no clue why this filter is there. Hopefully this will not break something

Fixes #1857
@jdx jdx closed this as completed in #3488 Dec 12, 2024
@jdx jdx closed this as completed in a4b6316 Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants