mirror of
https://github.com/openharmony/developtools_global_resource_tool.git
synced 2026-07-20 22:47:00 -04:00
针对没有base资源,给出warning提示
Signed-off-by: fangyunzhong <fangyunzhong2@huawei.com>
This commit is contained in:
+30
-5
@@ -31,11 +31,15 @@ namespace Restool {
|
||||
using namespace std;
|
||||
uint32_t FileManager::ScanModules(const vector<string> &inputs, const string &output)
|
||||
{
|
||||
vector<pair<ResType, string>> noBaseResource;
|
||||
for (auto input : inputs) {
|
||||
map<ResType, vector<DirectoryInfo>> resTypeOfDirs;
|
||||
if (ScanModule(input, output, resTypeOfDirs) != RESTOOL_SUCCESS) {
|
||||
if (ScanModule(input, output) != RESTOOL_SUCCESS) {
|
||||
return RESTOOL_ERROR;
|
||||
}
|
||||
CheckAllItems(noBaseResource);
|
||||
}
|
||||
if (!noBaseResource.empty()) {
|
||||
ResourceUtil::PrintWarningMsg(noBaseResource);
|
||||
}
|
||||
return ParseReference(output);
|
||||
}
|
||||
@@ -46,14 +50,12 @@ uint32_t FileManager::MergeResourceItem(const map<int32_t, vector<ResourceItem>>
|
||||
}
|
||||
|
||||
// below private founction
|
||||
uint32_t FileManager::ScanModule(const string &input, const string &output,
|
||||
map<ResType, vector<DirectoryInfo>> &resTypeOfDirs)
|
||||
uint32_t FileManager::ScanModule(const string &input, const string &output)
|
||||
{
|
||||
ResourceModule resourceModule(input, output, moduleName_);
|
||||
if (resourceModule.ScanResource() != RESTOOL_SUCCESS) {
|
||||
return RESTOOL_ERROR;
|
||||
}
|
||||
resTypeOfDirs = resourceModule.GetScanDirectorys();
|
||||
MergeResourceItem(resourceModule.GetOwner());
|
||||
return RESTOOL_SUCCESS;
|
||||
}
|
||||
@@ -66,6 +68,29 @@ uint32_t FileManager::ParseReference(const string &output)
|
||||
}
|
||||
return RESTOOL_SUCCESS;
|
||||
}
|
||||
|
||||
void FileManager::CheckAllItems(vector<pair<ResType, string>> &noBaseResource)
|
||||
{
|
||||
for (const auto &item : items_) {
|
||||
bool flag = false;
|
||||
for (const auto &iter : item.second) {
|
||||
if (iter.GetLimitKey() == "base") {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
auto firstItem = item.second.front();
|
||||
auto ret = find_if(noBaseResource.begin(), noBaseResource.end(), [firstItem](auto &iterItem) {
|
||||
return (firstItem.GetResType() == iterItem.first) &&
|
||||
(firstItem.GetName() == iterItem.second);
|
||||
});
|
||||
if (ret == noBaseResource.end()) {
|
||||
noBaseResource.push_back(make_pair(firstItem.GetResType(), firstItem.GetName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user