Closed rougsig closed 2 years ago
I don't understand https://github.com/google/protobuf-gradle-plugin/pull/637/commits/387c422a43ae2a0295ab69eaa78c74d6f015d676 . "KotlinCompile configuration block can be executed before generateTask lazy configuration" shouldn't matter at all, as generateTask lazy configuration doesn't change global state and it.outputSourceDirectories
in output is run after configuration. Is this another problem caused by map {}
? Or maybe we don't fully understand what is wrong?
Background To compile proto sources or java/kotlin sources, we need to combine many different tasks together.
Java examples:
generateProtos sources:
from sourceSet
+extractProtosTask
includes:extractIncludeProtosTask
generateTestProtos sources:
from testSourceSet
+extractTestProtosTask
includes:from mainSourceSet
+extractProtosTask
+extractIncludeProtosTask
+extractIncludeTestProtosTask
Android examples: android part is more complicated than java. Each android variant can contains more than one sourceSet. Let's name that sourceSet amount as
c
.generateProtos sources:
from c * sourceSet
+c * extractProtosTask
includes:extractIncludeProtosTask
generateTestProtos sources:
from c * testSourceSet
+c * extractTestProtosTask
includes:from c * mainSourceSet
+c * extractTestProtosTask
+extractIncludeProtosTask
+extractIncludeTestProtosTask
It's difficult to manipulate without any structure to mix them up.
Changes Added
ProtoSourceSet
structure. That structure contains all information about proto: sources, includes, outputs, tasks depends on, etc. We can easily mix source sets between. That case we need intest
compilation (test sourceSet contains main sourceSet). All tasks that depend onProtoSourceSet
will inherit all dependent task declarations.Test plan Green pipelines.