Skip to content

Commit

Permalink
Update dependencies (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
mars885 authored Aug 3, 2024
1 parent 33870ae commit 433c4c8
Show file tree
Hide file tree
Showing 135 changed files with 989 additions and 888 deletions.
12 changes: 11 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,14 @@ trim_trailing_whitespace = true
max_line_length = 120

[*.yml]
indent_size = 2
indent_size = 2

[*.{kt,kts}]
ktlint_standard_annotation = disabled
ktlint_standard_no-empty-first-line-in-class-body = disabled
ktlint_standard_blank-line-before-declaration = disabled
ktlint_standard_multiline-expression-wrapping = disabled
ktlint_standard_string-template-indent = disabled
ktlint_standard_spacing-between-declarations-with-annotations = disabled
ktlint_standard_function-signature = disabled
ktlint_standard_class-signature = disabled
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
java-version: '17'

- name: Generate a Cache Key
run: ./checksum.sh checksum.txt
Expand Down Expand Up @@ -52,11 +52,11 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
java-version: '17'

- name: Generate a Cache Key
run: ./checksum.sh checksum.txt
Expand Down Expand Up @@ -88,11 +88,11 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
java-version: '17'

- name: Generate a Cache Key
run: ./checksum.sh checksum.txt
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
java-version: '17'

- name: Generate a Cache Key
run: ./checksum.sh checksum.txt
Expand Down
43 changes: 22 additions & 21 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
* limitations under the License.
*/

import com.android.build.gradle.LibraryExtension
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jlleitschuh.gradle.ktlint.KtlintExtension
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType

Expand All @@ -35,9 +34,10 @@ buildscript {
}

dependencies {
classpath(deps.plugins.androidGradle)
classpath(deps.plugins.kotlinGradle)
classpath(deps.plugins.daggerHiltGradle)
classpath(deps.plugins.kotlin)
classpath(deps.plugins.android)
classpath(deps.plugins.ksp)
classpath(deps.plugins.daggerHilt)
classpath(deps.plugins.gradleVersions)
classpath(deps.plugins.dokka)
classpath(deps.plugins.shadow)
Expand All @@ -54,6 +54,14 @@ tasks.withType<Detekt>().configureEach {
reports.html.required.set(true)
}

tasks.withType<DependencyUpdatesTask> {
rejectVersionIf {
listOf("alpha", "beta", "rc").any { keyword ->
candidate.version.lowercase().contains(keyword)
}
}
}

allprojects {
apply(plugin = PLUGIN_KTLINT)

Expand All @@ -63,7 +71,7 @@ allprojects {
"sample-deps-javac",
"sample-deps-kapt",
"sample-deps-ksp",
"sample"
"sample",
)
}
.forEach { subproject ->
Expand All @@ -75,24 +83,11 @@ allprojects {
google()
}

tasks.withType(KotlinCompile::class.java) {
kotlinOptions {
jvmTarget = appConfig.kotlinCompatibilityVersion.toString()
}
}

plugins.withId(PLUGIN_ANDROID_LIBRARY) {
extensions.findByType<LibraryExtension>()?.run {
compileOptions {
sourceCompatibility = appConfig.javaCompatibilityVersion
targetCompatibility = appConfig.javaCompatibilityVersion
}
}
}

configure<KtlintExtension> {
version.set(versions.ktlint)
android.set(true)
outputToConsole.set(true)
verbose.set(true)

filter {
// https://github.com/JLLeitschuh/ktlint-gradle/issues/266#issuecomment-529527697
Expand All @@ -108,3 +103,9 @@ allprojects {
val clean by tasks.registering(Delete::class) {
delete(buildDir)
}

fun isUnstable(version: String): Boolean {
return listOf("alpha", "beta", "rc").any { keyword ->
version.lowercase().contains(keyword)
}
}
4 changes: 2 additions & 2 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ repositories {
}

dependencies {
implementation("com.android.tools.build:gradle:7.2.2")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0")
implementation("com.android.tools.build:gradle:8.1.0")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.25")
// See https://github.com/google/dagger/issues/3068#issuecomment-999118496
// for why it should be here.
implementation("com.squareup:javapoet:1.13.0")
Expand Down
60 changes: 31 additions & 29 deletions buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@ import org.gradle.api.JavaVersion

object appConfig {

const val compileSdkVersion = 32
const val targetSdkVersion = 32
const val compileSdkVersion = 34
const val targetSdkVersion = 34
const val minSdkVersion = 21
const val applicationId = "com.paulrybitskyi.hiltbinder.sample"
const val versionCode = 1
const val versionName = "1.0.0"

val javaCompatibilityVersion = JavaVersion.VERSION_1_8
val kotlinCompatibilityVersion = JavaVersion.VERSION_1_8
const val exportableLibJavaCompatVersion = 8

val androidModuleJavaCompatVersion = JavaVersion.VERSION_17
val androidModuleKotlinCompatVersion = JavaVersion.VERSION_17
}

object publishingConfig {
Expand Down Expand Up @@ -64,39 +66,40 @@ object publishingConfig {

object versions {

const val kotlin = "1.7.0" // also in buildSrc build.gradle.kts file
const val gradlePlugin = "7.2.2" // also in buildSrc build.gradle.kts file
const val detektPlugin = "1.20.0"
const val ktlintPlugin = "10.3.0"
const val gradleVersionsPlugin = "0.42.0"
const val dokkaPlugin = "1.7.0"
const val shadowPlugin = "7.1.2"
const val appCompat = "1.4.2"
const val navigation = "2.5.1"
const val fragmentKtx = "1.5.1"
const val kotlin = "1.9.25" // also in buildSrc build.gradle.kts file
const val gradlePlugin = "8.1.0" // also in buildSrc build.gradle.kts file
const val detektPlugin = "1.23.6"
const val ktlintPlugin = "12.1.1"
const val gradleVersionsPlugin = "0.51.0"
const val dokkaPlugin = "1.9.20"
const val shadowPlugin = "8.0.0"
const val ksp = "1.9.25-1.0.20"
const val dagger = "2.51.1"
const val appCompat = "1.7.0"
const val navigation = "2.7.7"
const val fragmentKtx = "1.8.2"
const val constraintLayout = "2.1.4"
const val dagger = "2.43.2"
const val materialComponents = "1.6.1"
const val apacheCommons = "3.12.0"
const val materialComponents = "1.12.0"
const val apacheCommons = "3.15.0"
const val javaPoet = "1.13.0" // also in buildSrc build.gradle.kts file
const val kotlinPoet = "1.12.0"
const val incap = "0.3"
const val autoService = "1.0"
const val ksp = "1.7.0-1.0.6"
const val kotlinPoet = "1.18.1"
const val incap = "1.0.0"
const val autoService = "1.1.1"
const val ktlint = "1.3.1"
const val jUnit = "4.13.2"
const val jUnitExt = "1.1.2"
const val truth = "1.1.3"
const val ktCompileTesting = "1.4.9"
const val testParamInjector = "1.0"
const val truth = "1.4.4"
const val ktCompileTesting = "1.6.0"
const val testParamInjector = "1.16"
}

object deps {

object plugins {

const val androidGradle = "com.android.tools.build:gradle:${versions.gradlePlugin}"
const val kotlinGradle = "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
const val daggerHiltGradle = "com.google.dagger:hilt-android-gradle-plugin:${versions.dagger}"
const val kotlin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
const val android = "com.android.tools.build:gradle:${versions.gradlePlugin}"
const val ksp = "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:${versions.ksp}"
const val daggerHilt = "com.google.dagger:hilt-android-gradle-plugin:${versions.dagger}"
const val gradleVersions = "com.github.ben-manes:gradle-versions-plugin:${versions.gradleVersionsPlugin}"
const val dokka = "org.jetbrains.dokka:dokka-gradle-plugin:${versions.dokkaPlugin}"
const val shadow = "gradle.plugin.com.github.johnrengelman:shadow:${versions.shadowPlugin}"
Expand Down Expand Up @@ -136,7 +139,6 @@ object deps {
const val kspCore = "com.google.devtools.ksp:symbol-processing:${versions.ksp}"
const val kspApi = "com.google.devtools.ksp:symbol-processing-api:${versions.ksp}"
const val jUnit = "junit:junit:${versions.jUnit}"
const val jUnitExt = "androidx.test.ext:junit:${versions.jUnitExt}"
const val truth = "com.google.truth:truth:${versions.truth}"
const val kspCompileTesting = "com.github.tschuchortdev:kotlin-compile-testing-ksp:${versions.ktCompileTesting}"
const val testParamInjector = "com.google.testparameterinjector:test-parameter-injector:${versions.testParamInjector}"
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/Plugins.kt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fun PluginDependenciesSpec.kotlinKapt(): PluginDependencySpec {
}

fun PluginDependenciesSpec.ksp(): PluginDependencySpec {
return (id(PLUGIN_KSP) version versions.ksp)
return id(PLUGIN_KSP)
}

fun PluginDependenciesSpec.daggerHiltAndroid(): PluginDependencySpec {
Expand Down
4 changes: 4 additions & 0 deletions common-utils/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@
plugins {
kotlin()
}

kotlin {
jvmToolchain(appConfig.exportableLibJavaCompatVersion)
}
4 changes: 4 additions & 0 deletions compiler-processing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ plugins {
kotlin()
}

kotlin {
jvmToolchain(appConfig.exportableLibJavaCompatVersion)
}

dependencies {
implementation(project(deps.local.commonUtils))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ package com.paulrybitskyi.hiltbinder.compiler.processing

enum class XBackend {
JAVAC,
KSP
KSP,
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface XFiler {
val name: String,
val extension: String,
val content: String,
val originatingElements: List<XOriginatingElement>
val originatingElements: List<XOriginatingElement>,
)

fun createSourceFile(file: File)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ internal object XElementFactory {
ElementKind.CLASS,
ElementKind.ENUM,
ElementKind.INTERFACE,
ElementKind.ANNOTATION_TYPE -> XTypeElementFactory.createJavacTypeElement(env, delegate.unsafeCast())
ElementKind.ANNOTATION_TYPE,
-> XTypeElementFactory.createJavacTypeElement(env, delegate.unsafeCast())
else -> error("A Javac element with the kind = ${delegate.kind} is not supported.")
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ object XProcessingEnvFactory {

fun createJavacEnv(
processingEnv: ProcessingEnvironment,
roundEnv: RoundEnvironment
roundEnv: RoundEnvironment,
): XProcessingEnv {
return JavacProcessingEnv(processingEnv, roundEnv)
}

fun createKspEnv(
processingEnv: SymbolProcessorEnvironment,
resolver: Resolver
resolver: Resolver,
): XProcessingEnv {
return KspProcessingEnv(processingEnv, resolver)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import javax.lang.model.element.AnnotationMirror

internal class JavacAnnotation(
private val env: JavacProcessingEnv,
private val delegate: AnnotationMirror
private val delegate: AnnotationMirror,
) : XAnnotation {

override val type: XType by lazy {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import javax.lang.model.type.TypeMirror

internal class JavacAnnotationValue(
private val env: JavacProcessingEnv,
private val value: Any?
private val value: Any?,
) : XAnnotationValue {

override fun getAsBoolean(default: Boolean): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import javax.lang.model.element.Parameterizable

internal abstract class JavacElement(
protected val env: JavacProcessingEnv,
open val delegate: Element
open val delegate: Element,
) : XElement {

override val packageName: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import javax.annotation.processing.Filer
import javax.lang.model.element.Element

internal class JavacFiler(
private val delegate: Filer
private val delegate: Filer,
) : XFiler {

override fun createSourceFile(file: XFiler.File) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import javax.lang.model.element.Element
import javax.tools.Diagnostic

internal class JavacLogger(
private val delegate: Messager
private val delegate: Messager,
) : XLogger {

override fun info(message: String, element: XElement?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ import com.paulrybitskyi.hiltbinder.compiler.processing.XOriginatingElement
import javax.lang.model.element.Element

internal class JavacOriginatingElement(
val element: Element
val element: Element,
) : XOriginatingElement
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import javax.lang.model.util.Types

internal class JavacProcessingEnv(
private val delegate: ProcessingEnvironment,
private val roundEnvironment: RoundEnvironment
private val roundEnvironment: RoundEnvironment,
) : XProcessingEnv {

val elementUtils: Elements = delegate.elementUtils
Expand Down
Loading

0 comments on commit 433c4c8

Please sign in to comment.