mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-20 02:58:45 +00:00
Publish Kotlin class outputs as SourceSet outputs for jdt.ls
- 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
This commit is contained in:
committed by
jeffrey-signal
parent
2a21fe1784
commit
448dda37bf
@@ -3,6 +3,8 @@
|
|||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.gradle.api.tasks.SourceSetContainer
|
||||||
|
|
||||||
val signalJavaVersion: JavaVersion by rootProject.extra
|
val signalJavaVersion: JavaVersion by rootProject.extra
|
||||||
val signalKotlinJvmTarget: String by rootProject.extra
|
val signalKotlinJvmTarget: String by rootProject.extra
|
||||||
|
|
||||||
@@ -49,6 +51,20 @@ tasks.runKtlintCheckOverMainSourceSet {
|
|||||||
dependsOn(":core-util-jvm:generateMainProtos")
|
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 {
|
dependencies {
|
||||||
implementation(libs.kotlin.reflect)
|
implementation(libs.kotlin.reflect)
|
||||||
implementation(libs.kotlinx.coroutines.core)
|
implementation(libs.kotlinx.coroutines.core)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.gradle.api.tasks.SourceSetContainer
|
||||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
@@ -41,6 +42,20 @@ tasks.withType<KotlinCompile>().configureEach {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
listOf(
|
listOf(
|
||||||
"runKtlintCheckOverMainSourceSet",
|
"runKtlintCheckOverMainSourceSet",
|
||||||
|
|||||||
Reference in New Issue
Block a user