uber / okbuck

OkBuck is a gradle plugin that lets developers utilize the Buck build system on a gradle project.
Other
1.54k stars 168 forks source link

OkBuck throws exception with Kotlin 1.3.20 #801

Closed ZacSweers closed 5 years ago

ZacSweers commented 5 years ago
Caused by: java.lang.IllegalStateException: No valid configuration found for 'kapt' in project 'project ':tooling:intellij:intellij-patcher''
        at com.uber.okbuck.core.annotation.AnnotationProcessorCache.getConfiguration(AnnotationProcessorCache.java:183)
        at com.uber.okbuck.core.annotation.AnnotationProcessorCache.hasEmptyAnnotationProcessors(AnnotationProcessorCache.java:117)
        at com.uber.okbuck.core.model.jvm.JvmTarget.getAptScopeForConfiguration(JvmTarget.java:129)
        at com.uber.okbuck.core.model.jvm.JvmTarget.getApt(JvmTarget.java:117)
        at com.uber.okbuck.composer.jvm.JvmLibraryRuleComposer.compose(JvmLibraryRuleComposer.java:29)
        at com.uber.okbuck.generator.BuckFileGenerator.createRules(BuckFileGenerator.java:122)
        at com.uber.okbuck.generator.BuckFileGenerator.lambda$createRules$1(BuckFileGenerator.java:81)
        at com.google.common.collect.SingletonImmutableBiMap.forEach(SingletonImmutableBiMap.java:65)
        at com.uber.okbuck.generator.BuckFileGenerator.createRules(BuckFileGenerator.java:73)
        at com.uber.okbuck.generator.BuckFileGenerator.generate(BuckFileGenerator.java:50)
        at com.uber.okbuck.OkBuckGradlePlugin.lambda$apply$7(OkBuckGradlePlugin.java:310)

The said project doesn't use kapt or annotationProcessor

apply plugin: "java-library"
apply plugin: "org.jetbrains.kotlin.jvm"
apply plugin: "application"

dependencies {
    implementation deps.build.commonsCodec
    implementation deps.build.commonsIo
    implementation deps.build.javassist
    implementation deps.build.ztZip
    implementation deps.kotlin.stdLib
    implementation deps.kotlin.stdLibJdk8

    testImplementation project(":libraries:foundation:test:test-core")
}

mainClassName = "com.ubercab.intellijpatcher.IntellijPatcher"

run {
    args System.getProperty("exec.args", "").split(",")
}
artem-zinnatullin commented 5 years ago

mainClassName = "com.ubercab.intellijpatcher.IntellijPatcher"

lmao

we have this

mainClassName = 'com.lyft.buck.imlfixer.MainKt'

kageiit commented 5 years ago

Im trying to switch us over to download kotlin compiler from github and hit an interesting issue - https://youtrack.jetbrains.com/issue/KT-29837

Suggestions welcome at this point, but im not willing to accept setting up a separate artifact mirror for the compiler zips ourselves

ZacSweers commented 5 years ago

What does the gradle plugin do?

ZacSweers commented 5 years ago

Specifically - I'd be surprised if consuming from github is the only way to make this work.

Context from our internal ticket details:


Kotlin Compiler release zip contains all the artifacts that is needed by the compiler classpath. (https://github.com/JetBrains/kotlin/releases/download/v1.3.20/kotlin-compiler-1.3.20.zip)

This zip compiler setup is used by buck & a bunch of other companies. We need to make okbuck use this zip as kotlin_home instead of using a custom generation by using specific compiler jar and its dependencies.

Work that needs to be done to achieve this:

this will unblock: gradle upgrade to 5.1: AGP upgrade to 3.3.0: https://github.com/uber/okbuck/pull/796 Kotlin Upgrade to 1.3.20: https://github.com/uber/okbuck/pull/802

ZacSweers commented 5 years ago

It seems to me like the real issue is more that buck is using this zip, when it maybe shouldn't?

kageiit commented 5 years ago

Using the zip is the right solution because as we have seen with this issue

ZacSweers commented 5 years ago

The kotlin gradle plugin must be able to deal with this in a way that plays nice with the gradle/maven ecosystem right?

kageiit commented 5 years ago

Im not sure about how the gradle plugin does things. We are only interested in the cli compiler. The gradle plugin probably has additional plumbing. The cli has to rely on file paths etc. to find its deps. We want to follow their recommendation to use the zip from https://kotlinlang.org/docs/tutorials/command-line.html

kageiit commented 5 years ago

I think I found a creative solution to the problem without needing to modify buck to switch it to the compiler zip artifact and to support future kotlin versions by keeping changes in okbuck only. I'll upload the pr today

I'll make a separate change to buck as a follow-up since it's better to have it for folks that don't use okbuck