build.gradle: Use proto task output instead of hard-coding path

This removes the need to specify dependsOn explicitly, because the task
input carries the dependency.
This commit is contained in:
Eric Anderson 2023-05-05 10:09:22 -07:00
parent 6e486cba48
commit 3f0e90d54e
1 changed files with 3 additions and 7 deletions

View File

@ -89,13 +89,9 @@ subprojects {
all().each { task ->
String variantOrSourceSet = isAndroid ? task.variant.name : task.sourceSet.name
def syncTask = project.tasks.register("syncGeneratedSources${variantOrSourceSet}", Sync) {
from "$buildDir/generated/source/proto/${variantOrSourceSet}/grpc"
into "$generatedSourcePath/${variantOrSourceSet}/grpc"
String source = GUtil.toCamelCase(variantOrSourceSet)
if (source == "Main") {
source = ""
}
dependsOn "generate${source}Proto"
from task
into "$generatedSourcePath/$variantOrSourceSet"
include "grpc/"
}
syncGeneratedSources.configure {
dependsOn syncTask