Commit Graph

396 Commits

Author SHA1 Message Date
Assam Boudjelthia
5454dda249 Android: keep up with sdk tools changing folder structure
The cmdline-tools package used to have the folder structure "tools/bin".
However, latest packages are using the structure "cmdline-tools/bin".
And since subsequent updates we are installing "cmdline-tools;latest"
package, it will be put in "cmdline-tools/latest" folder, so we cannot
extract to that path, or otherwise sdkmanager will complain that the
path is in use.

Currently we extract it and put it under the SDK path, then use it to
install the essential packages, then it won't be used at all. This patch
changes that by extracting the downloaded package into a temporary
location, and use sdkmanager from there directly.

Also, this patch updates the links to the cmdline-tools along the way.

Fixes: QTCREATORBUG-27174
Change-Id: I1f5d0e38f5a026631e8a3852821d85a69d543c32
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-03-17 20:45:07 +00:00
Assam Boudjelthia
851171f772 Android: rename avdname to avdName in AndroidDeviceInfo
Change-Id: I9f4743b0d9f953f1fa407acfea41345571cb9998
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-03-14 17:48:31 +00:00
Assam Boudjelthia
e5ce9e9e76 Android: Get rid of the avd info fields in AndroidDeviceInfo
The AVD specific fields don't need to be carried out by QtC settings,
these can be read from the AVD's config file when they are needed.

This also is good because those values can change at any time,
either manually or by some other IDE like Android Studio, and thus
we don't really need to manage them ourselves.

The fields in question are: skin name, target name, sdcard size,
openGL status.

Change-Id: I86163500ec2fed035e32ec02ed17e182778db4a7
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-03-14 17:47:55 +00:00
Jarek Kobus
8e0ae8ba96 QtcProcess: Limit the inclusion of qtcprocess.h
Move the rest of QtcProcess enums to processenums.h.
Move ExitCodeInterpreter into processenums.h.
Remove superfluous Utils:: prefix.

Change-Id: Iaa596f353d33d6930085a621b114cc15a35caa80
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-02 13:30:39 +00:00
Assam Boudjelthia
c43ba1ae32 Monitor Android devices in non-polling method
Use ADB's track-devices command to watch for device
events which would replace the current polling method
with a timer. For AVDs, a QFileSystemWatcher is used
to watch for changes in the AVDs home folder which
would allow updating the AVDs only when a change is done
like edition, deletion, start, stop, even from outside
Qt Creator.

This method would also make device updates faster,
instead of unexpected waits due to timer use.

Task-number: QTCREATORBUG-23991
Change-Id: I08a92252c99c02bc111e597d671f2350817458c7
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-02-22 21:21:53 +00:00
Eike Ziller
9bc9fb5a0d Fix avdmanageroutputparser test
- There is no PLUGIN_DEPENDS for tests, and it wouldn't work anyhow
  because of duplicated symbols. It was interpreted as a dependency and
  the test disabled because no such target exists.
- Move the platformNameToApiLevel(...) function to
  avdmanageroutputparser.h to break the dependency to a lot of Android
  support code.

Amends 78da7e2922

Change-Id: I6933684a76e5291d415c72388caa3df2bee7cbfb
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-02-03 15:31:13 +00:00
hjk
fd49c1d567 Android: Compile fix for Qt 5
Amends 49443d689.

Change-Id: Idadb794b85bebff9678b54f55f8b9822719a8d8a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-01-31 08:45:35 +00:00
Alessandro Portale
49443d689e Android: Detect available Ndk platforms also for recent Ndk versions
In order to detect the list of platforms that an Ndk installation
supports, AndroidConfig::availableNdkPlatforms iterates through the
directories of the Ndk.

The directory structure of the Ndk changed in the recent versions. So
that the detection that works with Ndk 19 does not work with Ndk 23.
Also, the new directory structure is split up by Android ABI. And the
lists of supported platforms differ between ABI.

This change adds detection for the new structure, in case that the
old implementation fails to return a list. It also adds an autotest
that covers the old and new detection of supported platforms.

Fixes: QTCREATORBUG-26772
Change-Id: I6e584963f51feca0bf90c7ed3a9fdb03cb5d39e6
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-01-30 19:11:45 +00:00
Alessandro Portale
d087fe424d Android: Set debugger sysroot also for recent Ndk versions
Android debug support specifies the sysroot inside the used Ndk.

Recent Ndk versions have a different folder structure which moved the
sysroot location inside the Ndk to somewhere else. This change adds
finding the sysroot in the new directory layout in case it cannot be
found in the traditional location.

Instead of Ndk version checks, this code uses FilePath::exists to see if
the sysroot is valid.

Fixes: QTCREATORBUG-26814
Change-Id: I37db3043e405b83168d7c80c522d31bc148e458c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-01-30 18:13:45 +00:00
hjk
1fc83d2a56 Utils: Wrap various file system iteration flags and filters
... into a single class.

