From 8370da11e2c7d5a49177e3e9071e13ec129b9df9 Mon Sep 17 00:00:00 2001 From: "K. Shankari" Date: Sun, 29 Jul 2018 19:47:59 -0700 Subject: [PATCH] Make the hook synchronous Without this change, only one plugin is added for each run of `cordova prepare`. you have to re-run `cordova prepare` multiple times to get them all to be added. --- hooks/android/addResourcesClassImport.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/hooks/android/addResourcesClassImport.js b/hooks/android/addResourcesClassImport.js index d31d1d0..61f3774 100644 --- a/hooks/android/addResourcesClassImport.js +++ b/hooks/android/addResourcesClassImport.js @@ -55,7 +55,7 @@ var walk = function(ctx, dir, done) { }); }); }); -}; +} module.exports = function (ctx) { // If Android platform is not installed, don't even execute @@ -66,8 +66,6 @@ module.exports = function (ctx) { path = ctx.requireCordovaModule('path'), Q = ctx.requireCordovaModule('q'); - var deferral = Q.defer(); - var platformSourcesRoot = path.join(ctx.opts.projectRoot, 'platforms/android/src'); var pluginSourcesRoot = path.join(ctx.opts.plugin.dir, 'src/android'); @@ -78,7 +76,6 @@ module.exports = function (ctx) { console.log("walk callback with files = "+files); if (err) { console.error('Error when reading file:', err) - deferral.reject(); return } @@ -155,9 +152,6 @@ module.exports = function (ctx) { Q.all(deferrals) .then(function() { console.log('Done with the hook!'); - deferral.resolve(); }) }); - - return deferral.promise; }