Skip to content

GenerateProto depends on compile tasks #578

Open

Description

Background
Test project structure (link):

├── instances
│   ├── app
├── work-with-proto
│   ├── implementation pure-kotlin
│   │   ├── api lib-core
│   ├── implementation pure-java
│   ├── implementation proto-kotlin
│   │   ├── api lib-core
│   ├── implementation proto-java
│   ├── implementation pure-android
│   ├── implementation proto-android

:generateProto executed a bunch of unnecessary tasks:
:lib-core:compileJava, :proto-android:compileDebugJavaWithJavac, :proto-java:compileJava,
:proto-kotlin:compileKotlin, :proto-kotlin:compileJava, :pure-android:compileDebugJavaWithJavac,
:pure-java:compileJava, :pure-kotlin:compileKotlin, :pure-kotlin:compileJava

It just compile all dependencies, without any reason.

How it works now
Protobuf gradle plugin create compileProtoPath configuration that extends from implementation and compileOnly.
It's quite user-friendly, because all you project dependencies provides proto files by default. No need to duplication dependency for compileProtoPath configuration.
i.e.

dependencies {
  implementation project(":with-proto")
  
  // no need write string below.
  // compileProtoPath configuration will take all implementation dependencies automatically.
  // compileProtoPath project(":with-proto")
}

What wrong
Gradle scan from test project for generate proto task.
Generate proto task resolves compileProtoPath configuration. compileProtoPath configuration resolves implementation and compileOnly configuration. As result we have compiled or downloaded all project's dependencies.

This is not good. It costs build time a lot. (that looks real, if project have a lot of dependencies #551).

Expected result
Generate proto task does not compile and download all of the project's dependencies. It should only work with dependencies marked as path dependencies.

Changes
The compileProtoPath configuration does not extends from implementation and compileOnly configurations.

Breaking changes
If compileProtoPath configuration does not extends from implementation and compileOnly configurations, user should declarate all dependencies for generate proto task with compileProtoPath configuration. i.e.

dependencies {
  implementation project(":with-proto")
  
  // User should add all path dependencies with compileProtoPath configuration.
  compileProtoPath project(":with-proto")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions