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
|
||||
= ToolchainManager::toolchains(Utils::equal(&Toolchain::typeId, Id(Constants::ANDROID_TOOLCHAIN_TYPEID)));
|
||||
|
||||
const Toolchains newToolchains = AndroidToolchainFactory::autodetectToolchains(
|
||||
existingAndroidToolchains);
|
||||
const Toolchains newToolchains = autodetectToolchains(existingAndroidToolchains);
|
||||
|
||||
for (Toolchain *tc : newToolchains)
|
||||
ToolchainManager::registerToolchain(tc);
|
||||
@@ -1310,9 +1309,8 @@ void AndroidConfigurations::registerCustomToolchainsAndDebuggers()
|
||||
|
||||
const FilePaths customNdks = FileUtils::toFilePathList(currentConfig().getCustomNdkList());
|
||||
const Toolchains customToolchains
|
||||
= AndroidToolchainFactory::autodetectToolchainsFromNdks(existingAndroidToolchains,
|
||||
customNdks,
|
||||
true);
|
||||
= autodetectToolchainsFromNdks(existingAndroidToolchains, customNdks, true);
|
||||
|
||||
for (Toolchain *tc : customToolchains) {
|
||||
ToolchainManager::registerToolchain(tc);
|
||||
const auto androidToolchain = static_cast<AndroidToolchain *>(tc);
|
||||
|
@@ -134,14 +134,6 @@ GccToolchain::DetectedAbisResult AndroidToolchain::detectSupportedAbis() const
|
||||
|
||||
// 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)
|
||||
{
|
||||
return clangPath.parentDir().pathAppended(clangPath.baseName() + "++").withExecutableSuffix();
|
||||
@@ -166,13 +158,7 @@ static FilePaths uniqueNdksForCurrentQtVersions()
|
||||
return uniqueNdks;
|
||||
}
|
||||
|
||||
ToolchainList AndroidToolchainFactory::autodetectToolchains(const ToolchainList &alreadyKnown)
|
||||
{
|
||||
const QList<FilePath> uniqueNdks = uniqueNdksForCurrentQtVersions();
|
||||
return autodetectToolchainsFromNdks(alreadyKnown, uniqueNdks);
|
||||
}
|
||||
|
||||
ToolchainList AndroidToolchainFactory::autodetectToolchainsFromNdks(
|
||||
ToolchainList autodetectToolchainsFromNdks(
|
||||
const ToolchainList &alreadyKnown,
|
||||
const QList<FilePath> &ndkLocations,
|
||||
const bool isCustom)
|
||||
@@ -248,6 +234,24 @@ ToolchainList AndroidToolchainFactory::autodetectToolchainsFromNdks(
|
||||
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()
|
||||
{
|
||||
static AndroidToolchainFactory theAndroidToolchainFactory;
|
||||
|
@@ -14,6 +14,7 @@ using ToolchainList = QList<ProjectExplorer::Toolchain *>;
|
||||
class AndroidToolchain : public ProjectExplorer::GccToolchain
|
||||
{
|
||||
public:
|
||||
explicit AndroidToolchain();
|
||||
~AndroidToolchain() override;
|
||||
|
||||
bool isValid() const override;
|
||||
@@ -30,32 +31,13 @@ protected:
|
||||
DetectedAbisResult detectSupportedAbis() const override;
|
||||
|
||||
private:
|
||||
explicit AndroidToolchain();
|
||||
|
||||
friend class AndroidToolchainFactory;
|
||||
|
||||
mutable Utils::FilePath m_ndkLocation;
|
||||
};
|
||||
|
||||
class AndroidToolchainFactory : public ProjectExplorer::ToolchainFactory
|
||||
{
|
||||
public:
|
||||
AndroidToolchainFactory();
|
||||
|
||||
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,
|
||||
ToolchainList autodetectToolchains(const ToolchainList &alreadyKnown);
|
||||
ToolchainList autodetectToolchainsFromNdks(const ToolchainList &alreadyKnown,
|
||||
const QList<Utils::FilePath> &ndkLocations,
|
||||
const bool isCustom = false);
|
||||
};
|
||||
|
||||
void setupAndroidToolchain();
|
||||
|
||||
|
@@ -84,13 +84,13 @@ public:
|
||||
bool matchesCompilerCommand(const Utils::FilePath &command) const override;
|
||||
|
||||
void setPriority(int priority) { m_priority = priority; }
|
||||
void setOriginalTargetTriple(const QString &targetTriple);
|
||||
|
||||
protected:
|
||||
using CacheItem = QPair<QStringList, Macros>;
|
||||
using GccCache = QVector<CacheItem>;
|
||||
|
||||
void setSupportedAbis(const Abis &abis);
|
||||
void setOriginalTargetTriple(const QString &targetTriple);
|
||||
void setInstallDir(const Utils::FilePath &installDir);
|
||||
void setMacroCache(const QStringList &allCxxflags, const Macros ¯oCache) const;
|
||||
Macros macroCache(const QStringList &allCxxflags) const;
|
||||
@@ -150,7 +150,6 @@ private:
|
||||
|
||||
friend class Internal::GccToolchainConfigWidget;
|
||||
friend class Internal::GccToolchainFactory;
|
||||
friend class ToolchainFactory;
|
||||
|
||||
// "resolved" on macOS from /usr/bin/clang(++) etc to <DeveloperDir>/usr/bin/clang(++)
|
||||
// which is used for comparison with matchesCompilerCommand
|
||||
|
Reference in New Issue
Block a user