Commit 096c4db8 authored by BogDan Vatra's avatar BogDan Vatra Committed by Daniel Teske

Run zipalign tool after android packges is created and signed.

Change-Id: Idaeb93490723085b8f5f7cae356fbaee40636f89
Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent 7140a685
......@@ -390,6 +390,12 @@ Utils::FileName AndroidConfigurations::jarsignerPath() const
return openJDKBinPath().appendPath(jarsignerName);
}
Utils::FileName AndroidConfigurations::zipalignPath() const
{
Utils::FileName path = m_config.sdkLocation;
return path.appendPath(QLatin1String("tools/zipalign" ANDROID_EXE_SUFFIX));
}
QString AndroidConfigurations::getDeployDeviceSerialNumber(int *apiLevel) const
{
QVector<AndroidDeviceInfo> devices = connectedDevices();
......
......@@ -107,6 +107,7 @@ public:
Utils::FileName openJDKPath() const;
Utils::FileName keytoolPath() const;
Utils::FileName jarsignerPath() const;
Utils::FileName zipalignPath() const;
Utils::FileName stripPath(ProjectExplorer::Abi::Architecture architecture) const;
Utils::FileName readelfPath(ProjectExplorer::Abi::Architecture architecture) const;
QString getDeployDeviceSerialNumber(int *apiLevel) const;
......
......@@ -175,6 +175,7 @@ bool AndroidPackageCreationStep::init()
m_keystorePathForRun = m_keystorePath;
m_certificatePasswdForRun = m_certificatePasswd;
m_jarSigner = AndroidConfigurations::instance().jarsignerPath();
m_zipAligner = AndroidConfigurations::instance().zipalignPath();
initCheckRequiredLibrariesForRun();
return true;
}
......@@ -425,7 +426,7 @@ bool AndroidPackageCreationStep::createPackage()
<< QLatin1String("-storepass") << m_keystorePasswd
<< m_apkPathUnsigned.toUserOutput()
<< m_certificateAlias;
buildProc->start(m_jarSigner.toString(), build); //TODO
buildProc->start(m_jarSigner.toString(), build);
if (!buildProc->waitForStarted()) {
disconnect(buildProc, 0, this, 0);
buildProc->deleteLater();
......@@ -442,7 +443,12 @@ bool AndroidPackageCreationStep::createPackage()
emit addOutput(tr("Failed, try again"), ErrorMessageOutput);
m_certificatePasswdForRun.clear();
}
if (QFile::rename(m_apkPathUnsigned.toString(), m_apkPathSigned.toString())) {
build.clear();
build << QLatin1String("-f") << QLatin1String("-v") << QLatin1String("4") << m_apkPathUnsigned.toString() << m_apkPathSigned.toString();
buildProc->start(m_zipAligner.toString(), build);
buildProc->waitForFinished();
if (!buildProc->exitCode()) {
QFile::remove(m_apkPathUnsigned.toString());
emit addOutput(tr("Release signed package created to %1")
.arg(m_apkPathSigned.toUserOutput())
, MessageOutput);
......
......@@ -125,6 +125,7 @@ private:
Utils::FileName m_keystorePathForRun;
QString m_certificatePasswdForRun;
Utils::FileName m_jarSigner;
Utils::FileName m_zipAligner;
// more for checkLibraries
Utils::FileName m_appPath;
Utils::FileName m_readElf;
......
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