Commit Graph

227 Commits

Author SHA1 Message Date
Petri Virkkunen
1c2ffde787 Android: set release flag when building and deploying apk
...in Release builds

Signed Release builds are now deployed correctly by giving
androiddeployqt the --release flag during the Deployment step
for Release builds.

Unsigned Release apks are now correctly built under the release
directory by giving androiddeployqt the --release flag during the Build
step for Release builds instead of determining build type from whether
or not the package is signed.

Fixes: QTCREATORBUG-28163
Change-Id: I319bc95325c88fb84a5997c9237df65eb7983c0e
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-09-30 05:58:47 +00:00
Alessandro Portale
139e190d77 Android: Cleanup qtc.android.build.androiddeployqtstep logging
Reduce excess spacing and quoting.

Change-Id: I685d78a91494f5805a175552db36df92d3da3ca5
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-06-27 19:31:19 +00:00
BogDan Vatra
aaf2318a19 Fix Android debugging
- gatherFilesToPull depends on AndroidManager::setDeviceAbis
- use the same path for app_process. gatherFilesToPull pulls app_process
to AndroidManager::buildDirectory(target) which might be different than
activeRunConfig->buildTargetInfo().workingDirectory.

Change-Id: Id47c4380fed5a8b3ad922359e5f9f25e529bacff
Reviewed-by: hjk <hjk@qt.io>
2022-06-23 08:25:43 +00:00
Jarek Kobus
41f9962ea6 AndroidDeployQtStep: Don't handle unfinished lines separately
Automatic handling of unfinished lines should be fixed
in cfe8b7ad88

Change-Id: I9f4bcf876ce5d7d51b651b6e997b7891d4483c56
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-03-25 11:15:54 +00:00
Jarek Kobus
bd7949f852 AndroidDeployQtStep: Make m_process local
There is no need to keep m_process as a class member,
since it's only used in just one function.

Change-Id: I156b978a18ab25a41b0e52d00fcb90c0f7f12ddd
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-03-24 09:43:57 +00:00
Eike Ziller
e914f42458 Merge remote-tracking branch 'origin/7.0'
Change-Id: I9c4ef46084fd392663c7c21c4ecdbc578ea28577
2022-03-18 08:42:02 +01:00
Assam Boudjelthia
03abdcda9f Android: don't fail if device abi list is empty
If for some reason the device abi list is empty, don't stop the
deployment, let it continue and potentially fail later.

Amends c1512dce87.

Task-number: QTCREATORBUG-27103
Change-Id: I484fbd1ddb365d5e96686eebc3ba76032684e506
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-03-17 09:21:10 +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
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
c1512dce87 Android: don't stop deployment if the kit's ABIs list is empty
If for some reason we cannot get the list of kit's ABIs or it's not set,
don't stop the deployment because of that, let it continue and fail
later.

Fixes: QTCREATORBUG-27103
Change-Id: I973e5ffdca1e8fb6af3f6e6438969b38b8e375c8
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-23 17:21:51 +00:00
Alessandro Portale
2cd7d89ec5 Android: Remove a cast in AndroidDeployQtStep::init
Don't do an additional dynamic_cast.

Change-Id: Icf3beda4e78bc03232689439e8ba264287b603ab
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-02-16 17:17:44 +00:00
Jarek Kobus
5127d155d2 QtcProcess: Get rid of setProcessUserEventWhileRunning()
Introduce EventLoopMode enum and pass it to the
QtcProcess::runBlocking() instead. There is no need to
store this setting. By default this value is NoEventLoop.

Change-Id: Icad98b77bec5280b79039b7e5aa4ec408261521c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-01-25 08:44:11 +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
Assam Boudjelthia
9a859de175 Android: fix error message when no valid device is set
Change-Id: Iff48a94100490222e039355c4e7558f1d79dc7b0
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-11-09 13:33:34 +00:00
Assam Boudjelthia
5ab9d45c5f Android: Add and organize error cases for different steps
Add error messages for cases in the different steps (e.g. build, deploy,
etc.) for user. This makes it easier for the user to know what's wrong
instead of just failing with no explanation.