This makes passing them around as a whole easier, and opens a path
to have "generic" filters in form of a lambda or such.

Change-Id: Ibf644b2fedcf0f1a35258030710afff8f5873f88
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-26 13:13:41 +00:00
Alessandro Portale
14eb2ce0a5 Android: Make a couple of AndroidConfig's functions static
They do not access non-static members. This way, the functions can be
called (e.g. by auto tests) without having an AndroidConfig instance.

Change-Id: I2551bddc2f4745ee7486b490f1abf935204c7763
Reviewed-by: hjk <hjk@qt.io>
2022-01-25 07:06:28 +00:00
hjk
a48a96e05c QtSupport: Introduce a type alias for QList<BaseQtVersion *>
Change-Id: I96b0eccc04da2f4a1a4e5ea9bdceb91b3fa3d724
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-01-24 14:38:20 +00:00
hjk
25f5771aa4 Rename QtSupport::BaseQtVersion to QtVersion
... and the Utils::QtVersion enum to Utils::QtMajorVersion to avoid
conflicts.

Change-Id: Ib688c67388272b7204a91444155f60b8c18a56bd
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-01-24 12:13:19 +00:00
hjk
e695109078 ProjectExplorer: Make ToolchainManager::toolchains() overloads explicit
Saves a few cycles for the plain access.

Also sprinkle a few 'const'.

Change-Id: I238dfd9352ee39caa3aa48cd04a9f1cf827b029e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-01-20 06:13:09 +00:00
hjk
d8e2a3fd45 Android: De-noise toolchain detection a bit
Change-Id: Iab68004fd6310b5658bd9c3c1e23a761e3414ead
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-01-19 11:03:18 +00:00
Alessandro Portale
f1a5a1f716 Android: Allow users to select which NDK to use for kits
This adds a "Make Default" button next to the NDKs list view. The
default NDK version is then used to override the NDK version for all Qt
versions in the sdk_definitions.json.

Fixes: QTCREATORBUG-21755
Fixes: QTCREATORBUG-22389
Fixes: QTCREATORBUG-24248
Fixes: QTCREATORBUG-26281
Change-Id: I460daafdd7f2d6380c0114bcd14cb0c46226d516
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-12-10 09:15:34 +00:00
Eike Ziller
d422b408e0 Merge remote-tracking branch 'origin/6.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri

Change-Id: I32991a77e52831dd2e24cf4a51ec252998c2d743
2021-12-09 12:04:32 +01:00
Kai Köhne
16c8f1a9b6 Android: Fix use of keytool on Windows
Fixes: QTCREATORBUG-26647
Change-Id: I34fd2b4304480186d1a05e2c9101b2cfbd1e8e47
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-12-02 17:07:43 +00:00
Eike Ziller
164aae53d2 Merge remote-tracking branch 'origin/6.0'
Conflicts:
	src/libs/utils/theme/theme_mac.mm
	src/plugins/android/androiddeployqtstep.cpp
	src/plugins/debugger/lldb/lldbengine.cpp

Change-Id: I5f2c62e0bce6c91a53a554b3278dbe23ff7dde36
2021-11-11 13:04:42 +01:00
hjk
652b9844e6 Utils: FilePathify Environment::{ap,pre}pendOrSetPath etc
Change-Id: Idfa5ec247337570936b0236cab9d3a5669792ca0
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-10 07:26:31 +00:00
Christian Stenger
eab5315904 Android: Register Lldb if it is present
Change-Id: I46a544c0541ca4f0a969064faf055c1e99b9c5ad
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-11-09 07:19:35 +00:00
Eike Ziller
3b9b9bdc0b Merge remote-tracking branch 'origin/6.0'
Change-Id: Ia7fc255ee8680e6beac5d4d878f446fe40873183
2021-11-08 09:46:57 +01:00
Jarek Kobus
a50c5db110 Use QtcProcess in getJdkPath()
Change-Id: I46544c1e0f811476a7e743a3085083ba204dc14b
Reviewed-by: hjk <hjk@qt.io>
2021-11-05 08:44:49 +00:00
Alessandro Portale
d4efd4a369 Android: Improve prior commit
Actually use the version variable that was defined prior to the line.

Amends: 0de09fe3a3

Change-Id: Ie05e1a4e1be0fa0729dd1de38fc6b5351d02d380
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-11-04 14:53:26 +00:00
Alessandro Portale
0de09fe3a3 Android: Enable manual adding of NDKs v22+
Don't enforce the presence of a "platforms" subdirectory if the NDK is
of version 22 or higher. The last NDK version with that directory is 21.

