[android] add sign task
This commit is contained in:
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,24 +1,30 @@
|
|||||||
|
0.1.1
|
||||||
|
-----
|
||||||
|
* Android sign apk (config.key.store and config.key.pass params)
|
||||||
|
|
||||||
|
0.1.0
|
||||||
|
------
|
||||||
|
* Android build
|
||||||
|
* Windows build
|
||||||
|
* Windows innosetup packer
|
||||||
|
|
||||||
0.0.18
|
0.0.18
|
||||||
------
|
------
|
||||||
* Add meta.fps project param
|
* Add meta.fps project param
|
||||||
|
|
||||||
0.0.12
|
0.0.12
|
||||||
------
|
-----
|
||||||
|
|
||||||
* Openfl android platform support
|
* Openfl android platform support
|
||||||
* Android sdk module
|
* Android sdk module
|
||||||
|
|
||||||
0.0.11
|
0.0.11
|
||||||
------
|
------
|
||||||
|
|
||||||
* Added Neko module
|
* Added Neko module
|
||||||
* FlashPlayer output with stream
|
* FlashPlayer output with stream
|
||||||
* Verbose output mode (--verbose)
|
* Verbose output mode (--verbose)
|
||||||
|
|
||||||
0.0.10
|
0.0.10
|
||||||
------
|
------
|
||||||
|
|
||||||
* Windows compatibility
|
* Windows compatibility
|
||||||
* Change FlashPlayer download link
|
* Change FlashPlayer download link
|
||||||
* Use 'fs-extra' without 'mkdirp' and 'rmdir'
|
* Use 'fs-extra' without 'mkdirp' and 'rmdir'
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const os = require('os');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const exec = require('./exec');
|
const exec = require('./exec');
|
||||||
const {StringWritable} = require('./tail');
|
const {StringWritable} = require('./tail');
|
||||||
@@ -89,12 +90,16 @@ class Android extends Sdk {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
aapt(args) {
|
buildTool(name) {
|
||||||
let buildToolsVersion = null;
|
let buildToolsVersion = null;
|
||||||
fs.readdirSync(path.join(this.path, 'build-tools')).forEach(file => {
|
fs.readdirSync(path.join(this.path, 'build-tools')).forEach(file => {
|
||||||
buildToolsVersion = file;
|
buildToolsVersion = file;
|
||||||
});
|
});
|
||||||
const aaptBin = path.join(this.path, 'build-tools', buildToolsVersion, 'aapt');
|
return path.join(this.path, 'build-tools', buildToolsVersion, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
aapt(args) {
|
||||||
|
const aaptBin = this.buildTool('aapt');
|
||||||
return exec('.', [aaptBin].concat(args).join(' '));
|
return exec('.', [aaptBin].concat(args).join(' '));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,6 +196,27 @@ class Android extends Sdk {
|
|||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sign(keystore, keypass) {
|
||||||
|
const self = this;
|
||||||
|
return through.obj(function(file, enc, callback) {
|
||||||
|
self.log.i('sign *%s*', file.path);
|
||||||
|
const filename = path.join(os.tmpdir(), 'tmp.apk');
|
||||||
|
fs.writeFileSync(filename, file.contents);
|
||||||
|
const cmd = [
|
||||||
|
self.buildTool('apksigner'),
|
||||||
|
'sign',
|
||||||
|
'--ks', keystore,
|
||||||
|
'--ks-pass', `pass:${keypass}`,
|
||||||
|
filename
|
||||||
|
].join(' ');
|
||||||
|
exec('.', cmd).then(() => {
|
||||||
|
file.contents = fs.readFileSync(filename);
|
||||||
|
this.push(file);
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Android.ID = 'android';
|
Android.ID = 'android';
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class Config {
|
|||||||
mobileHeight: null,
|
mobileHeight: null,
|
||||||
fps: 60,
|
fps: 60,
|
||||||
};
|
};
|
||||||
|
this.key = null;
|
||||||
if (params) {
|
if (params) {
|
||||||
this.update(params);
|
this.update(params);
|
||||||
this.afterUpdate();
|
this.afterUpdate();
|
||||||
@@ -68,6 +69,7 @@ class Config {
|
|||||||
if (params.macros !== undefined) this.macros = this.macros.concat(params.macros);
|
if (params.macros !== undefined) this.macros = this.macros.concat(params.macros);
|
||||||
if (params.flags !== undefined) this.flags = this.flags.concat(params.flags);
|
if (params.flags !== undefined) this.flags = this.flags.concat(params.flags);
|
||||||
if (params.meta !== undefined) this.meta = {...this.meta, ...params.meta};
|
if (params.meta !== undefined) this.meta = {...this.meta, ...params.meta};
|
||||||
|
if (params.key !== undefined) this.key = params.key;
|
||||||
if (this.meta.icon) this.icon = Config.absolutePath(this.meta.icon);
|
if (this.meta.icon) this.icon = Config.absolutePath(this.meta.icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,8 +103,7 @@ class HaxeBuilder extends Builder {
|
|||||||
'tools',
|
'tools',
|
||||||
'platform-tools',
|
'platform-tools',
|
||||||
'build-tools;27.0.3',
|
'build-tools;27.0.3',
|
||||||
//'platforms;android-19',
|
'platforms;android-28',
|
||||||
'platforms;android-26',
|
|
||||||
//'ndk-bundle',
|
//'ndk-bundle',
|
||||||
'lldb;3.1',
|
'lldb;3.1',
|
||||||
'cmake;3.6.4111459',
|
'cmake;3.6.4111459',
|
||||||
@@ -125,7 +124,12 @@ class HaxeBuilder extends Builder {
|
|||||||
switch (this.buildSystem) {
|
switch (this.buildSystem) {
|
||||||
case BuildSystem.OPENFL:
|
case BuildSystem.OPENFL:
|
||||||
return this.haxe.openfl('build', this.platform, this.config, this.debug)
|
return this.haxe.openfl('build', this.platform, this.config, this.debug)
|
||||||
.then(result => streamToPromise(result.pipe(vfs.dest(target))));
|
.then(result => {
|
||||||
|
if (this.platform === Platform.ANDROID && this.config.key) {
|
||||||
|
result = result.pipe(this.android.sign(this.config.key.store, this.config.key.pass));
|
||||||
|
}
|
||||||
|
return streamToPromise(result.pipe(vfs.dest(target)));
|
||||||
|
});
|
||||||
case BuildSystem.HAXE:
|
case BuildSystem.HAXE:
|
||||||
return this.haxe.build(this.platform, this.config, this.debug)
|
return this.haxe.build(this.platform, this.config, this.debug)
|
||||||
.then(result => streamToPromise(result.pipe(vfs.dest(target))));
|
.then(result => streamToPromise(result.pipe(vfs.dest(target))));
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gulp-haxetool",
|
"name": "gulp-haxetool",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"description": "HaXe Tool for Gulp",
|
"description": "HaXe Tool for Gulp",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
Reference in New Issue
Block a user