Remove bootstrap.cfg and some references to it.

Merge pull request #836 from aws-lumberyard-dev/LYN-2461
This commit is contained in:
SJ
2021-05-26 09:32:57 -07:00
committed by GitHub
56 changed files with 302 additions and 631 deletions
@@ -17,6 +17,7 @@
#include <AzToolsFramework/Application/ToolsApplication.h>
#include <AzToolsFramework/Asset/AssetBundler.h>
#include <AzCore/IO/Path/Path.h>
#include <AzCore/Settings/SettingsRegistryImpl.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/UserSettings/UserSettingsComponent.h>
@@ -57,6 +58,22 @@ namespace AssetBundler
UnitTest::ScopedAllocatorSetupFixture::SetUp();
m_data = AZStd::make_unique<StaticData>();
AZ::SettingsRegistryInterface* registry = nullptr;
if (!AZ::SettingsRegistry::Get())
{
AZ::SettingsRegistry::Register(&m_registry);
registry = &m_registry;
}
else
{
registry = AZ::SettingsRegistry::Get();
}
auto projectPathKey = AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey)
+ "/project_path";
registry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry);
m_data->m_applicationManager.reset(aznew MockApplicationManagerTest(0, 0));
m_data->m_applicationManager->Start(AzFramework::Application::Descriptor());
@@ -84,6 +101,12 @@ namespace AssetBundler
delete m_data->m_localFileIO;
AZ::IO::FileIOBase::SetInstance(m_data->m_priorFileIO);
auto settingsRegistry = AZ::SettingsRegistry::Get();
if(settingsRegistry == &m_registry)
{
AZ::SettingsRegistry::Unregister(settingsRegistry);
}
m_data->m_applicationManager->Stop();
m_data->m_applicationManager.reset();
m_data.reset();
@@ -99,6 +122,7 @@ namespace AssetBundler
};
AZStd::unique_ptr<StaticData> m_data;
AZ::SettingsRegistryImpl m_registry;
};
TEST_F(ApplicationManagerTest, ValidatePlatformFlags_ReadConfigFiles_OK)
+39 -21
View File
@@ -97,7 +97,28 @@ namespace AssetBundler
{
public:
void SetUp() override
{
{
AZ::SettingsRegistryInterface* registry = nullptr;
if (!AZ::SettingsRegistry::Get())
{
AZ::SettingsRegistry::Register(&m_registry);
registry = &m_registry;
}
else
{
registry = AZ::SettingsRegistry::Get();
}
auto projectPathKey = AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey)
+ "/project_path";
registry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry);
AZ::IO::FixedMaxPath engineRoot = AZ::Utils::GetEnginePath();
if (engineRoot.empty())
{
GTEST_FATAL_FAILURE_(AZStd::string::format("Unable to locate engine root.\n").c_str());
}
m_data = AZStd::make_unique<StaticData>();
m_data->m_application.reset(aznew AzToolsFramework::ToolsApplication());
m_data->m_application.get()->Start(AzFramework::Application::Descriptor());
@@ -107,19 +128,6 @@ namespace AssetBundler
// in the unit tests.
AZ::UserSettingsComponentRequestBus::Broadcast(&AZ::UserSettingsComponentRequests::DisableSaveOnFinalize);
if (!AZ::SettingsRegistry::Get())
{
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_Bootstrap(m_registry);
AZ::SettingsRegistry::Register(&m_registry);
}
AZ::IO::FixedMaxPath engineRoot = AZ::Utils::GetEnginePath();
if (engineRoot.empty())
{
GTEST_FATAL_FAILURE_(AZStd::string::format("Unable to locate engine root.\n").c_str());
}
m_data->m_testEngineRoot = (engineRoot / RelativeTestFolder).LexicallyNormal().String();
m_data->m_localFileIO = aznew AZ::IO::LocalFileIO();
@@ -144,14 +152,24 @@ namespace AssetBundler
}
void TearDown() override
{
AZ::IO::FileIOBase::SetInstance(nullptr);
delete m_data->m_localFileIO;
AZ::IO::FileIOBase::SetInstance(m_data->m_priorFileIO);
if (m_data)
{
AZ::IO::FileIOBase::SetInstance(nullptr);
delete m_data->m_localFileIO;
AZ::IO::FileIOBase::SetInstance(m_data->m_priorFileIO);
m_data->m_gemInfoList.set_capacity(0);
m_data->m_gemSeedFilePairList.set_capacity(0);
m_data->m_application.get()->Stop();
m_data->m_application.reset();
}
if(auto settingsRegistry = AZ::SettingsRegistry::Get();
settingsRegistry == &m_registry)
{
AZ::SettingsRegistry::Unregister(settingsRegistry);
}
m_data->m_gemInfoList.set_capacity(0);
m_data->m_gemSeedFilePairList.set_capacity(0);
m_data->m_application.get()->Stop();
m_data->m_application.reset();
}
void AddGemData(const char* engineRoot, const char* gemName, bool seedFileExists = true)
@@ -291,7 +291,6 @@ namespace AssetProcessor
}
}
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_Bootstrap(registry);
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_EngineRegistry(registry, platform, specialization, &scratchBuffer);
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_GemRegistries(registry, platform, specialization, &scratchBuffer);
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_ProjectRegistry(registry, platform, specialization, &scratchBuffer);
@@ -130,6 +130,9 @@ namespace AssetProcessor
auto cacheRootKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_cache_path";
settingsRegistry->Set(cacheRootKey, m_data->m_temporarySourceDir.absoluteFilePath("Cache").toUtf8().constData());
auto projectPathKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path";
settingsRegistry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*settingsRegistry);
AssetUtilities::ComputeProjectCacheRoot(m_data->m_cacheRootDir);
QString normalizedCacheRoot = AssetUtilities::NormalizeDirectoryPath(m_data->m_cacheRootDir.absolutePath());
@@ -12,7 +12,7 @@
#include "AssetProcessorTest.h"
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/UserSettings/UserSettingsComponent.h>
#include "BaseAssetProcessorTest.h"
@@ -67,6 +67,12 @@ namespace AssetProcessor
static char processName[] = {"AssetProcessorBatch"};
static char* namePtr = &processName[0];
static char** paramStringArray = &namePtr;
auto registry = AZ::SettingsRegistry::Get();
auto projectPathKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path";
registry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry);
m_application.reset(new UnitTestAppManager(&numParams, &paramStringArray));
ASSERT_EQ(m_application->BeforeRun(), ApplicationManager::Status_Success);
@@ -14,6 +14,7 @@
#include <AzTest/AzTest.h>
#include <AzCore/Memory/Memory.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzFramework/Application/Application.h>
#include <native/utilities/assetUtils.h>
#include <native/unittests/UnitTestRunner.h> // for the assert absorber.
@@ -44,7 +45,18 @@ namespace AssetProcessor
AZ::AllocatorInstance<AZ::SystemAllocator>::Create();
}
m_errorAbsorber = new UnitTestUtils::AssertAbsorber();
m_application = AZStd::make_unique<AzFramework::Application>();
// Inject the AutomatedTesting project as a project path into test fixture
using FixedValueString = AZ::SettingsRegistryInterface::FixedValueString;
constexpr auto projectPathKey = FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey)
+ "/project_path";
if(auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry != nullptr)
{
settingsRegistry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*settingsRegistry);
}
}
void TearDown() override
@@ -204,6 +204,9 @@ void AssetProcessorManagerTest::SetUp()
auto cacheRootKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_cache_path";
registry->Set(cacheRootKey, tempPath.absoluteFilePath("Cache").toUtf8().constData());
auto projectPathKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path";
registry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry);
m_data->m_databaseLocationListener.BusConnect();
@@ -39,7 +39,6 @@ void PlatformConfigurationUnitTests::SetUp()
m_qApp = new QCoreApplication(m_argc, m_argv);
AssetProcessorTest::SetUp();
AssetUtilities::ResetAssetRoot();
}
void PlatformConfigurationUnitTests::TearDown()
@@ -37,6 +37,5 @@ private:
int m_argc;
char** m_argv;
QCoreApplication* m_qApp;
};
@@ -13,6 +13,7 @@
#include <AzTest/AzTest.h>
#include <AzCore/Memory/OSAllocator.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/std/containers/vector.h>
#include <AzCore/std/string/string.h>
#include <AzFramework/Asset/AssetBundleManifest.h>
@@ -45,6 +46,12 @@ public:
protected:
void SetUp() override
{
AZ::SettingsRegistryInterface* registry = AZ::SettingsRegistry::Get();
auto projectPathKey =
AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path";
registry->Set(projectPathKey, "AutomatedTesting");
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*registry);
AZ::ComponentApplication::Descriptor desc;
desc.m_useExistingAllocator = true;
desc.m_enableDrilling = false; // we already created a memory driller for the test (AllocatorsFixture)