Skip to content

Commit 2fd375e

Browse files
committed
Merge branch 'main' into llvm-dylib-default
2 parents 2f1529f + 7691559 commit 2fd375e

File tree

21,795 files changed

+1501874
-664404
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

21,795 files changed

+1501874
-664404
lines changed

.ci/compute_projects.py

Lines changed: 62 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
PROJECT_DEPENDENCIES = {
2020
"llvm": set(),
2121
"clang": {"llvm"},
22+
"CIR": {"clang", "mlir"},
2223
"bolt": {"clang", "lld", "llvm"},
2324
"clang-tools-extra": {"clang", "llvm"},
2425
"compiler-rt": {"clang", "lld"},
@@ -48,13 +49,13 @@
4849
"flang",
4950
},
5051
"lld": {"bolt", "cross-project-tests"},
51-
# TODO(issues/132795): LLDB should be enabled on clang changes.
52-
"clang": {"clang-tools-extra", "cross-project-tests"},
52+
"clang": {"clang-tools-extra", "cross-project-tests", "lldb"},
5353
"mlir": {"flang"},
5454
# Test everything if ci scripts are changed.
5555
".ci": {
5656
"llvm",
5757
"clang",
58+
"CIR",
5859
"lld",
5960
"lldb",
6061
"bolt",
@@ -77,6 +78,8 @@
7778
DEPENDENT_RUNTIMES_TO_TEST = {
7879
"clang": {"compiler-rt"},
7980
"clang-tools-extra": {"libc"},
81+
"libc": {"libc"},
82+
"compiler-rt": {"compiler-rt"},
8083
".ci": {"compiler-rt", "libc"},
8184
}
8285
DEPENDENT_RUNTIMES_TO_TEST_NEEDS_RECONFIG = {
@@ -97,6 +100,9 @@
97100
"libc", # No Windows Support.
98101
"lldb", # TODO(issues/132800): Needs environment setup.
99102
"bolt", # No Windows Support.
103+
"libcxx",
104+
"libcxxabi",
105+
"libunwind",
100106
}
101107

102108
# These are projects that we should test if the project itself is changed but
@@ -115,6 +121,9 @@
115121
"lldb",
116122
"openmp",
117123
"polly",
124+
"libcxx",
125+
"libcxxabi",
126+
"libunwind",
118127
}
119128

120129
PROJECT_CHECK_TARGETS = {
@@ -127,6 +136,7 @@
127136
"lldb": "check-lldb",
128137
"llvm": "check-llvm",
129138
"clang": "check-clang",
139+
"CIR": "check-clang-cir",
130140
"bolt": "check-bolt",
131141
"lld": "check-lld",
132142
"flang": "check-flang",
@@ -140,6 +150,23 @@
140150

141151
RUNTIMES = {"libcxx", "libcxxabi", "libunwind", "compiler-rt", "libc"}
142152

153+
# Meta projects are projects that need explicit handling but do not reside
154+
# in their own top level folder. To add a meta project, the start of the path
155+
# for the metaproject should be mapped to the name of the project below.
156+
# Multiple paths can map to the same metaproject.
157+
META_PROJECTS = {
158+
("clang", "lib", "CIR"): "CIR",
159+
("clang", "test", "CIR"): "CIR",
160+
("clang", "include", "clang", "CIR"): "CIR",
161+
("*", "docs"): "docs",
162+
("llvm", "utils", "gn"): "gn",
163+
(".github", "workflows", "premerge.yaml"): ".ci",
164+
("third-party",): ".ci",
165+
}
166+
167+
# Projects that should not run any tests. These need to be metaprojects.
168+
SKIP_PROJECTS = ["docs", "gn"]
169+
143170

144171
def _add_dependencies(projects: Set[str], runtimes: Set[str]) -> Set[str]:
145172
projects_with_dependents = set(projects)
@@ -232,21 +259,34 @@ def _compute_runtimes_to_build(
232259
return _exclude_projects(runtimes_to_build, platform)
233260

234261

262+
def _path_matches(matcher: tuple[str], file_path: tuple[str]) -> bool:
263+
if len(file_path) < len(matcher):
264+
return False
265+
for match_part, file_part in zip(matcher, file_path):
266+
if match_part == "*" or file_part == "*":
267+
continue
268+
if match_part != file_part:
269+
return False
270+
return True
271+
272+
273+
def _get_modified_projects_for_file(modified_file: str) -> Set[str]:
274+
modified_projects = set()
275+
path_parts = pathlib.Path(modified_file).parts
276+
for meta_project_files in META_PROJECTS.keys():
277+
if _path_matches(meta_project_files, path_parts):
278+
meta_project = META_PROJECTS[meta_project_files]
279+
if meta_project in SKIP_PROJECTS:
280+
return set()
281+
modified_projects.add(meta_project)
282+
modified_projects.add(pathlib.Path(modified_file).parts[0])
283+
return modified_projects
284+
285+
235286
def _get_modified_projects(modified_files: list[str]) -> Set[str]:
236287
modified_projects = set()
237288
for modified_file in modified_files:
238-
path_parts = pathlib.Path(modified_file).parts
239-
# Exclude files in the docs directory. They do not impact an test
240-
# targets and there is a separate workflow used for ensuring the
241-
# documentation builds.
242-
if len(path_parts) > 2 and path_parts[1] == "docs":
243-
continue
244-
# Exclude files for the gn build. We do not test it within premerge
245-
# and changes occur often enough that they otherwise take up
246-
# capacity.
247-
if len(path_parts) > 3 and path_parts[:3] == ("llvm", "utils", "gn"):
248-
continue
249-
modified_projects.add(pathlib.Path(modified_file).parts[0])
289+
modified_projects.update(_get_modified_projects_for_file(modified_file))
250290
return modified_projects
251291

252292

@@ -266,6 +306,13 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
266306
runtimes_check_targets_needs_reconfig = _compute_project_check_targets(
267307
runtimes_to_test_needs_reconfig
268308
)
309+
310+
# CIR is used as a pseudo-project in this script. It is built as part of the
311+
# clang build, but it requires an explicit option to enable. We set that
312+
# option here, and remove it from the projects_to_build list.
313+
enable_cir = "ON" if "CIR" in projects_to_build else "OFF"
314+
projects_to_build.discard("CIR")
315+
269316
# We use a semicolon to separate the projects/runtimes as they get passed
270317
# to the CMake invocation and thus we need to use the CMake list separator
271318
# (;). We use spaces to separate the check targets as they end up getting
@@ -278,6 +325,7 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
278325
"runtimes_check_targets_needs_reconfig": " ".join(
279326
sorted(runtimes_check_targets_needs_reconfig)
280327
),
328+
"enable_cir": enable_cir,
281329
}
282330

283331

0 commit comments

Comments
 (0)