Remove bootstrap.cfg and some references to it.
Merge pull request #836 from aws-lumberyard-dev/LYN-2461
This commit is contained in:
@@ -244,7 +244,7 @@ public class LumberyardActivity extends NativeActivity
|
||||
boolean useMainObb = GetBooleanResource("use_main_obb");
|
||||
boolean usePatchObb = GetBooleanResource("use_patch_obb");
|
||||
|
||||
if (IsBootstrapInAPK() && (useMainObb || usePatchObb))
|
||||
if (AreAssetsInAPK() && (useMainObb || usePatchObb))
|
||||
{
|
||||
Log.d(TAG, "Using OBB expansion files for game assets");
|
||||
|
||||
@@ -421,12 +421,12 @@ public class LumberyardActivity extends NativeActivity
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
private boolean IsBootstrapInAPK()
|
||||
private boolean AreAssetsInAPK()
|
||||
{
|
||||
try
|
||||
{
|
||||
InputStream bootstrap = getAssets().open("bootstrap.cfg", AssetManager.ACCESS_UNKNOWN);
|
||||
bootstrap.close();
|
||||
InputStream engine = getAssets().open("engine.json", AssetManager.ACCESS_UNKNOWN);
|
||||
engine.close();
|
||||
return true;
|
||||
}
|
||||
catch (IOException exception)
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace AZ
|
||||
}
|
||||
}
|
||||
|
||||
AZ_Assert(false, "Failed to locate the bootstrap.cfg path");
|
||||
AZ_Assert(false, "Failed to locate the engine.json path");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,8 +73,8 @@ namespace AZ
|
||||
//! \return The pointer position of the relative asset path
|
||||
AZ::IO::FixedMaxPath StripApkPrefix(const char* filePath);
|
||||
|
||||
//! Searches application storage and the APK for bootstrap.cfg. Will return nullptr
|
||||
//! if bootstrap.cfg is not found.
|
||||
//! Searches application storage and the APK for engine.json. Will return nullptr
|
||||
//! if engine.json is not found.
|
||||
const char* FindAssetsDirectory();
|
||||
|
||||
//! Calls into Java to show the splash screen on the main UI (Java) thread
|
||||
|
||||
@@ -462,8 +462,6 @@ namespace AZ
|
||||
// for the application root.
|
||||
CalculateAppRoot();
|
||||
|
||||
// Merge the bootstrap.cfg file into the Settings Registry as soon as the OSAllocator has been created.
|
||||
SettingsRegistryMergeUtils::MergeSettingsToRegistry_Bootstrap(*m_settingsRegistry);
|
||||
SettingsRegistryMergeUtils::MergeSettingsToRegistry_O3deUserRegistry(*m_settingsRegistry, AZ_TRAIT_OS_PLATFORM_CODENAME, {});
|
||||
SettingsRegistryMergeUtils::MergeSettingsToRegistry_CommandLine(*m_settingsRegistry, m_commandLine, executeRegDumpCommands);
|
||||
SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(*m_settingsRegistry);
|
||||
|
||||
@@ -494,13 +494,6 @@ namespace AZ::SettingsRegistryMergeUtils
|
||||
return configFileParsed;
|
||||
}
|
||||
|
||||
void MergeSettingsToRegistry_Bootstrap(SettingsRegistryInterface& registry)
|
||||
{
|
||||
ConfigParserSettings parserSettings;
|
||||
parserSettings.m_registryRootPointerPath = BootstrapSettingsRootKey;
|
||||
MergeSettingsToRegistry_ConfigFile(registry, "bootstrap.cfg", parserSettings);
|
||||
}
|
||||
|
||||
void MergeSettingsToRegistry_AddRuntimeFilePaths(SettingsRegistryInterface& registry)
|
||||
{
|
||||
using FixedValueString = AZ::SettingsRegistryInterface::FixedValueString;
|
||||
|
||||
@@ -172,9 +172,6 @@ namespace AZ::SettingsRegistryMergeUtils
|
||||
bool MergeSettingsToRegistry_ConfigFile(SettingsRegistryInterface& registry, AZStd::string_view filePath,
|
||||
const ConfigParserSettings& configParserSettings);
|
||||
|
||||
//! Loads bootstrap.cfg into the Settings Registry. This file does not support specializations.
|
||||
void MergeSettingsToRegistry_Bootstrap(SettingsRegistryInterface& registry);
|
||||
|
||||
//! Extracts file path information from the environment and bootstrap to calculate the various file paths and adds those
|
||||
//! to the Settings Registry under the FilePathsRootKey.
|
||||
void MergeSettingsToRegistry_AddRuntimeFilePaths(SettingsRegistryInterface& registry);
|
||||
|
||||
@@ -679,8 +679,6 @@ namespace AzFramework
|
||||
{
|
||||
auto fileIoBase = m_archiveFileIO.get();
|
||||
// Set up the default file aliases based on the settings registry
|
||||
fileIoBase->SetAlias("@assets@", "");
|
||||
fileIoBase->SetAlias("@root@", GetEngineRoot());
|
||||
fileIoBase->SetAlias("@engroot@", GetEngineRoot());
|
||||
fileIoBase->SetAlias("@projectroot@", GetEngineRoot());
|
||||
fileIoBase->SetAlias("@exefolder@", GetExecutableFolder());
|
||||
@@ -694,8 +692,8 @@ namespace AzFramework
|
||||
pathAliases.clear();
|
||||
if (m_settingsRegistry->Get(pathAliases.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_CacheRootFolder))
|
||||
{
|
||||
fileIoBase->SetAlias("@projectplatformcache@", pathAliases.c_str());
|
||||
fileIoBase->SetAlias("@assets@", pathAliases.c_str());
|
||||
fileIoBase->SetAlias("@projectplatformcache@", pathAliases.c_str());
|
||||
fileIoBase->SetAlias("@root@", pathAliases.c_str()); // Deprecated Use @projectplatformcache@
|
||||
}
|
||||
pathAliases.clear();
|
||||
|
||||
@@ -46,7 +46,6 @@ namespace AzFramework::ProjectManager
|
||||
// Store the Command line to the Setting Registry
|
||||
AZ::SettingsRegistryImpl settingsRegistry;
|
||||
AZ::SettingsRegistryMergeUtils::StoreCommandLineToRegistry(settingsRegistry, commandLine);
|
||||
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_Bootstrap(settingsRegistry);
|
||||
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_O3deUserRegistry(settingsRegistry, AZ_TRAIT_OS_PLATFORM_CODENAME, {});
|
||||
// Retrieve Command Line from Settings Registry, it may have been updated by the call to FindEngineRoot()
|
||||
// in MergeSettingstoRegistry_ConfigFile
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace AzToolsFramework
|
||||
|
||||
[[maybe_unused]] bool result =
|
||||
settingsRegistry->Get(m_projectPathWithOsSeparator.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_ProjectPath);
|
||||
AZ_Assert(result, "Couldn't retrieve project root path");
|
||||
AZ_Warning("Prefab", result, "Couldn't retrieve project root path");
|
||||
m_projectPathWithSlashSeparator = AZ::IO::Path(m_projectPathWithOsSeparator.Native(), '/').MakePreferred();
|
||||
|
||||
AZ::Interface<PrefabLoaderInterface>::Register(this);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <AzToolsFramework/Asset/AssetSeedManager.h>
|
||||
#include <AzFramework/Asset/AssetRegistry.h>
|
||||
#include <AzCore/IO/FileIO.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzFramework/IO/LocalFileIO.h>
|
||||
#include <AzFramework/Asset/AssetCatalog.h>
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
@@ -62,6 +63,12 @@ namespace UnitTest
|
||||
m_assetSeedManager = new AzToolsFramework::AssetSeedManager();
|
||||
m_assetRegistry = new AzFramework::AssetRegistry();
|
||||
|
||||
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);
|
||||
|
||||
m_application->Start(AzFramework::Application::Descriptor());
|
||||
|
||||
for (int idx = 0; idx < s_totalAssets; idx++)
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/Settings/SettingsRegistryImpl.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
#include <AzToolsFramework/AssetCatalog/PlatformAddressedAssetCatalogManager.h>
|
||||
#include <AzFramework/Asset/AssetRegistry.h>
|
||||
@@ -49,6 +51,14 @@ namespace UnitTest
|
||||
using namespace AZ::Data;
|
||||
m_application = new ToolsTestApplication("AddressedAssetCatalogManager"); // Shorter name because Setting Registry
|
||||
// specialization are 32 characters max.
|
||||
|
||||
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);
|
||||
|
||||
m_application->Start(AzFramework::Application::Descriptor());
|
||||
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
|
||||
// shared across the whole engine, if multiple tests are run in parallel, the saving could cause a crash
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
*/
|
||||
|
||||
#include <AzTest/AzTest.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
#include <AzCore/UnitTest/UnitTest.h>
|
||||
#include <AzCore/UserSettings/UserSettingsComponent.h>
|
||||
@@ -40,6 +41,13 @@ namespace UnitTest
|
||||
|
||||
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);
|
||||
|
||||
m_application->Start({});
|
||||
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
|
||||
// shared across the whole engine, if multiple tests are run in parallel, the saving could cause a crash
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <AzCore/UnitTest/UnitTest.h>
|
||||
|
||||
#include <AzCore/IO/SystemFile.h> // for max path decl
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/std/parallel/thread.h>
|
||||
#include <AzCore/std/parallel/semaphore.h>
|
||||
#include <AzCore/std/functional.h> // for function<> in the find files callback.
|
||||
@@ -42,6 +43,14 @@ namespace UnitTest
|
||||
{
|
||||
AZ::ComponentApplication::Descriptor descriptor;
|
||||
descriptor.m_stackRecordLevels = 30;
|
||||
|
||||
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);
|
||||
|
||||
m_application->Start(descriptor);
|
||||
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
|
||||
// shared across the whole engine, if multiple tests are run in parallel, the saving could cause a crash
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <AzCore/Math/Uuid.h>
|
||||
#include <AzCore/Memory/Memory.h>
|
||||
#include <AzCore/Memory/PoolAllocator.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
#include <AzCore/UserSettings/UserSettingsComponent.h>
|
||||
@@ -304,6 +305,13 @@ namespace UnitTest
|
||||
m_app.reset(aznew AzFramework::Application());
|
||||
AZ::ComponentApplication::Descriptor desc;
|
||||
desc.m_useExistingAllocator = true;
|
||||
|
||||
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);
|
||||
|
||||
m_app->Start(desc);
|
||||
|
||||
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include <AzCore/Component/ComponentApplicationBus.h>
|
||||
#include <AzCore/Outcome/Outcome.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
#include <AzCore/UserSettings/UserSettingsComponent.h>
|
||||
|
||||
@@ -572,6 +573,12 @@ namespace UnitTest
|
||||
{
|
||||
AllocatorsTestFixture::SetUp();
|
||||
|
||||
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);
|
||||
|
||||
AzFramework::Application::Descriptor descriptor;
|
||||
descriptor.m_enableDrilling = false;
|
||||
m_app.Start(descriptor);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <AzCore/Serialization/Json/JsonSerialization.h>
|
||||
#include <AzCore/Serialization/Json/JsonSystemComponent.h>
|
||||
#include <AzCore/Serialization/Json/RegistrationContext.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzFramework/FileFunc/FileFunc.h>
|
||||
@@ -278,6 +279,12 @@ namespace UnitTest
|
||||
{
|
||||
FrameworkApplicationFixture::SetUp();
|
||||
|
||||
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);
|
||||
|
||||
m_serializeContext = AZStd::make_unique<AZ::SerializeContext>();
|
||||
m_jsonRegistrationContext = AZStd::make_unique<AZ::JsonRegistrationContext>();
|
||||
m_jsonSystemComponent = AZStd::make_unique<AZ::JsonSystemComponent>();
|
||||
|
||||
@@ -83,6 +83,7 @@ namespace UnitTest
|
||||
void SetUp() override
|
||||
{
|
||||
AllocatorsFixture::SetUp();
|
||||
|
||||
m_data = AZStd::make_unique<StaticData>();
|
||||
using namespace AzFramework::FileTag;
|
||||
AZ::ComponentApplication::Descriptor desc;
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace UnitTest
|
||||
};
|
||||
|
||||
void SetUp() override
|
||||
{
|
||||
{
|
||||
m_appDescriptor.m_allocationRecords = true;
|
||||
m_appDescriptor.m_allocationRecordsSaveNames = true;
|
||||
m_appDescriptor.m_recordingMode = AZ::Debug::AllocationRecords::Mode::RECORD_FULL;
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <AzTest/AzTest.h>
|
||||
#include <AzCore/Slice/SliceComponent.h>
|
||||
#include <AzCore/Serialization/Utils.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/UserSettings/UserSettingsComponent.h>
|
||||
#include <AzToolsFramework/ToolsComponents/GenericComponentWrapper.h>
|
||||
#include <AzToolsFramework/Application/ToolsApplication.h>
|
||||
@@ -59,6 +60,12 @@ class WrappedEditorComponentTest
|
||||
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);
|
||||
|
||||
m_app.Start(AZ::ComponentApplication::Descriptor());
|
||||
|
||||
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
|
||||
@@ -178,6 +185,12 @@ class FindWrappedComponentsTest
|
||||
public:
|
||||
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);
|
||||
|
||||
m_app.Start(AzFramework::Application::Descriptor());
|
||||
|
||||
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <AzCore/Slice/SliceAssetHandler.h>
|
||||
#include <AzCore/Script/ScriptSystemComponent.h>
|
||||
#include <AzCore/Script/ScriptAsset.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/std/chrono/chrono.h>
|
||||
#include <AzCore/RTTI/TypeInfo.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
@@ -1059,6 +1060,12 @@ namespace UnitTest
|
||||
|
||||
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);
|
||||
|
||||
m_app.Start(AzFramework::Application::Descriptor());
|
||||
|
||||
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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, ¶mStringArray));
|
||||
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();
|
||||
|
||||
-1
@@ -39,7 +39,6 @@ void PlatformConfigurationUnitTests::SetUp()
|
||||
m_qApp = new QCoreApplication(m_argc, m_argv);
|
||||
AssetProcessorTest::SetUp();
|
||||
AssetUtilities::ResetAssetRoot();
|
||||
|
||||
}
|
||||
|
||||
void PlatformConfigurationUnitTests::TearDown()
|
||||
|
||||
-1
@@ -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)
|
||||
|
||||
@@ -152,8 +152,11 @@ struct AssetValidationTest
|
||||
{
|
||||
AZ::SettingsRegistry::Register(&m_registry);
|
||||
|
||||
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_Bootstrap(m_registry);
|
||||
auto projectPathKey = AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey)
|
||||
+ "/project_path";
|
||||
m_registry.Set(projectPathKey, "AutomatedTesting");
|
||||
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(m_registry);
|
||||
|
||||
// Set the engine root to the temporary directory and re-update the runtime file paths
|
||||
auto enginePathKey = AZ::SettingsRegistryInterface::FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey)
|
||||
+ "/engine_path";
|
||||
|
||||
@@ -60,7 +60,9 @@ namespace UnitTest
|
||||
|
||||
TEST_F(UtilsTests, LoadFileString_Error_DoesNotExist)
|
||||
{
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
auto outcome = AZ::RHI::LoadFileString("FileDoesNotExist");
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT;
|
||||
EXPECT_FALSE(outcome.IsSuccess());
|
||||
EXPECT_TRUE(outcome.GetError().find("Could not open file") != AZStd::string::npos);
|
||||
EXPECT_TRUE(outcome.GetError().find("FileDoesNotExist") != AZStd::string::npos);
|
||||
@@ -68,7 +70,9 @@ namespace UnitTest
|
||||
|
||||
TEST_F(UtilsTests, LoadFileBytes_Error_DoesNotExist)
|
||||
{
|
||||
AZ_TEST_START_TRACE_SUPPRESSION;
|
||||
auto outcome = AZ::RHI::LoadFileBytes("FileDoesNotExist");
|
||||
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT;
|
||||
EXPECT_FALSE(outcome.IsSuccess());
|
||||
EXPECT_TRUE(outcome.GetError().find("Could not open file") != AZStd::string::npos);
|
||||
EXPECT_TRUE(outcome.GetError().find("FileDoesNotExist") != AZStd::string::npos);
|
||||
|
||||
@@ -384,8 +384,7 @@ def stash_env(_SYNTH_ENV_DICT = OrderedDict()):
|
||||
# changed to just make the fallback what is set in boostrap
|
||||
# so now it's less of a fallnack and more correct if not
|
||||
# explicitly set
|
||||
_LY_PROJECT = os.getenv(ENVAR_LY_PROJECT,
|
||||
get_current_project(_LY_DEV))
|
||||
_LY_PROJECT = os.getenv(ENVAR_LY_PROJECT)
|
||||
_SYNTH_ENV_DICT[ENVAR_LY_PROJECT] = _LY_PROJECT
|
||||
|
||||
_LY_BUILD_DIR_NAME = os.getenv(ENVAR_LY_BUILD_DIR_NAME,
|
||||
|
||||
@@ -59,7 +59,16 @@ namespace EMotionFX
|
||||
{
|
||||
public:
|
||||
|
||||
ComponentFixtureApp() = default;
|
||||
ComponentFixtureApp()
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
AZ::ComponentTypeList GetRequiredSystemComponents() const override
|
||||
{
|
||||
|
||||
@@ -77,7 +77,6 @@ namespace EMotionFX
|
||||
{
|
||||
auto testAssetsPath = AZ::IO::Path(GetEMotionFX().GetAssetCacheFolder()) / "TmpTestAssets";
|
||||
QString dataDir = QString::fromUtf8(testAssetsPath.c_str(), aznumeric_cast<int>(testAssetsPath.Native().size()));
|
||||
dataDir += "TmpTestAssets";
|
||||
|
||||
if (!QDir(dataDir).exists())
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <EditorPythonBindings/EditorPythonBindingsBus.h>
|
||||
|
||||
#include <AzCore/Debug/TraceMessageBus.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
#include <AzToolsFramework/API/EditorPythonRunnerRequestsBus.h>
|
||||
|
||||
@@ -322,6 +323,13 @@ sys.version
|
||||
void SetUp() override
|
||||
{
|
||||
PythonTestingFixture::SetUp();
|
||||
|
||||
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_app.RegisterComponentDescriptor(EditorPythonBindings::PythonSystemComponent::CreateDescriptor());
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <Builders/LevelBuilder/LevelBuilderWorker.h>
|
||||
#include <AzTest/Utils.h>
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/Slice/SliceAssetHandler.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
#include <AzCore/UserSettings/UserSettingsComponent.h>
|
||||
@@ -98,6 +99,12 @@ class LevelBuilderTest
|
||||
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);
|
||||
|
||||
m_app.Start(m_descriptor);
|
||||
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
|
||||
// shared across the whole engine, if multiple tests are run in parallel, the saving could cause a crash
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <Builders/LuaBuilder/LuaBuilderWorker.h>
|
||||
#include <AzTest/Utils.h>
|
||||
#include <AssetBuilderSDK/AssetBuilderSDK.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
#include <AzCore/UserSettings/UserSettingsComponent.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
@@ -32,6 +33,12 @@ namespace UnitTest
|
||||
{
|
||||
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);
|
||||
|
||||
m_app.Start(m_descriptor);
|
||||
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
|
||||
// shared across the whole engine, if multiple tests are run in parallel, the saving could cause a crash
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "LmbrCentral_precompiled.h"
|
||||
#include <AzTest/AzTest.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
#include <AzToolsFramework/Application/ToolsApplication.h>
|
||||
#include <Builders/DependencyBuilder/SeedBuilderWorker/SeedBuilderWorker.h>
|
||||
@@ -22,6 +23,12 @@ class SeedBuilderTests
|
||||
{
|
||||
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);
|
||||
|
||||
m_app.Start(AZ::ComponentApplication::Descriptor());
|
||||
|
||||
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <CryCommon/Mocks/ISystemMock.h>
|
||||
#include <LyShineBuilder/UiCanvasBuilderWorker.h>
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/UserSettings/UserSettingsComponent.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzToolsFramework/Application/ToolsApplication.h>
|
||||
@@ -88,6 +89,12 @@ protected:
|
||||
m_data->m_stubEnv.pSystem = &m_data->m_mockSystem;
|
||||
gEnv = &m_data->m_stubEnv;
|
||||
|
||||
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);
|
||||
|
||||
m_app.Start(m_descriptor);
|
||||
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
|
||||
// shared across the whole engine, if multiple tests are run in parallel, the saving could cause a crash
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <AzCore/Component/TransformBus.h>
|
||||
#include <AzCore/Serialization/Json/JsonSystemComponent.h>
|
||||
#include <AzCore/Serialization/Json/RegistrationContext.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/UserSettings/UserSettingsComponent.h>
|
||||
|
||||
namespace UnitTest
|
||||
@@ -172,6 +173,12 @@ namespace UnitTest
|
||||
|
||||
void PrefabBuilderTests::SetUp()
|
||||
{
|
||||
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;
|
||||
m_app.Start(desc);
|
||||
m_app.CreateReflectionManager();
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <AzCore/Component/ComponentApplication.h>
|
||||
#include <AzCore/Module/Environment.h>
|
||||
#include <AzCore/RTTI/ReflectContext.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
#include <AzCore/UserSettings/UserSettingsComponent.h>
|
||||
#include <AzCore/std/smart_ptr/make_shared.h>
|
||||
@@ -139,6 +140,12 @@ class SceneBuilderPhasesFixture
|
||||
public:
|
||||
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);
|
||||
|
||||
m_app.Start(AZ::ComponentApplication::Descriptor());
|
||||
|
||||
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <AssetBuilderSDK/AssetBuilderSDK.h>
|
||||
#include <AzCore/IO/FileIO.h>
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzCore/UnitTest/TestTypes.h>
|
||||
#include <AzCore/UserSettings/UserSettingsComponent.h>
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
@@ -30,6 +31,12 @@ class SceneBuilderTests
|
||||
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);
|
||||
|
||||
m_app.Start(AZ::ComponentApplication::Descriptor());
|
||||
AZ::Debug::TraceMessageBus::Handler::BusConnect();
|
||||
// Without this, the user settings component would attempt to save on finalize/shutdown. Since the file is
|
||||
|
||||
@@ -250,9 +250,6 @@ class AbstractResourceLocator(object):
|
||||
"""
|
||||
return os.path.join(self.build_directory(), 'CrySCompileServer')
|
||||
|
||||
def bootstrap_config_file(self):
|
||||
return os.path.join(self.engine_root(), 'bootstrap.cfg')
|
||||
|
||||
def asset_processor_config_file(self):
|
||||
return os.path.join(self.engine_root(), 'Registry', 'AssetProcessorPlatformConfig.setreg')
|
||||
|
||||
|
||||
@@ -123,7 +123,6 @@ class Launcher(object):
|
||||
"""
|
||||
backup_path = self.workspace.settings.get_temp_path()
|
||||
log.debug(f"Performing automatic backup of bootstrap, platform and user settings in path {backup_path}")
|
||||
self.workspace.settings.backup_bootstrap_settings(backup_path)
|
||||
self.workspace.settings.backup_platform_settings(backup_path)
|
||||
self.workspace.settings.backup_shader_compiler_settings(backup_path)
|
||||
|
||||
|
||||
@@ -664,8 +664,7 @@ class AssetProcessor(object):
|
||||
make_dir = os.path.join(self._temp_asset_root, copy_dir)
|
||||
if not os.path.isdir(make_dir):
|
||||
os.makedirs(make_dir)
|
||||
for copyfile_name in ['bootstrap.cfg',
|
||||
'Registry/AssetProcessorPlatformConfig.setreg',
|
||||
for copyfile_name in ['Registry/AssetProcessorPlatformConfig.setreg',
|
||||
os.path.join(self._workspace.project, "project.json"),
|
||||
os.path.join('Assets', 'Engine', 'exclude.filetag')]:
|
||||
shutil.copyfile(os.path.join(self._workspace.paths.engine_root(), copyfile_name),
|
||||
|
||||
@@ -57,14 +57,6 @@ class LySettings(object):
|
||||
"""
|
||||
self._backup_settings(self._resource_locator.platform_config_file(), backup_path)
|
||||
|
||||
def backup_bootstrap_settings(self, backup_path=None):
|
||||
"""
|
||||
Creates a backup of the bootstrap settings file (~/dev/bootstrap.cfg) in the backup_path. If no path is
|
||||
provided, it will store in the workspace temp path (the contents of the workspace temp directory are removed
|
||||
during workspace teardown)
|
||||
"""
|
||||
self._backup_settings(self._resource_locator.bootstrap_config_file(), backup_path)
|
||||
|
||||
def backup_shader_compiler_settings(self, backup_path=None):
|
||||
self._backup_settings(self._resource_locator.shader_compiler_config_file(), backup_path)
|
||||
|
||||
@@ -79,14 +71,6 @@ class LySettings(object):
|
||||
"""
|
||||
self._restore_settings(self._resource_locator.platform_config_file(), backup_path)
|
||||
|
||||
def restore_bootstrap_settings(self, backup_path=None):
|
||||
"""
|
||||
Restores the bootstrap settings file (~/dev/bootstrap.cfg) from its backup.
|
||||
The backup is stored in the backup_path.
|
||||
If no backup_path is provided, it will attempt to retrieve the backup from the workspace temp path.
|
||||
"""
|
||||
self._restore_settings(self._resource_locator.bootstrap_config_file(), backup_path)
|
||||
|
||||
def restore_shader_compiler_settings(self, backup_path=None):
|
||||
self._restore_settings(self._resource_locator.shader_compiler_config_file(), backup_path)
|
||||
|
||||
|
||||
@@ -158,13 +158,6 @@ class TestAbstractResourceLocator(object):
|
||||
|
||||
assert mock_abstract_resource_locator.shader_cache() == expected_path
|
||||
|
||||
def test_BootstrapConfigFile_IsCalled_ReturnBootstrapConfigFilePath(self):
|
||||
mock_abstract_resource_locator = abstract_resource_locator.AbstractResourceLocator(
|
||||
mock_build_directory, mock_project)
|
||||
expected_path = os.path.join(mock_abstract_resource_locator.engine_root(), 'bootstrap.cfg')
|
||||
|
||||
assert mock_abstract_resource_locator.bootstrap_config_file() == expected_path
|
||||
|
||||
def test_AssetProcessorConfigFile_IsCalled_ReturnsAssetProcessorConfigFilePath(self):
|
||||
mock_abstract_resource_locator = abstract_resource_locator.AbstractResourceLocator(
|
||||
mock_build_directory, mock_project)
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
; This file is deprecated and is only use currently for setting the path when running O3DE in an engine-centric manner
|
||||
; By engine-centric, what is meant is using CMake to configure from the <engine-root> directory and passing in the LY_PROJECTS value
|
||||
|
||||
project_path=AutomatedTesting
|
||||
|
||||
; The Asset Processor Specific settings are now the <engine-root>/Engine/Registry/bootstrap.setreg settings
|
||||
; The Engine specific settings can be overridden in order of least precedence to most
|
||||
; 1. Override the settings in a "<gem-root>/Registry/*.setreg(patch)" file (Shared per Gem Settings)
|
||||
; 2. Override the settings in a "<project-root>/Registry/*.setreg(patch)" file (Shared per Project Settings)
|
||||
; 3. Override the settings in a "<project-root>/user/Registry/*.setreg(patch)" file (User per Project Settings)
|
||||
; 4. Override the settings in a "~/.o3de/Registry/*.setreg(patch)" file (User Global Settings)
|
||||
; Where "~" is %USERPROFILE% on Windows and $HOME on Unix like platforms
|
||||
+20
-7
@@ -137,19 +137,32 @@ def get_config_file_values(config_file_path, keys_to_extract):
|
||||
return result_map
|
||||
|
||||
|
||||
def get_bootstrap_values(engine_root, keys_to_extract):
|
||||
def get_bootstrap_values(bootstrap_dir, keys_to_extract):
|
||||
"""
|
||||
Extract requested values from the bootstrap.cfg file in the def root folder
|
||||
:param engine_root: The engine root folder where bootstrap.cfg exists
|
||||
Extract requested values from the bootstrap.setreg file in the Registry folder
|
||||
:param bootstrap_dir: The parent directory of the bootstrap.setreg file
|
||||
:param keys_to_extract: The keys to extract into a dictionary
|
||||
:return: Dictionary of keys and its values (for matched keys)
|
||||
"""
|
||||
bootstrap_file = os.path.join(engine_root, 'bootstrap.cfg')
|
||||
bootstrap_file = os.path.join(bootstrap_dir, 'bootstrap.setreg')
|
||||
if not os.path.isfile(bootstrap_file):
|
||||
raise LmbrCmdError("Missing 'bootstrap.cfg' file from engine root ('{}')".format(engine_root),
|
||||
ERROR_CODE_FILE_NOT_FOUND)
|
||||
raise logging.error(f'Bootstrap.setreg file {bootstrap_file} does not exist.')
|
||||
|
||||
result_map = {}
|
||||
with bootstrap_file.open('r') as f:
|
||||
try:
|
||||
json_data = json.load(f)
|
||||
except Exception as e:
|
||||
logging.error(f'Bootstrap.setreg failed to load: {str(e)}')
|
||||
else:
|
||||
for search_key in keys_to_extract:
|
||||
try:
|
||||
search_result = json_data["Amazon"]["AzCore"]["Bootstrap"][f'"{search_key}"']
|
||||
except KeyError as e:
|
||||
logging.error(f'Bootstrap.setreg cannot find Amazon:AzCore:Bootstrap:{search_result}: {str(e)}')
|
||||
else:
|
||||
result_map[search_key] = search_result
|
||||
|
||||
result_map = get_config_file_values(bootstrap_file, keys_to_extract)
|
||||
return result_map
|
||||
|
||||
|
||||
|
||||
@@ -1,244 +0,0 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
import argparse
|
||||
import datetime
|
||||
import logging
|
||||
import pathlib
|
||||
import platform
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
ROOT_DEV_PATH = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '..'))
|
||||
if ROOT_DEV_PATH not in sys.path:
|
||||
sys.path.append(ROOT_DEV_PATH)
|
||||
|
||||
from cmake.Tools import common
|
||||
|
||||
# The location of this python script is not portable relative to the engine root, we determine the engine root based
|
||||
# on its relative location
|
||||
DEV_ROOT = os.path.realpath(os.path.join(__file__, '../../..'))
|
||||
|
||||
BOOTSTRAP_CFG = os.path.join(DEV_ROOT, 'bootstrap.cfg')
|
||||
|
||||
EXECUTABLE_EXTN = '.exe' if platform.system() == 'Windows' else ''
|
||||
RC_NAME = f'rc{EXECUTABLE_EXTN}'
|
||||
APB_NAME = f'AssetProcessorBatch{EXECUTABLE_EXTN}'
|
||||
|
||||
# Depending on the user request for verbosity, the argument list to subprocess may or may not redirect stdout to NULL
|
||||
VERBOSE_CALL_ARGS = dict(
|
||||
shell=True,
|
||||
cwd=DEV_ROOT
|
||||
)
|
||||
NON_VERBOSE_CALL_ARGS = dict(
|
||||
**VERBOSE_CALL_ARGS,
|
||||
stdout=subprocess.DEVNULL
|
||||
)
|
||||
|
||||
|
||||
def command_arg(arg):
|
||||
"""
|
||||
Work-around for an issue when running subprocess on Linux: subprocess.check_call will take in the argument as an array
|
||||
but only invokes the first item in the array, ignoring the arguments. As quick fix, we will combine the array into the
|
||||
full command line and execute it that way on non-windows platforms
|
||||
"""
|
||||
if platform.system() == 'Windows':
|
||||
return arg
|
||||
else:
|
||||
return ' '.join(arg)
|
||||
|
||||
|
||||
def validate(binfolder, game_name, pak_script):
|
||||
|
||||
#
|
||||
# Validate the binfolder is relative and contains 'rc' and 'AssetProcessorBatch'
|
||||
#
|
||||
if os.path.isabs(binfolder):
|
||||
raise common.LmbrCmdError("Invalid value for '-b/--binfolder'. It must be a path relative to the engine root folder",
|
||||
common.ERROR_CODE_ERROR_DIRECTORY)
|
||||
|
||||
binfolder_abs_path = pathlib.Path(DEV_ROOT) / binfolder
|
||||
if not binfolder_abs_path.is_dir():
|
||||
raise common.LmbrCmdError("Invalid value for '-b/--binfolder'. Path does not exist or is not a directory",
|
||||
common.ERROR_CODE_ERROR_DIRECTORY)
|
||||
|
||||
rc_check = binfolder_abs_path / RC_NAME
|
||||
if not rc_check.is_file():
|
||||
raise common.LmbrCmdError(f"Invalid value for '-b/--binfolder'. Path does not contain {RC_NAME}",
|
||||
common.ERROR_CODE_ERROR_DIRECTORY)
|
||||
|
||||
apb_check = binfolder_abs_path / APB_NAME
|
||||
if not apb_check.is_file():
|
||||
raise common.LmbrCmdError(f"Invalid value for '-b/--binfolder'. Path does not contain {APB_NAME}",
|
||||
common.ERROR_CODE_ERROR_DIRECTORY)
|
||||
|
||||
#
|
||||
# Validate the game name represents a game project within the game engine
|
||||
#
|
||||
gamefolder_abs_path = pathlib.Path(DEV_ROOT) / game_name
|
||||
if not gamefolder_abs_path.is_dir():
|
||||
raise common.LmbrCmdError(f"Invalid value for '-g/--game-name'. No game '{game_name} exists.",
|
||||
common.ERROR_CODE_ERROR_DIRECTORY)
|
||||
|
||||
project_json_path = gamefolder_abs_path / 'project.json'
|
||||
if not project_json_path.is_file():
|
||||
raise common.LmbrCmdError(
|
||||
f"Invalid value for '-g/--game-name'. Folder '{game_name} is not a valid game project.",
|
||||
common.ERROR_CODE_FILE_NOT_FOUND)
|
||||
|
||||
if not os.path.isfile(pak_script):
|
||||
raise common.LmbrCmdError(f'Pak script file {pak_script} does not exist.',
|
||||
common.ERROR_CODE_FILE_NOT_FOUND)
|
||||
|
||||
|
||||
def process(binfolder, game_name, asset_platform, autorun_assetprocessor, recompress, fastest_compression, target,
|
||||
pak_script, warn_on_assetprocessor_error, verbose):
|
||||
|
||||
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG if verbose else logging.INFO)
|
||||
|
||||
target_path_root_abs = pathlib.Path(DEV_ROOT) / target
|
||||
if target_path_root_abs.is_file():
|
||||
raise common.LmbrCmdError(f"Target '{target}' already exists as a file.",
|
||||
common.ERROR_CODE_GENERAL_ERROR)
|
||||
os.makedirs(target_path_root_abs.absolute(), exist_ok=True)
|
||||
|
||||
target_pak_folder_name = f'{game_name.lower()}_{asset_platform}_paks'
|
||||
target_pak = target_path_root_abs / target_pak_folder_name
|
||||
|
||||
# Prepare the asset processor batch arguments and execute if requested
|
||||
if autorun_assetprocessor:
|
||||
ap_executable = os.path.join(binfolder, APB_NAME)
|
||||
ap_cmd_args = [ap_executable,
|
||||
f'/gamefolder={game_name}',
|
||||
f'/platforms={asset_platform}']
|
||||
logging.debug("Calling {}".format(' '.join(ap_cmd_args)))
|
||||
try:
|
||||
logging.info(f"Running {APB_NAME} on {game_name}")
|
||||
start_time = datetime.datetime.now()
|
||||
|
||||
call_args = VERBOSE_CALL_ARGS if verbose else NON_VERBOSE_CALL_ARGS
|
||||
|
||||
subprocess.check_call(command_arg(ap_cmd_args),
|
||||
**call_args)
|
||||
|
||||
total_time = datetime.datetime.now() - start_time
|
||||
logging.info(f"Asset Processing Complete. Elapse: {total_time}")
|
||||
except subprocess.CalledProcessError:
|
||||
if warn_on_assetprocessor_error:
|
||||
logging.warning('AssetProcessorBatch reported errors')
|
||||
else:
|
||||
raise common.LmbrCmdError("AssetProcessorBatch has one or more failed assets.",
|
||||
common.ERROR_CODE_GENERAL_ERROR)
|
||||
|
||||
rc_executable = os.path.join(binfolder, RC_NAME)
|
||||
rc_cmd_args = [rc_executable,
|
||||
f'/job={pak_script}',
|
||||
f'/p={asset_platform}',
|
||||
f'/game={game_name}',
|
||||
f'/trg={target_pak}']
|
||||
if recompress:
|
||||
rc_cmd_args.append('/recompress=1')
|
||||
if fastest_compression:
|
||||
rc_cmd_args.append('/use_fastest=1')
|
||||
logging.debug("Calling {}".format(' '.join(rc_cmd_args)))
|
||||
|
||||
try:
|
||||
logging.info(f"Running {APB_NAME} on {game_name}")
|
||||
start_time = datetime.datetime.now()
|
||||
|
||||
call_args = VERBOSE_CALL_ARGS if verbose else NON_VERBOSE_CALL_ARGS
|
||||
|
||||
subprocess.check_call(command_arg(rc_cmd_args),
|
||||
**call_args)
|
||||
|
||||
total_time = datetime.datetime.now() - start_time
|
||||
logging.info(f"Asset Processing Complete. Elapse: {total_time}")
|
||||
logging.info(f"Pak files for {game_name} written to {target_pak}")
|
||||
|
||||
except subprocess.CalledProcessError as err:
|
||||
raise common.LmbrCmdError(f"{RC_NAME} returned an error: {str(err)}.",
|
||||
err.returncode)
|
||||
|
||||
|
||||
def main(args):
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
parser.add_argument('-b', '--binfolder',
|
||||
help='The relative location of the binary folder that contains the resource compiler and asset processor')
|
||||
|
||||
bootstrap = common.get_bootstrap_values(DEV_ROOT, ['project_path'])
|
||||
parser.add_argument('-g', '--game-name',
|
||||
help='The name of the Game whose asset pak will be generated for',
|
||||
default=bootstrap.get('project_path'))
|
||||
|
||||
parser.add_argument('-p', '--asset-platform',
|
||||
help='The asset platform type to process')
|
||||
|
||||
parser.add_argument('-a', '--autorun-assetprocessor',
|
||||
help='Option to automatically invoke asset processor batch on the game before generating the pak',
|
||||
action='store_true')
|
||||
|
||||
parser.add_argument('-w', '--warn-on-assetprocessor-error',
|
||||
help='When -a/--autorun-assetprocessor is specified, warn on asset processor failure rather than aborting the process',
|
||||
action='store_true')
|
||||
|
||||
parser.add_argument('-r', '--recompress',
|
||||
action='store_true',
|
||||
help='If present, the ResourceCompiler (RC.exe) will decompress and compress back each PAK file '
|
||||
'found as they are transferred from the cache folder to the game_pc_pak folder.')
|
||||
parser.add_argument('-fc', '--fastest-compression',
|
||||
action='store_true',
|
||||
help='As each file is being added to its PAK file, they will be compressed across all available '
|
||||
'codecs (ZLIB, ZSTD and LZ4) and the one with the fastest decompression time will be '
|
||||
'chosen. The default is to always use ZLIB')
|
||||
parser.add_argument('--target',
|
||||
default='Pak',
|
||||
help='Specify a target folder for the pak files. (Default : Pak)')
|
||||
parser.add_argument('--pak-script',
|
||||
default=f'{DEV_ROOT}/{os.path.normpath("Code/Tools/RC/Config/rc/RCJob_Generic_MakePaks.xml")}',
|
||||
help="The absolute path of the pak script configuration file to use to create the paks.")
|
||||
|
||||
parser.add_argument('-v', '--verbose',
|
||||
help='Enable debug messages',
|
||||
action='store_true')
|
||||
|
||||
parsed = parser.parse_args(args)
|
||||
|
||||
validate(binfolder=parsed.binfolder,
|
||||
game_name=parsed.game_name,
|
||||
pak_script=parsed.pak_script)
|
||||
|
||||
process(binfolder=parsed.binfolder,
|
||||
game_name=parsed.game_name,
|
||||
asset_platform=parsed.asset_platform,
|
||||
autorun_assetprocessor=parsed.autorun_assetprocessor,
|
||||
recompress=parsed.recompress,
|
||||
fastest_compression=parsed.fastest_compression,
|
||||
target=parsed.target,
|
||||
pak_script=parsed.pak_script,
|
||||
warn_on_assetprocessor_error=parsed.warn_on_assetprocessor_error,
|
||||
verbose=parsed.verbose)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
if not os.path.isfile(BOOTSTRAP_CFG):
|
||||
raise common.LmbrCmdError("Invalid dev root, missing bootstrap.cfg.",
|
||||
common.ERROR_CODE_FILE_NOT_FOUND)
|
||||
|
||||
main(sys.argv[1:])
|
||||
exit(0)
|
||||
|
||||
except common.LmbrCmdError as err:
|
||||
print(str(err), file=sys.stderr)
|
||||
exit(err.code)
|
||||
+16
-21
@@ -78,19 +78,19 @@ def verify_layout(layout_dir, platform_name, project_path, asset_mode, asset_typ
|
||||
if remote_on_check is None:
|
||||
# Validate that if '<platform>_connect_to_remote is enabled, that the 'input_remote_ip' is not set to local host
|
||||
if input_remote_connect == '1' and input_remote_ip == LOCAL_HOST:
|
||||
return _warn("'bootstrap.cfg' is configured to connect to Asset Processor remotely, but the 'remote_ip' "
|
||||
return _warn("'bootstrap.setreg' is configured to connect to Asset Processor remotely, but the 'remote_ip' "
|
||||
" is configured for LOCAL HOST")
|
||||
else:
|
||||
if remote_on_check:
|
||||
# Verify we are set for remote AP connection
|
||||
if input_remote_ip == LOCAL_HOST:
|
||||
return _warn(f"'bootstrap.cfg' is not configured for a remote Asset Processor connection (remote_ip={input_remote_ip})")
|
||||
return _warn(f"'bootstrap.setreg' is not configured for a remote Asset Processor connection (remote_ip={input_remote_ip})")
|
||||
if input_remote_connect != '1':
|
||||
return _warn(f"'bootstrap.cfg' is not configured for a remote Asset Processor connection ({platform_name}_connect_to_remote={input_remote_connect}")
|
||||
return _warn(f"'bootstrap.setreg' is not configured for a remote Asset Processor connection ({platform_name}_connect_to_remote={input_remote_connect}")
|
||||
else:
|
||||
# Verify we are disabled for remote AP connection
|
||||
if input_remote_connect != '0':
|
||||
return _warn(f"'bootstrap.cfg' is not configured for a remote Asset Processor connection ({platform_name}_connect_to_remote={input_remote_connect}")
|
||||
return _warn(f"'bootstrap.setreg' is not configured for a remote Asset Processor connection ({platform_name}_connect_to_remote={input_remote_connect}")
|
||||
|
||||
return 0
|
||||
|
||||
@@ -107,20 +107,15 @@ def verify_layout(layout_dir, platform_name, project_path, asset_mode, asset_typ
|
||||
project_name_lower = project_path.lower()
|
||||
layout_path = pathlib.Path(layout_dir)
|
||||
|
||||
# Validate bootstrap.cfg exists
|
||||
bootstrap_file = layout_path / 'bootstrap.cfg'
|
||||
if not bootstrap_file.is_file():
|
||||
warning_count += _warn(f"'bootstrap.cfg' is missing from {str(layout_path)}")
|
||||
bootstrap_values = None
|
||||
else:
|
||||
bootstrap_values = common.get_config_file_values(str(bootstrap_file), [f'{platform_name_lower}_remote_filesystem',
|
||||
f'{platform_name_lower}_connect_to_remote',
|
||||
f'{platform_name_lower}_wait_for_connect',
|
||||
f'{platform_name_lower}_assets',
|
||||
f'assets',
|
||||
f'{platform_name_lower}_remote_ip',
|
||||
f'remote_ip'
|
||||
])
|
||||
bootstrap_path = layout_path / 'Registry'
|
||||
bootstrap_values = common.get_bootstrap_values(str(bootstrap_path), [f'{platform_name_lower}_remote_filesystem',
|
||||
f'{platform_name_lower}_connect_to_remote',
|
||||
f'{platform_name_lower}_wait_for_connect',
|
||||
f'{platform_name_lower}_assets',
|
||||
f'assets',
|
||||
f'{platform_name_lower}_remote_ip',
|
||||
f'remote_ip'
|
||||
])
|
||||
|
||||
# Validate the system_{platform}_{asset type}.cfg exists
|
||||
platform_system_cfg_file = layout_path / f'system_{platform_name_lower}_{asset_type}.cfg'
|
||||
@@ -141,9 +136,9 @@ def verify_layout(layout_dir, platform_name, project_path, asset_mode, asset_typ
|
||||
# Validate that the asset type for the platform matches the one set for the build
|
||||
bootstrap_asset_type = bootstrap_values.get(f'{platform_name_lower}_assets') or bootstrap_values.get('assets')
|
||||
if not bootstrap_asset_type:
|
||||
warning_count += _warn("'bootstrap.cfg' is missing specifications for asset type.")
|
||||
warning_count += _warn("'bootstrap.setreg' is missing specifications for asset type.")
|
||||
elif bootstrap_asset_type != asset_type:
|
||||
warning_count += _warn(f"The asset type specified in bootstrap.cfg ({bootstrap_asset_type}) does not match the asset type specified for this deployment({asset_type}).")
|
||||
warning_count += _warn(f"The asset type specified in bootstrap.setreg ({bootstrap_asset_type}) does not match the asset type specified for this deployment({asset_type}).")
|
||||
|
||||
# Validate that if '<platform>_connect_to_remote is enabled, that the 'remote_ip' is not set to local host
|
||||
warning_count += _validate_remote_ap(remote_ip, remote_connect, None)
|
||||
@@ -211,7 +206,7 @@ def verify_layout(layout_dir, platform_name, project_path, asset_mode, asset_typ
|
||||
elif asset_mode == ASSET_MODE_VFS:
|
||||
remote_file_system = bootstrap_values.get(f'{platform_name_lower}_remote_filesystem') or '0'
|
||||
if not remote_file_system != '1':
|
||||
warning_count += _warn("Remote file system is not configured in bootstrap.cfg for VFS mode.")
|
||||
warning_count += _warn("Remote file system is not configured in bootstrap.setreg for VFS mode.")
|
||||
else:
|
||||
warning_count += _validate_remote_ap(remote_ip, remote_connect, True)
|
||||
|
||||
|
||||
@@ -48,60 +48,6 @@ def test_determine_engine_root(tmpdir, engine_json_content, expected_success):
|
||||
assert result is None
|
||||
|
||||
|
||||
TEST_BOOTSTRAP_CONTENT_1 = """
|
||||
project_path = Game1
|
||||
foo = bar
|
||||
key1 = value1
|
||||
key2 = value2
|
||||
assets = pc
|
||||
--No Assets
|
||||
"""
|
||||
|
||||
TEST_BOOTSTRAP_CONTENT_2 = """
|
||||
project_path = Game2
|
||||
foo = bar
|
||||
#-------------------------
|
||||
key1 = value1
|
||||
key2 = value2
|
||||
assets = pc
|
||||
--No Assets
|
||||
"""
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"contents, input_keys, expected_result_map", [
|
||||
pytest.param(TEST_BOOTSTRAP_CONTENT_1, ['project_path', 'foo', 'assets'], {'project_path': 'Game1',
|
||||
'foo': 'bar',
|
||||
'assets': 'pc'}, id="TestFullMatch"),
|
||||
pytest.param(TEST_BOOTSTRAP_CONTENT_2, ['project_path', 'foo', 'barnone'], {'project_path': 'Game2',
|
||||
'foo': 'bar'}, id="TestPartialMatch"),
|
||||
pytest.param(TEST_BOOTSTRAP_CONTENT_2, ['project_pathnone', 'foonone', 'barnone'], {}, id="TestNoMatch")
|
||||
]
|
||||
)
|
||||
def test_get_bootstrap_values_success(tmpdir, contents, input_keys, expected_result_map):
|
||||
|
||||
test_dev_root = 'dev'
|
||||
tmpdir.ensure('{}/bootstrap.cfg'.format(test_dev_root))
|
||||
bootstrap_file = tmpdir.join('{}/bootstrap.cfg'.format(test_dev_root))
|
||||
bootstrap_file.write(contents)
|
||||
|
||||
bootstrap_file_path = str(tmpdir.join(test_dev_root).realpath())
|
||||
|
||||
result = common.get_bootstrap_values(bootstrap_file_path, input_keys)
|
||||
|
||||
assert expected_result_map == result
|
||||
|
||||
|
||||
def test_get_bootstrap_values_fail():
|
||||
try:
|
||||
bad_file = 'x:\\foo\\bar\\file\\'
|
||||
common.get_bootstrap_values(bad_file, ['input_keys'])
|
||||
except common.LmbrCmdError as err:
|
||||
assert 'Missing' in str(err)
|
||||
else:
|
||||
assert False, "Excepted LayoutToolError (missing file)"
|
||||
|
||||
|
||||
TEST_AP_CONFIG_1 = """
|
||||
[Platforms]
|
||||
;pc=enabled
|
||||
@@ -245,7 +191,6 @@ def test_verify_game_project_and_dev_root_success(tmpdir):
|
||||
game_name = 'MyFoo'
|
||||
game_folder = 'myfoo'
|
||||
game_project_json = TEST_GAME_PROJECT_JSON_FORMAT.format(project_name=game_name)
|
||||
tmpdir.ensure(f'{dev_root}/bootstrap.cfg')
|
||||
tmpdir.ensure(f'{dev_root}/{game_folder}/project.json')
|
||||
project_json_path = tmpdir / dev_root / game_folder / 'project.json'
|
||||
project_json_path.write_text(game_project_json, encoding='ascii')
|
||||
@@ -285,72 +230,6 @@ asset_deploy_type={test_asset_deploy_type}
|
||||
assert result.asset_deploy_type == test_asset_deploy_type
|
||||
|
||||
|
||||
def test_transform_bootstrap_project_path(tmpdir):
|
||||
|
||||
tmpdir.ensure('bootstrap.cfg')
|
||||
|
||||
test_bootstrap_content = """
|
||||
-- Blah Blah
|
||||
-- Blah Blah
|
||||
|
||||
project_path=OldProject
|
||||
|
||||
-- remote_filesystem - enable Virtual File System (VFS)
|
||||
-- This feature allows a remote instance of the game to run off assets
|
||||
-- on the asset processor computers cache instead of deploying them the remote device
|
||||
-- By default it is off and can be overridden for any platform
|
||||
remote_filesystem=0
|
||||
"""
|
||||
test_src_bootstrap = tmpdir / 'bootstrap.cfg'
|
||||
test_src_bootstrap.write_text(test_bootstrap_content, encoding='ascii')
|
||||
|
||||
test_dst_bootstrap = tmpdir / 'bootstrap.transformed.cfg'
|
||||
test_game_name = 'FooBar'
|
||||
|
||||
common.transform_bootstrap_for_project(game_name=test_game_name,
|
||||
src_bootstrap=str(test_src_bootstrap),
|
||||
dst_bootstrap=str(test_dst_bootstrap))
|
||||
|
||||
transformed_text = test_dst_bootstrap.read_text('ascii')
|
||||
|
||||
search_gamename = re.search(r"project_path\s*=\s*(.*)", transformed_text)
|
||||
assert search_gamename
|
||||
assert search_gamename.group(1)
|
||||
assert search_gamename.group(1) == test_game_name
|
||||
|
||||
|
||||
def test_transform_bootstrap_project_path_missing(tmpdir):
|
||||
|
||||
tmpdir.ensure('bootstrap.cfg')
|
||||
|
||||
test_bootstrap_content = """
|
||||
-- Blah Blah
|
||||
-- Blah Blah
|
||||
|
||||
-- remote_filesystem - enable Virtual File System (VFS)
|
||||
-- This feature allows a remote instance of the game to run off assets
|
||||
-- on the asset processor computers cache instead of deploying them the remote device
|
||||
-- By default it is off and can be overridden for any platform
|
||||
remote_filesystem=0
|
||||
"""
|
||||
test_src_bootstrap = tmpdir / 'bootstrap.cfg'
|
||||
test_src_bootstrap.write_text(test_bootstrap_content, encoding='ascii')
|
||||
|
||||
test_dst_bootstrap = tmpdir / 'bootstrap.transformed.cfg'
|
||||
test_game_name = 'FooBar'
|
||||
|
||||
common.transform_bootstrap_for_project(game_name=test_game_name,
|
||||
src_bootstrap=str(test_src_bootstrap),
|
||||
dst_bootstrap=str(test_dst_bootstrap))
|
||||
|
||||
transformed_text = test_dst_bootstrap.read_text('ascii')
|
||||
|
||||
search_gamename = re.search(r"project_path\s*=\s*(.*)", transformed_text)
|
||||
assert search_gamename
|
||||
assert search_gamename.group(1)
|
||||
assert search_gamename.group(1) == test_game_name
|
||||
|
||||
|
||||
def test_cmake_dependency_success(tmpdir):
|
||||
|
||||
test_module = 'FooBar'
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
import os
|
||||
import pytest
|
||||
|
||||
from . import current_project
|
||||
|
||||
TEST_BOOTSTRAP_CONTENT_1 = """
|
||||
project_path = Game1
|
||||
foo = bar
|
||||
key1 = value1
|
||||
key2 = value2
|
||||
assets = pc
|
||||
"""
|
||||
TEST_BOOTSTRAP_CONTENT_2 = """
|
||||
project_path=Game1
|
||||
foo = bar
|
||||
key1 = value1
|
||||
key2 = value2
|
||||
assets = pc
|
||||
"""
|
||||
TEST_BOOTSTRAP_CONTENT_3 = """
|
||||
project_path= Game1
|
||||
foo = bar
|
||||
key1 = value1
|
||||
key2 = value2
|
||||
assets = pc
|
||||
"""
|
||||
TEST_BOOTSTRAP_CONTENT_4 = """
|
||||
project_path =Game1
|
||||
foo = bar
|
||||
key1 = value1
|
||||
key2 = value2
|
||||
assets = pc
|
||||
"""
|
||||
TEST_BOOTSTRAP_CONTENT_5 = """
|
||||
project_path = Game1
|
||||
foo = bar
|
||||
key1 = value1
|
||||
key2 = value2
|
||||
assets = pc
|
||||
"""
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"contents, expected_result", [
|
||||
pytest.param(TEST_BOOTSTRAP_CONTENT_1, 'Game1'),
|
||||
pytest.param(TEST_BOOTSTRAP_CONTENT_2, 'Game1'),
|
||||
pytest.param(TEST_BOOTSTRAP_CONTENT_3, 'Game1'),
|
||||
pytest.param(TEST_BOOTSTRAP_CONTENT_4, 'Game1'),
|
||||
pytest.param(TEST_BOOTSTRAP_CONTENT_5, 'Game1'),
|
||||
]
|
||||
)
|
||||
def test_get_current_project(tmpdir, contents, expected_result):
|
||||
dev_root = str(tmpdir.join('dev').realpath()).replace('\\', '/')
|
||||
os.makedirs(dev_root, exist_ok=True)
|
||||
|
||||
bootstrap_file = f'{dev_root}/bootstrap.cfg'
|
||||
if os.path.isfile(bootstrap_file):
|
||||
os.unlink(bootstrap_file)
|
||||
with open(bootstrap_file, 'a') as s:
|
||||
s.write(contents)
|
||||
|
||||
result = current_project.get_current_project(dev_root)
|
||||
assert expected_result == result
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"contents, project_to_set, expected_result", [
|
||||
pytest.param(TEST_BOOTSTRAP_CONTENT_1, 'Test1', 0),
|
||||
pytest.param(TEST_BOOTSTRAP_CONTENT_1, ' Test2', 0),
|
||||
pytest.param(TEST_BOOTSTRAP_CONTENT_1, 'Test3 ', 0),
|
||||
pytest.param(TEST_BOOTSTRAP_CONTENT_1, '/Test4', 1),
|
||||
pytest.param(TEST_BOOTSTRAP_CONTENT_1, '=Test5', 1),
|
||||
]
|
||||
)
|
||||
def test_set_current_project(tmpdir, contents, project_to_set, expected_result):
|
||||
dev_root = str(tmpdir.join('dev').realpath()).replace('\\', '/')
|
||||
os.makedirs(dev_root, exist_ok=True)
|
||||
|
||||
bootstrap_file = f'{dev_root}/bootstrap.cfg'
|
||||
if os.path.isfile(bootstrap_file):
|
||||
os.unlink(bootstrap_file)
|
||||
with open(bootstrap_file, 'a') as s:
|
||||
s.write(contents)
|
||||
|
||||
result = current_project.set_current_project(dev_root, project_to_set)
|
||||
assert expected_result == result
|
||||
|
||||
if result == 0:
|
||||
project_that_is_set = current_project.get_current_project(dev_root)
|
||||
print(project_that_is_set)
|
||||
print(project_to_set)
|
||||
assert project_to_set.strip() == project_that_is_set
|
||||
@@ -212,16 +212,15 @@ def test_create_link_error():
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"project_path, asset_type, ensure_path, warn_on_missing, expected_result", [
|
||||
pytest.param('Foo', 'pc', 'Foo/Cache/pc/bootstrap.cfg', False, 'Foo/Cache/pc'),
|
||||
pytest.param('Foo', 'pc', 'dev/bootstrap.cfg', True, None),
|
||||
pytest.param('Foo', 'pc', 'Foo/Cache/es3/bootstrap.cfg', True, None),
|
||||
pytest.param('Foo', 'pc', 'dev/bootstrap.cfg', False, common.LmbrCmdError),
|
||||
pytest.param('Foo', 'pc', 'Foo/Cache/es3/bootstrap.cfg', False, common.LmbrCmdError),
|
||||
"project_path, asset_type, warn_on_missing, expected_result", [
|
||||
pytest.param('Foo', 'pc', False, 'Foo/Cache/pc'),
|
||||
pytest.param('Foo', 'pc', True, None),
|
||||
pytest.param('Foo', 'pc', True, None),
|
||||
pytest.param('Foo', 'pc', False, common.LmbrCmdError),
|
||||
pytest.param('Foo', 'pc', False, common.LmbrCmdError),
|
||||
]
|
||||
)
|
||||
def test_construct_and_validate_cache_game_asset_folder_success(tmpdir, project_path, asset_type, ensure_path, warn_on_missing, expected_result):
|
||||
tmpdir.ensure(ensure_path)
|
||||
def test_construct_and_validate_cache_game_asset_folder_success(tmpdir, project_path, asset_type, warn_on_missing, expected_result):
|
||||
if isinstance(expected_result, str):
|
||||
expected_path_realpath = str(tmpdir.join(expected_result).realpath())
|
||||
elif expected_result == common.LmbrCmdError:
|
||||
@@ -385,7 +384,6 @@ def test_sync_layout_non_vfs_success(tmpdir, mode, existing_game_link, existing_
|
||||
old_remove_link = layout_tool.remove_link
|
||||
try:
|
||||
# Simple Test Parameters
|
||||
tmpdir.ensure('engine-root/bootstrap.cfg')
|
||||
engine_root_realpath = str(tmpdir.join('engine-root').realpath())
|
||||
test_project_path = str(tmpdir.join('Foo').realpath())
|
||||
test_project_name_lower = 'foo'
|
||||
|
||||
@@ -25,9 +25,6 @@ from glob3 import glob
|
||||
def package(options):
|
||||
package_env = PackageEnv(options.platform, options.type, options.package_env)
|
||||
|
||||
# Override values in bootstrap.cfg for PC package
|
||||
override_bootstrap_cfg(package_env)
|
||||
|
||||
if not package_env.get('SKIP_BUILD'):
|
||||
print(package_env.get('SKIP_BUILD'))
|
||||
print('SKIP_BUILD is False, running CMake build...')
|
||||
@@ -51,34 +48,6 @@ def get_python_path(package_env):
|
||||
return os.path.join(package_env.get('ENGINE_ROOT'), 'python', 'python.sh')
|
||||
|
||||
|
||||
def override_bootstrap_cfg(package_env):
|
||||
print('Override values in bootstrap.cfg')
|
||||
engine_root = package_env.get('ENGINE_ROOT')
|
||||
bootstrap_path = os.path.join(engine_root, 'bootstrap.cfg')
|
||||
replace_values = {'project_path':'{}'.format(package_env.get('BOOTSTRAP_CFG_GAME_FOLDER'))}
|
||||
try:
|
||||
with open(bootstrap_path, 'r') as bootstrap_cfg:
|
||||
content = bootstrap_cfg.read()
|
||||
except:
|
||||
error('Cannot read file {}'.format(bootstrap_path))
|
||||
content = content.split('\n')
|
||||
new_content = []
|
||||
for line in content:
|
||||
if not line.startswith('--'):
|
||||
strs = line.split('=')
|
||||
if len(strs):
|
||||
key = strs[0].strip(' ')
|
||||
if key in replace_values:
|
||||
line = '{}={}'.format(key, replace_values[key])
|
||||
new_content.append(line)
|
||||
try:
|
||||
with open(bootstrap_path, 'w') as out:
|
||||
out.write('\n'.join(new_content))
|
||||
except:
|
||||
error('Cannot write to file {}'.format(bootstrap_path))
|
||||
print('{} updated with value {}'.format(bootstrap_path, replace_values))
|
||||
|
||||
|
||||
def cmake_build(package_env):
|
||||
build_targets = package_env.get('BUILD_TARGETS')
|
||||
for build_target in build_targets:
|
||||
|
||||
Reference in New Issue
Block a user