Commit cb6eaa3c authored by Daniel Teske's avatar Daniel Teske
Browse files

Android: Set JAVA_HOME in environment and use that environment



Change-Id: Ia0f3abad74b7ac423fab621ca22e0f698747c477
Reviewed-by: default avatarBogDan Vatra <bogdan@kde.org>
Reviewed-by: default avatarRay Donnelly <mingw.android@gmail.com>
parent 8127ebe2
......@@ -611,9 +611,14 @@ void AndroidManager::updateTarget(ProjectExplorer::Target *target, const QString
{
QString androidDir = dirPath(target).toString();
Utils::Environment env = Utils::Environment::systemEnvironment();
QString javaHome = AndroidConfigurations::instance().config().openJDKLocation.toString();
if (!javaHome.isEmpty())
env.set(QLatin1String("JAVA_HOME"), javaHome);
// clean previous build
QProcess androidProc;
androidProc.setWorkingDirectory(androidDir);
androidProc.setProcessEnvironment(env.toProcessEnvironment());
androidProc.start(AndroidConfigurations::instance().antToolPath().toString(),
QStringList() << QLatin1String("clean"));
if (!androidProc.waitForFinished(-1))
......
......@@ -169,6 +169,7 @@ bool AndroidPackageCreationStep::init()
m_certificatePasswdForRun = m_certificatePasswd;
m_jarSigner = AndroidConfigurations::instance().jarsignerPath();
m_zipAligner = AndroidConfigurations::instance().zipalignPath();
m_environment = bc->environment();
ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(target()->kit());
if (tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE))
......@@ -702,6 +703,7 @@ bool AndroidPackageCreationStep::createPackage()
emit addOutput(tr("Creating package file ..."), MessageOutput);
QProcess *const buildProc = new QProcess;
buildProc->setProcessEnvironment(m_environment.toProcessEnvironment());
connect(buildProc, SIGNAL(readyReadStandardOutput()), this,
SLOT(handleBuildStdOutOutput()));
......
......@@ -35,6 +35,7 @@
#include <projectexplorer/abi.h>
#include <projectexplorer/buildstep.h>
#include <utils/environment.h>
#include <QAbstractItemModel>
......@@ -140,10 +141,10 @@ private:
QStringList m_qtLibsWithDependencies;
QVector<AndroidManager::Library> m_availableQtLibs;
QStringList m_prebundledLibs;
QStringList m_bundledJars;
QStringList m_otherBundledFiles;
bool m_bundleQt;
Utils::Environment m_environment;
};
} // namespace Internal
......
......@@ -115,6 +115,9 @@ void AndroidToolChain::addToEnvironment(Environment &env) const
env.set(QLatin1String("ANDROID_NDK_TOOLCHAIN_PREFIX"), AndroidConfigurations::toolchainPrefix(targetAbi().architecture()));
env.set(QLatin1String("ANDROID_NDK_TOOLS_PREFIX"), AndroidConfigurations::toolsPrefix(targetAbi().architecture()));
env.set(QLatin1String("ANDROID_NDK_TOOLCHAIN_VERSION"), m_ndkToolChainVersion);
QString javaHome = AndroidConfigurations::instance().openJDKPath().toString();
if (!javaHome.isEmpty() && QFileInfo(javaHome).exists())
env.set(QLatin1String("JAVA_HOME"), javaHome);
}
bool AndroidToolChain::operator ==(const ToolChain &tc) const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment