Skip to content
Open
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
21 changes: 8 additions & 13 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

plugins {
id("com.android.application")
id("kotlin-android")
id("org.jetbrains.kotlin.plugin.compose")
}


Expand All @@ -11,7 +11,7 @@

defaultConfig {
applicationId = "se.warting.permissionsui"
minSdk = 21
minSdk = 23

Check warning

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning

This expression contains a magic number. Consider defining it to a well named constant.
targetSdk = 36
versionCode = 1
versionName = "1.0"
Expand All @@ -35,20 +35,15 @@
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
freeCompilerArgs = listOfNotNull(
"-opt-in=kotlin.RequiresOptIn",
"-Xallow-jvm-ir-dependencies",
"-Xskip-prerelease-check"
)
kotlin {
jvmToolchain(17)

Check warning

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning

This expression contains a magic number. Consider defining it to a well named constant.
compilerOptions {
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
}
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get()
}

lint {
baseline = file("lint-baseline.xml")
Expand Down Expand Up @@ -84,4 +79,4 @@
androidTestImplementation(libs.androidx.test.espresso.espresso.core)
androidTestImplementation(libs.androidx.compose.ui.ui.test.junit4)
debugImplementation(libs.androidx.compose.ui.ui.tooling)
}
}
2 changes: 1 addition & 1 deletion appjava/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

