Skip to content

Commit

Permalink
Update lint issue registration mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
John Rodriguez committed Aug 8, 2021
1 parent f13fafd commit bab5800
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 24 deletions.
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ buildscript {
'compileSdk': 30,

'kotlin': '1.5.21',
'autoService': '1.0-rc7',

// Update WrongTimberUsageDetectorTest#innerStringFormatWithStaticImport when >= 7.1.0-alpha07
'androidPlugin': '7.0.0',
Expand All @@ -24,6 +25,10 @@ buildscript {
'checks': "com.android.tools.lint:lint-checks:${versions.androidTools}",
'tests': "com.android.tools.lint:lint-tests:${versions.androidTools}",
],
'auto': [
'service': "com.google.auto.service:auto-service:${versions.autoService}",
'serviceAnnotations': "com.google.auto.service:auto-service-annotations:${versions.autoService}",
],
annotations: 'org.jetbrains:annotations:20.1.0',

junit: 'junit:junit:4.13.2',
Expand Down
11 changes: 4 additions & 7 deletions timber-lint/build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
apply plugin: 'java-library'
apply plugin: 'kotlin'
apply plugin: 'org.jetbrains.kotlin.kapt'
apply plugin: 'com.android.lint'

targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8

dependencies {
compileOnly deps.lint.api
compileOnly deps.lint.checks

compileOnly deps.auto.serviceAnnotations
kapt deps.auto.service
testImplementation deps.junit
testImplementation deps.lint.core
testImplementation deps.lint.tests
testImplementation deps.junit
}

jar {
manifest {
attributes('Lint-Registry-v2': 'timber.lint.TimberIssueRegistry')
}
}
17 changes: 0 additions & 17 deletions timber-lint/src/main/java/timber/lint/TimberIssueRegistry.java

This file was deleted.

25 changes: 25 additions & 0 deletions timber-lint/src/main/java/timber/lint/TimberIssueRegistry.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package timber.lint

import com.android.tools.lint.client.api.IssueRegistry
import com.android.tools.lint.client.api.Vendor
import com.android.tools.lint.detector.api.CURRENT_API
import com.google.auto.service.AutoService

@AutoService(value = [IssueRegistry::class])
class TimberIssueRegistry : IssueRegistry() {
override val issues = WrongTimberUsageDetector.getIssues().asList()

override val api = CURRENT_API

/**
* works with Studio 4.0 or later; see
* [com.android.tools.lint.detector.api.describeApi]
*/
override val minApi = 7

override val vendor = Vendor(
vendorName = "JakeWharton/timber",
identifier = "com.jakewharton.timber:timber:{version}",
feedbackUrl = "https://github.com/JakeWharton/timber/issues",
)
}

0 comments on commit bab5800

Please sign in to comment.