-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Fix detecting when Gradle is invoked from Studio #92176
Conversation
platform/android/java/build.gradle
Outdated
@@ -233,8 +233,7 @@ def generateBuildTasks(String flavor = "template") { | |||
} | |||
|
|||
def isAndroidStudio() { | |||
def sysProps = System.getProperties() | |||
return sysProps != null && sysProps['idea.platform.prefix'] != null | |||
return project.hasProperty('android.injected.invoked.from.ide') |
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.
Can you apply the fix in config.gradle as well.
Is this approach supported by past releases of Android Studio?
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.
Actually looking at the code, the definition of isAndroidStudio()
defined in config.gradle
is visible here as well, so you can just make the change in the version in config.gradle
and delete the version of isAndroidStudio()
that's in this build.gradle
file.
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.
can just make the change in the version in config.gradle and delete the version of isAndroidStudio() that's in this build.gradle file.
Done.
Is this approach supported by past releases of Android Studio?
This property has been available since 2014: https://android.googlesource.com/platform/tools/base/+/45573717b3f70c58b9e389ada306b25d477af6d9
Validated the fix works as expected! |
PTAL. |
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.
Looks good!
Can you squash the commits into one so the PR is ready for merging (https://docs.godotengine.org/en/stable/contributing/workflow/pr_workflow.html#the-interactive-rebase)
The existing 'idea.platform.prefix' system-property approach only worked because of a Android Studio bug that leaks the system properties from Android Studio into Gradle build: - https://issuetracker.google.com/201075423 This bug was fixed in Android Studio 2023.3.1 (Jellyfish). The correct way of identifying builds from Android Studio is to use the following project property (not system property): - android.injected.invoked.from.ide
Squashed commits. PTAL. |
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.
Looks good!
Thanks! And congrats for your first merged Godot contribution 🎉 |
The existing
idea.platform.prefix
system-property approach only worked because of a Android Studio bug that leaks the system properties from Android Studio into Gradle build.This bug was fixed in Android Studio 2023.3.1 (Jellyfish), which is why Godot fails to build on Jellyfish without this fix.
The correct way of identifying builds from Android Studio is to use the following project property (not system property):
android.injected.invoked.from.ide
Fixes #92122