-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
[LOCAL] Make sure Java Toolchain and source/target level is applied to all projects #37576
Conversation
the solution works for the me. however i feel the way to apply java version for all projects is intrusive and afraid if that may break some third party libraries. especially this is done in RNGP where people don't have a way to change it (expect patch-package), would recommend to have a special property to disable this feature. so if there are some errors, people could add something like |
Yup I could and it probably makes sense. However there is no way to selectively disable this for some of the libraries |
so we may have comma splitting string for the property like fun configureJavaToolChains(input: Project) {
val excludeProjects = (input.rootProject.findProperty("reactNativeGradlePlugin.forceJavaVersionExcludedProjects") as String?)?.split(",") ?: emptyList()
input.rootProject.allprojects { project ->
if (excludeProjects.contains(project.name)) {
return@allprojects
}
// ...
}
} |
@Kudo I've added a killswitch. I don't think there will be scenarios where we need to selectively turn this off for a library as Java versions are generally forward compatible (i.e. Java 8 code is valid Java 11 code). If this is not the case, we can add specific handling in a point release |
* configure the toolchain to 11. | ||
*/ | ||
fun configureJavaToolChains(input: Project) { | ||
if (input.hasProperty(INTERNAL_DISABLE_JAVA_VERSION_ALIGNMENT)) { |
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.
nit: it's hasProperty so react.internal.disableJavaVersionAlignment=false
will also disable the java version enforcement. but it doesn't really matter though 😅
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.
doesn't have permission to approve the pr, but it looks good to me. thanks @cortinico.
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.
it's hasProperty so react.internal.disableJavaVersionAlignment=false will also disable the java version enforcement. but it doesn't really matter though 😅
Yeah I prefer this approach as the property is called disable...
so we won't have to handle all the boolean cases (true/True/1/etc). Plus it's an .internal.
property so no need to be super strict here
(CI is failing 'cause it's not rebased on top of the branch, go ahead and merge anyway, we're still addressing all the various ❌) |
Base commit: a244209 |
Summary:
This should fix reactwg/react-native-releases#54 (comment) by making sure we set JDK source/target level to 11 for all the modules.
Changelog:
[INTERNAL] - Make sure Java Toolchain and source/target level is applied to all projects
Test Plan:
cc @Kudo