[Chapel Merge] Add a new warning/error when the compiler is given a bad module directory

Branch: refs/heads/main
Revision: 069f95aac5c25e5c050053d0037a69ac2ecfc1b6
Author: jabraham17
Link: Add a new warning/error when the compiler is given a bad module directory by jabraham17 · Pull Request #28578 · chapel-lang/chapel · GitHub
Log Message:
Add a new warning/error when the compiler is given a bad module directory (#28578)

Adds a new warning when a user tries to pass an invalid directory to
-M (or other module directory paths).

This PR makes it an warning to pass a non-existent PATH to
-M/-module-dir, CHPL_MODULE_PATH, prepend-internal-module-dir,
and prepend-standard-module-dir and an error to pass a valid path to a
non-directory

The logic for checking new directories is put in Dyno. I think this is
cleaner than putting it in the arg parsing for the compiler, and means
tools like chpl-language-server and chpldoc will also benefit from
the warning (with no extra work). However, this was somewhat tricky to
implement, for 2 reasons.

  • paratest
  • start_test test/compflags/AddNonDirToModulePath.chpl test/compflags/AddNonDirToModulePath-env1.chpl test/compflags/AddNonDirToModulePath-env2.chpl
  • start_test test/compflags/AddNonDirToModulePath.chpl test/compflags/AddNonDirToModulePath-env1.chpl test/compflags/AddNonDirToModulePath-env2.chpl --compopts --no-compiler-driver

Resolves `-M` flag should error (or warn?) if argument is not a directory · Issue #24770 · chapel-lang/chapel · GitHub
Subsumes and closes Issue an error if an argument passed to '-M' is not a directory by dlongnecke-cray · Pull Request #25358 · chapel-lang/chapel · GitHub

[Reviewed by @arifthpe]

Compare: Comparing 43690950f9b587fdb7369bb3e10a9550869b8b11...1df71d6efb962239bc3f93fa8af78df4138895ad · chapel-lang/chapel · GitHub

Diff:
M compiler/include/driver.h
M compiler/include/files.h
M compiler/include/parser.h
M compiler/llvm/clangUtil.cpp
M compiler/main/driver.cpp
M compiler/passes/parseAndConvert.cpp
M compiler/util/files.cpp
M frontend/include/chpl/framework/Context.h
M frontend/include/chpl/util/filesystem.h
M frontend/lib/framework/Context.cpp
M frontend/lib/parsing/parsing-queries.cpp
M frontend/lib/util/filesystem.cpp
M frontend/test/resolution/testEnums.cpp
M frontend/test/util/testQueryTimingAndTrace.cpp
A test/compflags/AddNonDir-dir/UsefulModule.chpl
A test/compflags/AddNonDir-dir/UsefulModule.notest
A test/compflags/AddNonDir-file.txt
A test/compflags/AddNonDir-symlink-dir
A test/compflags/AddNonDir-symlink-file
A test/compflags/AddNonDirToModulePath-env1.chpl
A test/compflags/AddNonDirToModulePath-env1.compenv
A test/compflags/AddNonDirToModulePath-env1.good
A test/compflags/AddNonDirToModulePath-env2.chpl
A test/compflags/AddNonDirToModulePath-env2.compenv
A test/compflags/AddNonDirToModulePath-env2.good
A test/compflags/AddNonDirToModulePath.1.good
A test/compflags/AddNonDirToModulePath.2.good
A test/compflags/AddNonDirToModulePath.3.good
A test/compflags/AddNonDirToModulePath.4.good
A test/compflags/AddNonDirToModulePath.5.good
A test/compflags/AddNonDirToModulePath.6.good
A test/compflags/AddNonDirToModulePath.7.good
A test/compflags/AddNonDirToModulePath.8.good
A test/compflags/AddNonDirToModulePath.9.good
A test/compflags/AddNonDirToModulePath.chpl
A test/compflags/AddNonDirToModulePath.compopts
https://github.com/chapel-lang/chapel/pull/28578.diff