-
Notifications
You must be signed in to change notification settings - Fork 25
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
Getting Started with Gradle: Avoid using internal APIs #6
Comments
A possible solution would be to use https://github.com/google/osdetector-gradle-plugin from Google, which builds on top of https://github.com/trustin/os-maven-plugin. This plugin resolves
Or alternatively since Gradle 2.1
Also, do not use script variables, prefer the usage of project variables, that is,
|
Using a plugin to replace the internal API and the ugly |
There is also org.gradle.nativeplatform.platform.OperatingSystem, which is however still incubating. |
Google's ossdetector plugin is used by everyone building gRPC projects, with both Maven and Gradle. That's a sizeable chunk. |
I like it!
|
My opinion is that having a dependency to a gradle plugin or a dependency to internal gradle API is the same. They are both pieces that are outside your direct control and that might break things in the future. Having said that, the plugin dependency is an improvement here, just for the sake of readability. @aalmiray, it would be great if you can create a PR with your suggestions! |
Use of a plugin for such a simple thing (at this stage anyway - with only three flavours to pick) seems like overkill. Specially if you have to massage the strings with additional conditions anyway ('osx' -> 'mac'). |
Fixed by #7. |
Just got my hand on a windows machine. The plugin actually sets the platform as 'windows' instead of 'win'. A viable solution would be to extend the condition:
I am writing it here in case someone has a better approach. |
The current example shows the usage of internal Gradle APIs to compute the value of a platform Script variable. It would be better to use public APIs or a plugin to resolve this value as Gradle may remove/change internal APIs at any given time.
The text was updated successfully, but these errors were encountered: