forked from qt-creator/qt-creator
Android: Hide AndroidToolchainFactory in .cpp
Change-Id: Ic820eea1b597eefc850407d75fd4a4c3a0a9985d Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -1148,8 +1148,7 @@ void AndroidConfigurations::registerNewToolchains()
|
|||||||
const Toolchains existingAndroidToolchains
|
const Toolchains existingAndroidToolchains
|
||||||
= ToolchainManager::toolchains(Utils::equal(&Toolchain::typeId, Id(Constants::ANDROID_TOOLCHAIN_TYPEID)));
|
= ToolchainManager::toolchains(Utils::equal(&Toolchain::typeId, Id(Constants::ANDROID_TOOLCHAIN_TYPEID)));
|
||||||
|
|
||||||
const Toolchains newToolchains = AndroidToolchainFactory::autodetectToolchains(
|
const Toolchains newToolchains = autodetectToolchains(existingAndroidToolchains);
|
||||||
existingAndroidToolchains);
|
|
||||||
|
|
||||||
for (Toolchain *tc : newToolchains)
|
for (Toolchain *tc : newToolchains)
|
||||||
ToolchainManager::registerToolchain(tc);
|
ToolchainManager::registerToolchain(tc);
|
||||||
@@ -1310,9 +1309,8 @@ void AndroidConfigurations::registerCustomToolchainsAndDebuggers()
|
|||||||
|
|
||||||
const FilePaths customNdks = FileUtils::toFilePathList(currentConfig().getCustomNdkList());
|
const FilePaths customNdks = FileUtils::toFilePathList(currentConfig().getCustomNdkList());
|
||||||
const Toolchains customToolchains
|
const Toolchains customToolchains
|
||||||
= AndroidToolchainFactory::autodetectToolchainsFromNdks(existingAndroidToolchains,
|
= autodetectToolchainsFromNdks(existingAndroidToolchains, customNdks, true);
|
||||||
customNdks,
|
|
||||||
true);
|
|
||||||
for (Toolchain *tc : customToolchains) {
|
for (Toolchain *tc : customToolchains) {
|
||||||
ToolchainManager::registerToolchain(tc);
|
ToolchainManager::registerToolchain(tc);
|
||||||
const auto androidToolchain = static_cast<AndroidToolchain *>(tc);
|
const auto androidToolchain = static_cast<AndroidToolchain *>(tc);
|
||||||
|
@@ -134,14 +134,6 @@ GccToolchain::DetectedAbisResult AndroidToolchain::detectSupportedAbis() const
|
|||||||
|
|
||||||
// AndroidToolchainFactory
|
// AndroidToolchainFactory
|
||||||
|
|
||||||
AndroidToolchainFactory::AndroidToolchainFactory()
|
|
||||||
{
|
|
||||||
setDisplayName(Tr::tr("Android Clang"));
|
|
||||||
setSupportedToolchainType(Constants::ANDROID_TOOLCHAIN_TYPEID);
|
|
||||||
setSupportedLanguages({ProjectExplorer::Constants::CXX_LANGUAGE_ID});
|
|
||||||
setToolchainConstructor([] { return new AndroidToolchain; });
|
|
||||||
}
|
|
||||||
|
|
||||||
static FilePath clangPlusPlusPath(const FilePath &clangPath)
|
static FilePath clangPlusPlusPath(const FilePath &clangPath)
|
||||||
{
|
{
|
||||||
return clangPath.parentDir().pathAppended(clangPath.baseName() + "++").withExecutableSuffix();
|
return clangPath.parentDir().pathAppended(clangPath.baseName() + "++").withExecutableSuffix();
|
||||||
@@ -166,13 +158,7 @@ static FilePaths uniqueNdksForCurrentQtVersions()
|
|||||||
return uniqueNdks;
|
return uniqueNdks;
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolchainList AndroidToolchainFactory::autodetectToolchains(const ToolchainList &alreadyKnown)
|
ToolchainList autodetectToolchainsFromNdks(
|
||||||
{
|
|
||||||
const QList<FilePath> uniqueNdks = uniqueNdksForCurrentQtVersions();
|
|
||||||
return autodetectToolchainsFromNdks(alreadyKnown, uniqueNdks);
|
|
||||||
}
|
|
||||||
|
|
||||||
ToolchainList AndroidToolchainFactory::autodetectToolchainsFromNdks(
|
|
||||||
const ToolchainList &alreadyKnown,
|
const ToolchainList &alreadyKnown,
|
||||||
const QList<FilePath> &ndkLocations,
|
const QList<FilePath> &ndkLocations,
|
||||||
const bool isCustom)
|
const bool isCustom)
|
||||||
@@ -248,6 +234,24 @@ ToolchainList AndroidToolchainFactory::autodetectToolchainsFromNdks(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ToolchainList autodetectToolchains(const ToolchainList &alreadyKnown)
|
||||||
|
{
|
||||||
|
const QList<FilePath> uniqueNdks = uniqueNdksForCurrentQtVersions();
|
||||||
|
return autodetectToolchainsFromNdks(alreadyKnown, uniqueNdks);
|
||||||
|
}
|
||||||
|
|
||||||
|
class AndroidToolchainFactory final : public ToolchainFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AndroidToolchainFactory()
|
||||||
|
{
|
||||||
|
setDisplayName(Tr::tr("Android Clang"));
|
||||||
|
setSupportedToolchainType(Constants::ANDROID_TOOLCHAIN_TYPEID);
|
||||||
|
setSupportedLanguages({ProjectExplorer::Constants::CXX_LANGUAGE_ID});
|
||||||
|
setToolchainConstructor([] { return new AndroidToolchain; });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void setupAndroidToolchain()
|
void setupAndroidToolchain()
|
||||||
{
|
{
|
||||||
static AndroidToolchainFactory theAndroidToolchainFactory;
|
static AndroidToolchainFactory theAndroidToolchainFactory;
|
||||||
|
@@ -14,6 +14,7 @@ using ToolchainList = QList<ProjectExplorer::Toolchain *>;
|
|||||||
class AndroidToolchain : public ProjectExplorer::GccToolchain
|
class AndroidToolchain : public ProjectExplorer::GccToolchain
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
explicit AndroidToolchain();
|
||||||
~AndroidToolchain() override;
|
~AndroidToolchain() override;
|
||||||
|
|
||||||
bool isValid() const override;
|
bool isValid() const override;
|
||||||
@@ -30,32 +31,13 @@ protected:
|
|||||||
DetectedAbisResult detectSupportedAbis() const override;
|
DetectedAbisResult detectSupportedAbis() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit AndroidToolchain();
|
|
||||||
|
|
||||||
friend class AndroidToolchainFactory;
|
|
||||||
|
|
||||||
mutable Utils::FilePath m_ndkLocation;
|
mutable Utils::FilePath m_ndkLocation;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AndroidToolchainFactory : public ProjectExplorer::ToolchainFactory
|
ToolchainList autodetectToolchains(const ToolchainList &alreadyKnown);
|
||||||
{
|
ToolchainList autodetectToolchainsFromNdks(const ToolchainList &alreadyKnown,
|
||||||
public:
|
const QList<Utils::FilePath> &ndkLocations,
|
||||||
AndroidToolchainFactory();
|
const bool isCustom = false);
|
||||||
|
|
||||||
class AndroidToolchainInformation
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Utils::Id language;
|
|
||||||
Utils::FilePath compilerCommand;
|
|
||||||
ProjectExplorer::Abi abi;
|
|
||||||
QString version;
|
|
||||||
};
|
|
||||||
|
|
||||||
static ToolchainList autodetectToolchains(const ToolchainList &alreadyKnown);
|
|
||||||
static ToolchainList autodetectToolchainsFromNdks(const ToolchainList &alreadyKnown,
|
|
||||||
const QList<Utils::FilePath> &ndkLocations,
|
|
||||||
const bool isCustom = false);
|
|
||||||
};
|
|
||||||
|
|
||||||
void setupAndroidToolchain();
|
void setupAndroidToolchain();
|
||||||
|
|
||||||
|
@@ -84,13 +84,13 @@ public:
|
|||||||
bool matchesCompilerCommand(const Utils::FilePath &command) const override;
|
bool matchesCompilerCommand(const Utils::FilePath &command) const override;
|
||||||
|
|
||||||
void setPriority(int priority) { m_priority = priority; }
|
void setPriority(int priority) { m_priority = priority; }
|
||||||
|
void setOriginalTargetTriple(const QString &targetTriple);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
using CacheItem = QPair<QStringList, Macros>;
|
using CacheItem = QPair<QStringList, Macros>;
|
||||||
using GccCache = QVector<CacheItem>;
|
using GccCache = QVector<CacheItem>;
|
||||||
|
|
||||||
void setSupportedAbis(const Abis &abis);
|
void setSupportedAbis(const Abis &abis);
|
||||||
void setOriginalTargetTriple(const QString &targetTriple);
|
|
||||||
void setInstallDir(const Utils::FilePath &installDir);
|
void setInstallDir(const Utils::FilePath &installDir);
|
||||||
void setMacroCache(const QStringList &allCxxflags, const Macros ¯oCache) const;
|
void setMacroCache(const QStringList &allCxxflags, const Macros ¯oCache) const;
|
||||||
Macros macroCache(const QStringList &allCxxflags) const;
|
Macros macroCache(const QStringList &allCxxflags) const;
|
||||||
@@ -150,7 +150,6 @@ private:
|
|||||||
|
|
||||||
friend class Internal::GccToolchainConfigWidget;
|
friend class Internal::GccToolchainConfigWidget;
|
||||||
friend class Internal::GccToolchainFactory;
|
friend class Internal::GccToolchainFactory;
|
||||||
friend class ToolchainFactory;
|
|
||||||
|
|
||||||
// "resolved" on macOS from /usr/bin/clang(++) etc to <DeveloperDir>/usr/bin/clang(++)
|
// "resolved" on macOS from /usr/bin/clang(++) etc to <DeveloperDir>/usr/bin/clang(++)
|
||||||
// which is used for comparison with matchesCompilerCommand
|
// which is used for comparison with matchesCompilerCommand
|
||||||
|
Reference in New Issue
Block a user