CB-11083: Fixing syncronous file check and future-proofing the JS for Travis

This closes #323
This commit is contained in:
Joe Bowser 2016-08-10 15:29:24 -07:00
parent 304cbef5ed
commit 6aa4b1b301

View File

@ -73,11 +73,13 @@ GradleBuilder.prototype.prepBuildFiles = function() {
var subProjects = propertiesObj.libs; var subProjects = propertiesObj.libs;
var checkAndCopy = function(subProject, root) { var checkAndCopy = function(subProject, root) {
var subProjectGradle = path.join(root, subProject, 'build.gradle'); var subProjectGradle = path.join(root, subProject, 'build.gradle');
fs.exists(subProject, function(exists) { // This is the future-proof way of checking if a file exists
if (!exists) { // This must be synchronous to satisfy a Travis test
try {
fs.accessSync(subProjectGradle, fs.F_OK);
} catch (e) {
shell.cp('-f', pluginBuildGradle, subProjectGradle); shell.cp('-f', pluginBuildGradle, subProjectGradle);
} }
});
}; };
for (var i = 0; i < subProjects.length; ++i) { for (var i = 0; i < subProjects.length; ++i) {
if (subProjects[i] !== 'CordovaLib') { if (subProjects[i] !== 'CordovaLib') {