Add Kotlin DSL extension function for configuring proto source directory set in Android builds #433
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The plugin is missing the
proto
Kotlin DSL extension for Android builds.protobuf-gradle-plugin/src/main/groovy/com/google/protobuf/gradle/ProtobufPlugin.groovy
Lines 209 to 215 in bf6301a
For Android builds,
project.android.sourceSets
returnsAndroidSourceSet
s. So in Kotlin DSL it expects the receiver ofproto
extension function to beAndroidSourceSet
, which is missing now.Note the argument of the extension function should be an action for
SourceDirectorySet
instead of forAndroidSourceDirectorySet
. This is because the plugin createdSourceDirectorySet
for both Android and non-Android projects.Majority part of this change is for adding the integration test for Android builds with Kotlin DSL. The test project includes configuring custom proto source directories. Reviewer may only need to review
build.gradle
,src/main/kotlin/com/google/protobuf/gradle/ProtobufConfiguratorExts.kt
,src/test/groovy/com/google/protobuf/gradle/ProtobufKotlinDslPluginTest.groovy
andtestProjectAndroidKotlinDsl/build.gradle.kts
.Resolves #429.