@@ -6,9 +6,8 @@ package kotlinx.rpc.protoc
66
77import kotlinx.rpc.buf.tasks.BufGenerateTask
88import kotlinx.rpc.rpcExtension
9- import kotlinx.rpc.util.KotlinPluginId
109import kotlinx.rpc.util.findOrCreate
11- import kotlinx.rpc.util.withAndroid
10+ import kotlinx.rpc.util.withLegacyAndroid
1211import kotlinx.rpc.util.withAndroidSourceSets
1312import kotlinx.rpc.util.withKotlin
1413import kotlinx.rpc.util.withLazyJavaPluginExtension
@@ -51,7 +50,7 @@ internal class ProtoSourceSetFactory(
5150}
5251
5352internal fun Project.findOrCreateProtoSourceSets (): NamedDomainObjectContainer <ProtoSourceSet > =
54- project. findOrCreate(PROTO_SOURCE_SETS ) {
53+ findOrCreate(PROTO_SOURCE_SETS ) {
5554 val container = objects.domainObjectContainer(
5655 ProtoSourceSet ::class .java,
5756 ProtoSourceSetFactory (project)
@@ -119,6 +118,9 @@ internal open class DefaultProtoSourceSet(
119118 }
120119 }
121120
121+ val tasksConfigured: Property <Boolean > = project.objects.property<Boolean >()
122+ .convention(false )
123+
122124 // Collection of AndroidSourceSet, KotlinSourceSet, SourceSet (java) associated with this proto source set
123125 val languageSourceSets: ListProperty <Any > = project.objects.listProperty<Any >()
124126 val generateTask: Property <BufGenerateTask ?> = project.objects.property<BufGenerateTask ?>()
@@ -133,18 +135,6 @@ internal open class DefaultProtoSourceSet(
133135 internal val isLegacyAndroid: Property <Boolean > = project.objects.property<Boolean >()
134136 .convention(false )
135137
136- // when com.android.* (not kotlin.multiplatform.library) is applied - kotlin has proxy source sets:
137- // | AndroidSourceSet | KotlinSourceSet |
138- // | main | androidMain |
139- // | test | androidUnitTest |
140- // | debug | androidDebug |
141- // ...
142- //
143- // these kotlin 'proxy' source sets have propper dependsOn values, but should not have tasks configures,
144- // as tasks are configured once for the android source sets
145- internal val isKotlinProxyLegacyAndroid: Property <Boolean > = project.objects.property<Boolean >()
146- .convention(false )
147-
148138 // used to track tasks' dependencies for main/commonMain/commonTest tasks, e.g.:
149139 // - bufGenerateTestDebug depends on bufGenerateDebug
150140 // - bufGenerateTestDebug depends on bufGenerateCommonTest and bufGenerateDebug for KMP
@@ -250,19 +240,15 @@ internal fun Project.createProtoExtensions() {
250240
251241 // CCE free check for kotlin
252242 withKotlin {
253- withKotlinSourceSets { id, extension ->
243+ withKotlinSourceSets { extension ->
254244 extension.sourceSets.all {
255245 findOrCreateAndConfigure(name, this )
256246 }
257-
258- if (id != KotlinPluginId .MULTIPLATFORM ) {
259- return @withKotlinSourceSets
260- }
261247 }
262248 }
263249
264250 // CCE free check for android
265- withAndroid {
251+ withLegacyAndroid {
266252 withAndroidSourceSets { sourceSets ->
267253 sourceSets.all {
268254 findOrCreateAndConfigure(name, this )
@@ -284,6 +270,6 @@ internal fun Project.createProtoExtensions() {
284270internal fun DefaultProtoSourceSet.protoTaskProperties (): ProtoTask .Properties {
285271 return androidProperties.orNull ? : ProtoTask .Properties (
286272 isTest = name.lowercase().endsWith(" test" ),
287- sourceSetName = name,
273+ sourceSetNames = setOf ( name) ,
288274 )
289275}
0 commit comments