Change-Id: Ib431e7db4521533206304d252dcf93b7ea6169e5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-11-03 14:33:02 +00:00
Assam Boudjelthia
d5a3435798 Android: drop const from AndroidConfigurations::currentConfig()
Since the config can be expected to modify configuration values
(e.g. setEmulatorArgs()) it shouldn't be const, but can be set
to const whenever creating a reference that is not meant for
modifying the config.

Change-Id: I8c816a5422d4d57afa158c723d908e3a9a9a0db8
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-10-26 18:34:58 +00:00
Assam Boudjelthia
ec55b1a483 Android: remove AndroidDeviceType and State from AndroidDeviceInfo
No need to have these enums which are now only a duplication of
IDevice::MachineType and IDevice::DeviceState.

Change-Id: Icc3f112f2670c7354bb282b36fad0f0631b9e047
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2021-10-25 09:21:37 +00:00
Assam Boudjelthia
336cee445e Android: Remove unnecessary parameters in AndroidConfigurations
No need to manually provide a parameter to adbToolPath inside
AndroidConfigurations itself, functions that needs it can just
get it directly.

Change-Id: Ie319e82e4ea3b7e3ad6588284168f6116bef2686
Reviewed-by: hjk <hjk@qt.io>
2021-10-13 14:59:03 +00:00
Assam Boudjelthia
6e4d829a40 Android: handle return correct serialNumber for a running avd
AVDs don't get a serial number until they are started, and avdmanager
don't make it easy to get their serial either, so we need to check
the running devices with adb "emu avd name" command and compare.

Change-Id: I3253d25a3461a36eb9918b3c796062bf9e82e0c6
Reviewed-by: hjk <hjk@qt.io>
2021-10-13 14:58:27 +00:00
Assam Boudjelthia
78da7e2922 Move sdkmanager's sdk level parsing to AndroidConfig
Both the sdkmanger and avdmanager (maybe more) need to parse the sdk
level for packages and devices which may contain letters, make them
use the same logic.

Change-Id: Iff7fef3a66e00fac11b833f73f2f334a4cf1a766
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-13 14:56:06 +00:00
Assam Boudjelthia
c94d5a257b Android: few fixes for android kits aspects
Make some changes to make Android kits behave as, for example,
desktop kits:
* Set the build device of the kit to the default desktop device.
* Don't make the device and toolchain aspects sticky.

Change-Id: I41a40c6ed8dc3434fa4f3a09349b75b5fd379317
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-10-06 08:08:05 +00:00
Assam Boudjelthia
91117a1c36 Android: Clean up for extraData constants
clean, rename and delete unused constants, we well as unify the
usage between qmake, cmake, and qbs.

Change-Id: I8827ac2f2f7660e337694fef17f744e727bd776a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-10-06 08:07:42 +00:00
Assam Boudjelthia
96255208a5 Change device selection mechanism on Android
Currently, on deploy/debug steps on Android, an AndroidDeviceDialog
is popped up each time a deployement is done to select a device. This
can be avoidable by using Qt Creator DeviceKitAspect to have the list
of devices easily selectable from the project mini-menu.

This is better than the current way because it:
* reduces the time from deployment to running the app
* reduces the number of clicks
* avoids having to select the same device each time or
* if a default device is selected, this avoids having to go to project
settings to reset the default device to be able to deploy to a new
device.
* it looks cleaner and more compatible with Creator.

Task-number: QTCREATORBUG-23991
Change-Id: Ida4ab7245c1a3b0ca26c5ccdc9a21a072edf0725
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-09-21 15:33:40 +00:00
Artem Sokolovskii
2d22dbe612 Android: Use FilePath
Change-Id: Ia1cf2a615f0de70038a575f851572e944a9797df
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-09-17 11:37:35 +00:00
Jarek Kobus
686603ae83 Remove unused includes of QThread from cpp files
Change-Id: I61b8e9182bf03fa96d2aabe399a6c93964fc8d03
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2021-09-13 10:37:20 +00:00
Eike Ziller
8e51295959 Merge remote-tracking branch 'origin/5.0'
Conflicts:
	src/libs/utils/processreaper.cpp
	src/plugins/clangcodemodel/clangmodelmanagersupport.cpp
	src/plugins/cmakeprojectmanager/cmakeprocess.cpp

Change-Id: Ie248bcb02a80f3e02ab19d73033ce2ba31e7fd83
2021-09-07 11:05:40 +02:00
Assam Boudjelthia
bf3dae64a2 Android: fix toolchain path retrieval for NDK r10
Although, recent Qt versions (Qt 5.12+) don't really need r10, this
can be useful if an older version is used, or if the user wants to
explicitly use Ndk r10.

Change-Id: Ic88929a747bcea89384a7bae9d8f8b26135fae65
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-09-03 17:06:02 +00:00
Eike Ziller
987ad3fe9c Merge remote-tracking branch 'origin/5.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/android/androidconfigurations.cpp

