mirror of
https://github.com/openharmony/developtools_ace-ets2bundle.git
synced 2026-07-18 16:04:32 -04:00
@@ -36,7 +36,8 @@ import {
|
||||
import { projectConfig } from '../main';
|
||||
import {
|
||||
circularFile,
|
||||
mkDir
|
||||
mkDir,
|
||||
writeFileSync
|
||||
} from './utils';
|
||||
import {
|
||||
MODULE_ETS_PATH,
|
||||
@@ -203,10 +204,13 @@ export class ResultStates {
|
||||
if (projectConfig.aceSuperVisualPath && fs.existsSync(projectConfig.aceSuperVisualPath)) {
|
||||
appComponentCollection.clear();
|
||||
}
|
||||
compilation.assets['./component_collection.txt'] =
|
||||
new RawSource(Array.from(appComponentCollection).join(','));
|
||||
compilation.assets['./module_collection.txt'] =
|
||||
new RawSource(moduleCollection.size === 0 ? 'NULL' : Array.from(moduleCollection).join(','));
|
||||
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);
|
||||
callback();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -223,3 +223,14 @@ export function toHashData(path: string) {
|
||||
hash.update(content);
|
||||
return hash.digest('hex');
|
||||
}
|
||||
|
||||
export function writeFileSync(filePath: string, content: string): void {
|
||||
if (!fs.existsSync(filePath)) {
|
||||
const parent: string = path.join(filePath, '..');
|
||||
if (!(fs.existsSync(parent) && !fs.statSync(parent).isFile())) {
|
||||
mkDir(parent);
|
||||
}
|
||||
}
|
||||
fs.writeFileSync(filePath, content);
|
||||
}
|
||||
|
||||
|
||||
@@ -216,6 +216,7 @@ function setCopyPluginConfig(config) {
|
||||
path.resolve(__dirname, projectConfig.buildPath, '**').replace(/\\/g, '/')
|
||||
]
|
||||
},
|
||||
to: path.resolve(__dirname, projectConfig.buildPath),
|
||||
noErrorOnMissing: true
|
||||
});
|
||||
const sharePath = path.resolve(__dirname, projectConfig.projectPath, BUILD_SHARE_PATH);
|
||||
@@ -236,9 +237,15 @@ function setCopyPluginConfig(config) {
|
||||
}
|
||||
if (abilityConfig.abilityType === 'page') {
|
||||
if (fs.existsSync(projectConfig.manifestFilePath)) {
|
||||
copyPluginPattrens.push({ from: projectConfig.manifestFilePath });
|
||||
copyPluginPattrens.push({
|
||||
from: projectConfig.manifestFilePath,
|
||||
to: path.resolve(__dirname, projectConfig.buildPath)
|
||||
});
|
||||
} else if (fs.existsSync(projectConfig.aceConfigPath)) {
|
||||
copyPluginPattrens.push({ from: projectConfig.aceConfigPath });
|
||||
copyPluginPattrens.push({
|
||||
from: projectConfig.aceConfigPath,
|
||||
to: path.resolve(__dirname, projectConfig.buildPath)
|
||||
});
|
||||
}
|
||||
}
|
||||
config.plugins.push(new CopyPlugin({ patterns: copyPluginPattrens }));
|
||||
@@ -277,7 +284,6 @@ module.exports = (env, argv) => {
|
||||
initConfig(config);
|
||||
setOptimizationConfig(config);
|
||||
setCopyPluginConfig(config);
|
||||
|
||||
if (env.isPreview !== "true") {
|
||||
loadWorker(projectConfig);
|
||||
if (env.compilerType && env.compilerType === 'ark') {
|
||||
@@ -291,6 +297,10 @@ module.exports = (env, argv) => {
|
||||
}
|
||||
config.plugins.push(new GenAbcPlugin(projectConfig.buildPath, arkDir, nodeJs,
|
||||
env.buildMode === 'debug'));
|
||||
if (env.buildMode === 'release') {
|
||||
config.output.path = path.join(projectConfig.cachePath, 'releaseAssets',
|
||||
path.basename(projectConfig.buildPath))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
projectConfig.isPreview = true;
|
||||
|
||||
Reference in New Issue
Block a user