!211 增强叠加编译中对Hap包输入的判定逻辑

Merge pull request !211 from HanSY/dev
This commit is contained in:
openharmony_ci
2025-01-21 09:07:06 +00:00
committed by Gitee
2 changed files with 31 additions and 8 deletions
+2
View File
@@ -60,6 +60,7 @@ private:
uint32_t ParseCommand(int argc, char *argv[]);
uint32_t CheckError(int argc, char *argv[], int c, int optIndex);
uint32_t AddInput(const std::string &argValue);
bool IsOverlapInput(const std::string& inputPath);
uint32_t AddPackageName(const std::string &argValue);
uint32_t AddOutput(const std::string &argValue);
uint32_t AddResourceHeader(const std::string &argValue);
@@ -111,6 +112,7 @@ private:
std::vector<std::string> sysIdDefinedPaths_;
std::string compressionPath_;
size_t threadCount_{ 0 };
bool isOverlap_{ false };
};
} // namespace Restool
} // namespace Global
+29 -8
View File
@@ -139,9 +139,7 @@ uint32_t PackageParser::AddInput(const string& argValue)
return RESTOOL_ERROR;
}
string indexPath = FileEntry::FilePath(inputPath).Append(RESOURCE_INDEX_FILE).GetPath();
string indexPathJson = ResourceUtil::GetMainPath(inputPath).Append(RESOURCE_INDEX_FILE).GetPath();
if (ResourceUtil::FileExist(indexPath) || ResourceUtil::FileExist(indexPathJson)) {
if (IsOverlapInput(inputPath)) {
inputs_.emplace(inputs_.begin(), inputPath);
} else {
inputs_.push_back(inputPath);
@@ -149,6 +147,33 @@ uint32_t PackageParser::AddInput(const string& argValue)
return RESTOOL_SUCCESS;
}
bool PackageParser::IsOverlapInput(const string& inputPath)
{
if (isOverlap_) {
return false;
}
string indexPath = FileEntry::FilePath(inputPath).Append(RESOURCE_INDEX_FILE).GetPath();
if (ResourceUtil::FileExist(indexPath)) {
isOverlap_ = true;
return true;
}
string jsonIndexPath = ResourceUtil::GetMainPath(inputPath).Append(RESOURCE_INDEX_FILE).GetPath();
string txtResHeaderPath = ResourceUtil::GetMainPath(inputPath).Append("ResourceTable.txt").GetPath();
string jsResHeaderPath = ResourceUtil::GetMainPath(inputPath).Append("ResourceTable.js").GetPath();
string hResJsHeaderPath = ResourceUtil::GetMainPath(inputPath).Append("ResourceTable.h").GetPath();
if (ResourceUtil::FileExist(jsonIndexPath) &&
!ResourceUtil::FileExist(txtResHeaderPath) &&
!ResourceUtil::FileExist(jsResHeaderPath) &&
!ResourceUtil::FileExist(hResJsHeaderPath)) {
isOverlap_ = true;
return true;
}
return false;
}
uint32_t PackageParser::AddSysIdDefined(const std::string& argValue)
{
string sysIdDefinedPath = ResourceUtil::RealPath(argValue);
@@ -481,11 +506,7 @@ const std::string &PackageParser::GetCompressionPath() const
bool PackageParser::IsOverlap() const
{
string indexPath = ResourceUtil::GetMainPath(inputs_[0]).Append(RESOURCE_INDEX_FILE).GetPath();
if (ResourceUtil::FileExist(indexPath)) {
return true;
}
return false;
return isOverlap_;
}
void PackageParser::InitCommand()