!995 fix xtsmode without save resources

Merge pull request !995 from 卡哥/master
This commit is contained in:
openharmony_ci
2022-08-23 09:41:42 +00:00
committed by Gitee
+15 -15
View File
@@ -382,32 +382,32 @@ function loadModuleInfo(projectConfig, envArgs) {
function checkAppResourcePath(appResourcePath, config) {
if (appResourcePath) {
const appResourcePathSavePath = path.resolve(projectConfig.cachePath, 'resource_path.txt');
saveAppResourcePath(appResourcePath, appResourcePathSavePath);
readAppResource(resources, appResourcePath);
if (fs.existsSync(appResourcePath) && config.cache) {
config.cache.buildDependencies.config.push(appResourcePath);
}
if (fs.existsSync(appResourcePathSavePath) && config.cache) {
config.cache.buildDependencies.config.push(appResourcePathSavePath);
if (!projectConfig.xtsMode) {
const appResourcePathSavePath = path.resolve(projectConfig.cachePath, 'resource_path.txt');
saveAppResourcePath(appResourcePath, appResourcePathSavePath);
if (fs.existsSync(appResourcePathSavePath) && config.cache) {
config.cache.buildDependencies.config.push(appResourcePathSavePath);
}
}
}
}
function saveAppResourcePath(appResourcePath, appResourcePathSavePath) {
if (!projectConfig.xtsMode) {
let isSave = false;
if (fs.existsSync(appResourcePathSavePath)) {
const saveContent = fs.readFileSync(appResourcePathSavePath);
if (appResourcePath !== saveContent) {
isSave = true;
}
} else {
let isSave = false;
if (fs.existsSync(appResourcePathSavePath)) {
const saveContent = fs.readFileSync(appResourcePathSavePath);
if (appResourcePath !== saveContent) {
isSave = true;
}
if (isSave) {
fs.writeFileSync(appResourcePathSavePath, appResourcePath);
}
} else {
isSave = true;
}
if (isSave) {
fs.writeFileSync(appResourcePathSavePath, appResourcePath);
}
}