File tree 2 files changed +19
-1
lines changed
main/groovy/com/google/protobuf/gradle
test/groovy/com/google/protobuf/gradle
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -156,6 +156,15 @@ class Utils {
156
156
SourceFolder entry = new SourceFolder (relativePath, getOutputPath(cp, sourceSetName))
157
157
entry. entryAttributes. put(" optional" , " true" )
158
158
entry. entryAttributes. put(" ignore_optional_problems" , " true" )
159
+
160
+ entry. entryAttributes. put(" gradle_scope" , isTest ? " test" : " main" )
161
+ entry. entryAttributes. put(" gradle_used_by_scope" , isTest ? " test" : " main,test" )
162
+
163
+ // this attribute is optional, but it could be useful for IDEs to recognize that it is
164
+ // generated source folder from protobuf, thus providing some support for that.
165
+ // e.g. Hint user to run generate tasks if the folder is empty or does not exist.
166
+ entry. entryAttributes. put(" protobuf_generated_source" , " true" )
167
+
159
168
// check if output is not null here because test source folder
160
169
// must have a separate output folder in Eclipse
161
170
if (entry. output != null && isTest) {
Original file line number Diff line number Diff line change @@ -437,7 +437,16 @@ class ProtobufJavaPluginTest extends Specification {
437
437
438
438
Set<String> sourceDir = [] as Set
439
439
srcEntries.each {
440
- sourceDir.add(it.@path)
440
+ String path = it.@path
441
+ sourceDir.add(path)
442
+ if (path.startsWith(" build/ generated/ source/ proto" )) {
443
+ if (path.contains(" test" )) {
444
+ // test source path has one more attribute: [" test" =" true " ]
445
+ assert it.attributes.attribute.size() == 6
446
+ } else {
447
+ assert it.attributes.attribute.size() == 5
448
+ }
449
+ }
441
450
}
442
451
443
452
Set<String> expectedSourceDir = ImmutableSet.builder()
You can’t perform that action at this time.
0 commit comments