aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Bespalov <bespalov.maxim.a@gmail.com>2022-06-19 14:21:41 +0200
committerMax Bespalov <bespalov.maxim.a@gmail.com>2022-06-23 16:51:06 +0000
commitb20256ccef06f515d1cbfdd51bf2b2398d114c70 (patch)
tree020b7f3081a7a5aba5f3eba168e4da1f4a602374
parent08e3d36098937844e84d447527ac50b9e19e74ff (diff)
Fix Android build-tools detection, if it was installed via cmdline-tools
The modern way to install android packages is to use cmdline-tools. The old way was to use SDK tools, but now it is deprecated (see https://developer.android.com/studio/releases/sdk-tools). There is a code in AndroidSdkProbe which looks for android executable in SDK tools folder to prove, that the folder does contain Android SDK. But if you use cmdline-tools, there is no folder "tools" anymore. The probe fails to find build tools. The fix is to look for build-tools directory. Fixes: QBS-1700 Change-Id: Iad92664ba07d034ba365e8b7b178cd47f5d3f187 Reviewed-by: Raphaƫl Cotty <raphael.cotty@gmail.com> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--share/qbs/imports/qbs/Probes/AndroidSdkProbe.qbs22
1 files changed, 9 insertions, 13 deletions
diff --git a/share/qbs/imports/qbs/Probes/AndroidSdkProbe.qbs b/share/qbs/imports/qbs/Probes/AndroidSdkProbe.qbs
index 28375a469..5b777d3e2 100644
--- a/share/qbs/imports/qbs/Probes/AndroidSdkProbe.qbs
+++ b/share/qbs/imports/qbs/Probes/AndroidSdkProbe.qbs
@@ -35,7 +35,7 @@ import qbs.Host
import "../../../modules/Android/sdk/utils.js" as SdkUtils
import "../../../modules/Android/android-utils.js" as AndroidUtils
-BinaryProbe {
+PathProbe {
environmentPaths: Environment.getEnv("ANDROID_HOME")
platformSearchPaths: {
if (Host.os().contains("windows"))
@@ -54,21 +54,17 @@ BinaryProbe {
property string platform
configure: {
- var suffixes = nameSuffixes || [""];
var i, allPaths = (environmentPaths || []).concat(platformSearchPaths || []);
candidatePaths = allPaths;
for (i in allPaths) {
- for (var j in suffixes) {
- if (File.exists(FileInfo.joinPaths(allPaths[i],
- "tools", "android" + suffixes[j]))) {
- path = allPaths[i];
- buildToolsVersions = SdkUtils.availableBuildToolsVersions(path)
- buildToolsVersion = buildToolsVersions[buildToolsVersions.length - 1];
- platforms = AndroidUtils.availablePlatforms(path)
- platform = platforms[platforms.length - 1];
- found = true;
- return;
- }
+ if (File.exists(FileInfo.joinPaths(allPaths[i], "build-tools"))) {
+ path = allPaths[i];
+ buildToolsVersions = SdkUtils.availableBuildToolsVersions(path)
+ buildToolsVersion = buildToolsVersions[buildToolsVersions.length - 1];
+ platforms = AndroidUtils.availablePlatforms(path)
+ platform = platforms[platforms.length - 1];
+ found = true;
+ return;
}
}
}