Skip to content

Update build files to KTS and version catalogs (and latest AGP) #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 31, 2023
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
37 changes: 0 additions & 37 deletions app/build.gradle

This file was deleted.

33 changes: 33 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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"))
}
31 changes: 0 additions & 31 deletions build.gradle

This file was deleted.

8 changes: 8 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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
}
51 changes: 51 additions & 0 deletions checks/app
Original file line number Diff line number Diff line change
@@ -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)
}
26 changes: 0 additions & 26 deletions checks/build.gradle

This file was deleted.

24 changes: 24 additions & 0 deletions checks/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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)
}
37 changes: 37 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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" }

23 changes: 0 additions & 23 deletions library/build.gradle

This file was deleted.

26 changes: 26 additions & 0 deletions library/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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"))
}
1 change: 0 additions & 1 deletion settings.gradle

This file was deleted.

26 changes: 26 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -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")