Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[android] Add lint support #9318

Merged
merged 1 commit into from
Jul 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 32 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ jobs:
LIBSYSCONFCPUS: 4
JOBS: 4
BUILDTYPE: Debug
IS_LOCAL_DEVELOPMENT: false
steps:
- checkout
- *generate-cache-key
Expand All @@ -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: |
Expand Down Expand Up @@ -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:
Expand All @@ -223,6 +254,7 @@ jobs:
LIBSYSCONFCPUS: 4
JOBS: 4
BUILDTYPE: Release
IS_LOCAL_DEVELOPMENT: false
steps:
- checkout
- *generate-cache-key
Expand Down
2 changes: 2 additions & 0 deletions platform/android/MapboxGLAndroidSDK/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
lint-baseline.xml
lint/lint-baseline-local.xml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Guardiola31337 Why do we have different baselines for local dev and for CI? Shouldn't they both be the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zugaldia they should, but in practice baselines include absolute paths (pointing to the files containing an error) which are different in local and in CI, so we need to keep both 😞

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zugaldia at the moment, if you run this locally and remove any error, you'll get a warning from the command line advising you to remove it from the baseline. If you removed it you should remove it too from the CI baseline (which is the only one included in the repo). Eventually, it'll be removed (when we remove all current lint errors included).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Guardiola31337 Thanks for the explanation 👍 . Could we add a big note to the XML lint files saying that? Something like "remember to update file XXXX.XML as well if you make any changes to this file".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zugaldia I've added the following comment

<!-- REMEMBER! First you run Lint locally you'll need to move the lint-baseline.xml file
    generated into the lint folder and called it lint-baseline-local.xml
    If you remove any error when running Lint locally, you'll get a warning from the command
    line advising you to remove it from the baseline. If you remove it (remember to remove it
    from lint-baseline-local.xml file) you should remove it too from
    lint-baseline-ci.xml (THIS FILE) which is the only one included in the repo.
    Eventually, it'll be removed (when we remove all current lint errors included). -->

into the different lint-baseline-ci.xml files.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 changes: 2 additions & 0 deletions platform/android/MapboxGLAndroidSDK/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ android {
}

lintOptions {
baseline file("lint-baseline.xml")
checkAllWarnings true
warningsAsErrors true
}
Expand Down Expand Up @@ -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'
Loading