breautek commented on code in PR #1678: URL: https://github.com/apache/cordova-android/pull/1678#discussion_r1592471109
########## lib/builders/ProjectBuilder.js: ########## @@ -116,16 +114,17 @@ class ProjectBuilder { return args; } - /* - * This returns a promise - */ - runGradleWrapper (gradle_cmd) { - const gradlePath = path.join(this.root, 'gradlew'); - const wrapperGradle = path.join(this.root, 'wrapper.gradle'); - if (fs.existsSync(gradlePath)) { - // Literally do nothing, for some reason this works, while !fs.existsSync didn't on Windows + /** + * Installs/updates the gradle wrapper + * @param {string} gradleVersion The gradle version to install. Ignored if CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL environment variable is defined + * @returns {Promise<void>} + */ + async installGradleWrapper (gradleVersion) { + if (process.env.CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL) { + events.emit('verbose', `Overriding Gradle Version via CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL (${process.env.CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL})`); + await execa('gradle', ['-p', this.root, 'wrapper', '--gradle-distribution-url', process.env.CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL], { stdio: 'inherit' }); } else { - return execa(gradle_cmd, ['-p', this.root, 'wrapper', '-b', wrapperGradle], { stdio: 'inherit' }); + await execa('gradle', ['-p', this.root, 'wrapper', '--gradle-version', gradleVersion], { stdio: 'inherit' }); Review Comment: I assume `--validate-url` only makes sense if `--gradle-distribution-url` is used. Which would only be the cause if there is a system environment variable set for `CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org