Skip to content

Commit

Permalink
Make the hook synchronous
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
shankari committed Jul 30, 2018
1 parent 54bebbb commit 1fcea28
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions hooks/android/addResourcesClassImport.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var walk = function(ctx, dir, done) {
});
});
});
};
}

module.exports = function (ctx) {
// If Android platform is not installed, don't even execute
Expand All @@ -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');

Expand All @@ -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
}

Expand Down Expand Up @@ -155,9 +152,6 @@ module.exports = function (ctx) {
Q.all(deferrals)
.then(function() {
console.log('Done with the hook!');
deferral.resolve();
})
});

return deferral.promise;
}

0 comments on commit 1fcea28

Please sign in to comment.