forked from github/cordova-android
CB-11083: Reading files to check for CordovaLib dependency, if so, we exclude CordovaLib to be safe
This commit is contained in:
parent
263968e019
commit
304cbef5ed
@ -71,16 +71,17 @@ GradleBuilder.prototype.prepBuildFiles = function() {
|
||||
var pluginBuildGradle = path.join(this.root, 'cordova', 'lib', 'plugin-build.gradle');
|
||||
var propertiesObj = this.readProjectProperties();
|
||||
var subProjects = propertiesObj.libs;
|
||||
var checkAndCopy = function(subProject, root) {
|
||||
var subProjectGradle = path.join(root, subProject, 'build.gradle');
|
||||
fs.exists(subProject, function(exists) {
|
||||
if (!exists) {
|
||||
shell.cp('-f', pluginBuildGradle, subProjectGradle);
|
||||
}
|
||||
});
|
||||
};
|
||||
for (var i = 0; i < subProjects.length; ++i) {
|
||||
if (subProjects[i] !== 'CordovaLib') {
|
||||
var subProjectGradle = path.join(this.root, subProjects[i], 'build.gradle');
|
||||
// Only copy the gradle if it doesn't exist for the library
|
||||
fs.exists(subProjectGradle, function(exists) {
|
||||
if (!exists)
|
||||
{
|
||||
shell.cp('-f', pluginBuildGradle, path.join(this.root, subProjects[i], 'build.gradle'));
|
||||
}
|
||||
});
|
||||
checkAndCopy(subProjects[i], this.root);
|
||||
}
|
||||
}
|
||||
var name = this.extractRealProjectNameFromManifest();
|
||||
@ -101,20 +102,24 @@ GradleBuilder.prototype.prepBuildFiles = function() {
|
||||
// Update dependencies within build.gradle.
|
||||
var buildGradle = fs.readFileSync(path.join(this.root, 'build.gradle'), 'utf8');
|
||||
var depsList = '';
|
||||
var insertExclude = function(libName) {
|
||||
if(libName.indexOf("cordova-plugin") != -1) {
|
||||
depsList += '{\n exclude module:("CordovaLib")\n }\n';
|
||||
}
|
||||
else {
|
||||
depsList += "\n";
|
||||
}
|
||||
}
|
||||
var root = this.root;
|
||||
var insertExclude = function(p) {
|
||||
var gradlePath = path.join(root, p, 'build.gradle');
|
||||
var projectGradleFile = fs.readFileSync(gradlePath, 'utf-8');
|
||||
if(projectGradleFile.indexOf('CordovaLib') != -1) {
|
||||
depsList += '{\n exclude module:("CordovaLib")\n }\n';
|
||||
}
|
||||
else {
|
||||
depsList +='\n';
|
||||
}
|
||||
};
|
||||
subProjects.forEach(function(p) {
|
||||
console.log('Subproject Path: ' + p);
|
||||
var libName=p.replace(/[/\\]/g, ':').replace(name+'-','');
|
||||
depsList += ' debugCompile(project(path: "' + libName + '", configuration: "debug"))';
|
||||
insertExclude(libName);
|
||||
insertExclude(p);
|
||||
depsList += ' releaseCompile(project(path: "' + libName + '", configuration: "release"))';
|
||||
insertExclude(libName);
|
||||
insertExclude(p);
|
||||
});
|
||||
// For why we do this mapping: https://issues.apache.org/jira/browse/CB-8390
|
||||
var SYSTEM_LIBRARY_MAPPINGS = [
|
||||
|
Loading…
Reference in New Issue
Block a user