From eedb35f1a8397a1ba1fab71f1027a750207a368c Mon Sep 17 00:00:00 2001 From: Max Podkorytov <4273004+tenpercent@users.noreply.github.com> Date: Tue, 24 Feb 2026 12:59:29 -0800 Subject: [PATCH] [CK] Add project root marker for monorepo compatibility (#4430) ## Summary - Add `.ck-project-root` marker file at the composablekernel project root - Update `find_project_root()` in `script/tools/common.sh` to look for this marker instead of `.git` - Fixes project root detection when CK is part of the rocm-libraries monorepo ## Background Since the project was moved into the monorepo, the `.git` directory is at the monorepo root rather than the CK project root. This caused `find_project_root()` to return the wrong path, breaking tools in `script/tools/`. ## Test plan - [x] Verify `find_project_root` returns correct path from any CK subdirectory - [x] Verify `ck-build --help` works - [x] Verify `ck-configure --help` works Co-authored-by: Claude Opus 4.6 Co-authored-by: Thomas Ning --- .ck-project-root | 2 ++ script/tools/common.sh | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 .ck-project-root diff --git a/.ck-project-root b/.ck-project-root new file mode 100644 index 0000000000..a5ca7080df --- /dev/null +++ b/.ck-project-root @@ -0,0 +1,2 @@ +# Composable Kernel project root marker +# Used by scripts in script/tools/ to locate the project root diff --git a/script/tools/common.sh b/script/tools/common.sh index e5a39cea67..315fc535d0 100644 --- a/script/tools/common.sh +++ b/script/tools/common.sh @@ -5,7 +5,7 @@ # Common utilities for CK Docker tools # Shared configuration and helper functions -# Find project root (where .git directory is) +# Find project root using relative path (fallback) get_project_root() { local script_dir="$1" cd "${script_dir}/../.." && pwd @@ -149,11 +149,11 @@ is_build_configured() { [ -f "${build_dir}/build.ninja" ] } -# Find project root from any subdirectory (walks up to find .git) +# Find project root from any subdirectory (walks up to find .ck-project-root) find_project_root() { local dir="${1:-$(pwd)}" while [ "$dir" != "/" ]; do - if [ -d "$dir/.git" ]; then + if [ -f "$dir/.ck-project-root" ]; then echo "$dir" return 0 fi