Skip to content

Commit

Permalink
fix(android): module "clean" shouldn't error if missing "libs" (#11509)
Browse files Browse the repository at this point in the history
- When doing an "appc ti clean" in module folder, now checks if "libs" directory exists before attempting to clean it.
  * Titanium 9.0.0 no longer generates a "libs" folder. So, this help avoids the error.

Co-authored-by: ssekhri <ssekhri@axway.com>
  • Loading branch information
jquick-axway and ssekhri committed Mar 20, 2020
1 parent 6c1a206 commit e90b8af
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions android/cli/commands/_cleanModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ const fs = require('fs-extra');
const appc = require('node-appc');
const __ = appc.i18n(__dirname).__;

// TODO Do we need a validate function?

exports.run = function run(logger, config, cli, finished) {
const projectDir = cli.argv['project-dir'];

Expand All @@ -34,17 +32,20 @@ exports.run = function run(logger, config, cli, finished) {
});

// remove only the libraries we generate
const moduleid = cli.manifest.moduleid;
const arches = fs.readdirSync(path.join(projectDir, 'libs'));
arches.forEach(arch => {
const target = path.join(projectDir, 'libs', arch, `lib${moduleid}.so`);
if (appc.fs.exists(target)) {
logger.debug(__('Deleting %s', target.cyan));
fs.removeSync(target);
} else {
logger.debug(__('File does not exist %s', target.cyan));
}
});
const libsDir = path.join(projectDir, 'libs');
if (appc.fs.exists(libsDir)) {
const moduleid = cli.manifest.moduleid;
const arches = fs.readdirSync(libsDir);
arches.forEach(arch => {
const target = path.join(projectDir, 'libs', arch, `lib${moduleid}.so`);
if (appc.fs.exists(target)) {
logger.debug(__('Deleting %s', target.cyan));
fs.removeSync(target);
} else {
logger.debug(__('File does not exist %s', target.cyan));
}
});
}

finished();
};

0 comments on commit e90b8af

Please sign in to comment.