diff --git a/src/python/pants/init/engine_initializer.py b/src/python/pants/init/engine_initializer.py index 84b3f008113b..4efa116b832a 100644 --- a/src/python/pants/init/engine_initializer.py +++ b/src/python/pants/init/engine_initializer.py @@ -3,6 +3,7 @@ import logging from dataclasses import dataclass +from pathlib import Path from typing import Any, Iterable, List, Optional, Set, Tuple, Type, cast from pants.base.build_environment import get_buildroot @@ -308,14 +309,17 @@ def build_root_singleton() -> BuildRoot: union_rules = build_configuration.union_rules() + def ensure_absolute_path(v: str) -> str: + return Path(v).resolve().as_posix() + scheduler = Scheduler( native=native, ignore_patterns=pants_ignore_patterns, use_gitignore=use_gitignore, build_root=build_root, - local_store_dir=local_store_dir, - local_execution_root_dir=local_execution_root_dir, - named_caches_dir=named_caches_dir, + local_store_dir=ensure_absolute_path(local_store_dir), + local_execution_root_dir=ensure_absolute_path(local_execution_root_dir), + named_caches_dir=ensure_absolute_path(named_caches_dir), rules=rules, union_rules=union_rules, execution_options=execution_options, diff --git a/src/python/pants/option/global_options.py b/src/python/pants/option/global_options.py index 713f516db530..84e04c5948e2 100644 --- a/src/python/pants/option/global_options.py +++ b/src/python/pants/option/global_options.py @@ -670,7 +670,9 @@ def register_bootstrap_options(cls, register): register( "--local-store-dir", advanced=True, - help="Directory to use for engine's local file store.", + help=( + "Directory to use for engine's local file store. This may be absolute or relative." + ), # This default is also hard-coded into the engine's rust code in # fs::Store::default_path so that tools using a Store outside of pants # are likely to be able to use the same storage location. @@ -679,14 +681,19 @@ def register_bootstrap_options(cls, register): register( "--local-execution-root-dir", advanced=True, - help="Directory to use for engine's local process execution sandboxing.", + help=( + "Directory to use for engine's local process execution sandboxing. This may be " + "absolute or relative." + ), default=tempfile.gettempdir(), ) register( "--named-caches-dir", advanced=True, - help="Directory to use as the base for named global caches for processes with " - "trusted, concurrency-safe caches.", + help=( + "Directory to use as the base for named global caches for processes with trusted, " + "concurrency-safe caches. This may be absolute or relative." + ), default=os.path.join(get_pants_cachedir(), "named_caches"), ) register(