ANDROID: Prefer DTC from PATH.

This reverts commit dc39b233fe,
as well as fixing legacy usage from checkpatch_presbumit.sh.
Reason for revert: relanding change

This change deviates from 2a2cffe9e2
("ANDROID: Use DTC from PATH.") to allow missing DTC
because there may be usages that directly `source _setup_env.sh`
without setting up PATH with Kleaf's hermetic tools.
One such usage is the legacy checkpatch.sh and
checkpatch_presubmit.sh.

Below is the original commit message.

ANDROID: Use DTC from PATH.

Instead of using a hard-coded path to DTC, infer its
path from PATH. This change removes the dependency on
the ${BUILDTOOLS_PREBUILT_BIN}/dtc symlink, so the
build infrastructure is free to reset PATH to a place
where the actual DTC binary exists.

This change is needed to set
--incompatible_disable_hermetic_tools_symlink_source
to true by default.

Test: bazel run //common:db845c_dist
Fixes: a71e480e82 ("ANDROID: build.config: Set DTC to absolute path")
Fixes: 2a2cffe9e2 ("ANDROID: Use DTC from PATH.")
Bug: 291816237
Bug: 296265825
Change-Id: Ibb1be6c2b8f2f9d8a09bdc2187d392925c082fe0
Signed-off-by: Yifan Hong <elsk@google.com>
This commit is contained in:
Yifan Hong
2023-08-17 02:17:31 +00:00
parent dc39b233fe
commit cd4ca8caa7
+6 -1
View File
@@ -4,7 +4,12 @@ LLVM=1
DEPMOD=depmod
CLANG_PREBUILT_BIN=prebuilts/clang/host/linux-x86/clang-${CLANG_VERSION}/bin
BUILDTOOLS_PREBUILT_BIN=build/kernel/build-tools/path/linux-x86
DTC=${ROOT_DIR}/${BUILDTOOLS_PREBUILT_BIN}/dtc
# TODO(b/296265825): Turn this into a proper error
DTC=$(command -v dtc || { echo "WARNING: $BUILD_CONFIG loaded without Kleaf hermetic tools.
This will become an error in the future." >&2;
echo "${ROOT_DIR}/${BUILDTOOLS_PREBUILT_BIN}/dtc";
})
KCFLAGS="${KCFLAGS} -D__ANDROID_COMMON_KERNEL__"
EXTRA_CMDS=''