Change-Id: I96ea65f5c73edf14c2214b699503211b740d029c
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-10-26 14:50:46 +00:00
Assam Boudjelthia
f49fbe7f58 Android: set the deploy step widget to expanded by default
The deploy step widget most useful aspect is the uninstall before
deploy checkbox, and having it expanded by default would improve the
UX a bit by avoiding one extra mouse click.

Change-Id: I23ebc90daf9290d229d93dca1b9b25629902e3f2
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-10-12 10:59:13 +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
Assam Boudjelthia
7bf268114d Fix issue with deploy step not getting valid abi with CMake
With CMake, it seems that the abi was being empty string because
looking for ANDROID_ABIS is not defined and instead there's ANDROID_ABI.

Also make sure to handle the case of ANDROID_ABIS, which might be
declared in future versions like Qt 6.3 which can support multi-abi
builds.

Change-Id: I805c5c25409a4e20a237b8747082d256bd72e275
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-09-21 06:07:41 +00:00
Eike Ziller
6a99368979 Merge remote-tracking branch 'origin/5.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/libs/utils/processreaper.cpp
	src/plugins/android/androidbuildapkstep.cpp
	src/plugins/cmakeprojectmanager/cmakeprocess.cpp

Change-Id: I353a445b5862f63362ea954749b5565360951283
2021-09-20 13:43:20 +02:00
Assam Boudjelthia
a2b6dba0bc Android: fix for retrieving the path to deployment file and build dir
The Android deployment file for CMake project was constructed based
on the main project target and thus was always expecting the file
to be under the build folder root path. This makes sure the correct
path to the output path is retrieved.

This practically different problems with running examples when the
main project is a Qt module, for both qmake and cmake.

Fixes: QTCREATORBUG-25793
Change-Id: I5fdedd94c7c4c84c351c28476ca14b0f95f99f22
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-09-15 11:02:21 +00:00
Eike Ziller
3d4d7c7e14 Merge remote-tracking branch 'origin/5.0'
Conflicts:
	src/plugins/clangtools/clangtoolssettings.cpp
	src/plugins/clangtools/executableinfo.cpp
	src/plugins/clangtools/executableinfo.h

Change-Id: Id8caf63e3e594792467d3447870086bd2d8f73b9
2021-09-13 17:03:55 +02:00
Alessandro Portale
3a26271660 Android: Fix build
Amends: e92418edca

Change-Id: I40615c2fa6e9b9cd98976c9ebfc56a9bdf1dd612
Reviewed-by: Aleksei German <aleksei.german@qt.io>
2021-09-07 11:44:48 +00:00
Assam Boudjelthia
e92418edca Fix minSdkVersion in deploy step
Deploy step uses AndroidManager::minimumSDK() which looks for the
version in the AndroidManifest.xml file which used to contain the
minimum and target sdk, but if the manifest doesn't contain that
value, this logic returns 0. So, return the defaultMinimumSDK()
in case the first way fails.

Change-Id: Id10e552d7c8de4d3544b7fa8f26ae5dd9e974df5
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-09-07 11:11:45 +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
c7061af61f Android: don't throw error on adb's "All files should be loaded." log
When installing a signed apk, adb might throw the following log
"All files should be loaded. Notifying the device." which is being
treated as an error and will stop the deployment from going forward
until user input is given. The current condition is not catching it
probably because it has a \n at the end, but let's treat it as a
warning.

Change-Id: If071730b39871b4e60f8755d14ba352b86e7c244
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-09-06 07:04:27 +00:00
hjk
062006b07f Android: Use FileUtils in AndroidDeployQtStep::createConfigWidget
Change-Id: Ib2ca0dbcdc811a6c130bf921845484b95039d076
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-08-24 11:45:58 +00:00
hjk
bd4a501f15 Replace some uses of HostOsInfo::withExecutableSuffix with FilePath
Change-Id: Id72e9fd04dd4995ff2775ee919f747018cbcc339
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-17 11:48:48 +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
Christian Stenger
d97335c4ea Android: Use line-based output callback
Change-Id: I5d2ede450ee3e36cc16d7f1566083125204ce552
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2021-06-09 06:38:02 +00:00
hjk
fde88f9f07 Android, Debugger: Simplify setUseCtrlCStub callers
The Windows-only restriction is nowadays handled inside QtcProcess.

