From 64ef2d0b57a1e04341774c06de996dc48782a1c9 Mon Sep 17 00:00:00 2001 From: Guardiola31337 Date: Wed, 21 Jun 2017 09:49:02 +0200 Subject: [android] add lint using current baseline as starting point --- Makefile | 12 + circle.yml | 32 + platform/android/MapboxGLAndroidSDK/.gitignore | 2 + platform/android/MapboxGLAndroidSDK/build.gradle | 2 + .../MapboxGLAndroidSDK/lint/lint-baseline-ci.xml | 629 +++++ .../android/MapboxGLAndroidSDKTestApp/.gitignore | 2 + .../android/MapboxGLAndroidSDKTestApp/build.gradle | 2 + .../lint/lint-baseline-ci.xml | 2569 ++++++++++++++++++++ .../MapboxGLAndroidSDKWearTestApp/.gitignore | 2 + .../MapboxGLAndroidSDKWearTestApp/build.gradle | 2 + .../gradle-config.gradle | 2 +- .../lint/lint-baseline-ci.xml | 823 +++++++ platform/android/gradle-lint.gradle | 30 + 13 files changed, 4108 insertions(+), 1 deletion(-) create mode 100644 platform/android/MapboxGLAndroidSDK/.gitignore create mode 100644 platform/android/MapboxGLAndroidSDK/lint/lint-baseline-ci.xml create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/.gitignore create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/lint/lint-baseline-ci.xml create mode 100644 platform/android/MapboxGLAndroidSDKWearTestApp/.gitignore create mode 100644 platform/android/MapboxGLAndroidSDKWearTestApp/lint/lint-baseline-ci.xml create mode 100644 platform/android/gradle-lint.gradle diff --git a/Makefile b/Makefile index dfa5c8b640..4a52f47c25 100644 --- a/Makefile +++ b/Makefile @@ -616,6 +616,18 @@ test-code-android: android-checkstyle: platform/android/configuration.gradle cd platform/android && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=none checkstyle +.PHONY: android-lint-sdk +android-lint-sdk: platform/android/configuration.gradle + cd platform/android && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=none :MapboxGLAndroidSDK:lint + +.PHONY: android-lint-test-app +android-lint-test-app: platform/android/configuration.gradle + cd platform/android && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=none :MapboxGLAndroidSDKTestApp:lint + +.PHONY: android-lint-wear-app +android-lint-wear-app: platform/android/configuration.gradle + cd platform/android && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=none :MapboxGLAndroidSDKWearTestApp:lint + .PHONY: android-javadoc android-javadoc: platform/android/configuration.gradle cd platform/android && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=none :MapboxGLAndroidSDK:javadocrelease diff --git a/circle.yml b/circle.yml index 218e5822e3..506fbddb33 100644 --- a/circle.yml +++ b/circle.yml @@ -152,6 +152,7 @@ jobs: LIBSYSCONFCPUS: 4 JOBS: 4 BUILDTYPE: Debug + IS_LOCAL_DEVELOPMENT: false steps: - checkout - *generate-cache-key @@ -175,6 +176,18 @@ jobs: - run: name: Check Java code style command: make android-checkstyle + - run: + name: Check Android modules for potential bugs (Lint SDK) + command: | + make android-lint-sdk + - run: + name: Check Android modules for potential bugs (Lint Test App) + command: | + make android-lint-test-app + - run: + name: Check Android modules for potential bugs (Lint Wear Test App) + command: | + make android-lint-wear-app - run: name: Build Test APK command: | @@ -213,6 +226,24 @@ jobs: - store_artifacts: path: platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk destination: . + - store_artifacts: + path: platform/android/MapboxGLAndroidSDK/build/reports/lint-results.html + - store_artifacts: + path: platform/android/MapboxGLAndroidSDK/build/reports/lint-results.xml + - store_artifacts: + path: platform/android/MapboxGLAndroidSDK/lint-baseline.xml + - store_artifacts: + path: platform/android/MapboxGLAndroidSDKTestApp/build/reports/lint-results.html + - store_artifacts: + path: platform/android/MapboxGLAndroidSDKTestApp/build/reports/lint-results.xml + - store_artifacts: + path: platform/android/MapboxGLAndroidSDKTestApp/lint-baseline.xml + - store_artifacts: + path: platform/android/MapboxGLAndroidSDKWearTestApp/build/reports/lint-results.html + - store_artifacts: + path: platform/android/MapboxGLAndroidSDKWearTestApp/build/reports/lint-results.xml + - store_artifacts: + path: platform/android/MapboxGLAndroidSDKWearTestApp/lint-baseline.xml # ------------------------------------------------------------------------------ android-release-all: @@ -223,6 +254,7 @@ jobs: LIBSYSCONFCPUS: 4 JOBS: 4 BUILDTYPE: Release + IS_LOCAL_DEVELOPMENT: false steps: - checkout - *generate-cache-key diff --git a/platform/android/MapboxGLAndroidSDK/.gitignore b/platform/android/MapboxGLAndroidSDK/.gitignore new file mode 100644 index 0000000000..cec211fe81 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/.gitignore @@ -0,0 +1,2 @@ +lint-baseline.xml +lint/lint-baseline-local.xml \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDK/build.gradle b/platform/android/MapboxGLAndroidSDK/build.gradle index 8b92fa1af2..0cb6e529f1 100644 --- a/platform/android/MapboxGLAndroidSDK/build.gradle +++ b/platform/android/MapboxGLAndroidSDK/build.gradle @@ -116,6 +116,7 @@ android { } lintOptions { + baseline file("lint-baseline.xml") checkAllWarnings true warningsAsErrors true } @@ -152,3 +153,4 @@ apply from: 'gradle-javadoc.gradle' apply from: 'gradle-publish.gradle' apply from: 'gradle-checkstyle.gradle' apply from: 'gradle-tests-staticblockremover.gradle' +apply from: '../gradle-lint.gradle' diff --git a/platform/android/MapboxGLAndroidSDK/lint/lint-baseline-ci.xml b/platform/android/MapboxGLAndroidSDK/lint/lint-baseline-ci.xml new file mode 100644 index 0000000000..4dc8ecde70 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/lint/lint-baseline-ci.xml @@ -0,0 +1,629 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/platform/android/MapboxGLAndroidSDKTestApp/.gitignore b/platform/android/MapboxGLAndroidSDKTestApp/.gitignore new file mode 100644 index 0000000000..cec211fe81 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/.gitignore @@ -0,0 +1,2 @@ +lint-baseline.xml +lint/lint-baseline-local.xml \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle index 656789fcdb..b13362751a 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle +++ b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle @@ -25,6 +25,7 @@ android { } lintOptions { + baseline file("lint-baseline.xml") checkAllWarnings true warningsAsErrors true disable 'MissingTranslation' @@ -84,5 +85,6 @@ apply from: 'gradle-config.gradle' apply from: 'gradle-device-farm.gradle' apply from: 'gradle-spoon.gradle' apply from: 'gradle-checkstyle.gradle' +apply from: '../gradle-lint.gradle' diff --git a/platform/android/MapboxGLAndroidSDKTestApp/lint/lint-baseline-ci.xml b/platform/android/MapboxGLAndroidSDKTestApp/lint/lint-baseline-ci.xml new file mode 100644 index 0000000000..89eab70c48 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/lint/lint-baseline-ci.xml @@ -0,0 +1,2569 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/platform/android/MapboxGLAndroidSDKWearTestApp/.gitignore b/platform/android/MapboxGLAndroidSDKWearTestApp/.gitignore new file mode 100644 index 0000000000..cec211fe81 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKWearTestApp/.gitignore @@ -0,0 +1,2 @@ +lint-baseline.xml +lint/lint-baseline-local.xml \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKWearTestApp/build.gradle b/platform/android/MapboxGLAndroidSDKWearTestApp/build.gradle index 6ac8961421..7c3ffd8ce5 100644 --- a/platform/android/MapboxGLAndroidSDKWearTestApp/build.gradle +++ b/platform/android/MapboxGLAndroidSDKWearTestApp/build.gradle @@ -13,6 +13,7 @@ android { } lintOptions { + baseline file("lint-baseline.xml") disable 'MissingTranslation' } @@ -48,3 +49,4 @@ dependencies { apply from: 'gradle-config.gradle' apply from: 'gradle-checkstyle.gradle' +apply from: '../gradle-lint.gradle' diff --git a/platform/android/MapboxGLAndroidSDKWearTestApp/gradle-config.gradle b/platform/android/MapboxGLAndroidSDKWearTestApp/gradle-config.gradle index 27c13b935b..1068e5e69e 100644 --- a/platform/android/MapboxGLAndroidSDKWearTestApp/gradle-config.gradle +++ b/platform/android/MapboxGLAndroidSDKWearTestApp/gradle-config.gradle @@ -3,7 +3,7 @@ // task accessToken { - def tokenFile = new File("MapboxGLAndroidSDKWearTestApp/src/main/res/values/developer-config.xml") + def tokenFile = new File("${projectDir}/src/main/res/values/developer-config.xml") if (!tokenFile.exists()) { String tokenFileContents = "\n" + "\n" + diff --git a/platform/android/MapboxGLAndroidSDKWearTestApp/lint/lint-baseline-ci.xml b/platform/android/MapboxGLAndroidSDKWearTestApp/lint/lint-baseline-ci.xml new file mode 100644 index 0000000000..de038e3bcc --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKWearTestApp/lint/lint-baseline-ci.xml @@ -0,0 +1,823 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/platform/android/gradle-lint.gradle b/platform/android/gradle-lint.gradle new file mode 100644 index 0000000000..cbebeaa74a --- /dev/null +++ b/platform/android/gradle-lint.gradle @@ -0,0 +1,30 @@ +task ciLint(type: Copy) { + if (isLocalBuild()) { + from "${projectDir}/lint/lint-baseline-local.xml" + into "${projectDir}" + rename { String fileName -> + fileName.replace("lint-baseline-local.xml", "lint-baseline.xml") + } + } else { + from "${projectDir}/lint/lint-baseline-ci.xml" + into "${projectDir}" + rename { String fileName -> + fileName.replace("lint-baseline-ci.xml", "lint-baseline.xml") + } + } +} + +def isLocalBuild() { + if (System.getenv('IS_LOCAL_DEVELOPMENT') != null) { + return System.getenv('IS_LOCAL_DEVELOPMENT').toBoolean() + } + return true +} + +lint.dependsOn ciLint + +tasks.whenTaskAdded { task -> + if (task.name == 'lintVitalRelease') { + task.dependsOn ciLint + } +} \ No newline at end of file -- cgit v1.2.1