Skip to content

Commit b95e75f

Browse files
committed
Update build files to KTS and version catalogs (and latest AGP)
1 parent 3c4e7af commit b95e75f

12 files changed

+205
-118
lines changed

Diff for: app/build.gradle

-37
This file was deleted.

Diff for: app/build.gradle.kts

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
plugins {
2+
alias(libs.plugins.android.application)
3+
alias(libs.plugins.kotlin.android)
4+
}
5+
6+
android {
7+
namespace = "com.android.example"
8+
compileSdk = 34
9+
10+
defaultConfig {
11+
applicationId = "com.android.example.lint_usage"
12+
minSdk = 21
13+
targetSdk = 34
14+
versionCode = 1
15+
versionName = "1.0"
16+
}
17+
18+
compileOptions {
19+
sourceCompatibility = JavaVersion.VERSION_17
20+
targetCompatibility = JavaVersion.VERSION_17
21+
}
22+
lint {
23+
checkDependencies = true
24+
// Produce report for CI:
25+
// https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/sarif-support-for-code-scanning
26+
sarifOutput = file("../lint-results.sarif")
27+
textReport = true
28+
}
29+
}
30+
31+
dependencies {
32+
implementation(project(":library"))
33+
}

Diff for: build.gradle

-31
This file was deleted.

Diff for: build.gradle.kts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
plugins {
3+
alias(libs.plugins.kotlin.jvm) apply false
4+
alias(libs.plugins.kotlin.android) apply false
5+
alias(libs.plugins.android.application) apply false
6+
alias(libs.plugins.android.library) apply false
7+
alias(libs.plugins.android.lint) apply false
8+
}

Diff for: checks/app

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
plugins {
2+
alias(libs.plugins.androidApplication)
3+
alias(libs.plugins.kotlinAndroid)
4+
}
5+
6+
android {
7+
namespace = "com.android.example.lint_usage"
8+
compileSdk = 34
9+
10+
defaultConfig {
11+
applicationId = "com.android.example.lint_usage"
12+
minSdk = 21
13+
targetSdk = 34
14+
versionCode = 1
15+
versionName = "1.0"
16+
}
17+
18+
compileOptions {
19+
sourceCompatibility = JavaVersion.VERSION_1_8
20+
targetCompatibility = JavaVersion.VERSION_1_8
21+
}
22+
kotlinOptions {
23+
jvmTarget = "1.8"
24+
}
25+
buildFeatures {
26+
compose = true
27+
}
28+
composeOptions {
29+
kotlinCompilerExtensionVersion = "1.5.1"
30+
}
31+
}
32+
33+
dependencies {
34+
35+
implementation(libs.core.ktx)
36+
implementation(libs.lifecycle.runtime.ktx)
37+
implementation(libs.activity.compose)
38+
implementation(platform(libs.compose.bom))
39+
implementation(libs.ui)
40+
implementation(libs.ui.graphics)
41+
implementation(libs.ui.tooling.preview)
42+
implementation(libs.material3)
43+
implementation(project(":library"))
44+
testImplementation(libs.junit)
45+
androidTestImplementation(libs.androidx.test.ext.junit)
46+
androidTestImplementation(libs.espresso.core)
47+
androidTestImplementation(platform(libs.compose.bom))
48+
androidTestImplementation(libs.ui.test.junit4)
49+
debugImplementation(libs.ui.tooling)
50+
debugImplementation(libs.ui.test.manifest)
51+
}

Diff for: checks/build.gradle

-26
This file was deleted.

Diff for: checks/build.gradle.kts

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
plugins {
2+
id("java-library")
3+
alias(libs.plugins.kotlin.jvm)
4+
alias(libs.plugins.android.lint)
5+
}
6+
7+
java {
8+
sourceCompatibility = JavaVersion.VERSION_17
9+
targetCompatibility = JavaVersion.VERSION_17
10+
}
11+
12+
lint {
13+
htmlReport = true
14+
htmlOutput = file("lint-report.html")
15+
textReport = true
16+
absolutePaths = false
17+
ignoreTestSources = true
18+
}
19+
20+
dependencies {
21+
// For a description of the below dependencies, see the main project README
22+
compileOnly(libs.bundles.lint.api)
23+
testImplementation(libs.bundles.lint.tests)
24+
}

Diff for: gradle/libs.versions.toml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[versions]
2+
agp = '8.1.2'
3+
lint = '31.1.2' # = agp + 23.0.0
4+
kotlin = '1.9.10'
5+
junit = '4.13.2'
6+
7+
8+
[libraries]
9+
# For a description of the below dependencies, see the main project README
10+
lint-api = { group = "com.android.tools.lint", name = "lint-api", version.ref = "lint" }
11+
lint-checks = { group = "com.android.tools.lint", name = "lint-checks", version.ref = "lint" }
12+
lint-cli = { group = "com.android.tools.lint", name = "lint", version.ref = "lint" }
13+
lint-tests = { group = "com.android.tools.lint", name = "lint-tests", version.ref = "lint" }
14+
junit = { group = "junit", name = "junit", version.ref = "junit" }
15+
kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" }
16+
17+
[bundles]
18+
lint-api = [
19+
"kotlin-stdlib",
20+
"lint-api",
21+
# You typically don't need this one, but it does have some utilities
22+
# like the API database that some lint checks may want to use
23+
#"lint-checks",
24+
]
25+
lint-tests = [
26+
"junit",
27+
"lint-cli",
28+
"lint-tests"
29+
]
30+
31+
[plugins]
32+
android-application = { id = "com.android.application", version.ref = "agp" }
33+
android-library = { id = "com.android.library", version.ref = "agp" }
34+
android-lint = { id = "com.android.lint", version.ref = "agp" }
35+
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
36+
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
37+

Diff for: library/build.gradle

-23
This file was deleted.

Diff for: library/build.gradle.kts

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
plugins {
2+
alias(libs.plugins.android.library)
3+
alias(libs.plugins.kotlin.android)
4+
}
5+
6+
android {
7+
namespace = "com.example.lint.library"
8+
compileSdk = 34
9+
10+
defaultConfig {
11+
minSdk = 19
12+
}
13+
14+
compileOptions {
15+
sourceCompatibility = JavaVersion.VERSION_17
16+
targetCompatibility = JavaVersion.VERSION_17
17+
}
18+
lint {
19+
checkDependencies = true
20+
}
21+
}
22+
23+
dependencies {
24+
implementation(project(":checks"))
25+
lintPublish(project(":checks"))
26+
}

Diff for: settings.gradle

-1
This file was deleted.

Diff for: settings.gradle.kts

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@file:Suppress("UnstableApiUsage")
2+
3+
pluginManagement {
4+
repositories {
5+
google {
6+
content {
7+
includeGroupByRegex("com\\.android.*")
8+
includeGroupByRegex("com\\.google.*")
9+
includeGroupByRegex("androidx.*")
10+
}
11+
}
12+
mavenCentral()
13+
gradlePluginPortal()
14+
}
15+
}
16+
dependencyResolutionManagement {
17+
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
18+
repositories {
19+
google()
20+
mavenCentral()
21+
}
22+
}
23+
24+
include(":app")
25+
include(":checks")
26+
include(":library")

0 commit comments

Comments
 (0)