mirror of
https://github.com/openharmony/developtools_ace-ets2bundle.git
synced 2026-07-18 16:04:32 -04:00
collect module_collection Signed-off-by: houhaoyu <houhaoyu@huawei.com> Change-Id: Iadf6e8ffb0df484f709fc491ea5d15e902a53eec
This commit is contained in:
@@ -203,22 +203,35 @@ export class ResultStates {
|
||||
if (!projectConfig.isPreview) {
|
||||
compiler.hooks.compilation.tap('Collect Components And Modules', compilation => {
|
||||
compilation.hooks.additionalAssets.tapAsync('Collect Components And Modules', callback => {
|
||||
if (projectConfig.aceSuperVisualPath && fs.existsSync(projectConfig.aceSuperVisualPath)) {
|
||||
appComponentCollection.clear();
|
||||
}
|
||||
const moduleContent: string =
|
||||
moduleCollection.size === 0 ? 'NULL' : Array.from(moduleCollection).join(',');
|
||||
writeFileSync(path.resolve(projectConfig.buildPath, './module_collection.txt'),
|
||||
moduleContent);
|
||||
const componentContent: string = Array.from(appComponentCollection).join(',');
|
||||
writeFileSync(path.resolve(projectConfig.buildPath, './component_collection.txt'),
|
||||
componentContent);
|
||||
this.generateCollectionFile();
|
||||
callback();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private generateCollectionFile() {
|
||||
if (projectConfig.aceSuperVisualPath && fs.existsSync(projectConfig.aceSuperVisualPath)) {
|
||||
appComponentCollection.clear();
|
||||
}
|
||||
if (fs.existsSync(path.resolve(projectConfig.buildPath, './module_collection.txt'))) {
|
||||
const lastModuleCollection: string =
|
||||
fs.readFileSync(path.resolve(projectConfig.buildPath, './module_collection.txt')).toString();
|
||||
if (lastModuleCollection && lastModuleCollection !== 'NULL') {
|
||||
lastModuleCollection.split(',').forEach(item => {
|
||||
moduleCollection.add(item);
|
||||
})
|
||||
}
|
||||
}
|
||||
const moduleContent: string =
|
||||
moduleCollection.size === 0 ? 'NULL' : Array.from(moduleCollection).join(',');
|
||||
writeFileSync(path.resolve(projectConfig.buildPath, './module_collection.txt'),
|
||||
moduleContent);
|
||||
const componentContent: string = Array.from(appComponentCollection).join(',');
|
||||
writeFileSync(path.resolve(projectConfig.buildPath, './component_collection.txt'),
|
||||
componentContent);
|
||||
}
|
||||
|
||||
private printDiagnostic(diagnostic: ts.Diagnostic): void {
|
||||
const message: string = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
|
||||
if (this.validateError(message)) {
|
||||
|
||||
@@ -327,6 +327,9 @@ module.exports = (env, argv) => {
|
||||
const appResourcePath = env.appResource || process.env.appResource;
|
||||
if (appResourcePath) {
|
||||
readAppResource(resources, appResourcePath);
|
||||
if (fs.existsSync(appResourcePath) && config.cache) {
|
||||
config.cache.buildDependencies.config.push(appResourcePath)
|
||||
}
|
||||
}
|
||||
config.output.library = projectConfig.hashProjectPath;
|
||||
return config;
|
||||
|
||||
Reference in New Issue
Block a user