diff --git a/src/gn/item.h b/src/gn/item.h index 0d3eb802d5c5bc0b937d814fc03c7e7191cce1b4..c7463664e8015cddde18f0e295f7c306e2f2b9bf 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 5ad3d59010a61939d1fe0843ef1ec1529882a298..2a5c50e716608466bc62d80befb2041a3a115045 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 d645940746b88fdd6433164c08d4e30f2702d4ee..e47f3949b2359a163eac681bdce60024e2599320 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 228a8a9ba71f66b490b4367ca8f2d49c17002e0e..e36d574afe7148de6d13cbb50383b64a1c97d476 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.