mapping absolute path dependency and add check rules

Signed-off-by: RingKing <1300547600@qq.com>
This commit is contained in:
RingKing 2024-01-29 12:17:13 +00:00
parent dee8cd5976
commit d002acb598
13 changed files with 323 additions and 125 deletions

View File

@ -651,6 +651,7 @@ def WriteGNNinja(path, platform, host, options, args_list):
'src/gn/ninja_writer.cc',
'src/gn/ohos_components.cc',
"src/gn/ohos_components_checker.cc",
"src/gn/ohos_components_mapping.cc",
'src/gn/ohos_variables.cc',
'src/gn/operators.cc',
'src/gn/output_conversion.cc',

View File

@ -17,6 +17,7 @@
#include "gn/err.h"
#include "gn/input_file.h"
#include "gn/ohos_components_checker.h"
#include "gn/ohos_components_mapping.h"
#include "gn/parse_node_value_adapter.h"
#include "gn/parse_tree.h"
#include "gn/pool.h"
@ -663,16 +664,33 @@ Value RunImport(Scope* scope,
const SourceDir& input_dir = scope->GetSourceDir();
SourceFile import_file = input_dir.ResolveRelativeFile(
args[0], err, scope->settings()->build_settings()->root_path_utf8());
const OhosComponentChecker *checker = OhosComponentChecker::getInstance();
if (checker != nullptr) {
checker->CheckImportOther(function, scope->settings()->build_settings(),
input_dir.value(), import_file.value(), err);
}
std::string mapping_file = "";
const OhosComponentMapping *mapping = OhosComponentMapping::getInstance();
if (mapping != nullptr) {
mapping_file = mapping->MappingImportOther(scope->settings()->build_settings(),
input_dir.value(), import_file.value());
}
if (mapping_file != "") {
SourceFile real_file(mapping_file);
scope->AddBuildDependencyFile(real_file);
if (!err->has_error()) {
scope->settings()->import_manager().DoImport(real_file, function, scope, err);
}
return Value();
}
scope->AddBuildDependencyFile(import_file);
if (!err->has_error()) {
scope->settings()->import_manager().DoImport(import_file, function, scope,
err);
}
const OhosComponentChecker *checker = OhosComponentChecker::getInstance();
if (checker != nullptr) {
checker->CheckImportOther(function, scope->settings()->build_settings(),
input_dir.value(), import_file.value(), err);
}
return Value();
}

View File