Change-Id: I77d6914831ff172026665a429b497940c60970ac
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-04 09:59:28 +00:00
Christian Stenger
4f0759d7ea Utils: Remove couple of functions from QtcProcess
Some functions do not work and should therefore not be used.
Line-based processing of the output interferes with the internal
automatic usage of the ChannelBuffers.
Remove the respective functions and move the line parsing over
to the client.

Change-Id: Iaaa58c181e35e132fae863ddb808547142c99221
Reviewed-by: hjk <hjk@qt.io>
2021-06-03 13:40:03 +00:00
hjk
accb1e6e08 Utils: Make QtcProcess::{setW,w}orkingDirectory use FilePath
But keep the old setter for a while to ease transition.

Change-Id: If02b79b1fcd31fbf8b06ef26876c41af891127f9
Reviewed-by: hjk <hjk@qt.io>
2021-06-03 10:31:13 +00:00
hjk
e2cf0b52a7 Android: Don't check QtcProcess exit code
This is already baked into QtcProcess::Result.

Change-Id: I02b017c7d26b5c42ea4e00cea5c3b393274edfdc
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-06-02 14:21:23 +00:00
hjk
0ba4338467 Utils: Rename QtcProcess::Result::Finished to FinishedWithSuccess
To make clear that this is not just any finish.

Also change FinishedError to FinishedWithError, to create
symmetry.

Also adapt enum member description to reality.

Change-Id: I13e05391eb86fdb24e2ae660f14dfddb282e1104
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-06-02 14:16:36 +00:00
hjk
770d87709e Utils: Join SynchronousProcess::run and runBlocking implementations
Make functionality dependent on an (intentionally ugly)
setProcessUserEventWhileRunning call.

Also, back-paddle a bit on API combination of QtcProcess and
SynchronousPrceoss for now and prevent the QtcProcess-and-
runBlocking and SynchronousProcess-and-start combinations.

Goal is still to have all in QtcProcess in the end, but this
may take a while.

Change-Id: Ic146ec5db0ab8dc9613e5b2af5f4dc90bc7465ca
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-25 06:40:01 +00:00
hjk
90ad902486 Utils: Remove CommandLine argument from QtcProcess::run{,Blocking}
Makes run() more similar to what start() looks like.

Also add some asserts to make sure run() and related functions are
only called on SyncronousProcesses, as these are currently the only
ones where this works.

Change-Id: Idee6076c3f40a484db5c17f5bb348698cc83d220
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-19 13:01:51 +00:00
hjk
b2dc771d80 Utils: Simplify QtcProcess::exitMessage() interface
This was requiring parameters the process object already knows.

This is a slight behavior change in most cases, it now includes
always the command line arguments, which previously only happened
in gcctoolchain.cpp and iarewtoolchain.cpp.

Change-Id: Id25a68c397e2f1d8bf52ab29210e215b1de46c6d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-05-17 08:59:48 +00:00
hjk
55f768e1b0 Utils: Make process results accessible through QtcProcess object
The result is fully stored in the object anyway. Using the extra
SynchronousProcessResponse structure only causes copies of
the data and complicates access on the user side in
a lot of cases.

The result bits are now also accessible individually.

There's obvious room for follow-up changes on the topic, e.g.
ShellCommand::runCommand's parameter list could shrink to
just a SynchronousProcess parameter.

Change-Id: I45aa7eb23832340be06905929280c012e1217263
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-05-14 13:19:01 +00:00
hjk
c23cdd9262 Utils: Merge {synchronous,qtc}process.{h,cpp} file pairs
Mechanical to prepare merging the actual classes.
Adapting #includes.

