forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -28,6 +28,7 @@
|
|||||||
#include "webassemblyconstants.h"
|
#include "webassemblyconstants.h"
|
||||||
|
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
|
#include <projectexplorer/buildsystem.h>
|
||||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||||
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
|
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
@@ -55,12 +56,6 @@ static FilePath pythonInterpreter(const Environment &env)
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
static FilePath htmlFileInDir(const FilePath &dir)
|
|
||||||
{
|
|
||||||
const FilePaths htmlFiles = dir.dirEntries(QStringList("*.html"), QDir::Files);
|
|
||||||
return htmlFiles.isEmpty() ? FilePath() : htmlFiles.first();
|
|
||||||
}
|
|
||||||
|
|
||||||
static CommandLine emrunCommand(const RunConfiguration *rc, const QString &browser,
|
static CommandLine emrunCommand(const RunConfiguration *rc, const QString &browser,
|
||||||
const QString &port)
|
const QString &port)
|
||||||
{
|
{
|
||||||
@@ -68,7 +63,7 @@ static CommandLine emrunCommand(const RunConfiguration *rc, const QString &brows
|
|||||||
const Environment env = bc->environment();
|
const Environment env = bc->environment();
|
||||||
const FilePath emrun = env.searchInPath("emrun");
|
const FilePath emrun = env.searchInPath("emrun");
|
||||||
const FilePath emrunPy = emrun.absolutePath().pathAppended(emrun.baseName() + ".py");
|
const FilePath emrunPy = emrun.absolutePath().pathAppended(emrun.baseName() + ".py");
|
||||||
const FilePath html = htmlFileInDir(bc->buildDirectory());
|
const FilePath html = bc->buildDirectory() / rc->buildKey() + ".html";
|
||||||
|
|
||||||
return CommandLine(pythonInterpreter(env), {
|
return CommandLine(pythonInterpreter(env), {
|
||||||
emrunPy.path(),
|
emrunPy.path(),
|
||||||
@@ -103,17 +98,7 @@ public:
|
|||||||
"<port>").toUserOutput());
|
"<port>").toUserOutput());
|
||||||
});
|
});
|
||||||
|
|
||||||
update(); // FIXME: Looks spurious
|
connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update);
|
||||||
|
|
||||||
// FIXME: A case for acquaintSiblings?
|
|
||||||
connect(webBrowserAspect, &WebBrowserSelectionAspect::changed,
|
|
||||||
this, &RunConfiguration::update);
|
|
||||||
// FIXME: Is wrong after active build config changes, but probably
|
|
||||||
// not needed anyway.
|
|
||||||
connect(target->activeBuildConfiguration(), &BuildConfiguration::buildDirectoryChanged,
|
|
||||||
this, &RunConfiguration::update);
|
|
||||||
connect(target->project(), &Project::displayNameChanged,
|
|
||||||
this, &RunConfiguration::update);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -144,7 +129,6 @@ RunWorkerFactory::WorkerCreator makeEmrunWorker()
|
|||||||
// Factories
|
// Factories
|
||||||
|
|
||||||
EmrunRunConfigurationFactory::EmrunRunConfigurationFactory()
|
EmrunRunConfigurationFactory::EmrunRunConfigurationFactory()
|
||||||
: FixedRunConfigurationFactory(EmrunRunConfigurationFactory::tr("Launch with emrun"))
|
|
||||||
{
|
{
|
||||||
registerRunConfiguration<EmrunRunConfiguration>(Constants::WEBASSEMBLY_RUNCONFIGURATION_EMRUN);
|
registerRunConfiguration<EmrunRunConfiguration>(Constants::WEBASSEMBLY_RUNCONFIGURATION_EMRUN);
|
||||||
addSupportedTargetDeviceType(Constants::WEBASSEMBLY_DEVICE_TYPE);
|
addSupportedTargetDeviceType(Constants::WEBASSEMBLY_DEVICE_TYPE);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
namespace WebAssembly {
|
namespace WebAssembly {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class EmrunRunConfigurationFactory : public ProjectExplorer::FixedRunConfigurationFactory
|
class EmrunRunConfigurationFactory final : public ProjectExplorer::RunConfigurationFactory
|
||||||
{
|
{
|
||||||
Q_DECLARE_TR_FUNCTIONS(WebAssembly::Internal::EmrunRunConfigurationFactory)
|
Q_DECLARE_TR_FUNCTIONS(WebAssembly::Internal::EmrunRunConfigurationFactory)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user