Files
Vincent Jicquel 29af6b87c5 Provide more information to the user when a project file is not found
The paths used for project-file searching are now displayed to the user as a
categorized list when a missing relative path is passed to the Load subprogram.

To achieve this, the origin of the paths needed to be stored, which is now
done in the Default field of the All_Search_Paths record.

Additional paths are added later in the Recursive_Load subprogram and are
also displayed in their respective categories.

We no longer depend on Search_Paths to ensure that the paths used for searching
match those displayed; previously, these could easily diverge if the
implementation of Search_Paths changed without the display code being updated.

Issues:
- eng/gpr/gpr-issues#682
- eng/gpr/gpr-issues#707
- eng/das/cov/gnatcoverage#406
2025-12-19 11:24:31 +00:00

26 lines
718 B
Python

import os
import subprocess
from testsuite_support.builder_and_runner import BuilderAndRunner
from testsuite_support.tools import GPRBUILD, GPRCLEAN
bnr = BuilderAndRunner()
bnr.build("missing_projects.gpr", args=["-p"])
def test(title):
print(f"--- {title} ---")
p = bnr.call(["./main"], quiet=True)
for line in p.out.splitlines():
# Prevent displaying search paths when a project file is not found
if not line.startswith(" -"):
print(line)
print("")
print("without")
test("Without all environment variables set")
os.environ["ADA_PROJECT_PATH"] = "/non/existant/path"
os.environ["GPR_PROJECT_FILE_PATH"] = "project_files"
test("With all environment variables set")