Change-Id: I77a2c28129287778bc870c30cb890cd26bc2e62b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-10 09:47:51 +00:00
Alessandro Portale
a25ea9febe Android/iOS: Don't add markup to display names of build steps
The display name is continuously read and written from/to settings.
Let's not add markup each occurrence, it accumulates.

BuildStep::summaryText has the logic to add the markup for the UI.

Change-Id: Ifbb74ccb8d2f0adcebbd69cc012a5b1376154934
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2021-03-26 11:21:36 +00:00
Eike Ziller
863260f1fd Merge remote-tracking branch 'origin/4.15'
Conflicts:
	src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
	src/plugins/debugger/gdb/gdboptionspage.cpp

Change-Id: I4149e860b6842ea63bff3a7eb9632b7a6c2919d8
2021-03-22 09:52:14 +01:00
Eike Ziller
8a7b9fbdd4 Merge remote-tracking branch 'origin/4.14' into 4.15
Change-Id: I72ac4dab24021f0272a30400cc801387f0dcb558
2021-03-22 09:24:41 +01:00
Andy Shaw
7ec825be5e Android: Ignore an error when doing an incremental build
Since this is not really an error but it is outputted to stderr,
we need to explicitly ignore it so it does not show an error
dialog.

Change-Id: Ia972cf134278216c317649b5483e3deac683374d
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-03-20 09:29:27 +00:00
hjk
035a6ff031 Utils: Avoid intermediate widgets when using LayoutBuilder
In most cases, the layout constructed in the builder was set
on a widget which in turn was put into a vbox in the actual
widget. This is not necessary, but needs some re-ordering.

Also make sure that using not-yet-parented widgets during
layout construction does not cause visible artifacts.

Change-Id: I75727a571da093d3131ea6fba467c2c646cdb6f1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-16 11:37:44 +00:00
Alessandro Portale
ae5255cebd Android: Fix android-*-deployment-settings.json detection
Qt 6.0 + CMake: The name for the Android deployment settings file needs
to be determined by using the build key of the current run configuration
rather than by using the display name of the project root node.

Since in contrast to qmake/Qbs, CMake does not supply us with the file
name and we have to contruct it ourselves. Therefore, it makes sense to
move the value into the Android plugin.

This change adds AndroidQtVersion::androidDeploymentSettings which lets
qmake and Qbs still provide the value as before while handling the CMake
fallback.

Fixes: QTCREATORBUG-25209
Change-Id: I12314d06a45d6e045cb654d9140f9d2ed4602f67
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2021-02-18 09:34:48 +00:00
Assam Boudjelthia
6f17ad0562 Android: avoid QTC_ASSERT in addTask
Change-Id: I0b3eee749f21a031ff7b7f910b07719b03585759
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-11-26 19:03:01 +00:00
Assam Boudjelthia
34a7f6f9f2 Android: remove newline chars before adding output in error/warning pane
The output of androiddeployqt that is picked by QC, can contain newline
char at the start of the received line like:
"\nNote: Recompile with -Xlint:deprecation for details."
Such output is sould be only a warning
and not an error, that's we try to remove the newline from the start to
avdoid this behavior.

Fixes: QTCREATORBUG-24881
Change-Id: Iad7556917cb0f53dc691dfb316f999ad504976e9
Reviewed-by: hjk <hjk@qt.io>
2020-11-23 07:23:07 +00:00
Assam Boudjelthia
33b06f5b81 Android: avoid adding ANDROID_ABIS to the project file
Use buildSystem::property()/setProperty() to keep track of the
selected ABI and avoid polluting the *.pro file with it.

Task-number: QTCREATORBUG-24674
Change-Id: I5516a77c9f2d1a8975045e1d7c383e72c52db9d7
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2020-11-05 17:08:46 +00:00
Assam Boudjelthia
62e84f129a Android: fix "uninstall app first" checkbox placement
Change-Id: I2f79e9a5c344e5364fa377422f682f8e0c2927e2
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2020-10-26 07:13:30 +00:00