mirror of
https://gitee.com/openharmony/developtools_ace_ets2bundle
synced 2024-11-23 16:39:56 +00:00
Fixed failed compilation of projects that depend on external har
Issue: #IAESVY Signed-off-by: wuhailong <wuhailong22@huawei.com> Change-Id: I61672653d424f718a4bcf1f3fe11434d033c830b
This commit is contained in:
parent
b7f015f8a8
commit
4b87649ad0
@ -737,9 +737,16 @@ export class ModuleMode extends CommonMode {
|
||||
}
|
||||
|
||||
private genFileCachePath(filePath: string, projectRootPath: string, cachePath: string, metaInfo: Object): string {
|
||||
const sufStr: string = toUnixPath(filePath).startsWith(toUnixPath(projectRootPath)) ?
|
||||
toUnixPath(filePath).replace(toUnixPath(projectRootPath) + '/', '') :
|
||||
toUnixPath(filePath).replace(toUnixPath(metaInfo.belongProjectPath) + '/', '');
|
||||
filePath = toUnixPath(filePath);
|
||||
let sufStr: string = '';
|
||||
// Only the files of the third-party package will not have the belongProjectPath field in metaInfo.
|
||||
// If both branches are not satisfied, the compilation process will not go here,
|
||||
// and an error will be reported when the cache file is written to the disk(in the genTemporaryPath method).
|
||||
if (metaInfo && metaInfo.belongProjectPath) {
|
||||
sufStr = filePath.replace(toUnixPath(metaInfo.belongProjectPath) + '/', '');
|
||||
} else if (filePath.startsWith(toUnixPath(projectRootPath))) {
|
||||
sufStr = filePath.replace(toUnixPath(projectRootPath) + '/', '');
|
||||
}
|
||||
const output: string = path.join(cachePath, sufStr);
|
||||
return output;
|
||||
}
|
||||
|
@ -346,10 +346,11 @@ export function genTemporaryPath(filePath: string, projectPath: string, buildPat
|
||||
const reset: string = '\u001b[39m';
|
||||
projectRootPath = toUnixPath(buildInHar ? projectPath : projectRootPath);
|
||||
let relativeFilePath: string = '';
|
||||
if (filePath.startsWith(projectRootPath)) {
|
||||
relativeFilePath = filePath.replace(projectRootPath, '');
|
||||
} else if (metaInfo && metaInfo.belongProjectPath) {
|
||||
// Only the files of the third-party package will not have the belongProjectPath field in metaInfo.
|
||||
if (metaInfo && metaInfo.belongProjectPath) {
|
||||
relativeFilePath = filePath.replace(toUnixPath(metaInfo.belongProjectPath), '');
|
||||
} else if (filePath.startsWith(projectRootPath)) {
|
||||
relativeFilePath = filePath.replace(projectRootPath, '');
|
||||
} else {
|
||||
logger.error(red, 'ARKTS:INTERNAL ERROR\n' +
|
||||
`Error Message: Failed to generate the cache path corresponding to file ${filePath}.\n` +
|
||||
|
@ -15,7 +15,8 @@
|
||||
|
||||
import {
|
||||
MODULE_ID_ROLLUP_PLACEHOLDER,
|
||||
PROJECT_ROOT
|
||||
PROJECT_ROOT,
|
||||
DEFAULT_PROJECT
|
||||
} from '../rollup_mock/path_config';
|
||||
|
||||
class Meta {
|
||||
@ -36,7 +37,7 @@ class Meta {
|
||||
this.isNodeEntryFile = false;
|
||||
this.pkgPath = modulePath;
|
||||
this.dependencyPkgInfo = undefined;
|
||||
this.belongProjectPath = PROJECT_ROOT;
|
||||
this.belongProjectPath = `${PROJECT_ROOT}/${DEFAULT_PROJECT}`;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user