From 8ef742e79d80631206439f516fefede652873331 Mon Sep 17 00:00:00 2001 From: Norman Breau Date: Tue, 21 Jan 2020 06:24:00 -0400 Subject: [PATCH] feat: upgrade gradle to 6.1 & gradle build tools to 3.5.3 (#792) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat!: upgrade gradle to 6.1 * feat!: upgrade gradle build tools to 3.5.3 * feat: added `npm run clean-tests` * fix!: Removed useDeprecatedNdk as this option is now completely removed from gradle. * feat!: bump gradle to 6.1 & gradle build tools to 3.5.3 Co-authored-by: エリス --- bin/clean_test.js | 28 +++++++++++++++++++ .../cordova/lib/builders/ProjectBuilder.js | 2 +- .../lib/config/GradlePropertiesParser.js | 5 +--- bin/templates/project/app/build.gradle | 4 +-- bin/templates/project/build.gradle | 2 +- package.json | 3 +- test/build.gradle | 2 +- test/wrapper.gradle | 2 +- 8 files changed, 37 insertions(+), 11 deletions(-) create mode 100644 bin/clean_test.js diff --git a/bin/clean_test.js b/bin/clean_test.js new file mode 100644 index 00000000..919f0b2b --- /dev/null +++ b/bin/clean_test.js @@ -0,0 +1,28 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +const fs = require('fs'); + +if (fs.existsSync('./test/gradlew')) { + fs.unlinkSync('./test/gradlew'); +} + +if (fs.existsSync('./test/gradlew.bat')) { + fs.unlinkSync('./test/gradlew.bat'); +} diff --git a/bin/templates/cordova/lib/builders/ProjectBuilder.js b/bin/templates/cordova/lib/builders/ProjectBuilder.js index 335578de..df05e495 100644 --- a/bin/templates/cordova/lib/builders/ProjectBuilder.js +++ b/bin/templates/cordova/lib/builders/ProjectBuilder.js @@ -226,7 +226,7 @@ class ProjectBuilder { // If it's not set, do nothing, assuming that we're using a future version of gradle that we don't want to mess with. // For some reason, using ^ and $ don't work. This does the job, though. var distributionUrlRegex = /distributionUrl.*zip/; - var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-4.10.3-all.zip'; + var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'https\\://services.gradle.org/distributions/gradle-6.1-all.zip'; var gradleWrapperPropertiesPath = path.join(self.root, 'gradle', 'wrapper', 'gradle-wrapper.properties'); shell.chmod('u+w', gradleWrapperPropertiesPath); shell.sed('-i', distributionUrlRegex, 'distributionUrl=' + distributionUrl, gradleWrapperPropertiesPath); diff --git a/bin/templates/cordova/lib/config/GradlePropertiesParser.js b/bin/templates/cordova/lib/config/GradlePropertiesParser.js index 59d9eac3..060da2d9 100644 --- a/bin/templates/cordova/lib/config/GradlePropertiesParser.js +++ b/bin/templates/cordova/lib/config/GradlePropertiesParser.js @@ -34,10 +34,7 @@ class GradlePropertiesParser { 'org.gradle.daemon': 'true', // to allow dex in process - 'org.gradle.jvmargs': '-Xmx2048m', - - // allow NDK to be used - required by Gradle 1.5 plugin - 'android.useDeprecatedNdk': 'true' + 'org.gradle.jvmargs': '-Xmx2048m' // Shaves another 100ms, but produces a "try at own risk" warning. Not worth it (yet): // 'org.gradle.parallel': 'true' diff --git a/bin/templates/project/app/build.gradle b/bin/templates/project/app/build.gradle index 2db1aa65..29503bdb 100644 --- a/bin/templates/project/app/build.gradle +++ b/bin/templates/project/app/build.gradle @@ -29,7 +29,7 @@ buildscript { dependencies { apply from: '../CordovaLib/cordova.gradle' - classpath 'com.android.tools.build:gradle:3.3.0' + classpath 'com.android.tools.build:gradle:3.5.3' if(cdvHelpers.getConfigPreference('GradlePluginGoogleServicesEnabled', 'false').toBoolean()) { String defaultGradlePluginGoogleServicesVersion = '4.2.0' @@ -61,7 +61,7 @@ allprojects { } task wrapper(type: Wrapper) { - gradleVersion = '4.10.3' + gradleVersion = '6.1' } // Configuration properties. Set these via environment variables, build-extras.gradle, or gradle.properties. diff --git a/bin/templates/project/build.gradle b/bin/templates/project/build.gradle index 411e1a44..3c9aa712 100644 --- a/bin/templates/project/build.gradle +++ b/bin/templates/project/build.gradle @@ -28,7 +28,7 @@ buildscript { // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files - classpath 'com.android.tools.build:gradle:3.3.0' + classpath 'com.android.tools.build:gradle:3.5.3' } } diff --git a/package.json b/package.json index e43bff3d..e7058f9e 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,8 @@ "cover": "nyc jasmine --config=spec/coverage.json", "e2e-tests": "jasmine --config=spec/e2e/jasmine.json", "java-unit-tests": "node test/run_java_unit_tests.js", - "eslint": "eslint . \"bin/**/!(*.*|gitignore)\"" + "eslint": "eslint . \"bin/**/!(*.*|gitignore)\"", + "clean-tests": "node bin/clean_test.js" }, "author": "Apache Software Foundation", "license": "Apache-2.0", diff --git a/test/build.gradle b/test/build.gradle index c9bf1e7d..fbfcb272 100644 --- a/test/build.gradle +++ b/test/build.gradle @@ -28,7 +28,7 @@ buildscript { // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files - classpath 'com.android.tools.build:gradle:3.3.0' + classpath 'com.android.tools.build:gradle:3.5.3' } } diff --git a/test/wrapper.gradle b/test/wrapper.gradle index 5dd3dbca..3980234f 100644 --- a/test/wrapper.gradle +++ b/test/wrapper.gradle @@ -17,5 +17,5 @@ */ wrapper { - gradleVersion = '4.10.3' + gradleVersion = '6.1' }