mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
clean project after compiling simulator (#3218)
This commit is contained in:
+22
-1
@@ -34,6 +34,7 @@ var spawn = require('child_process').spawn;
|
||||
var Path = require('path');
|
||||
var fs = require('fs-extra');
|
||||
const which = require('which');
|
||||
const del = require('del');
|
||||
|
||||
function absolutePath (relativePath) {
|
||||
return Path.join(__dirname, relativePath);
|
||||
@@ -130,6 +131,10 @@ function getCurrentBranch() {
|
||||
return output.stdout.toString().trim();
|
||||
}
|
||||
|
||||
function formatPath (p) {
|
||||
return p.replace(/\\/g, '/');
|
||||
}
|
||||
|
||||
gulp.task('update', function (cb) {
|
||||
const git = require('./utils/git');
|
||||
var branch = git.getCurrentBranch('.');
|
||||
@@ -149,6 +154,9 @@ gulp.task('gen-cocos2d-x', function(cb) {
|
||||
});
|
||||
|
||||
gulp.task('gen-simulator', async function () {
|
||||
console.log('remove old simulator project\n');
|
||||
await del(Path.join(__dirname, './simulator'));
|
||||
|
||||
let isWin32 = process.platform === 'win32';
|
||||
// get the cmake path
|
||||
let cmakeBin = await new Promise((resolve, reject) => {
|
||||
@@ -185,7 +193,6 @@ gulp.task('gen-simulator', async function () {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
console.log('=====================================\n');
|
||||
console.log('build project\n');
|
||||
console.log('=====================================\n');
|
||||
@@ -212,6 +219,20 @@ gulp.task('gen-simulator', async function () {
|
||||
});
|
||||
});
|
||||
|
||||
console.log('=====================================\n');
|
||||
console.log('clean project\n');
|
||||
console.log('=====================================\n');
|
||||
let delPatterns = [
|
||||
formatPath(Path.join(__dirname, './simulator/*')),
|
||||
formatPath(`!${Path.join(__dirname, './simulator/Debug')}`),
|
||||
];
|
||||
if (!isWin32) {
|
||||
delPatterns.push(formatPath(Path.join(__dirname, './simulator/Debug/libcocos2d.a')));
|
||||
delPatterns.push(formatPath(Path.join(__dirname, './simulator/Debug/libsimulator.a')));
|
||||
}
|
||||
console.log('delete patterns: ', JSON.stringify(delPatterns, undefined, 2));
|
||||
await del(delPatterns, { force: true });
|
||||
|
||||
console.log('done!');
|
||||
});
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"@types/fs-extra": "^9.0.1",
|
||||
"async": "^2.6.1",
|
||||
"chalk": "^2.4.1",
|
||||
"del": "^6.0.0",
|
||||
"fs-extra": "^9.0.0",
|
||||
"ftp": "0.3.10",
|
||||
"tmp": "^0.2.1",
|
||||
|
||||
Reference in New Issue
Block a user