Fix detecting when Gradle is invoked from Studio

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
This commit is contained in:
Emre Kultursay 2024-05-20 14:20:17 -07:00
parent 40b4130c93
commit 3b8d0bee4a
2 changed files with 1 additions and 7 deletions

View File

@ -330,8 +330,7 @@ ext.getReleaseKeyAlias = { ->
}
ext.isAndroidStudio = { ->
def sysProps = System.getProperties()
return sysProps != null && sysProps['idea.platform.prefix'] != null
return project.hasProperty('android.injected.invoked.from.ide')
}
ext.shouldZipAlign = { ->

View File

@ -232,11 +232,6 @@ def generateBuildTasks(String flavor = "template") {
return tasks
}
def isAndroidStudio() {
def sysProps = System.getProperties()
return sysProps != null && sysProps['idea.platform.prefix'] != null
}
task copyEditorReleaseApkToBin(type: Copy) {
dependsOn ':editor:assembleRelease'
from('editor/build/outputs/apk/release')