3 Commits

Author SHA1 Message Date
Assam Boudjelthia
2eeb35539c Android: fix warnings in runner script
Remove f-format prints that uses no placeholders.

Check if logcat_process is initialized before accessing it.

Remove unused import.

Pick-to: 6.8
Change-Id: I72cc34666460300b3b6b58174b3c7cefac27da7d
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2024-12-03 20:18:21 +00:00
Assam Boudjelthia
df3f5d88d3 Android: add option to run app detached to runner script
Allow the script to install, deploy and start the app without
waiting for the logs.

Pick-to: 6.8
Change-Id: Id852d827f627b902a75d1ed8101892552bd4202d
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2024-12-03 20:18:21 +00:00
Assam Boudjelthia
a905d26f14 CMake:Android: add wrapper scripts to easily run apps
Create a script that allows running an app or a test easily similar
to running on host. This improves development workflow and time by
allowing quick runs without having to manually call the various adb
commands to launch, get a pid of the app and then print the logcat,
let alone passing parameters or environment variables.

For normal apps, the app package name is retrieved by the script, run
and live logcat is printed as long as the app is still running.

For tests, the script calls androidtestrunner, allowing test parameters
to be passed to the test.

For CI debugging, this would save quite a lot of hussle and frustration
trying to run or debug a test app.

One other benefit for this is enabling running Android tests from Qt
Creator's testlib plugin without big changes to Qt Creator to support
androidtestrunner explicitly.

Because file(GENERATE) would fail if called twice for the same file,
I use file(WRITE). This is used because at the time of calling the
target executable finalizer, we don't know if the target is a test
or not, so we rely on writing the script first as a normal target,
then call it if the target is a test where it overrides the script.
For this also, parameters passed to the runner or androidtestrunner
can't handle generator expressions.

[ChangeLog][CMake][Android] Add wrapper scripts to run Android apps and
tests with ease from the host.

Task-number: QTBUG-129889
Change-Id: I84e85ce2bbf6944c8aa20bdc2c2b6d7b956bc748
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2024-10-16 20:40:08 +03:00