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 -> all().each { task ->
String variantOrSourceSet = isAndroid ? task.variant.name : task.sourceSet.name String variantOrSourceSet = isAndroid ? task.variant.name : task.sourceSet.name
def syncTask = project.tasks.register("syncGeneratedSources${variantOrSourceSet}", Sync) { def syncTask = project.tasks.register("syncGeneratedSources${variantOrSourceSet}", Sync) {
from "$buildDir/generated/source/proto/${variantOrSourceSet}/grpc" from task
into "$generatedSourcePath/${variantOrSourceSet}/grpc" into "$generatedSourcePath/$variantOrSourceSet"
String source = GUtil.toCamelCase(variantOrSourceSet) include "grpc/"
if (source == "Main") {
source = ""
}
dependsOn "generate${source}Proto"
} }
syncGeneratedSources.configure { syncGeneratedSources.configure {
dependsOn syncTask dependsOn syncTask