Skip to content

Commit

Permalink
chore: migrate to Kotlin DSL and upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeyls committed Nov 16, 2023
1 parent 4d6914e commit a91fd39
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 154 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# generated files
build/
output.json
output-metadata.json

# Local configuration file (sdk path, etc)
local.properties
Expand Down
118 changes: 0 additions & 118 deletions app/build.gradle

This file was deleted.

120 changes: 120 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("org.jetbrains.kotlin.plugin.parcelize")
id("com.google.devtools.ksp")
id("com.google.dagger.hilt.android")
}

android {
namespace = "be.digitalia.fosdem"
compileSdk = 34

defaultConfig {
applicationId = "be.digitalia.fosdem"
minSdk = 21
targetSdk = 33
multiDexEnabled = true
versionCode = 1900213
versionName = "2.1.3"
// Supported languages
resourceConfigurations += listOf("en")
vectorDrawables {
useSupportLibrary = true
}
}

sourceSets {
named("main") {
resources.srcDir("src/main/res-override")
}
}

buildTypes {
release {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles("proguard-defaults.txt", "proguard-rules.pro")

kotlinOptions {
freeCompilerArgs = listOf(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}

packaging {
resources {
excludes += listOf(
"DebugProbesKt.bin",
"kotlin-tooling-metadata.json",
"kotlin/**",
"META-INF/*.kotlin_module",
"META-INF/*.version"
)
}
}
}
}

compileOptions {
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = "1.8"
}
}

fun patchDesugarConfig(config: Property<String>) {
val defaultConfig = config as org.gradle.api.internal.provider.DefaultProperty<String>
val patchedDesugarConfig = defaultConfig.provider.map {
it.replace(
"\"support_all_callbacks_from_library\":true",
"\"support_all_callbacks_from_library\":false"
)
}
config.set(patchedDesugarConfig)
}

afterEvaluate {
tasks.withType(com.android.build.gradle.internal.tasks.R8Task::class).configureEach {
patchDesugarConfig(coreLibDesugarConfig)
}
tasks.withType(com.android.build.gradle.internal.tasks.L8DexDesugarLibTask::class).configureEach {
patchDesugarConfig(libConfiguration)
}
}

dependencies {
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")

implementation(libs.hilt.android)
ksp(libs.hilt.compiler)
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.activity:activity-ktx:1.8.1")
implementation("androidx.fragment:fragment-ktx:1.6.2")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.10.0")
implementation("androidx.coordinatorlayout:coordinatorlayout:1.2.0")
implementation("androidx.recyclerview:recyclerview:1.3.2")
implementation("androidx.viewpager2:viewpager2:1.1.0-beta02")
implementation("androidx.drawerlayout:drawerlayout:1.2.0")
implementation("androidx.preference:preference-ktx:1.2.1")
implementation("androidx.browser:browser:1.7.0")
implementation(libs.lifecycle.runtime)
implementation(libs.lifecycle.viewmodel)
implementation("androidx.paging:paging-runtime-ktx:3.2.1")
implementation(libs.room.runtime)
implementation(libs.room.paging)
implementation("androidx.datastore:datastore-preferences:1.0.0")
ksp(libs.room.compiler)
implementation("com.squareup.okhttp3:okhttp:4.12.0")
implementation("com.squareup.okio:okio:3.6.0")
implementation("com.squareup.moshi:moshi:1.15.0")
implementation("com.github.chrisbanes:PhotoView:2.3.0")
}
13 changes: 0 additions & 13 deletions build.gradle

This file was deleted.

7 changes: 7 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.1.3" apply false
id("org.jetbrains.kotlin.android") version "1.9.10" apply false
id("com.google.devtools.ksp") version "1.9.10-1.0.13" apply false
id("com.google.dagger.hilt.android") apply false
}
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ android.defaults.buildfeatures.buildconfig=true
android.experimental.enableNewResourceShrinker.preciseShrinking=true
org.gradle.jvmargs=-Xmx2048m

hiltVersion=2.48.1

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
Expand Down
22 changes: 0 additions & 22 deletions settings.gradle

This file was deleted.

43 changes: 43 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
val hiltVersion: String by settings
plugins {
id("com.google.dagger.hilt.android") version hiltVersion
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven {
url = uri("https://jitpack.io")
content {
includeGroup("com.github.chrisbanes")
}
}
google()
mavenCentral()
}

versionCatalogs {
val hiltVersion: String by settings
create("libs") {
version("hilt", hiltVersion)
version("room", "2.6.0")
version("lifecycle", "2.6.2")
library("hilt-android", "com.google.dagger", "hilt-android").versionRef("hilt")
library("hilt-compiler", "com.google.dagger", "hilt-compiler").versionRef("hilt")
library("room-runtime", "androidx.room", "room-ktx").versionRef("room")
library("room-paging", "androidx.room", "room-paging").versionRef("room")
library("room-compiler", "androidx.room", "room-compiler").versionRef("room")
library("lifecycle-runtime", "androidx.lifecycle", "lifecycle-runtime-ktx").versionRef("lifecycle")
library("lifecycle-viewmodel", "androidx.lifecycle", "lifecycle-viewmodel-ktx").versionRef("lifecycle")
}
}
}

rootProject.name = "FOSDEM Companion"
include(":app")

0 comments on commit a91fd39

Please sign in to comment.