forked from qt-creator/qt-creator
Android: Tolerate empty build/deploy configurations
If there is no build or deploy configuration, just skip the building and deploying. Change-Id: I8b6f6d14100f366df5683eb77490d7c0dc588f94 Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
This commit is contained in:
@@ -121,10 +121,8 @@ bool AndroidDeployQtStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
|
|
||||||
AndroidBuildApkStep *androidBuildApkStep
|
AndroidBuildApkStep *androidBuildApkStep
|
||||||
= AndroidGlobal::buildStep<AndroidBuildApkStep>(target()->activeBuildConfiguration());
|
= AndroidGlobal::buildStep<AndroidBuildApkStep>(target()->activeBuildConfiguration());
|
||||||
if (!androidBuildApkStep) {
|
if (!androidBuildApkStep)
|
||||||
emit addOutput(tr("Cannot find the android build step."), OutputFormat::Stderr);
|
emit addOutput(tr("Cannot find the android build step."), OutputFormat::Stderr);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int deviceAPILevel = AndroidManager::minimumSDK(target());
|
int deviceAPILevel = AndroidManager::minimumSDK(target());
|
||||||
AndroidDeviceInfo info = earlierDeviceInfo(earlierSteps, Id);
|
AndroidDeviceInfo info = earlierDeviceInfo(earlierSteps, Id);
|
||||||
@@ -167,9 +165,11 @@ bool AndroidDeployQtStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
if (m_uninstallPreviousPackageRun)
|
if (m_uninstallPreviousPackageRun)
|
||||||
m_manifestName = AndroidManager::manifestPath(target());
|
m_manifestName = AndroidManager::manifestPath(target());
|
||||||
|
|
||||||
m_useAndroiddeployqt = version->qtVersion() >= QtSupport::QtVersionNumber(5, 4, 0);
|
AndroidQtSupport *qtSupport = AndroidManager::androidQtSupport(target());
|
||||||
|
m_useAndroiddeployqt = qtSupport && version->qtVersion() >= QtSupport::QtVersionNumber(5, 4, 0);
|
||||||
|
|
||||||
if (m_useAndroiddeployqt) {
|
if (m_useAndroiddeployqt) {
|
||||||
Utils::FileName tmp = AndroidManager::androidQtSupport(target())->androiddeployqtPath(target());
|
Utils::FileName tmp = qtSupport->androiddeployqtPath(target());
|
||||||
if (tmp.isEmpty()) {
|
if (tmp.isEmpty()) {
|
||||||
emit addOutput(tr("Cannot find the androiddeployqt tool."), OutputFormat::Stderr);
|
emit addOutput(tr("Cannot find the androiddeployqt tool."), OutputFormat::Stderr);
|
||||||
return false;
|
return false;
|
||||||
@@ -189,14 +189,14 @@ bool AndroidDeployQtStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Utils::QtcProcess::addArg(&m_androiddeployqtArgs, tmp.toString());
|
Utils::QtcProcess::addArg(&m_androiddeployqtArgs, tmp.toString());
|
||||||
if (androidBuildApkStep->useMinistro()) {
|
if (androidBuildApkStep && androidBuildApkStep->useMinistro()) {
|
||||||
Utils::QtcProcess::addArg(&m_androiddeployqtArgs, QLatin1String("--deployment"));
|
Utils::QtcProcess::addArg(&m_androiddeployqtArgs, QLatin1String("--deployment"));
|
||||||
Utils::QtcProcess::addArg(&m_androiddeployqtArgs, QLatin1String("ministro"));
|
Utils::QtcProcess::addArg(&m_androiddeployqtArgs, QLatin1String("ministro"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::QtcProcess::addArg(&m_androiddeployqtArgs, QLatin1String("--gradle"));
|
Utils::QtcProcess::addArg(&m_androiddeployqtArgs, QLatin1String("--gradle"));
|
||||||
|
|
||||||
if (androidBuildApkStep->signPackage()) {
|
if (androidBuildApkStep && androidBuildApkStep->signPackage()) {
|
||||||
// The androiddeployqt tool is not really written to do stand-alone installations.
|
// The androiddeployqt tool is not really written to do stand-alone installations.
|
||||||
// This hack forces it to use the correct filename for the apk file when installing
|
// This hack forces it to use the correct filename for the apk file when installing
|
||||||
// as a temporary fix until androiddeployqt gets the support. Since the --sign is
|
// as a temporary fix until androiddeployqt gets the support. Since the --sign is
|
||||||
@@ -208,12 +208,12 @@ bool AndroidDeployQtStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
} else {
|
} else {
|
||||||
m_uninstallPreviousPackageRun = true;
|
m_uninstallPreviousPackageRun = true;
|
||||||
m_command = AndroidConfigurations::currentConfig().adbToolPath().toString();
|
m_command = AndroidConfigurations::currentConfig().adbToolPath().toString();
|
||||||
m_apkPath = AndroidManager::androidQtSupport(target())->apkPath(target()).toString();
|
m_apkPath = qtSupport ? qtSupport->apkPath(target()).toString() : QString();
|
||||||
m_workingDirectory = bc->buildDirectory().toString();
|
m_workingDirectory = bc ? bc->buildDirectory().toString() : QString();
|
||||||
}
|
}
|
||||||
m_environment = bc->environment();
|
m_environment = bc ? bc->environment() : Utils::Environment();
|
||||||
|
|
||||||
m_buildDirectory = bc->buildDirectory().toString();
|
m_buildDirectory = bc ? bc->buildDirectory().toString() : QString();
|
||||||
|
|
||||||
m_adbPath = AndroidConfigurations::currentConfig().adbToolPath().toString();
|
m_adbPath = AndroidConfigurations::currentConfig().adbToolPath().toString();
|
||||||
|
|
||||||
@@ -379,6 +379,11 @@ void AndroidDeployQtStep::run(QFutureInterface<bool> &fi)
|
|||||||
emit setSerialNumber(serialNumber);
|
emit setSerialNumber(serialNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_apkPath.isEmpty()) { // nothing to deploy
|
||||||
|
reportRunResult(fi, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DeployErrorCode returnValue = runDeploy(fi);
|
DeployErrorCode returnValue = runDeploy(fi);
|
||||||
if (returnValue > DeployErrorCode::NoError && returnValue < DeployErrorCode::Failure) {
|
if (returnValue > DeployErrorCode::NoError && returnValue < DeployErrorCode::Failure) {
|
||||||
emit askForUninstall(returnValue);
|
emit askForUninstall(returnValue);
|
||||||
|
|||||||
@@ -203,10 +203,11 @@ Utils::FileName AndroidManager::dirPath(ProjectExplorer::Target *target)
|
|||||||
|
|
||||||
Utils::FileName AndroidManager::manifestSourcePath(ProjectExplorer::Target *target)
|
Utils::FileName AndroidManager::manifestSourcePath(ProjectExplorer::Target *target)
|
||||||
{
|
{
|
||||||
AndroidQtSupport *androidQtSupport = AndroidManager::androidQtSupport(target);
|
if (AndroidQtSupport *androidQtSupport = AndroidManager::androidQtSupport(target)) {
|
||||||
Utils::FileName source = androidQtSupport->manifestSourcePath(target);
|
Utils::FileName source = androidQtSupport->manifestSourcePath(target);
|
||||||
if (!source.isEmpty())
|
if (!source.isEmpty())
|
||||||
return source;
|
return source;
|
||||||
|
}
|
||||||
return manifestPath(target);
|
return manifestPath(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user