breautek commented on code in PR #1678: URL: https://github.com/apache/cordova-android/pull/1678#discussion_r1597304675
########## 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've reverted the `--validate-url`. I'm not confident it actually fixed anything. [Gradle Docs](https://docs.gradle.org/8.2/userguide/gradle_wrapper.html) states that `--validate-url` enables validation on the distribution url and that it's enabled by default. So it doesn't much sense that adding `--validate-url` would have changed anything, and explicitly adding it will require a minimum system gradle of 8.2 or later since that's when the flag was added. I've also haven't reproduced the issue since the first time. Even after trying to force the issue by messing with `validateDistributionUrl` in the gradle properties file. -- 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