From 051445c0556b7bcadedb229b8704292d224cf7d8 Mon Sep 17 00:00:00 2001 From: liutuantuan Date: Wed, 7 May 2025 15:51:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=8F=82=E6=95=B0=EF=BC=8C=E9=85=8D=E5=90=88=E5=A4=B4=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=A8=A1=E6=9D=BF=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liutuantuan --- src/gn/item.h | 4 ++++ src/gn/ohos_components_checker.cc | 4 ++++ src/gn/target_generator.cc | 12 ++++++++++++ src/gn/target_generator.h | 1 + 4 files changed, 21 insertions(+) diff --git a/src/gn/item.h b/src/gn/item.h index 0d3eb80..c746366 100644 --- a/src/gn/item.h +++ b/src/gn/item.h @@ -42,6 +42,9 @@ class Item { bool testonly() const { return testonly_; } void set_testonly(bool value) { testonly_ = value; } + bool checkflag() const { return checkflag_; } + void set_checkflag(bool value) { checkflag_ = value; } + Visibility& visibility() { return visibility_; } const Visibility& visibility() const { return visibility_; } @@ -83,6 +86,7 @@ class Item { const ParseNode* defined_from_; bool testonly_ = false; + bool checkflag_ = true; Visibility visibility_; const OhosComponent *component; diff --git a/src/gn/ohos_components_checker.cc b/src/gn/ohos_components_checker.cc index 5ad3d59..2a5c50e 100644 --- a/src/gn/ohos_components_checker.cc +++ b/src/gn/ohos_components_checker.cc @@ -527,6 +527,10 @@ bool OhosComponentChecker::CheckInnerApiNotLib(const Item *item, const OhosCompo return true; } + if (type == Target::GROUP && item->checkflag() == false) { + return true; + } + if (checkType_ >= CheckType::INTERCEPT_IGNORE_TEST) { return InterceptDepsNotLib(item, label, deps, err) && InterceptInnerApiNotLib(item, deps, err); } diff --git a/src/gn/target_generator.cc b/src/gn/target_generator.cc index d645940..e47f394 100644 --- a/src/gn/target_generator.cc +++ b/src/gn/target_generator.cc @@ -74,6 +74,8 @@ void TargetGenerator::Run() { if (!FillWriteRuntimeDeps()) return; + FillCheckFlag(); + // Do type-specific generation. DoRun(); } @@ -368,6 +370,16 @@ bool TargetGenerator::FillTestonly() { return true; } +void TargetGenerator::FillCheckFlag() { + const Value* value = scope_->GetValue("check_flag", true); + if (value) { + if (!value->VerifyTypeIs(Value::BOOLEAN, err_)) + return; + target_->set_checkflag(value->boolean_value()); + } + return; +} + bool TargetGenerator::FillAssertNoDeps() { const Value* value = scope_->GetValue(variables::kAssertNoDeps, true); if (value) { diff --git a/src/gn/target_generator.h b/src/gn/target_generator.h index 228a8a9..e36d574 100644 --- a/src/gn/target_generator.h +++ b/src/gn/target_generator.h @@ -74,6 +74,7 @@ class TargetGenerator { bool FillTestonly(); bool FillAssertNoDeps(); bool FillWriteRuntimeDeps(); + void FillCheckFlag(); // Reads configs/deps from the given var name, and uses the given setting on // the target to save them. -- Gitee