trustin / os-maven-plugin

A Maven plugin that sets various useful properties detected from ${os.name} and ${os.arch} properties.
Apache License 2.0
296 stars 66 forks source link

abstract operations for reading/setting system properties and reading files #48

Closed voidzcy closed 3 years ago

voidzcy commented 3 years ago

Context:

The osdetector-gradle-plugin is a thin wrapper built on top of this plugin for Gradle users. It has been a handy tool built into many other Gradle plugins, such as the protobuf-gradle-plugin, which needs OS information to determine and resolve a platform-dependent artifact (protoc).

Gradle is rolling out its configuration caching feature, which persists build configurations to the disk and can be loaded and executed instantly next time if the build configuration has not change. In order to be compliant with this feature, plugins are not allowed to perform direct system property/file read at the configuration phase (see Gradle configuration cache requirements). Instead, Gradle provides several Provider APIs for doing such at the configuration phase in a configuration cache compliant way.

Request of changes:

We want this plugin to abstract and expose an interface for system property/file operations, so that it allows wrapper plugins to override/inject code for performing system property/file operations in their own way.

Would you accept a PR for such changes? I've create one in #47, please let me know or comment on the PR if you have any concerns.

trustin commented 3 years ago

Fixed via #47