CB-13289: Fixing build problems with Studio Three, but keeping Windows Gradle fix for now, will be deprecated

This commit is contained in:
Joe Bowser 2017-10-30 10:39:59 -07:00
parent d73108cc13
commit 9fdb126715
3 changed files with 7 additions and 17 deletions

View File

@ -133,9 +133,7 @@ GradleBuilder.prototype.prepBuildFiles = function () {
subProjects.forEach(function (p) { subProjects.forEach(function (p) {
console.log('Subproject Path: ' + p); console.log('Subproject Path: ' + p);
var libName = p.replace(/[/\\]/g, ':').replace(name + '-', ''); var libName = p.replace(/[/\\]/g, ':').replace(name + '-', '');
depsList += ' debugCompile(project(path: "' + libName + '", configuration: "debug"))'; depsList += ' implementation(project(path: "' + libName + '"))';
insertExclude(p);
depsList += ' releaseCompile(project(path: "' + libName + '", configuration: "release"))';
insertExclude(p); insertExclude(p);
}); });
// For why we do this mapping: https://issues.apache.org/jira/browse/CB-8390 // For why we do this mapping: https://issues.apache.org/jira/browse/CB-8390
@ -198,7 +196,7 @@ GradleBuilder.prototype.prepEnv = function (opts) {
// For some reason, using ^ and $ don't work. This does the job, though. // For some reason, using ^ and $ don't work. This does the job, though.
var distributionUrlRegex = /distributionUrl.*zip/; var distributionUrlRegex = /distributionUrl.*zip/;
/* jshint -W069 */ /* jshint -W069 */
var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-3.3-all.zip'; var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-4.1-all.zip';
/* jshint +W069 */ /* jshint +W069 */
var gradleWrapperPropertiesPath = path.join(self.root, 'gradle', 'wrapper', 'gradle-wrapper.properties'); var gradleWrapperPropertiesPath = path.join(self.root, 'gradle', 'wrapper', 'gradle-wrapper.properties');
shell.chmod('u+w', gradleWrapperPropertiesPath); shell.chmod('u+w', gradleWrapperPropertiesPath);

View File

@ -99,16 +99,8 @@ module.exports.get_gradle_wrapper = function () {
var i = 0; var i = 0;
var foundStudio = false; var foundStudio = false;
var program_dir; var program_dir;
if (module.exports.isDarwin()) { //OK, This hack only works on Windows, not on Mac OS or Linux. We will be deleting this eventually!
program_dir = fs.readdirSync('/Applications'); if (module.exports.isWindows()) {
while (i < program_dir.length && !foundStudio) {
if (program_dir[i].startsWith('Android Studio')) {
// TODO: Check for a specific Android Studio version, make sure it's not Canary
androidStudioPath = path.join('/Applications', program_dir[i], 'Contents', 'gradle');
foundStudio = true;
} else { ++i; }
}
} else if (module.exports.isWindows()) {
var result = child_process.spawnSync(path.join(__dirname, 'getASPath.bat')); var result = child_process.spawnSync(path.join(__dirname, 'getASPath.bat'));
// console.log('result.stdout =' + result.stdout.toString()); // console.log('result.stdout =' + result.stdout.toString());

View File

@ -32,7 +32,7 @@ buildscript {
// http://tools.android.com/tech-docs/new-build-system/version-compatibility // http://tools.android.com/tech-docs/new-build-system/version-compatibility
// and https://issues.apache.org/jira/browse/CB-8143 // and https://issues.apache.org/jira/browse/CB-8143
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.2.3' classpath 'com.android.tools.build:gradle:3.0.0'
} }
} }
@ -47,7 +47,7 @@ allprojects {
} }
task wrapper(type: Wrapper) { task wrapper(type: Wrapper) {
gradleVersion = '2.14.1' gradleVersion = '4.1.0'
} }
// Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties. // Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties.
@ -249,7 +249,7 @@ android {
} }
dependencies { dependencies {
compile fileTree(dir: 'libs', include: '*.jar') implementation fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START // SUB-PROJECT DEPENDENCIES START
// SUB-PROJECT DEPENDENCIES END // SUB-PROJECT DEPENDENCIES END
} }