Commit Graph

22 Commits

Author SHA1 Message Date
hjk
530b9ae85a ProjectExplorer: Copy more RunConfiguration data to RunControl
The aspects are now responsible for defining what data needs
to be copied and also to provide a suitable interface (kind
of source-compatible to direct use) for access.

The important change here is that RunControl::aspect(...) doesn't
need to access RunControl::runConfiguration() in fully aspectified
RunConfigurations anymore. In not-fully aspectified the runConfig
access is moved to the user code to make the problem visible there.
Long term, aspectification should be finished.

As an additional benefit, the resolving of macros etc can
now be done at the correct time.

Change-Id: I690d9f8f696ce9b4efd42082ba3f81b514efcb77
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-04-12 08:43:09 +00:00
Jarek Kobus
f1e973de79 RunControl: Drop IDevice * from doStart()
Use device set inside passed runnable instead.

Grep for all usages of RunControl::start().
If passed device wasn't nullptr, set this device
inside passed runnable. Otherwise ensure that
passed runnable contains device set to nullptr.

Change-Id: I06fd42a16246fa9fedd81eeb47481a217f887cb0
Reviewed-by: hjk <hjk@qt.io>
2022-02-23 16:28:01 +00:00
Alessandro Portale
0bbc465f61 WebAssembly: Improve browser selection combobox of run configuation
This adds a "Default Browser" entry to the browser selection combobox in
WebAssembly' run configuration. Choosing that omits the "--browser"
parameter and let's emrun determine which browser to launch (should by
the system default browser).

In order to implement that, the combobox items now got user data in
addition to have display data. The parsing of emrun's output was
extended to retrieve the long form of a browser name as display data:
"Mozilla Firefox 96.0.0.8041" instead of just "firefox".
The parsing of emrun's outout received a dedicated plugin test.

Turning the result in parseEmrunOutput() non-static fixed
QTCREATORBUG-26562

Fixes: QTCREATORBUG-25028
Fixes: QTCREATORBUG-26559
Change-Id: I18891b88b063903d1a9eeb88a6c906e596e561c1
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-01-25 11:49:22 +00:00
Alessandro Portale
09daa5ddfd WebAssembly: Fix launching of target.html with qmake-based projects
A recent fix for launching CMake-based projects (where target name
differs from project name) broke launching of any qmake-based project.

The reason for the failure is that the code uses to the buildKey in
order to determine the html file name. CMakeProjectManager holds a
buildKey that corresponts to the target name (which is the right base
name for the html file), but qmake holds the project file path as
buildKey.

This change causes the targetFilePath to be used to determine the html
filee name. It works with CMake and qmake.

Amends: b1db3d2506

Fixes: QTCREATORBUG-26849
Change-Id: Ifaa8a279317d7fdb54ceea8198a374a317d9c2d7
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-01-25 09:37:36 +00:00
Alessandro Portale
b1db3d2506 WebAssembly: Proper fix for targetname != projectname
Insipred by a similar fix in McuSupport, it became now clear to me how
to get the target name (aka buildkey) for a runconfiguration.

The hack of searching for .html files can be removed.

At the same time, remove the very detailed update connections, and just
update on Target::buildSystemUpdated.

Amends: dd1882b817

Task-number: QTCREATORBUG-26562
Change-Id: Ic07b36a1e618d6cc2b6f2ee50b4170170f707632
Reviewed-by: hjk <hjk@qt.io>
2021-12-17 17:14:36 +00:00
Alessandro Portale
dd1882b817 WebAssembly: fix the running of targets with name != project.name
The new QtQuick application wizard for Qt 6.2-based applications now
uses different names for the project and for the main target.

The WebAssembly plugin cannot construct the html file name for launching
like <projectname>.html, anymore. It instead would need to use
<targetname>.html for that.

The author of this patch did not manage to programmatically retrieve the
target name or buildkey. So, as a hack, we simply chose the first html
file that we find in the build directory.

