diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index 7f031ff9..00000000 --- a/app/build.gradle +++ /dev/null @@ -1,37 +0,0 @@ -plugins { - id 'com.android.application' - id 'kotlin-android' -} - -android { - compileSdkVersion 33 - - defaultConfig { - applicationId "com.android.example.lint_usage" - minSdkVersion 21 - targetSdkVersion 33 - versionCode 1 - versionName "1.0" - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - } - kotlinOptions { - jvmTarget = '17' - } - namespace 'com.android.example' - lint { - checkDependencies true - // Produce report for CI: - // https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/sarif-support-for-code-scanning - sarifOutput file('../lint-results.sarif') - textReport true - } -} - -dependencies { - implementation project(':library') -} - diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 00000000..b397c317 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,33 @@ +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) +} + +android { + namespace = "com.android.example" + compileSdk = 34 + + defaultConfig { + applicationId = "com.android.example.lint_usage" + minSdk = 21 + targetSdk = 34 + versionCode = 1 + versionName = "1.0" + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + lint { + checkDependencies = true + // Produce report for CI: + // https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/sarif-support-for-code-scanning + sarifOutput = file("../lint-results.sarif") + textReport = true + } +} + +dependencies { + implementation(project(":library")) +} \ No newline at end of file diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 8d9778fd..00000000 --- a/build.gradle +++ /dev/null @@ -1,31 +0,0 @@ -buildscript { - ext { - kotlinVersion = '1.8.20' - // Current release: Flamingo / AGP 8.0 - gradlePluginVersion = '8.0.2' - lintVersion = '31.0.2' - // Current preview release: Hedgehog - //gradlePluginVersion = '8.2.0-alpha07' - //lintVersion = '31.2.0-alpha07' - } - - repositories { - google() - mavenCentral() - } - dependencies { - classpath "com.android.tools.build:gradle:$gradlePluginVersion" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" - } -} - -allprojects { - repositories { - google() - mavenCentral() - } -} - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..7511b799 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,8 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + alias(libs.plugins.kotlin.jvm) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.android.lint) apply false +} diff --git a/checks/app b/checks/app new file mode 100644 index 00000000..123a6651 --- /dev/null +++ b/checks/app @@ -0,0 +1,51 @@ +plugins { + alias(libs.plugins.androidApplication) + alias(libs.plugins.kotlinAndroid) +} + +android { + namespace = "com.android.example.lint_usage" + compileSdk = 34 + + defaultConfig { + applicationId = "com.android.example.lint_usage" + minSdk = 21 + targetSdk = 34 + versionCode = 1 + versionName = "1.0" + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + } + buildFeatures { + compose = true + } + composeOptions { + kotlinCompilerExtensionVersion = "1.5.1" + } +} + +dependencies { + + implementation(libs.core.ktx) + implementation(libs.lifecycle.runtime.ktx) + implementation(libs.activity.compose) + implementation(platform(libs.compose.bom)) + implementation(libs.ui) + implementation(libs.ui.graphics) + implementation(libs.ui.tooling.preview) + implementation(libs.material3) + implementation(project(":library")) + testImplementation(libs.junit) + androidTestImplementation(libs.androidx.test.ext.junit) + androidTestImplementation(libs.espresso.core) + androidTestImplementation(platform(libs.compose.bom)) + androidTestImplementation(libs.ui.test.junit4) + debugImplementation(libs.ui.tooling) + debugImplementation(libs.ui.test.manifest) +} \ No newline at end of file diff --git a/checks/build.gradle b/checks/build.gradle deleted file mode 100644 index b2976f1b..00000000 --- a/checks/build.gradle +++ /dev/null @@ -1,26 +0,0 @@ -apply plugin: 'java-library' -apply plugin: 'kotlin' -apply plugin: 'com.android.lint' - -lintOptions { - htmlReport true - htmlOutput file("lint-report.html") - textReport true - absolutePaths false - ignoreTestSources true -} - -dependencies { - // For a description of the below dependencies, see the main project README - compileOnly "com.android.tools.lint:lint-api:$lintVersion" - // You typically don't need this one: - compileOnly "com.android.tools.lint:lint-checks:$lintVersion" - compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion" - - testImplementation "junit:junit:4.13.2" - testImplementation "com.android.tools.lint:lint:$lintVersion" - testImplementation "com.android.tools.lint:lint-tests:$lintVersion" -} - -sourceCompatibility = "17" -targetCompatibility = "17" diff --git a/checks/build.gradle.kts b/checks/build.gradle.kts new file mode 100644 index 00000000..2f515374 --- /dev/null +++ b/checks/build.gradle.kts @@ -0,0 +1,24 @@ +plugins { + id("java-library") + alias(libs.plugins.kotlin.jvm) + alias(libs.plugins.android.lint) +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +lint { + htmlReport = true + htmlOutput = file("lint-report.html") + textReport = true + absolutePaths = false + ignoreTestSources = true +} + +dependencies { + // For a description of the below dependencies, see the main project README + compileOnly(libs.bundles.lint.api) + testImplementation(libs.bundles.lint.tests) +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..3b94864e --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,37 @@ +[versions] +agp = '8.1.2' +lint = '31.1.2' # = agp + 23.0.0 +kotlin = '1.9.10' +junit = '4.13.2' + + +[libraries] +# For a description of the below dependencies, see the main project README +lint-api = { group = "com.android.tools.lint", name = "lint-api", version.ref = "lint" } +lint-checks = { group = "com.android.tools.lint", name = "lint-checks", version.ref = "lint" } +lint-cli = { group = "com.android.tools.lint", name = "lint", version.ref = "lint" } +lint-tests = { group = "com.android.tools.lint", name = "lint-tests", version.ref = "lint" } +junit = { group = "junit", name = "junit", version.ref = "junit" } +kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" } + +[bundles] +lint-api = [ + "kotlin-stdlib", + "lint-api", + # You typically don't need this one, but it does have some utilities + # like the API database that some lint checks may want to use + #"lint-checks", +] +lint-tests = [ + "junit", + "lint-cli", + "lint-tests" +] + +[plugins] +android-application = { id = "com.android.application", version.ref = "agp" } +android-library = { id = "com.android.library", version.ref = "agp" } +android-lint = { id = "com.android.lint", version.ref = "agp" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } + diff --git a/library/build.gradle b/library/build.gradle deleted file mode 100644 index 73beb630..00000000 --- a/library/build.gradle +++ /dev/null @@ -1,23 +0,0 @@ -apply plugin: 'com.android.library' - -android { - compileSdkVersion 33 - defaultConfig { - minSdkVersion 19 - targetSdkVersion 33 - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - } - namespace 'com.example.lint.library' - lint { - checkDependencies true - } -} - -/** Package the given lint checks library into this AAR */ -dependencies { - implementation project(':checks') - lintPublish project(':checks') -} diff --git a/library/build.gradle.kts b/library/build.gradle.kts new file mode 100644 index 00000000..7c5071d9 --- /dev/null +++ b/library/build.gradle.kts @@ -0,0 +1,26 @@ +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) +} + +android { + namespace = "com.example.lint.library" + compileSdk = 34 + + defaultConfig { + minSdk = 19 + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + lint { + checkDependencies = true + } +} + +dependencies { + implementation(project(":checks")) + lintPublish(project(":checks")) +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 802b0e45..00000000 --- a/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':checks', ':library', ':app' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..84a573c8 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,26 @@ +@file:Suppress("UnstableApiUsage") + +pluginManagement { + repositories { + google { + content { + includeGroupByRegex("com\\.android.*") + includeGroupByRegex("com\\.google.*") + includeGroupByRegex("androidx.*") + } + } + mavenCentral() + gradlePluginPortal() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} + +include(":app") +include(":checks") +include(":library")