Change-Id: Icd2b0fda2b2653656285bbbe457c30c9cd414d3f
2021-08-30 12:15:37 +02:00
hjk
3b75ca96d6 Utils: Remove FilePath::isWritablePath() uses
And fix remaining users.

Change-Id: I41c27908f2e9f1e253d0b51830ba351b29a84ec5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-27 07:05:29 +00:00
Assam Boudjelthia
b3a12e1ab9 Android: Don't register multiple debuggers for each ABI
After NDK r10x, there's one common gdb executable instead
of separate for each ABI. Currently, multiple debuggers
are being registered for each ABI although they all share
the same command. Apart from simplifying the list of debuggers,
this will make it less time consuming where each NDK can register
one instead of 4 debuggers.

Also, there was two functions handling debugger registration for
the default NDKs and another for custom ones chosen manually by
the user. Now, they are merged together instead.

Change-Id: I886b6fa8eb2190e630189f9002e7a44cd18c7b71
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2021-08-26 10:58:04 +00:00
Eike Ziller
0777b65db3 Merge remote-tracking branch 'origin/5.0'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	src/plugins/android/androidconfigurations.cpp

Change-Id: If8dc2cdf131811e08ca147c6f58dbb3ed3bf7227
2021-08-26 11:09:08 +02:00
Assam Boudjelthia
cd8da8fe5f Android: Get the minimum sdk level based on the used Qt version
Currently, Creator gets the minimum sdk version from a hard-coded
value (16) which is used for all projects. However, this is not ideal
because some Qt versions require a specific sdk level to build and run
properly. So, this change ensures that the minimum sdk value is obtained
based the Qt version used in the project.

Fixes: QTCREATORBUG-26127
Change-Id: I948dd18d16c3d9ca587ad7712aa4c9a1bfd53972
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-08-26 08:03:09 +00:00
Eike Ziller
34a884a52a Android: Clean up messed up kits that were created by Android plugin
No idea how to reproduce, but it can happen [1] that stale Android kits
appear in Qt Creator, which have broken combinations of Qt version and
toolchains. The Android plugin updates the Android kits at startup,
but only updates known "correct" kits, or creates new ones.

Additionally remove any previously auto-created Android kits that
were not recognized to be still usable.

[1]: probably after switching between a working Android setup and a
broken one, with broken toolchains/debuggers brought into the mix

Change-Id: I709f52df62f8998647e4d68bdfe76015e8941ab8
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-08-26 07:19:46 +00:00
hjk
1b6c212928 Android: Use FilePath operations in AndroidConfig::parseDependenciesJson()
Change-Id: I32bd5cbce4f486132be338c4318f499ce0b03325
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-08-25 05:38:02 +00:00
hjk
823e48a1fb Android: Partially FilePathify BuildApkStep and AndroidConfigurations
Change-Id: Ie7a7ae9f0d30235eab3dbcab9554fdfa1709a3c1
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-08-19 03:02:29 +00:00
hjk
7c28c4f744 Utils: Introduce a FilePath constructor from char arrays
Similar to QT_RESTRICTED_CAST_FROM_ASCII to avoid the need for
decorations in user code.

At the same time, drop some convenience constructors and functions
in CommandLine and Icon essentially serving the same purpose.

Change-Id: Ida4e5ac19c2da0a4298a97b2a8e1511d56bbb79d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-17 05:34:10 +00:00
Alessandro Portale
99700bb009 Android: Enforce portable/clean Android SDK path
When reading a path from file chooser, settings or environment variable,
make sure it is portable and "clean".

Avoids extra compiler registrations, invalid Kits and similar issues.

Fixes: QTCREATORBUG-26092
Change-Id: I2a11563f40973d5f595bf00e37ff045a503aa9f7
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-08-16 07:31:12 +00:00
Assam Boudjelthia
45611e841b Android: avoid blocking call to show avd selection for default device
If a user already chose a default device to run, we don't need to create
the whole AVD selection dialog, but rather straightforward to get the
device info if it's already connected, otherwise the dialog opens for
selection as usual.

Change-Id: I5fee9411d755e89da23a8d365f284e8b52808a07
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-07-22 08:51:46 +00:00
hjk
430e81facd All: Replace most SynchronousProcess by QtcProcess
Change-Id: I0bf22fef2cd4a7297ef5a1e9aa9c3e2b9348ba42
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-23 07:55:31 +00:00
hjk
c0fe038f93 Utils: Simplify FilePath::toFileInfo().lastModified() calls
It's the same as FilePath::lastModified locally, and toFileInfo
doesn't work remotely. So it's overall at least not worse.

Change-Id: Ice8d80dcfd01dc38edc1dce2b53e1b5e6274380f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-06-22 08:57:28 +00:00