Fixes: QTCREATORBUG-26562
Change-Id: I7e929fe265a15501c7275e2c76b7f5fa4ed1e6b5
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-11-16 13:39:21 +00:00
Alessandro Portale
cab210ad36 WebAssembly: Call emrun.py directly instead of via the wrapper script
From now on do on Linux and macOS what was already done on Windows in
order to launch a WebAssembly program: Directly call the emrun.py python
script instead of indirectly via the wrapper shell script.

The wrapper was too fragile. Also, this change consolidates the code
paths on the three host platforms a bit.

Fixes: QTCREATORBUG-25905
Fixes: QTCREATORBUG-26189
Change-Id: If79567e4dc688de460b38daa479becb53d3c5f03
Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-10-15 10:12:22 +00:00
hjk
52e5023bcc ProjectExplorer: Use Utils::CommandLine in ProjectExplorer::Runnable
Change-Id: Id965f1f9047dcbc3ea5c9ddaa550d12668cf8ae6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-13 15:04:30 +00:00
Alessandro Portale
2bc7f6603c WebAssembly: (Win) Use python.exe from EMSDK_PYTHON instead from Path
This affects Windows only. Instead of searching python.exe in the Path,
use the executable name which is stored in the "EMSDK_PYTHON"
environment variable (which is set by emsdk_env).

emsdk_env also prepends entries to Path, but not the one pointing to the
emsdk-shipped python interpreter. I believe that earlier versions of
emsdk_env used to add the python location to Path, else this is an old
bug.

Fixes: QTCREATORBUG-25897
Change-Id: I9b5bc43f865d19a862f8c6cd45105be54286a549
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-07-01 07:02:58 +00:00
Alessandro Portale
b057ea1ab8 WebAssembly: Revamp Emscripten SDK registration and toolchain handling
Qt Creator's ability to register Emscripten toolchains depended on an
SDK being activated "globally", and on the presence of the ~/.emscripten
file. Qt Creator would parse that file in order to determine the
location of the compiler and the necessary environment variables that
have to be set.

As of recently, the Emscripten SDK does neither activate gobally
anymore, nor is the ~/.emscripten generated. This change here addresses
the new situation in a couple of ways:

- Instead of trying to silently detect everything, add a UI
(IOptionsPageWidget) that lets the user select the Emscripten SDK root.
- Instead of parsing the ~/.emscripten file, parse the output of the
emsdk_env tool to determine the toolchain environment
(ToolChain::addToEnvironment). The parsing is cached. A test for the
parsing is included.
- Instead of registering the underlying clang as compiler, register the
emcc/em++ wrapper scripts, which are (also as of recently) compatible
with Qt Creator's way of determining gcc's predefined macros and built-
in header paths.

One Emscripten SDK is registered globally in Qt Creator. When changing
that, the previous Emscripten toolchains are removed, the new ones are
registered and the kit are "fixed" to use those.

On startup, an InfoBar entry is shown if Qt for Webassembly kits exist
and no Emscripten toolchains are present. That's the case for first-time
use after installing Qt for Webassembly via Qt SDK installer. The
InfoBar entry opens up the IOptionsPageWidget.

Qt 5.15.0 for WebAssembly and Emscripten SDK 1.39.0 are the minimum
supported versions. The new UI will show warnings accordingly.

Task-number: QTCREATORBUG-24811
Fixes: QTCREATORBUG-24822
Fixes: QTCREATORBUG-24814
Fixes: QTCREATORBUG-23741
Fixes: QTCREATORBUG-23561
Fixes: QTCREATORBUG-23160
Fixes: QTCREATORBUG-23126
Change-Id: I017c61586b17e815bb20a90e3f305a6bf705da36
Reviewed-by: hjk <hjk@qt.io>
2020-11-16 07:39:20 +00:00
hjk
51e7bce109 ProjectExplorer: Rename Base*Aspect to *Aspect
In most cases they are used directly, so there's not much Base* in that.

Added the old name as alias as porting help for a while.

Change-Id: I494a8a560b8996bcf74915ea3570b504df6a6b4c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-08-14 07:35:43 +00:00
hjk
430a33dcd9 Core/Utils: Migrate further to Utils::Id
The coreplugin/id.h header is kept for downstream for now.

Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-07-06 06:07:13 +00:00
Alessandro Portale
49ac9bb517 WebAssembly: Fix run configuration for Qt 5.15 app with emsdk 1.39.x
With Emscripten SDK 1.39.x, emrun quits and shuts down the web server
before the complete WebAssembly application can be fetched by the
browser.

