-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Configuration cache] Dependent OsDetectorPlugin is not compliant with configuration cache #409
Comments
There is no easy way to mitigate this now.
We probably would need to migrate away from os-mavan-plugin. |
@voidzcy Can we implement this in the Protobuf plugin? We probably need to support just a couple of basic os/arch combinations. |
We need to read the system property in configuration time to determine the dependency notation in a map form for protoc. I am not sure if a map with lazily evaluated values would work. Even with that, we would need to implement the system properties/files reading with Gradle's |
I don't see any need to reimplement this logic. It seems very easy to enhance os-detector-maven to work with our needs. It seems Detector is pretty close already. It already requires overriding some protected methods for logging; we would just add a few for accessing |
We can try wrapping We are not able to make |
I tried using |
I've experimented locally by replacing
RegularFile file = getProjectLayout().getProjectDirectory().file(fileName);
ProviderFactory.fileContents(file).getAsBytes().forUseAtConfigurationTime().getOrNull(); It works with configuration cache. Note this approach still reads system properties/files at configuration phase (in a configuration cache compliant way), which means changing to their values will cause cache entry invalidation and reconfiguration. But since the os-detector plugin is mostly reading OS properties/files, they are not expect to change between builds in normal cases. So configuration cache would still be beneficial for most users. I've created trustin/os-maven-plugin#47 for os-maven-plugin. Once that gets accepted, I will make changes to osdetetor-gradle-plugin and then solve this issue here. |
osdetector-gradle-plugin 1.7.0 is now compliant with configuration caching. Tests for this plugin have been fully enabled in #467. |
As mentioned in #406 (comment), the dependent OsDetectorPlugin uses JDK APIs to read system properties, which violates the requirement for configuration cache:
That needs to be fixed either in osdetector-gradle-plugin or having some workaround in protobuf-gradle-plugin if possible.
Users of protobuf-gradle-plugin are still able to take advantage of configuration cache feature with
--configuration-cache=warn
argument (ignoring errors ofInvalidUserCodeException
, which are considered to be harmless, our existing test does so).The text was updated successfully, but these errors were encountered: