Skip to content

[SYCL] Add flag to print CMake args without execution to buildbot.py #19636

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

Merged
merged 1 commit into from
Aug 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 29 additions & 18 deletions buildbot/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@ def do_configure(args, passthrough_args):
# CI Default conditionally appends to options, keep it at the bottom of
# args handling
if args.ci_defaults:
print("#############################################")
print("# Default CI configuration will be applied. #")
print("#############################################")
if not args.print_cmake_flags:
print("#############################################")
print("# Default CI configuration will be applied. #")
print("#############################################")

# For clang-format, clang-tidy and code coverage
llvm_enable_projects += ";clang-tools-extra;compiler-rt"
Expand Down Expand Up @@ -255,20 +256,24 @@ def do_configure(args, passthrough_args):
)

cmake_cmd += passthrough_args
print("[Cmake Command]: {}".format(" ".join(map(shlex.quote, cmake_cmd))))

try:
subprocess.check_call(cmake_cmd, cwd=abs_obj_dir)
except subprocess.CalledProcessError:
cmake_cache = os.path.join(abs_obj_dir, "CMakeCache.txt")
if os.path.isfile(cmake_cache):
print(
"There is CMakeCache.txt at "
+ cmake_cache
+ " ... you can try to remove it and rerun."
)
print("Configure failed!")
return False

if args.print_cmake_flags:
print(" ".join(map(shlex.quote, cmake_cmd[1:])))
else:
print("[Cmake Command]: {}".format(" ".join(map(shlex.quote, cmake_cmd))))

try:
subprocess.check_call(cmake_cmd, cwd=abs_obj_dir)
except subprocess.CalledProcessError:
cmake_cache = os.path.join(abs_obj_dir, "CMakeCache.txt")
if os.path.isfile(cmake_cache):
print(
"There is CMakeCache.txt at "
+ cmake_cache
+ " ... you can try to remove it and rerun."
)
print("Configure failed!")
return False

return True

Expand Down Expand Up @@ -411,9 +416,15 @@ def main():
parser.add_argument(
"--use-zstd", action="store_true", help="Force zstd linkage while building."
)
parser.add_argument(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we could call the flag --dry-run? that one is commonly used and seems to fit here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 140 would be a less obvious change with dry-run as option name. Not that I'm arguing for one or another, just stating.

Copy link
Contributor

@sarnex sarnex Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yeah fair, based on the description it seems generating a cmake command with no other output is important for this use case, so the name is fine enough as is and i don't think we need to spend 15 years bikeshedding :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to make it clear, we still reserve the right to remove the entire script if we switch to using CMake caches instead of it. Use it in any automation at your own risk.

@blenderfreaky

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right sorry, I mentioned it in the issue I linked in my other comment but this script is for the convenience of developers in the repo, and the only stable interface is the LLVM CMake infrastructure which we have extended.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that was my reasoning behind not naming it --dry-run as well.

I understand that the script isn't stable, I'm just using it because it's the method recommended by the docs and makes it easier to keep in sync. (It's also what the AUR packages uses for example)

The way updates on Nix work, any update will require manual approval anyways, so there shouldn't be any random breakage if it gets removed.

"--print-cmake-flags",
action="store_true",
help="Print the generated CMake flags to a single line on standard output and exit. Suppresses all other output and does not run the cmake command.",
)
args, passthrough_args = parser.parse_known_intermixed_args()

print("args:{}".format(args))
if not args.print_cmake_flags:
print("args:{}".format(args))

return do_configure(args, passthrough_args)

Expand Down