Skip to content

Commit

Permalink
Merge pull request #2595 from square/bquenaudon.2023-08-29.warning
Browse files Browse the repository at this point in the history
Adds warning when one defines a protoLibrary without source sets
  • Loading branch information
oldergod authored Aug 30, 2023
2 parents f51580d + 527f584 commit c56b618
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,15 @@ class WirePlugin : Plugin<Project> {
if (extension.protoLibrary) {
val sourceSets = project.extensions.getByType(SourceSetContainer::class.java)
// Note that there are no source sets for some platforms such as native.
if (sourceSets.isNotEmpty()) {
// TODO(Benoit) Probably should be checking for other names than `main`. As well, source
// sets might be created 'afterEvaluate'. Does that mean we should do this work in
// `afterEvaluate` as well? See: https://kotlinlang.org/docs/multiplatform-dsl-reference.html#source-sets
if (sourceSets.findByName("main") != null) {
sourceSets.getByName("main") { main: SourceSet ->
main.resources.srcDir(protoOutputDirectory)
}
} else {
project.logger.warn("${project.displayName} doesn't have a 'main' source sets. The .proto files will not automatically be added to the artifact.")
}
}

Expand Down

0 comments on commit c56b618

Please sign in to comment.