[android] installed packages list

This commit is contained in:
2019-11-10 17:05:03 +03:00
parent 85f2cb8ff7
commit 4f3ffe1181
3 changed files with 26 additions and 5 deletions

View File

@@ -61,12 +61,33 @@ class Android extends Sdk {
sdkmanager(packages) {
this.log.i('sdkmanager: *%s*', packages.join(', '));
const installedFile = path.join(this.path, '.installed');
const installed = new Set(
fs.existsSync(installedFile) ?
fs.readFileSync(installedFile, {encoding: 'utf8'}).split('\n') :
[]
);
const install = new Set(packages);
for (const key of installed) {
if (install.has(key)) {
install.delete(key);
}
}
if (install.size === 0) {
return Promise.resolve();
}
const androidBin = path.join(this.path, 'tools/bin/sdkmanager');
if (fs.existsSync(androidBin)) {
fs.chmodSync(androidBin, 0o755);
}
const yes = '(while sleep 3; do echo "y"; done)';
return exec('.', [yes, '|', androidBin].concat(packages.map(name => `"${name}"`)).join(' '));
const command = [yes, '|', androidBin].concat(Array.from(install).map(name => `"${name}"`)).join(' ');
return exec('.', command).then(() => {
for (const key of install) {
installed.add(key);
}
fs.writeFileSync(installedFile, Array.from(installed).join('\n'), {encoding: 'utf8'});
});
}
activate() {

View File

@@ -82,9 +82,7 @@ class Haxe extends Sdk {
}
resolveBuildDir(config) {
//const baseDir = os.tmpdir();
const baseDir = process.cwd();
return path.join(baseDir, 'build', config.name);
return path.join(Haxe.buildDir, config.name);
}
openfl(command, platform, config, debug=false) {
@@ -204,6 +202,8 @@ class Haxe extends Sdk {
}
}
Haxe.buildDir = path.join(process.cwd(), 'build');
Haxe.ID = 'haxe';
Haxe.VERSION_3_4_0 = '3.4.0';

View File

@@ -1,6 +1,6 @@
{
"name": "gulp-haxetool",
"version": "0.1.2",
"version": "0.1.3",
"description": "HaXe Tool for Gulp",
"main": "index.js",
"dependencies": {