defaultConfig {
applicationId = "se.warting.permissionsuijava"
minSdk = 21
minSdk = 23

Check warning

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning

This expression contains a magic number. Consider defining it to a well named constant.
targetSdk = 36
versionCode = 1
versionName = "1.0"
Expand Down
50 changes: 18 additions & 32 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@


import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import java.util.Properties

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {

repositories {
google()
mavenCentral()
}
dependencies {
classpath(libs.com.android.tools.build.gradle)
classpath(libs.org.jetbrains.kotlin.kotlin.gradle.plugin)
classpath(libs.io.gitlab.arturbosch.detekt.detekt.gradle.plugin)

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

plugins {
id("com.android.application") version libs.versions.agp apply false
id("com.android.library") version libs.versions.agp apply false
id("org.jetbrains.kotlin.plugin.compose") version libs.versions.kotlin apply false
alias(libs.plugins.com.github.ben.manes.versions)
alias(libs.plugins.nl.littlerobots.version.catalog.update)
id("io.gitlab.arturbosch.detekt") version "1.23.8"
Expand All @@ -32,9 +21,15 @@ androidGitVersion {
tagPattern = "^v[0-9]+.*"
}

val localProperties = Properties().apply {
val localPropertiesFile = File(rootDir, "local.properties")
if (localPropertiesFile.exists()) {
localPropertiesFile.inputStream().use { load(it) }
}
}

val gitOrLocalVersion: String =
com.android.build.gradle.internal.cxx.configure.gradleLocalProperties(rootDir)
.getProperty("VERSION_NAME", androidGitVersion.name().replace("v", ""))
localProperties.getProperty("VERSION_NAME", androidGitVersion.name().replace("v", ""))

version = gitOrLocalVersion

Expand Down Expand Up @@ -63,16 +58,12 @@ allprojects {
detekt {
autoCorrect = true
buildUponDefaultConfig = true
config = files("$projectDir/config/detekt/detekt.yml")
config.setFrom(files("$projectDir/config/detekt/detekt.yml"))
baseline = file("$projectDir/config/detekt/baseline.xml")

reports {
html.enabled = true
}
}

fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
Expand All @@ -86,15 +77,10 @@ tasks.named("dependencyUpdates", DependencyUpdatesTask::class.java).configure {

versionCatalogUpdate {
sortByKey.set(true)
keep {
// keep all libraries that aren't used in the project
keepUnusedLibraries.set(true)
// keep all plugins that aren't used in the project
keepUnusedPlugins.set(true)
}
}
task<Delete>("clean") {
delete(rootProject.buildDir)

tasks.register<Delete>("clean") {
delete(layout.buildDirectory)
}

apply(from = "${rootDir}/gradle/publish-root.gradle")
apply(from = "${rootDir}/gradle/publish-root.gradle")
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
android.enableJetifier=false
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official

Expand Down
23 changes: 10 additions & 13 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[versions]
agp = "8.2.2"
agp = "9.1.0"
kotlin = "2.3.10"
androidx-activity = "1.8.2"
androidx-appcompat = "1.7.1"
# @keep this version, kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get()
androidx-compose-compiler = "1.5.8"
androidxComposeBom = "2023.10.01"
androidx-lifecycle = "2.7.0"
androidxComposeBom = "2026.02.01"
dev-marcelpinto = "0.9"
io-gitlab-arturbosch-detekt = "1.23.8"
ui-test-junit4 = "1.10.2"
ui-test-junit4 = "1.10.4"

[libraries]
androidx-activity = { module = "androidx.activity:activity", version.ref = "androidx-activity" }
Expand All @@ -26,22 +26,19 @@ androidx-compose-ui-ui-text = { module = "androidx.compose.ui:ui-text" }
androidx-compose-ui-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
androidx-compose-ui-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }
androidx-constraintlayout = "androidx.constraintlayout:constraintlayout:2.2.1"
androidx-core-core-ktx = "androidx.core:core-ktx:1.12.0"
androidx-core-core-ktx = "androidx.core:core-ktx:1.17.0"
androidx-lifecycle-lifecycle-extensions = "androidx.lifecycle:lifecycle-extensions:2.2.0"
androidx-lifecycle-lifecycle-runtime-ktx = "androidx.lifecycle:lifecycle-runtime-ktx:2.7.0"
androidx-lifecycle-lifecycle-viewmodel-compose = "androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0"
androidx-lifecycle-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androidx-lifecycle" }
androidx-lifecycle-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "androidx-lifecycle" }
androidx-startup-startup-runtime = "androidx.startup:startup-runtime:1.2.0"
androidx-test-espresso-espresso-core = "androidx.test.espresso:espresso-core:3.7.0"
androidx-test-ext-junit = "androidx.test.ext:junit:1.3.0"
com-android-tools-build-gradle = "com.android.tools.build:gradle:8.2.2"
com-google-android-material = "com.google.android.material:material:1.13.0"
dev-marcelpinto-permissions-compose-ktx = { module = "dev.marcelpinto:permissions-compose-ktx", version.ref = "dev-marcelpinto" }
io-gitlab-arturbosch-detekt-detekt-gradle-plugin = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "io-gitlab-arturbosch-detekt" }
junit = "junit:junit:4.13.2"
org-jetbrains-kotlin-kotlin-gradle-plugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22"
org-jetbrains-kotlinx-kotlinx-coroutines-android = "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0"

[plugins]
com-github-ben-manes-versions = "com.github.ben-manes.versions:0.51.0"

nl-littlerobots-version-catalog-update = "nl.littlerobots.version-catalog-update:0.8.4"
com-github-ben-manes-versions = "com.github.ben-manes.versions:0.53.0"
nl-littlerobots-version-catalog-update = "nl.littlerobots.version-catalog-update:1.1.0"
23 changes: 12 additions & 11 deletions gradle/publish-module.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'org.jetbrains.dokka'

task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
Expand All @@ -17,15 +16,8 @@ task androidSourcesJar(type: Jar) {
}
}

tasks.withType(dokkaHtmlPartial.getClass()).configureEach {
pluginsMapConfiguration.set(
["org.jetbrains.dokka.base.DokkaBase": """{ "separateInheritedMembers": true}"""]
)
}

task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
task javadocJar(type: Jar) {
archiveClassifier.set('javadoc')
from dokkaJavadoc.outputDirectory
}

artifacts {
Expand All @@ -36,6 +28,16 @@ artifacts {
group = PUBLISH_GROUP_ID
version = PUBLISH_VERSION

if (project.plugins.findPlugin("com.android.library")) {
android {
publishing {
singleVariant("release") {
withSourcesJar()
}
}
}
}

afterEvaluate {
publishing {
publications {
Expand All @@ -50,8 +52,7 @@ afterEvaluate {
from components.java
}

artifact androidSourcesJar
//artifact javadocJar
artifact javadocJar

pom {
name = PUBLISH_ARTIFACT_ID
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
23 changes: 7 additions & 16 deletions permissionsui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

plugins {
id("com.android.library")
id("kotlin-android")
id("org.jetbrains.kotlin.plugin.compose")
id("maven-publish")
id("signing")
id("org.jetbrains.dokka") version "2.1.0"
Expand All @@ -15,13 +15,11 @@

apply(from = "${rootProject.projectDir}/gradle/publish-module.gradle")

val composeVersion = "1.2.0-beta02"

android {
compileSdk = 36

defaultConfig {
minSdk = 21
minSdk = 23

Check warning

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning

This expression contains a magic number. Consider defining it to a well named constant.
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

Expand All @@ -39,17 +37,11 @@
compose = true
}

composeOptions {
kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get()
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
freeCompilerArgs = listOfNotNull(
"-Xopt-in=kotlin.RequiresOptIn",
"-Xallow-jvm-ir-dependencies",
"-Xskip-prerelease-check"
)
kotlin {
jvmToolchain(17)

Check warning

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning

This expression contains a magic number. Consider defining it to a well named constant.
compilerOptions {
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
}
}

lint {
Expand Down Expand Up @@ -103,4 +95,3 @@
androidTestImplementation(libs.androidx.test.espresso.espresso.core)
}


31 changes: 7 additions & 24 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,34 +1,17 @@
// https://github.com/otormaigh/playground-android/issues/27
//dependencyResolutionManagement {
// repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
// repositories {
// google()
// mavenCentral()
// }
//}

plugins {
id("com.gradle.enterprise") version "3.19.2"
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

buildCache {
local {
isEnabled = true
directory = File(rootDir, "build-cache")
removeUnusedEntriesAfterDays = 30
}
remote<HttpBuildCache> {
isEnabled = false
}
}

dependencyResolutionManagement {
versionCatalogs {
create("libs") {
// from(files("../gradle/libs.versions.toml"))
}
}
}

rootProject.name = "Background Location Permission Rationale"
include(":app",":appjava", ":permissionsui")
include(":app", ":appjava", ":permissionsui")
Loading