I’m overriding the `out` directory for Wire in an ...
# squarelibraries
r
I’m overriding the
out
directory for Wire in an Android library module:
Copy code
wire {
    kotlin {
        out "${projectDir}/src-gen/main/kotlin"
    }
}
Because of that I see errors such as:
Copy code
- Gradle detected a problem with the following location: 'module/src-gen/main/kotlin'. Reason: Task ':moudle:compileReleaseKotlin' uses this output of task ':module:generateDebugProtos' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to <https://docs.gradle.org/7.6.1/userguide/validation_problems.html#implicit_dependency> for more details about this problem.
Is there a way for me to remove the different variants of the generateProtos task? I only need
generateProtos
.
b
The workaround for now would be to create another non-Android module, generate there and consume it from the Android module
r
That’s what I ended up doing. The downside of this approach is that I either end up with a large proto module or many extra modules if I split the proto generation for unrelated parts of the app. I wish the WireTask would allow me to override this per target. Thanks for confirming.
b
If that’s a library, you could as well disable the release variant.
This might work
Copy code
plugins.withType(com.android.build.gradle.AppPlugin) { plugin ->
        project.extensions.configure(com.android.build.api.variant.AndroidComponentsExtension) { extension ->
          extension.beforeVariants(extension.selector().withName('release')) { variant ->
            variant.enable = false
          }
        }
      }
r
Disabling the release variant isn’t an option. Thanks for filing the ticket.