Skip to content

Commit 5708189

Browse files
authored
Merge pull request #629 from tidev/221221_ndk_error
chore(all): remove ndk message, fix eslint warnings
2 parents 4e564d3 + 0d03e50 commit 5708189

File tree

6 files changed

+28
-35
lines changed

6 files changed

+28
-35
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"sourceType": "script"
66
},
77
"rules": {
8+
"no-empty": ["error", { "allowEmptyCatch": true }],
89
"no-implicit-globals": "off"
910
},
1011
"overrides": [

lib/android.js

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,11 @@ exports.detect = function detect(config, opts, finished) {
253253
}
254254

255255
var archs = {};
256-
run(dpkg, '--print-architecture', function (code, stdout, stderr) {
256+
run(dpkg, '--print-architecture', function (code, stdout, _stderr) {
257257
stdout.split('\n').forEach(function (line) {
258258
(line = line.trim()) && (archs[line] = 1);
259259
});
260-
run(dpkg, '--print-foreign-architectures', function (code, stdout, stderr) {
260+
run(dpkg, '--print-foreign-architectures', function (code, stdout, _stderr) {
261261
stdout.split('\n').forEach(function (line) {
262262
(line = line.trim()) && (archs[line] = 1);
263263
});
@@ -278,7 +278,7 @@ exports.detect = function detect(config, opts, finished) {
278278
async.each(
279279
[ 'libc6:i386', 'libncurses5:i386', 'libstdc++6:i386', 'zlib1g:i386' ],
280280
function (pkg, next) {
281-
run(dpkgquery, [ '-l', pkg ], function (code, out, err) {
281+
run(dpkgquery, [ '-l', pkg ], function (code, out, _err) {
282282
result[pkg] = false;
283283
if (!code) {
284284
var lines = out.split('\n'),
@@ -310,7 +310,7 @@ exports.detect = function detect(config, opts, finished) {
310310
return cb();
311311
}
312312

313-
run(rpm, '-qa', function (code, stdout, stderr) {
313+
run(rpm, '-qa', function (code, stdout, _stderr) {
314314
stdout.split('\n').forEach(function (line) {
315315
if (/^glibc-/.test(line)) {
316316
if (/\.i[36]86$/.test(line)) {
@@ -362,7 +362,8 @@ exports.detect = function detect(config, opts, finished) {
362362
type: 'error',
363363
message: __('JDK (Java Development Kit) not found.') + '\n'
364364
+ __('If you already have installed the JDK, verify your __JAVA_HOME__ environment variable is correctly set.') + '\n'
365-
+ __('The JDK can be downloaded and installed from %s.', '__https://www.oracle.com/technetwork/java/javase/downloads/index.html__')
365+
+ __('The JDK can be downloaded and installed from %s', '__https://www.oracle.com/java/technologies/downloads/__') + '\n'
366+
+ __('or %s.', '__https://jdk.java.net/archive/__')
366367
});
367368
results.sdk = null;
368369
return finalize();
@@ -391,19 +392,6 @@ exports.detect = function detect(config, opts, finished) {
391392
}
392393
}
393394

394-
if (!results.ndk) {
395-
results.issues.push({
396-
id: 'ANDROID_NDK_NOT_FOUND',
397-
type: 'warning',
398-
message: __('Unable to locate an Android NDK.') + '\n'
399-
+ __('Without the NDK, you will not be able to build native Android Titanium modules.') + '\n'
400-
+ __('If you have already downloaded and installed the Android NDK, you can tell Titanium where the Android NDK is located by running \'%s\', otherwise you can install it by running \'%s\' or manually downloading from %s.',
401-
'__' + commandPrefix + 'titanium config android.ndkPath /path/to/android-ndk__',
402-
'__' + commandPrefix + 'titanium setup android__',
403-
'__https://developer.android.com/ndk__')
404-
});
405-
}
406-
407395
// if we don't have an android sdk, then nothing else to do
408396
if (!results.sdk) {
409397
results.issues.push({
@@ -714,8 +702,7 @@ exports.detect = function detect(config, opts, finished) {
714702
} else if (message.length > 0) {
715703
message += '\n';
716704
}
717-
message +=
718-
__('Current installed Android SDK tools:') + '\n'
705+
message += __('Current installed Android SDK tools:') + '\n'
719706
+ ' Android SDK Tools: ' + (results.sdk.tools.version || 'not installed') + ' (Supported: ' + androidPackageJson.vendorDependencies['android tools'] + ')\n'
720707
+ ' Android SDK Platform Tools: ' + (results.sdk.platformTools.version || 'not installed') + ' (Supported: ' + androidPackageJson.vendorDependencies['android platform tools'] + ')\n'
721708
+ ' Android SDK Build Tools: ' + (results.sdk.buildTools.version || 'not installed') + ' (Supported: ' + androidPackageJson.vendorDependencies['android build tools'] + ')\n\n'
@@ -1033,7 +1020,7 @@ function loadPlatform(dir, systemImages) {
10331020
};
10341021
}
10351022

1036-
function loadAddon(dir, platforms, systemImages) {
1023+
function loadAddon(dir, platforms, _systemImages) {
10371024
// read in the properties
10381025
const sourceProps = readProps(path.join(dir, 'source.properties'));
10391026
const apiLevel = sourceProps ? ~~sourceProps['AndroidVersion.ApiLevel'] : null;

lib/builder.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,12 @@ Builder.prototype.validate = function validate(logger, config, cli) {
150150
* Defines common variables prior to running the build. This super function
151151
* should be called prior to the platform-specific build command's run().
152152
*
153-
* @param {Object} logger - The logger instance
154-
* @param {Object} config - The CLI config
155-
* @param {Object} cli - The CLI instance
156-
* @param {Function} finished - A function to call after the function finishes
153+
* @param {Object} _logger - The logger instance
154+
* @param {Object} _config - The CLI config
155+
* @param {Object} _cli - The CLI instance
156+
* @param {Function} _finished - A function to call after the function finishes
157157
*/
158-
Builder.prototype.run = function run(logger, config, cli, finished) {
158+
Builder.prototype.run = function run(_logger, _config, _cli, _finished) {
159159
// note: this function must be sync!
160160

161161
var buildDirFiles = this.buildDirFiles = {};
@@ -508,7 +508,7 @@ Builder.prototype.generateAppIcons = function generateAppIcons(icons, callback)
508508
return fail();
509509
}
510510

511-
appc.image.resize(defaultIcon, icons, function (error, stdout, stderr) {
511+
appc.image.resize(defaultIcon, icons, function (error, _stdout, _stderr) {
512512
if (error) {
513513
this.logger.error(error);
514514
this.logger.log();

lib/emulators/avd.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ exports.start = function start(config, emu, opts, callback) {
195195
cb(tryPort > 5584 ? new Error(__('Unable to find a free port between 5554 and 5584')) : null);
196196
});
197197

198-
socket.on('end', function (err) {
198+
socket.on('end', function (_err) {
199199
if (socket) {
200200
socket.end();
201201
socket = null;
@@ -225,11 +225,16 @@ exports.start = function start(config, emu, opts, callback) {
225225
var args = [
226226
'-avd', emu.id, // use a specific android virtual device
227227
'-port', port, // TCP port that will be used for the console
228-
'-partition-size', opts.partitionSize || 512 // system/data partition size in MBs
229228
];
230229

230+
if (opts.partitionSize !== undefined) {
231+
args.push('-partition-size', opts.partitionSize); // system/data partition size in MBs
232+
}
233+
231234
var sdcard = opts.sdcard || emu.sdcard;
232-
sdcard && args.push('-sdcard', sdcard); // SD card image (default <system>/sdcard.img
235+
if (sdcard !== undefined) {
236+
args.push('-sdcard', sdcard); // SD card image (default <system>/sdcard.img
237+
}
233238

234239
// add any other args
235240
opts.logcat && args.push('-logcat', opts.logcat); // enable logcat output with given tags

lib/emulators/genymotion.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ exports.detect = function detect(config, opts, finished) {
101101
// try to find the VBoxManage file in the config file or system paths
102102
appc.subprocess.findExecutable([ config.get('genymotion.executables.vboxmanage'), 'VBoxManage' + exe ], function (err, result) {
103103
function getVersion(exe) {
104-
appc.subprocess.run(exe, '--version', function (code, out, err) {
104+
appc.subprocess.run(exe, '--version', function (code, out, _err) {
105105
next(null, {
106106
vboxmanage: exe,
107107
version: code ? null : out.trim()
@@ -312,7 +312,7 @@ function findGenymotion(dir, config, callback) {
312312
}
313313

314314
function getVMInfo(config, vboxmanage, callback) {
315-
appc.subprocess.run(vboxmanage, [ 'list', 'vms' ], function (code, out, err) {
315+
appc.subprocess.run(vboxmanage, [ 'list', 'vms' ], function (code, out, _err) {
316316
if (code) {
317317
return callback(null, []);
318318
}
@@ -337,7 +337,7 @@ function getVMInfo(config, vboxmanage, callback) {
337337
'sdk-version': null
338338
};
339339

340-
appc.subprocess.run(vboxmanage, [ 'guestproperty', 'enumerate', emu.guid ], function (code, out, err) {
340+
appc.subprocess.run(vboxmanage, [ 'guestproperty', 'enumerate', emu.guid ], function (code, out, _err) {
341341
if (!code) {
342342
out.split('\n').forEach(function (line) {
343343
var m = line.trim().match(/Name: (\S+), value: (\S*), timestamp:/);

lib/titanium.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ exports.validateCorrectSDK = function (logger, config, cli, commandName) {
437437
}
438438
}
439439

440-
function cmdAddSecret(param) {
440+
function cmdAddSecret(_param) {
441441
for (var i = 0; i < arguments.length; i++) {
442442
cmd.push(arguments[i]);
443443
cmdSafe.push('*******');
@@ -636,7 +636,7 @@ exports.validateCorrectSDK = function (logger, config, cli, commandName) {
636636
setTimeout(function () {
637637
spawn(cmdRoot, cmd, {
638638
stdio: 'inherit'
639-
}).on('exit', function (code, signal) {
639+
}).on('exit', function (code, _signal) {
640640
code && process.exit(code);
641641
});
642642
}, delayCmd ? 1000 : 0);

0 commit comments

Comments
 (0)