google / protobuf-gradle-plugin

Protobuf Plugin for Gradle
Other
1.77k stars 274 forks source link

ProtobufExtract task not UP-TO-DATE when it should be #667

Open scott-pollom opened 1 year ago

scott-pollom commented 1 year ago

ProtobufExtract task is not UP-TO-DATE when irrelevant input directories are added or removed.

See example below from AndroidX build:

task :datastore:datastore-preferences-proto:extractIncludeTestProto not UP-TO-DATE. It was out-of-date because:
[Input property 'inputProtoFiles' file $OUT_DIR/androidx/datastore/datastore-preferences-proto/build/classes/kotlin/main/META-INF has been removed., Input property 'inputProtoFiles' file $OUT_DIR/androidx/datastore/datastore-preferences-proto/build/classes/java/main/androidx has been removed., Input property 'inputProtoFiles' file $OUT_DIR/androidx/datastore/datastore-preferences-proto/build/classes/kotlin/main/androidx has been removed.]

This is surprising because ProtobufExtract.getInputProtoFiles() should only contain proto files.

protobuf-gradle-plugin version: 0.9.0

rougsig commented 1 year ago

Hi. Could you please write your androidx.* project dependencies?

scott-pollom commented 1 year ago

Sorry for ambiguity, I'm building the androidx project itself.

To repro, you can do the following:

  1. run ./gradlew :datastore:datastore-preferences-proto:extractIncludeTestProto --scan
  2. create empty directory $OUT_DIR/androidx/datastore/datastore-preferences-proto/build/classes/kotlin/main/foo
  3. run ./gradlew :datastore:datastore-preferences-proto:extractIncludeTestProto --scan

The build scan from step 3 will show that the task was not UP-TO-DATE because of the empty directory.

rougsig commented 1 year ago

This is much better. Is this reproducible on the androidx-main branch?

scott-pollom commented 1 year ago

yes

rougsig commented 1 year ago

@scott-pollock great, thanks. Will investigate on this weekend.

scott-pollom commented 1 year ago

Thanks!

rougsig commented 1 year ago

This is the expected behavior at the moment. Bad behavior, but true. Will be fixed in the future, somewhere in version 0.10.*.

Extract include tasks for test sources depends on the main classpath that is passed as input to the task.

liutikas commented 1 year ago

Any updates on the fixes?

liutikas commented 11 months ago

Are we still planning to fix this?