@ -17,6 +17,7 @@
#include "gn/innerapis_publicinfo_generator.h"
#include "gn/ohos_components_checker.h"
#include "gn/ohos_components_impl.h"
#include "gn/ohos_components_mapping.h"
/**
* Ohos Component API
@ -45,8 +46,18 @@ OhosComponent::OhosComponent(const char *name, const char *subsystem, const char
void OhosComponent::addInnerApi(const std::string &name, const std::string &label)
{
innerapi_names_[name] = label;
innerapi_labels_[label] = name;
std::string la = label;
size_t pos = label.find(":");
if (pos > 0) {
if ((label[pos - 1]) == '/') { // some are like this : "//components/foo/libfoo/:libfoo"
unsigned long indexToRemove = pos - 1;
if (indexToRemove >= 0 && indexToRemove <= la.length()) {
la.erase(la.begin() + indexToRemove);
}
}
}
innerapi_names_[name] = la;
innerapi_labels_[la] = name;
}
@ -97,38 +108,31 @@ bool OhosComponentsImpl::ReadBuildConfigFile(const std::string &build_dir, const
return true;
}
bool OhosComponentsImpl::LoadComponentSubsystemAndPaths(const std::string &paths, const std::string &override_map,
const std::string &subsystems, std::string &err_msg_out)
bool OhosComponentsImpl::LoadComponentInfo(const std::string &components_content, std::string &err_msg_out)
{
const base::DictionaryValue *paths_dict;
std::unique_ptr<base::Value> paths_value = base::JSONReader::ReadAndReturnError(paths,
const base::DictionaryValue *components_dict;
std::unique_ptr<base::Value> components_value = base::JSONReader::ReadAndReturnError(components_content,
base::JSONParserOptions::JSON_PARSE_RFC, nullptr, &err_msg_out, nullptr, nullptr);
if (!paths_value) {
if (!components_value) {
return false;
}
if (!paths_value->GetAsDictionary(&paths_dict)) {
if (!components_value->GetAsDictionary(&components_dict)) {
return false;
}
const base::DictionaryValue *subsystems_dict;
std::unique_ptr<base::Value> subsystems_value = base::JSONReader::ReadAndReturnError(subsystems,
base::JSONParserOptions::JSON_PARSE_RFC, nullptr, &err_msg_out, nullptr, nullptr);
if (!subsystems_value) {
return false;
}
if (!subsystems_value->GetAsDictionary(&subsystems_dict)) {
return false;
}
const base::Value *subsystem;
for (const auto com : paths_dict->DictItems()) {
subsystem = subsystems_dict->FindKey(com.first);
if (!subsystem) {
for (const auto com : components_dict->DictItems()) {
const base::Value *subsystem = com.second.FindKey("subsystem");
const base::Value *path = com.second.FindKey("path");
if (!subsystem || !path) {
continue;
}
components_[com.first] =
new OhosComponent(com.first.c_str(), subsystem->GetString().c_str(), com.second.GetString().c_str());
new OhosComponent(com.first.c_str(), subsystem->GetString().c_str(), path->GetString().c_str());
const base::Value *innerapis = com.second.FindKey("innerapis");
if (!innerapis) {
continue;
}
LoadInnerApi(com.first, innerapis->GetList());
}
setupComponentsTree();
return true;
@ -259,91 +263,45 @@ void OhosComponentsImpl::setupComponentsTree()
}
}
void OhosComponentsImpl::LoadInnerApi(const base::DictionaryValue *innerapis)
void OhosComponentsImpl::LoadInnerApi(const std::string &component_name, const std::vector<base::Value> &innerapis)
{
OhosComponent *component;
for (const auto kv : innerapis->DictItems()) {
for (const auto inner : kv.second.DictItems()) {
component = (OhosComponent *)GetComponentByName(kv.first);
if (!component) {
break;
}
for (const auto info : inner.second.DictItems()) {
if (info.first == "label") {
component->addInnerApi(inner.first, info.second.GetString());
break;
}
}
for (const auto info : inner.second.DictItems()) {
if (info.first == "visibility") {
component->addInnerApiVisibility(inner.first, info.second.GetList());
break;
}
}
OhosComponent *component = (OhosComponent *)GetComponentByName(component_name);
if (!component) {
return;
}
for (const base::Value &kv : innerapis) {
const base::Value *label = kv.FindKey("label");
const base::Value *name = kv.FindKey("name");
if (!label || !name) {
continue;
}
component->addInnerApi(name->GetString(), label->GetString());
const base::Value *visibility = kv.FindKey("visibility");
if (!visibility) {
continue;
}
component->addInnerApiVisibility(name->GetString(), visibility->GetList());
}
}
bool OhosComponentsImpl::LoadOhosInnerApis_(const std::string innerapi_content, std::string &err_msg_out)
{
const base::DictionaryValue *innerapis_dict;
std::unique_ptr<base::Value> innerapis = base::JSONReader::ReadAndReturnError(innerapi_content,
base::JSONParserOptions::JSON_PARSE_RFC, nullptr, &err_msg_out, nullptr, nullptr);
if (!innerapis) {
return false;
}
if (!innerapis->GetAsDictionary(&innerapis_dict)) {
return false;
}
LoadInnerApi(innerapis_dict);
return true;
}
bool OhosComponentsImpl::LoadOhosComponents(const std::string &build_dir, const Value *enable, Err *err)
{
const char *paths_file = "parts_info/parts_path_info.json";
std::string paths_content;
if (!ReadBuildConfigFile(build_dir, paths_file, paths_content)) {
const char *components_file = "parts_info/components.json";
std::string components_content;
if (!ReadBuildConfigFile(build_dir, components_file, components_content)) {
*err = Err(*enable, "Your .gn file has enabled \"ohos_components_support\", but "
"OpenHarmony build config file (" +
std::string(paths_file) + ") does not exists.\n");
std::string(components_file) + ") does not exists.\n");
return false;
}
const char *subsystems_file = "parts_info/part_subsystem.json";
std::string subsystems_content;
if (!ReadBuildConfigFile(build_dir, subsystems_file, subsystems_content)) {
*err = Err(*enable, "Your .gn file has enabled \"ohos_components_support\", but "
"OpenHarmony build config file (" +
std::string(subsystems_file) + ") does not exists.\n");
return false;
}
const char *innerapis_file = "parts_info/inner_kits_info.json";
std::string innerapis_content;
if (!ReadBuildConfigFile(build_dir, innerapis_file, innerapis_content)) {
*err = Err(*enable, "Your .gn file has enabled \"ohos_components_support\", but "
"OpenHarmony build config file (" +
std::string(innerapis_file) + ") does not exists.\n");
return false;
}
const char *override_file = "component_override_map.json";
std::string override_map;
if (!ReadBuildConfigFile(build_dir, override_file, override_map)) {
override_map = EMPTY_INNERAPI;
}
std::string err_msg_out;
if (!LoadComponentSubsystemAndPaths(paths_content, override_map, subsystems_content, err_msg_out)) {
if (!LoadComponentInfo(components_content, err_msg_out)) {
*err = Err(*enable, "Your .gn file has enabled \"ohos_components_support\", but "
"OpenHarmony build config file parsing failed:\n" +
err_msg_out + "\n");
return false;
}
if (!LoadOhosInnerApis_(innerapis_content, err_msg_out)) {
*err = Err(*enable, "Your .gn file has enabled \"ohos_components_support\", but "
"OpenHarmony build config file " +
std::string(innerapis_file) + " parsing failed:\n" + err_msg_out + "\n");
return false;
}
return true;
}
@ -483,3 +441,20 @@ void OhosComponents::LoadOhosComponentsChecker(const std::string &build_dir, con
InnerApiPublicInfoGenerator::Init(build_dir, checkType);
return;
}
void OhosComponents::LoadOhosComponentsMapping(const Value *support, const Value *independent)
{
if (!support) {
return;
}
if (!support->boolean_value()) {
return;
}
if (!independent || !independent->boolean_value()) {
return;
}
OhosComponentMapping::Init();
return;
}

View File

@ -75,6 +75,8 @@ public:
void LoadOhosComponentsChecker(const std::string &build_dir, const Value *support, int checkType);
void LoadOhosComponentsMapping(const Value *support, const Value *independent);
private:
OhosComponentsImpl *mgr = nullptr;

View File

@ -25,8 +25,6 @@
#include "gn/target.h"
#include "gn/value.h"
namespace fs = std::filesystem;
static const std::string SCAN_RESULT_PATH = "scan_out";
static const std::string WHITELIST_PATH = "build/component_compilation_whitelist.json";
static std::vector<std::string> all_deps_config_;
@ -37,6 +35,7 @@ static std::vector<std::string> innerapi_not_declare_;
static std::map<std::string, std::vector<std::string>> includes_absolute_deps_other_;
static std::map<std::string, std::vector<std::string>> target_absolute_deps_other_;
static std::map<std::string, std::vector<std::string>> import_other_;
static std::map<std::string, std::vector<std::string>> deps_not_lib_;
OhosComponentChecker *OhosComponentChecker::instance_ = nullptr;
@ -57,8 +56,8 @@ static bool StartWith(const std::string &str, const std::string prefix)
static void CreateScanOutDir(const std::string &dir)
{
fs::path path(dir);
fs::create_directories(path);
base::FilePath path(dir);
base::CreateDirectory(path);
return;
}
@ -67,19 +66,14 @@ static void RemoveScanOutDir(const std::string& dir)
if (access(dir.c_str(), F_OK) == -1) {
return;
}
for (auto& entry : fs::directory_iterator(dir)) {
if (entry.is_regular_file()) {
fs::remove(entry);
} else if (entry.is_directory()) {
RemoveScanOutDir(entry.path().string());
}
}
fs::remove(dir);
base::FilePath path(dir);
base::DeleteFile(path, true);
return;
}
static bool ReadBuildConfigFile(std::string &content)
static bool ReadBuildConfigFile(base::FilePath path, std::string &content)
{
if (!base::ReadFileToString(base::FilePath(WHITELIST_PATH), &content)) {
if (!base::ReadFileToString(path, &content)) {
return false;
}
return true;
@ -149,6 +143,15 @@ static void LoadImportOtherWhitelist(const base::Value &value)
}
}
static void LoadDepsNotLibWhitelist(const base::Value &value)
{
for (auto info : value.DictItems()) {
for (const base::Value &value_tmp : info.second.GetList()) {
deps_not_lib_[info.first].push_back(value_tmp.GetString());
}
}
}
static std::map<std::string, std::function<void(const base::Value &value)>> whitelist_map_ = {
{ "all_dependent_configs", LoadAllDepsConfigWhitelist },
{ "includes_over_range", LoadIncludesOverRangeWhitelist },
@ -157,13 +160,14 @@ static std::map<std::string, std::function<void(const base::Value &value)>> whit
{ "innerapi_public_deps_inner", LoadInnerApiPublicDepsInnerWhitelist },
{ "includes_absolute_deps_other", LoadIncludesAbsoluteDepsOtherWhitelist },
{ "target_absolute_deps_other", LoadAbsoluteDepsOtherWhitelist },
{ "import_other", LoadImportOtherWhitelist }
{ "import_other", LoadImportOtherWhitelist },
{ "deps_not_lib", LoadDepsNotLibWhitelist }
};
static void LoadWhitelist()
{
std::string whitelistContent;
if (!ReadBuildConfigFile(whitelistContent)) {
if (!ReadBuildConfigFile(base::FilePath(WHITELIST_PATH), whitelistContent)) {
return;
}
const base::DictionaryValue *whitelist_dict;
@ -235,6 +239,21 @@ bool OhosComponentChecker::InterceptInnerApiNotLib(const Item *item, const std::
return false;
}
bool OhosComponentChecker::InterceptDepsNotLib(const Item *item, const std::string label,
const std::string deps, Err *err) const
{
if (auto res = deps_not_lib_.find(label); res != deps_not_lib_.end()) {
std::string deps_str(deps);
auto res_second = std::find(res->second.begin(), res->second.end(), Trim(deps_str));
if (res_second != res->second.end()) {
return true;
}
}
*err = Err(item->defined_from(), "Depend a non-lib target.",
"The item " + label + " cannot depend on a non-lib target " + deps);
return false;
}
bool OhosComponentChecker::InterceptInnerApiNotDeclare(const Item *item, const std::string label, Err *err) const
{
auto result = std::find(innerapi_not_declare_.begin(), innerapi_not_declare_.end(), label);
@ -395,7 +414,7 @@ bool OhosComponentChecker::CheckInnerApiPublicDepsInner(const Target *target, co
}
bool OhosComponentChecker::CheckInnerApiNotLib(const Item *item, const OhosComponent *component,
const std::string label, Err *err) const
const std::string label, const std::string deps, Err *err) const
{
if (checkType_ <= CheckType::NONE || item == nullptr || item->AsTarget() == nullptr ||
(ignoreTest_ && item->testonly()) || component == nullptr) {
@ -408,9 +427,12 @@ bool OhosComponentChecker::CheckInnerApiNotLib(const Item *item, const OhosCompo
}
if (checkType_ >= CheckType::INTERCEPT_IGNORE_TEST) {
return InterceptInnerApiNotLib(item, label, err);
return InterceptDepsNotLib(item, label, deps, err) && InterceptInnerApiNotLib(item, deps, err);
}
GenerateScanList("innerapi_not_lib.list", component->subsystem(), component->name(), label, "");
std::string type_str(Target::GetStringForOutputType(type));
GenerateScanList("innerapi_not_lib.list", component->subsystem(), component->name(), deps, type_str);
GenerateScanList("deps_not_lib.list", component->subsystem(), component->name(), label, deps);
return true;
}
@ -496,9 +518,6 @@ bool OhosComponentChecker::CheckTargetAbsoluteDepsOther(const Item *item, const
if (checkType_ <= CheckType::NONE || component == nullptr || item == nullptr || (ignoreTest_ && item->testonly())) {
return true;
}
if (!component->isInnerApi(deps)) {
return true;
}
if (is_external_deps) {
return true;

View File

@ -37,7 +37,8 @@ public:
Err *err) const;
bool CheckInnerApiPublicDepsInner(const Target *target, const std::string label, const std::string deps,
Err *err) const;
bool CheckInnerApiNotLib(const Item *item, const OhosComponent *component, const std::string label, Err *err) const;
bool CheckInnerApiNotLib(const Item *item, const OhosComponent *component, const std::string label,
const std::string deps, Err *err) const;
bool CheckInnerApiNotDeclare(const Item *item, const OhosComponent *component, const std::string label,
Err *err) const;
bool CheckIncludesAbsoluteDepsOther(const Target *target, const std::string label, const std::string includes,
@ -65,6 +66,7 @@ private:
bool InterceptInnerApiPublicDepsInner(const Target *target, const std::string label, const std::string deps,
Err *err) const;
bool InterceptInnerApiNotLib(const Item *item, const std::string label, Err *err) const;
bool InterceptDepsNotLib(const Item *item, const std::string label, const std::string deps, Err *err) const;
bool InterceptInnerApiNotDeclare(const Item *item, const std::string label, Err *err) const;
bool InterceptIncludesAbsoluteDepsOther(const Target *target, const std::string label, const std::string includes,
Err *err) const;

View File

@ -0,0 +1,73 @@
// Copyright (c) 2024 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "gn/ohos_components_mapping.h"
#include <filesystem>
#include <fstream>
#include <functional>
#include <iostream>
#include <sys/stat.h>
#include "base/values.h"
#include "gn/build_settings.h"
#include "gn/config.h"
#include "gn/functions.h"
#include "gn/ohos_components.h"
#include "gn/parse_tree.h"
#include "gn/settings.h"
#include "gn/substitution_writer.h"
#include "gn/target.h"
#include "gn/value.h"
OhosComponentMapping *OhosComponentMapping::instance_ = nullptr;
static bool StartWith(const std::string &str, const std::string prefix)
{
return (str.rfind(prefix, 0) == 0);
}
const std::string OhosComponentMapping::MappingTargetAbsoluteDpes(const BuildSettings* build_settings,
const std::string label, const std::string deps) const
{
if (build_settings == nullptr) {
return "";
}
const OhosComponent *component = build_settings->GetOhosComponent(label);
if (component == nullptr) {
return "";
}
if (StartWith(deps, component->path())) {
return "";
}
const OhosComponent *deps_component = build_settings->GetOhosComponent(deps);
if (deps_component == nullptr) {
return "";
}
size_t pos = deps.find(":");
if (pos <= 0) {
return "";
}
return deps_component->getInnerApi(deps.substr(pos + 1));
}
const std::string OhosComponentMapping::MappingImportOther(const BuildSettings* build_settings,
const std::string label, const std::string deps) const
{
if (build_settings == nullptr) {
return "";
}
const OhosComponent *component = build_settings->GetOhosComponent(label);
if (component == nullptr) {
return "";
}
if (StartWith(deps, component->path()) || StartWith(deps, "//build/") || StartWith(deps, "//out/")) {
return "";
}
return "//build/indep_configs/gni" + deps.substr(1);
}

View File

@ -0,0 +1,43 @@
// Copyright (c) 2024 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef OHOS_COMPONENTS_MAPPING_H_
#define OHOS_COMPONENTS_MAPPING_H_
#include "gn/build_settings.h"
#include "gn/config.h"
#include "gn/functions.h"
#include "gn/parse_tree.h"
#include "gn/settings.h"
#include "gn/substitution_writer.h"
#include "gn/target.h"
#include "gn/value.h"
class OhosComponentMapping {
public:
static void Init()
{
if (instance_ != nullptr) {
return;
}
instance_ = new OhosComponentMapping();
}
const std::string MappingTargetAbsoluteDpes(const BuildSettings* build_settings,
const std::string label, const std::string deps) const;
const std::string MappingImportOther(const BuildSettings* build_settings,
const std::string label, const std::string deps) const;
static OhosComponentMapping *getInstance()
{
return instance_;
}
private:
static OhosComponentMapping *instance_;
OhosComponentMapping() {}
OhosComponentMapping &operator = (const OhosComponentMapping &) = delete;
};
#endif // OHOS_COMPONENTS_MAPPING_H_

View File

@ -413,13 +413,18 @@ bool Setup::FillOhosComponentsInfo(const std::string& build_dir, Err* err)
if (ohos_components_.isOhosComponentsLoaded()) {
build_settings_.SetOhosComponentsInfo(&ohos_components_);
}
const Value* checkType = build_settings_.build_args().GetArgOverride("ohos_components_checktype");
if (checkType && checkType->type() == Value::INTEGER) {
ohos_components_.LoadOhosComponentsChecker(build_dir, support, checkType->int_value());
} else {
ohos_components_.LoadOhosComponentsChecker(build_dir, support, 0);
}
const Value *independent = build_settings_.build_args().GetArgOverride("ohos_indep_compiler_enable");
if (independent) {
ohos_components_.LoadOhosComponentsMapping(support, independent);
}
return true;
}

View File

@ -441,9 +441,8 @@ bool TargetGenerator::FillGenericDeps(const char* var_name,
LabelTargetVector* dest) {
const Value* value = scope_->GetValue(var_name, true);
if (value) {
ExtractListOfLabels(scope_->settings()->build_settings(), *value,
scope_->GetSourceDir(), ToolchainLabelForScope(scope_),
dest, err_);
ExtractListOfLabelsMapping(target_->label().GetUserVisibleName(false), scope_->settings()->build_settings(),
*value, scope_->GetSourceDir(), ToolchainLabelForScope(scope_), dest, err_);
}
return !err_->has_error();
}

View File

@ -10,6 +10,7 @@
#include "gn/err.h"
#include "gn/frameworks_utils.h"
#include "gn/label.h"
#include "gn/ohos_components_mapping.h"
#include "gn/source_dir.h"
#include "gn/source_file.h"
#include "gn/target.h"
@ -190,6 +191,46 @@ struct LabelResolver {
const Label& current_toolchain;
};
// Fills the label part of a LabelPtrPair, if it is a cross-component dependency, mapping is required.
template <typename T>
struct LabelPtrResolverMapping {
LabelPtrResolverMapping(const std::string &label_in,
const BuildSettings* build_settings_in,
const SourceDir& current_dir_in,
const Label& current_toolchain_in)
: label(label_in),
build_settings(build_settings_in),
current_dir(current_dir_in),
current_toolchain(current_toolchain_in) {}
bool operator()(const Value& v, LabelPtrPair<T>* out, Err* err) const {
if (!v.VerifyTypeIs(Value::STRING, err)) {
return false;
}
std::string map_label = "";
OhosComponentMapping *mapping = OhosComponentMapping::getInstance();
if (mapping != nullptr) {
map_label = mapping->MappingTargetAbsoluteDpes(build_settings, label, v.string_value());
}
if (map_label != "") {
Value map_dep(v.origin(), map_label);
out->label = Label::Resolve(current_dir, build_settings->root_path_utf8(),
current_toolchain, map_dep, err);
out->origin = map_dep.origin();
} else {
out->label = Label::Resolve(current_dir, build_settings->root_path_utf8(),
current_toolchain, v, err);
out->origin = v.origin();
}
return !err->has_error();
}
const std::string &label;
const BuildSettings* build_settings;
const SourceDir& current_dir;
const Label& current_toolchain;
};
// Fills the label part of a LabelPtrPair, leaving the pointer null.
template <typename T>
struct LabelPtrResolver {
@ -311,6 +352,18 @@ bool ExtractListOfLabels(const BuildSettings* build_settings,
LabelPtrResolver<Target>(build_settings, current_dir, current_toolchain));
}
bool ExtractListOfLabelsMapping(const std::string& label,
const BuildSettings* build_settings,
const Value& value,
const SourceDir& current_dir,
const Label& current_toolchain,
LabelTargetVector* dest,
Err* err) {
return ListValueExtractor(
value, dest, err,
LabelPtrResolverMapping<Target>(label, build_settings, current_dir, current_toolchain));
}
bool ExtractListOfExternalDeps(const BuildSettings* build_settings,
const Value& value,
const SourceDir& current_dir,

View File

@ -56,6 +56,14 @@ bool ExtractListOfLabels(const BuildSettings* build_settings,
LabelTargetVector* dest,
Err* err);
bool ExtractListOfLabelsMapping(const std::string& label,
const BuildSettings* build_settings,
const Value& value,
const SourceDir& current_dir,
const Label& current_toolchain,
LabelTargetVector* dest,
Err* err);
bool ExtractListOfExternalDeps(const BuildSettings* build_settings,
const Value& value,
const SourceDir& current_dir,

View File

@ -122,7 +122,7 @@ bool Visibility::CheckItemVisibility(const Item *from, const Item *to, bool is_e
OhosComponentChecker *checker = OhosComponentChecker::getInstance();
if (checker != nullptr) {
if (!checker->CheckInnerApiNotLib(to, to_component, to_label, err) ||
if (!checker->CheckInnerApiNotLib(to, to_component, from_label, to_label, err) ||
!checker->CheckInnerApiNotDeclare(to, to_component, to_label, err) ||
!checker->CheckTargetAbsoluteDepsOther(from, to_component, from_label, to_label, is_external_deps, err) ||
!checker->CheckInnerApiVisibilityDenied(from, to_component, from_label, to_label, err)) {