-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fulfill the new requirements for Kotlin User Projects #4392
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
base: develop
Are you sure you want to change the base?
Conversation
* Then, `true` means that warnings should be treated as errors, `false` means that they should not. | ||
*/ | ||
private fun warningsAreErrorsOverride(project: Project): Boolean? = | ||
when (val prop = project.rootProject.properties["kotlin_Werror_override"] as? String) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably, should be used API compatible with isolated projects?
when (val prop = project.rootProject.properties["kotlin_Werror_override"] as? String) { | |
when (val prop = project.providers.gradleProperty("kotlin_Werror_override").orNull) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but I don't know what the difference is. rootProject.properties
is already used throughout our build scripts, and I haven't heard of any issues because of that. Could provide/link to a clear explanation of the downsides of the existing approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
Calling Project.properties
is quite expensive because it collects not only properties from gradle.properties
and CLI arguments, but also tasks and their fields, extensions, extras, conventions, etc (see gradle/gradle#25053)
getProperty
and hasProperty
are better, but they're not compatible with isolated projects because of the access to properties
of other projects.
Since you're getting the property from the root project, it should be safe to use providers.gradleProperty
which looks for Gradle properties in the root project. As a bonus, this API is compatible with isolated projects (which I hope will be stable someday) as there is no need in calling methods of the rootProject
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, as soon as this syntax is used everywhere in this file, this change is indeed out of the scope of the current PR.
@dkhalanskyjb can you please also like this?: |
@woainikk, are there examples (either of other libraries doing this or of this property being used)? What exactly is the content of the property? Is it a space-separated list of strings? A comma-separated list? Something else? Should the options go before or after the usual ones (if that's important)? |
@dkhalanskyjb values are space-separated (quoting values with spaces is not supported); |
@dkhalanskyjb Can you please also add logging to somewhere, to all applied compiler flags were printed to log? |
bb0d0db
to
36b551f
Compare
No description provided.