mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-20 02:58:45 +00:00
- Resolves Java <-> Kotlin in VSCode
- Add build/classes/kotlin/{main,test} as SourceSet outputs (builtBy compileKotlin/compileTestKotlin)
- Improves VSCode Java (jdt.ls via Buildship) classpath so Java can resolve Kotlin symbols in same module
- Metadata-only; no change to packaging or runtime
Signed-off-by: Pekka Nikander <pekka.nikander@iki.fi>
Resolves #14355
82 lines
1.8 KiB
Kotlin
82 lines
1.8 KiB
Kotlin
/*
|
|
* Copyright 2023 Signal Messenger, LLC
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import org.gradle.api.tasks.SourceSetContainer
|
|
|
|
val signalJavaVersion: JavaVersion by rootProject.extra
|
|
val signalKotlinJvmTarget: String by rootProject.extra
|
|
|
|
plugins {
|
|
id("java-library")
|
|
id("org.jetbrains.kotlin.jvm")
|
|
id("ktlint")
|
|
id("com.squareup.wire")
|
|
}
|
|
|
|
java {
|
|
sourceCompatibility = signalJavaVersion
|
|
targetCompatibility = signalJavaVersion
|
|
}
|
|
|
|
kotlin {
|
|
jvmToolchain {
|
|
languageVersion = JavaLanguageVersion.of(signalKotlinJvmTarget)
|
|
}
|
|
}
|
|
|
|
afterEvaluate {
|
|
listOf(
|
|
"runKtlintCheckOverMainSourceSet",
|
|
"runKtlintFormatOverMainSourceSet"
|
|
).forEach { taskName ->
|
|
tasks.named(taskName) {
|
|
mustRunAfter(tasks.named("generateMainProtos"))
|
|
}
|
|
}
|
|
}
|
|
|
|
wire {
|
|
kotlin {
|
|
javaInterop = true
|
|
}
|
|
|
|
sourcePath {
|
|
srcDir("src/main/protowire")
|
|
}
|
|
}
|
|
|
|
tasks.runKtlintCheckOverMainSourceSet {
|
|
dependsOn(":core-util-jvm:generateMainProtos")
|
|
}
|
|
|
|
val sourceSets = extensions.getByName("sourceSets") as SourceSetContainer
|
|
sourceSets.named("main") {
|
|
output.dir(
|
|
mapOf("builtBy" to tasks.named("compileKotlin")),
|
|
"$buildDir/classes/kotlin/main"
|
|
)
|
|
}
|
|
sourceSets.named("test") {
|
|
output.dir(
|
|
mapOf("builtBy" to tasks.named("compileTestKotlin")),
|
|
"$buildDir/classes/kotlin/test"
|
|
)
|
|
}
|
|
|
|
dependencies {
|
|
implementation(libs.kotlin.reflect)
|
|
implementation(libs.kotlinx.coroutines.core)
|
|
implementation(libs.kotlinx.coroutines.core.jvm)
|
|
implementation(libs.google.libphonenumber)
|
|
implementation(libs.rxjava3.rxjava)
|
|
implementation(libs.rxjava3.rxkotlin)
|
|
implementation(libs.kotlinx.serialization.json)
|
|
implementation(libs.libsignal.client)
|
|
|
|
testImplementation(testLibs.junit.junit)
|
|
testImplementation(testLibs.assertk)
|
|
testImplementation(testLibs.kotlinx.coroutines.test)
|
|
}
|