forked from qt-creator/qt-creator
Profile introduction
Introduce Profiles to store sets of values that describe a system/device. These profiles are held by a target, getting rid of much of the information stored in the Build-/Run-/DeployConfigurations, greatly simplifying those. This is a squash of the wip/profile branch which has been on gerrit for a while, rebased to current master. Change-Id: I25956c8dd4d1962b2134bfaa8a8076ae3909460f Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
@@ -124,16 +124,16 @@ QLatin1String AndroidConfigurations::toolsPrefix(ProjectExplorer::Abi::Architect
|
||||
AndroidConfig::AndroidConfig(const QSettings &settings)
|
||||
{
|
||||
// user settings
|
||||
armGdbLocation = settings.value(ArmGdbLocationKey).toString();
|
||||
armGdbserverLocation = settings.value(ArmGdbserverLocationKey).toString();
|
||||
x86GdbLocation = settings.value(X86GdbLocationKey).toString();
|
||||
x86GdbserverLocation = settings.value(X86GdbserverLocationKey).toString();
|
||||
armGdbLocation = Utils::FileName::fromString(settings.value(ArmGdbLocationKey).toString());
|
||||
armGdbserverLocation = Utils::FileName::fromString(settings.value(ArmGdbserverLocationKey).toString());
|
||||
x86GdbLocation = Utils::FileName::fromString(settings.value(X86GdbLocationKey).toString());
|
||||
x86GdbserverLocation = Utils::FileName::fromString(settings.value(X86GdbserverLocationKey).toString());
|
||||
partitionSize = settings.value(PartitionSizeKey, 1024).toInt();
|
||||
sdkLocation = settings.value(SDKLocationKey).toString();
|
||||
ndkLocation = settings.value(NDKLocationKey).toString();
|
||||
antLocation = settings.value(AntLocationKey).toString();
|
||||
openJDKLocation = settings.value(OpenJDKLocationKey).toString();
|
||||
keystoreLocation = settings.value(KeystoreLocationKey).toString();
|
||||
sdkLocation = Utils::FileName::fromString(settings.value(SDKLocationKey).toString());
|
||||
ndkLocation = Utils::FileName::fromString(settings.value(NDKLocationKey).toString());
|
||||
antLocation = Utils::FileName::fromString(settings.value(AntLocationKey).toString());
|
||||
openJDKLocation = Utils::FileName::fromString(settings.value(OpenJDKLocationKey).toString());
|
||||
keystoreLocation = Utils::FileName::fromString(settings.value(KeystoreLocationKey).toString());
|
||||
|
||||
QRegExp versionRegExp(NDKGccVersionRegExp);
|
||||
const QString &value = settings.value(NDKToolchainVersionKey).toString();
|
||||
@@ -147,11 +147,11 @@ AndroidConfig::AndroidConfig(const QSettings &settings)
|
||||
if (reader.load(settingsFileName())
|
||||
&& settings.value(changeTimeStamp).toInt() != QFileInfo(settingsFileName()).lastModified().toMSecsSinceEpoch() / 1000) {
|
||||
// persisten settings
|
||||
sdkLocation = reader.restoreValue(SDKLocationKey).toString();
|
||||
ndkLocation = reader.restoreValue(NDKLocationKey).toString();
|
||||
antLocation = reader.restoreValue(AntLocationKey).toString();
|
||||
openJDKLocation = reader.restoreValue(OpenJDKLocationKey).toString();
|
||||
keystoreLocation = reader.restoreValue(KeystoreLocationKey).toString();
|
||||
sdkLocation = Utils::FileName::fromString(reader.restoreValue(SDKLocationKey).toString());
|
||||
ndkLocation = Utils::FileName::fromString(reader.restoreValue(NDKLocationKey).toString());
|
||||
antLocation = Utils::FileName::fromString(reader.restoreValue(AntLocationKey).toString());
|
||||
openJDKLocation = Utils::FileName::fromString(reader.restoreValue(OpenJDKLocationKey).toString());
|
||||
keystoreLocation = Utils::FileName::fromString(reader.restoreValue(KeystoreLocationKey).toString());
|
||||
|
||||
QRegExp versionRegExp(NDKGccVersionRegExp);
|
||||
const QString &value = reader.restoreValue(NDKToolchainVersionKey).toString();
|
||||
@@ -160,17 +160,17 @@ AndroidConfig::AndroidConfig(const QSettings &settings)
|
||||
else
|
||||
ndkToolchainVersion = value.mid(versionRegExp.indexIn(value));
|
||||
|
||||
if (!armGdbLocation.length())
|
||||
armGdbLocation = reader.restoreValue(ArmGdbLocationKey).toString();
|
||||
if (armGdbLocation.isEmpty())
|
||||
armGdbLocation = Utils::FileName::fromString(reader.restoreValue(ArmGdbLocationKey).toString());
|
||||
|
||||
if (!armGdbserverLocation.length())
|
||||
armGdbserverLocation = reader.restoreValue(ArmGdbserverLocationKey).toString();
|
||||
if (armGdbserverLocation.isEmpty())
|
||||
armGdbserverLocation = Utils::FileName::fromString(reader.restoreValue(ArmGdbserverLocationKey).toString());
|
||||
|
||||
if (!x86GdbLocation.length())
|
||||
x86GdbLocation = reader.restoreValue(X86GdbLocationKey).toString();
|
||||
if (x86GdbLocation.isEmpty())
|
||||
x86GdbLocation = Utils::FileName::fromString(reader.restoreValue(X86GdbLocationKey).toString());
|
||||
|
||||
if (!x86GdbserverLocation.length())
|
||||
x86GdbserverLocation = reader.restoreValue(X86GdbserverLocationKey).toString();
|
||||
if (x86GdbserverLocation.isEmpty())
|
||||
x86GdbserverLocation = Utils::FileName::fromString(reader.restoreValue(X86GdbserverLocationKey).toString());
|
||||
// persistent settings
|
||||
}
|
||||
|
||||
@@ -188,16 +188,16 @@ void AndroidConfig::save(QSettings &settings) const
|
||||
settings.setValue(changeTimeStamp, fileInfo.lastModified().toMSecsSinceEpoch() / 1000);
|
||||
|
||||
// user settings
|
||||
settings.setValue(SDKLocationKey, sdkLocation);
|
||||
settings.setValue(NDKLocationKey, ndkLocation);
|
||||
settings.setValue(SDKLocationKey, sdkLocation.toString());
|
||||
settings.setValue(NDKLocationKey, ndkLocation.toString());
|
||||
settings.setValue(NDKToolchainVersionKey, ndkToolchainVersion);
|
||||
settings.setValue(AntLocationKey, antLocation);
|
||||
settings.setValue(OpenJDKLocationKey, openJDKLocation);
|
||||
settings.setValue(KeystoreLocationKey, keystoreLocation);
|
||||
settings.setValue(ArmGdbLocationKey, armGdbLocation);
|
||||
settings.setValue(ArmGdbserverLocationKey, armGdbserverLocation);
|
||||
settings.setValue(X86GdbLocationKey, x86GdbLocation);
|
||||
settings.setValue(X86GdbserverLocationKey, x86GdbserverLocation);
|
||||
settings.setValue(AntLocationKey, antLocation.toString());
|
||||
settings.setValue(OpenJDKLocationKey, openJDKLocation.toString());
|
||||
settings.setValue(KeystoreLocationKey, keystoreLocation.toString());
|
||||
settings.setValue(ArmGdbLocationKey, armGdbLocation.toString());
|
||||
settings.setValue(ArmGdbserverLocationKey, armGdbserverLocation.toString());
|
||||
settings.setValue(X86GdbLocationKey, x86GdbLocation.toString());
|
||||
settings.setValue(X86GdbserverLocationKey, x86GdbserverLocation.toString());
|
||||
settings.setValue(PartitionSizeKey, partitionSize);
|
||||
// user settings
|
||||
|
||||
@@ -214,7 +214,7 @@ void AndroidConfigurations::setConfig(const AndroidConfig &devConfigs)
|
||||
void AndroidConfigurations::updateAvailablePlatforms()
|
||||
{
|
||||
m_availablePlatforms.clear();
|
||||
QDirIterator it(m_config.ndkLocation + QLatin1String("/platforms"), QStringList() << QLatin1String("android-*"), QDir::Dirs);
|
||||
QDirIterator it(m_config.ndkLocation.appendPath(QLatin1String("platforms")).toString(), QStringList() << QLatin1String("android-*"), QDir::Dirs);
|
||||
while (it.hasNext()) {
|
||||
const QString &fileName = it.next();
|
||||
m_availablePlatforms.push_back(fileName.mid(fileName.lastIndexOf(QLatin1Char('-')) + 1).toInt());
|
||||
@@ -226,7 +226,7 @@ QStringList AndroidConfigurations::sdkTargets(int minApiLevel) const
|
||||
{
|
||||
QStringList targets;
|
||||
QProcess proc;
|
||||
proc.start(androidToolPath(), QStringList() << QLatin1String("list") << QLatin1String("target")); // list avaialbe AVDs
|
||||
proc.start(androidToolPath().toString(), QStringList() << QLatin1String("list") << QLatin1String("target")); // list avaialbe AVDs
|
||||
if (!proc.waitForFinished(-1)) {
|
||||
proc.terminate();
|
||||
return targets;
|
||||
@@ -248,7 +248,8 @@ QStringList AndroidConfigurations::ndkToolchainVersions() const
|
||||
{
|
||||
QRegExp versionRegExp(NDKGccVersionRegExp);
|
||||
QStringList result;
|
||||
QDirIterator it(m_config.ndkLocation + QLatin1String("/toolchains"),
|
||||
Utils::FileName path = m_config.ndkLocation;
|
||||
QDirIterator it(path.appendPath(QLatin1String("toolchains")).toString(),
|
||||
QStringList() << QLatin1String("*"), QDir::Dirs);
|
||||
while (it.hasNext()) {
|
||||
const QString &fileName = it.next();
|
||||
@@ -262,66 +263,71 @@ QStringList AndroidConfigurations::ndkToolchainVersions() const
|
||||
return result;
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::adbToolPath() const
|
||||
Utils::FileName AndroidConfigurations::adbToolPath() const
|
||||
{
|
||||
return m_config.sdkLocation + QLatin1String("/platform-tools/adb" ANDROID_EXE_SUFFIX);
|
||||
Utils::FileName path = m_config.sdkLocation;
|
||||
return path.appendPath(QLatin1String("platform-tools/adb"ANDROID_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::androidToolPath() const
|
||||
Utils::FileName AndroidConfigurations::androidToolPath() const
|
||||
{
|
||||
#ifdef Q_OS_WIN32
|
||||
// I want to switch from using android.bat to using an executable. All it really does is call
|
||||
// Java and I've made some progress on it. So if android.exe exists, return that instead.
|
||||
QFileInfo fi(m_config.sdkLocation + QLatin1String("/tools/android" ANDROID_EXE_SUFFIX));
|
||||
if (fi.exists())
|
||||
return m_config.sdkLocation + QString("/tools/android" ANDROID_EXE_SUFFIX);
|
||||
else
|
||||
return m_config.sdkLocation + QLatin1String("/tools/android" ANDROID_BAT_SUFFIX);
|
||||
Utils::FileName path = m_config.sdkLocation;
|
||||
path.appendPath(QLatin1String("tools/android"ANDROID_EXE_SUFFIX));
|
||||
if (path.toFileInfo().exists())
|
||||
return path;
|
||||
path = m_config.sdkLocation;
|
||||
return path.appendPath(QLatin1String("tools/android"ANDROID_BAT_SUFFIX));
|
||||
#else
|
||||
return m_config.sdkLocation + QLatin1String("/tools/android" ANDROID_EXE_SUFFIX);
|
||||
Utils::FileName path = m_config.sdkLocation;
|
||||
return path.appendPath(QLatin1String("tools/android"ANDROID_EXE_SUFFIX));
|
||||
#endif
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::antToolPath() const
|
||||
Utils::FileName AndroidConfigurations::antToolPath() const
|
||||
{
|
||||
if (m_config.antLocation.length())
|
||||
if (!m_config.antLocation.isEmpty())
|
||||
return m_config.antLocation;
|
||||
else
|
||||
return QLatin1String("ant");
|
||||
return Utils::FileName::fromString(QLatin1String("ant"));
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::emulatorToolPath() const
|
||||
Utils::FileName AndroidConfigurations::emulatorToolPath() const
|
||||
{
|
||||
return m_config.sdkLocation + QLatin1String("/tools/emulator" ANDROID_EXE_SUFFIX);
|
||||
Utils::FileName path = m_config.sdkLocation;
|
||||
return path.appendPath(QLatin1String("tools/emulator"ANDROID_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::toolPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
Utils::FileName AndroidConfigurations::toolPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
{
|
||||
return m_config.ndkLocation + QString::fromLatin1("/toolchains/%1-%2/prebuilt/%3/bin/%4")
|
||||
Utils::FileName path = m_config.ndkLocation;
|
||||
return path.appendPath(QString::fromLatin1("toolchains/%1-%2/prebuilt/%3/bin/%4")
|
||||
.arg(toolchainPrefix(architecture))
|
||||
.arg(m_config.ndkToolchainVersion)
|
||||
.arg(ToolchainHost)
|
||||
.arg(toolsPrefix(architecture));
|
||||
.arg(toolsPrefix(architecture)));
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::stripPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
Utils::FileName AndroidConfigurations::stripPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
{
|
||||
return toolPath(architecture) + QLatin1String("-strip" ANDROID_EXE_SUFFIX);
|
||||
return toolPath(architecture).append(QLatin1String("-strip"ANDROID_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::readelfPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
Utils::FileName AndroidConfigurations::readelfPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
{
|
||||
return toolPath(architecture) + QLatin1String("-readelf" ANDROID_EXE_SUFFIX);
|
||||
return toolPath(architecture).append(QLatin1String("-readelf"ANDROID_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::gccPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
Utils::FileName AndroidConfigurations::gccPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
{
|
||||
return toolPath(architecture) + QLatin1String("-gcc" ANDROID_EXE_SUFFIX);
|
||||
return toolPath(architecture).append(QLatin1String("-gcc"ANDROID_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::gdbServerPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
Utils::FileName AndroidConfigurations::gdbServerPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
{
|
||||
QString gdbServerPath;
|
||||
Utils::FileName gdbServerPath;
|
||||
switch (architecture) {
|
||||
case ProjectExplorer::Abi::ArmArchitecture:
|
||||
gdbServerPath = m_config.armGdbserverLocation;
|
||||
@@ -330,20 +336,21 @@ QString AndroidConfigurations::gdbServerPath(ProjectExplorer::Abi::Architecture
|
||||
gdbServerPath = m_config.x86GdbserverLocation;
|
||||
break;
|
||||
default:
|
||||
gdbServerPath = Unknown;
|
||||
gdbServerPath = Utils::FileName::fromString(Unknown);
|
||||
break;
|
||||
}
|
||||
|
||||
if (gdbServerPath.length())
|
||||
if (!gdbServerPath.isEmpty())
|
||||
return gdbServerPath;
|
||||
return m_config.ndkLocation + QString::fromLatin1("/toolchains/%1-%2/prebuilt/gdbserver")
|
||||
.arg(toolchainPrefix(architecture))
|
||||
.arg(m_config.ndkToolchainVersion);
|
||||
Utils::FileName path = m_config.ndkLocation;
|
||||
return path.appendPath(QString::fromLatin1("toolchains/%1-%2/prebuilt/gdbserver")
|
||||
.arg(toolchainPrefix(architecture))
|
||||
.arg(m_config.ndkToolchainVersion));
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::gdbPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
Utils::FileName AndroidConfigurations::gdbPath(ProjectExplorer::Abi::Architecture architecture) const
|
||||
{
|
||||
QString gdbPath;
|
||||
Utils::FileName gdbPath;
|
||||
switch (architecture) {
|
||||
case ProjectExplorer::Abi::ArmArchitecture:
|
||||
gdbPath = m_config.armGdbLocation;
|
||||
@@ -352,45 +359,47 @@ QString AndroidConfigurations::gdbPath(ProjectExplorer::Abi::Architecture archit
|
||||
gdbPath = m_config.x86GdbLocation;
|
||||
break;
|
||||
default:
|
||||
gdbPath = Unknown;
|
||||
gdbPath = Utils::FileName::fromString(Unknown);
|
||||
break;
|
||||
}
|
||||
if (!gdbPath.isEmpty())
|
||||
return gdbPath;
|
||||
return toolPath(architecture) + QLatin1String("-gdb" ANDROID_EXE_SUFFIX);
|
||||
return toolPath(architecture).append(QLatin1String("-gdb"ANDROID_EXE_SUFFIX));
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::openJDKPath() const
|
||||
Utils::FileName AndroidConfigurations::openJDKPath() const
|
||||
{
|
||||
return m_config.openJDKLocation;
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::openJDKBinPath() const
|
||||
Utils::FileName AndroidConfigurations::openJDKBinPath() const
|
||||
{
|
||||
if (m_config.openJDKLocation.length())
|
||||
return m_config.openJDKLocation + QLatin1String("/bin/");
|
||||
return QString();
|
||||
Utils::FileName path = m_config.openJDKLocation;
|
||||
if (!path.isEmpty())
|
||||
return path.appendPath(QLatin1String("bin"));
|
||||
return path;
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::keytoolPath() const
|
||||
Utils::FileName AndroidConfigurations::keytoolPath() const
|
||||
{
|
||||
return openJDKBinPath() + keytoolName;
|
||||
return openJDKBinPath().appendPath(keytoolName);
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::jarsignerPath() const
|
||||
Utils::FileName AndroidConfigurations::jarsignerPath() const
|
||||
{
|
||||
return openJDKBinPath() + jarsignerName;
|
||||
return openJDKBinPath().appendPath(jarsignerName);
|
||||
}
|
||||
|
||||
QString AndroidConfigurations::getDeployDeviceSerialNumber(int *apiLevel) const
|
||||
{
|
||||
QVector<AndroidDevice> devices = connectedDevices();
|
||||
|
||||
foreach (AndroidDevice device, devices)
|
||||
foreach (AndroidDevice device, devices) {
|
||||
if (device.sdk >= *apiLevel) {
|
||||
*apiLevel = device.sdk;
|
||||
return device.serialNumber;
|
||||
}
|
||||
}
|
||||
return startAVD(apiLevel);
|
||||
}
|
||||
|
||||
@@ -398,7 +407,7 @@ QVector<AndroidDevice> AndroidConfigurations::connectedDevices(int apiLevel) con
|
||||
{
|
||||
QVector<AndroidDevice> devices;
|
||||
QProcess adbProc;
|
||||
adbProc.start(adbToolPath(), QStringList() << QLatin1String("devices"));
|
||||
adbProc.start(adbToolPath().toString(), QStringList() << QLatin1String("devices"));
|
||||
if (!adbProc.waitForFinished(-1)) {
|
||||
adbProc.terminate();
|
||||
return devices;
|
||||
@@ -443,7 +452,7 @@ bool AndroidConfigurations::createAVD(int minApiLevel) const
|
||||
bool AndroidConfigurations::createAVD(const QString &target, const QString &name, int sdcardSize ) const
|
||||
{
|
||||
QProcess proc;
|
||||
proc.start(androidToolPath(),
|
||||
proc.start(androidToolPath().toString(),
|
||||
QStringList() << QLatin1String("create") << QLatin1String("avd")
|
||||
<< QLatin1String("-a") << QLatin1String("-t") << target
|
||||
<< QLatin1String("-n") << name
|
||||
@@ -461,7 +470,7 @@ bool AndroidConfigurations::createAVD(const QString &target, const QString &name
|
||||
bool AndroidConfigurations::removeAVD(const QString &name) const
|
||||
{
|
||||
QProcess proc;
|
||||
proc.start(androidToolPath(),
|
||||
proc.start(androidToolPath().toString(),
|
||||
QStringList() << QLatin1String("delete") << QLatin1String("avd")
|
||||
<< QLatin1String("-n") << name);
|
||||
if (!proc.waitForFinished(-1)) {
|
||||
@@ -475,7 +484,7 @@ QVector<AndroidDevice> AndroidConfigurations::androidVirtualDevices() const
|
||||
{
|
||||
QVector<AndroidDevice> devices;
|
||||
QProcess proc;
|
||||
proc.start(androidToolPath(),
|
||||
proc.start(androidToolPath().toString(),
|
||||
QStringList() << QLatin1String("list") << QLatin1String("avd")); // list available AVDs
|
||||
if (!proc.waitForFinished(-1)) {
|
||||
proc.terminate();
|
||||
@@ -540,7 +549,7 @@ QString AndroidConfigurations::startAVD(int *apiLevel, const QString &name) cons
|
||||
return avdName;
|
||||
|
||||
// start the emulator
|
||||
m_avdProcess->start(emulatorToolPath(),
|
||||
m_avdProcess->start(emulatorToolPath().toString(),
|
||||
QStringList() << QLatin1String("-partition-size") << QString::number(config().partitionSize)
|
||||
<< QLatin1String("-avd") << avdName);
|
||||
if (!m_avdProcess->waitForStarted(-1)) {
|
||||
@@ -550,7 +559,7 @@ QString AndroidConfigurations::startAVD(int *apiLevel, const QString &name) cons
|
||||
|
||||
// wait until the emulator is online
|
||||
QProcess proc;
|
||||
proc.start(adbToolPath(), QStringList() << QLatin1String("-e") << QLatin1String("wait-for-device"));
|
||||
proc.start(adbToolPath().toString(), QStringList() << QLatin1String("-e") << QLatin1String("wait-for-device"));
|
||||
if (!proc.waitForFinished(-1)) {
|
||||
proc.terminate();
|
||||
return QString();
|
||||
@@ -558,7 +567,7 @@ QString AndroidConfigurations::startAVD(int *apiLevel, const QString &name) cons
|
||||
sleep(5);// wait for pm to start
|
||||
|
||||
// workaround for stupid adb bug
|
||||
proc.start(adbToolPath(), QStringList() << QLatin1String("devices"));
|
||||
proc.start(adbToolPath().toString(), QStringList() << QLatin1String("devices"));
|
||||
if (!proc.waitForFinished(-1)) {
|
||||
proc.terminate();
|
||||
return QString();
|
||||
@@ -577,7 +586,7 @@ int AndroidConfigurations::getSDKVersion(const QString &device) const
|
||||
{
|
||||
|
||||
QProcess adbProc;
|
||||
adbProc.start(adbToolPath(),
|
||||
adbProc.start(adbToolPath().toString(),
|
||||
QStringList() << QLatin1String("-s") << device
|
||||
<< QLatin1String("shell") << QLatin1String("getprop")
|
||||
<< QLatin1String("ro.build.version.sdk"));
|
||||
|
||||
Reference in New Issue
Block a user