Adding "--serve_after_close" to the emrun call restores the original
behavior. That parameter is accepted by previous Emscripten SDK versions
and seems to not change how it used behave in earlier versions.

Task-number: QTCREATORBUG-24072
Change-Id: Ie43604d42eb9c5a7cccd09fdf1c33391dc31098d
Reviewed-by: hjk <hjk@qt.io>
2020-05-25 06:32:51 +00:00
hjk
e5f8d81fc8 WebAssembly: Use new runconfiguration aspect update mechanism
And some questions.

Change-Id: Ibedf4ffaa77390c43b36c53ff80c571a47e7ec29
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-11-25 17:02:40 +00:00
Eike Ziller
34e8f58c47 Fix lupdate issues
Change-Id: Ib0cbb96a1a4857db5724f9d1e316b97bf2827dbd
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-11-04 14:06:09 +00:00
Tim Jenssen
51991e3a3e WebAssembly: fix crashes
Change-Id: I9a2a44c85a254628f119eb041036492bc3022cdf
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-10-28 06:55:14 +00:00
Alessandro Portale
6147584c97 WebAssembly: Update runconfiguration on Project::displayNameChanged
...since the runconfiguation uses the displayName.

Change-Id: Ieb382e237ab462fcf679a133c7cdaafb783569d4
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-10-09 10:37:25 +00:00
hjk
4028a41d2e ProjectExplorer: Use std::function for SimpleTargetRunner::start()
This spares us the typical r = runnable(); modify(r); setRunnable(r)
roundtrip and the m_runnable storage that might or might not
be the same as runControl->runnable. Similar for m_device.

Change-Id: I8300260dd8dd7cd395e40bcd3d2ae45089085008
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-04 11:08:34 +00:00
hjk
dca7edbeef Let PortsGatherer produce full URLs instead of ports only
This is what the consuming code expects in most cases.

Change-Id: I135592039e28b994996186f627215ab1d2f8d6dc
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2019-08-26 08:16:03 +00:00
hjk
f9c221eb54 ProjectExplorer: Re-work setup runworker factories
This combines two of the previous three paths to create run workers,
and refers to RunConfigurations by id, not by type where possible
to decrease coupling between the classes.

Only allow "type of run configuration" and "type of device"
as the only possible kind of restriction and require a uniform
RunWorker constructor signature.

Adapt user code to fit that pattern.

Change-Id: I5a6d49c9a144785fd0235d7586f244b56f67b366
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-08-09 12:34:42 +00:00
hjk
399f8d2dff WebAssembly: Drop run config inheritance from CustomExecutable
Also, auto-detect free port.

Change-Id: I377956ef20a928f1877d702162792e7cae75a202
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-08-07 10:53:21 +00:00
Alessandro Portale
b89ad81293 WebAssembly: Initial commit
This change adds WebAssembly support in the shape of a plugin.

- Auto-detection of the emsdk toolchain
- Handling of "asmjs-unknown-emscripten" Abi
- Binary detection of WebAssembly libraries
- Auto-creation of a "WebAssembly runtime" device (with icon)
- Runconfiguration that launches the application via the "emrun"
  tool which spawns a local web server and runs the application on
  the chosen web browser.

Limitations:
- So far only tested on Windows/MinGW and Linux
- Not yet tested with Qt WebAssembly installation form the installer
  Only tested with self-built Qt and manually added kit
- The attempt to launch an application via emrun, while a previous
  application is still running, will fail. The reason is that the
  web servers spawned by emrun listen to the same default port but
  serve only the content of one application.
  Possible solutions: We could either spawn the different web servers
  with different ports, or we could use one single web server instance
  which serves the whole default project location (home directory).

Task-number: QTCREATORBUG-21068
Task-number: QTCREATORBUG-22249
Change-Id: I1a16fbe52382d45c37e9bc624a943a6ca475fa09
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-07-25 13:17:51 +00:00