LYN-2537 AssetBundler updates (#426)

* LYN-2537 Updated the AssetBundler code to looks for the AssetSeedList
files within the Assets/Engine directory
Updated the MissingDependencyScanner GetXMLDependenciesFile functions to
use the Assets/Engine directory as well

Also fixed the MissingDependencyScanner to properly located dependency
xml files within gem directories

* Adding back input argument validation for the AssetBundler command options.

Also added an application_options settings registry file that contains the list of valid command options for the ComponentApplication

* Adding missing end of file newline for applications_options.setreg

* Fixed the AssetBundler help output for the bundleSeed command
This commit is contained in:
lumberyard-employee-dm
2021-05-03 20:09:37 -05:00
committed by GitHub
parent 15c2203e01
commit bcbe1bfef7
12 changed files with 127 additions and 95 deletions
@@ -17,7 +17,7 @@
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/Utils.h>
#include <AzCore/std/parallel/thread.h>
#include <AzCore/Component/ComponentApplicationBus.h>
#include <AzCore/Utils/Utils.h>
#include <AzFramework/Asset/AssetBundleManifest.h>
#include <AzFramework/StringFunc/StringFunc.h>
#include <AzFramework/API/ApplicationAPI.h>
@@ -250,7 +250,7 @@ namespace AzToolsFramework
AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance();
AZ_Assert(fileIO != nullptr, "AZ::IO::FileIOBase must be ready for use.\n");
AZStd::string bundleFilePath = assetBundleSettings.m_bundleFilePath;
AZ::IO::Path bundleFilePath = AZ::IO::Path(AZStd::string_view{ AZ::Utils::GetEnginePath() }) / assetBundleSettings.m_bundleFilePath;
AzFramework::PlatformId platformId = static_cast<AzFramework::PlatformId>(AzFramework::PlatformHelper::GetPlatformIndexFromName(assetBundleSettings.m_platform.c_str()));
@@ -259,22 +259,13 @@ namespace AzToolsFramework
return false;
}
const char* appRoot = nullptr;
AzFramework::ApplicationRequests::Bus::BroadcastResult(appRoot, &AzFramework::ApplicationRequests::GetAppRoot);
if (AzFramework::StringFunc::Path::IsRelative(bundleFilePath.c_str()))
{
AzFramework::StringFunc::Path::ConstructFull(appRoot, bundleFilePath.c_str(), bundleFilePath, true);
}
AZ::u64 maxSizeInBytes = static_cast<AZ::u64>(assetBundleSettings.m_maxBundleSizeInMB * NumOfBytesInMB);
AZ::u64 assetCatalogFileSizeBuffer = static_cast<AZ::u64>(AssetCatalogFileSizeBufferPercentage * assetBundleSettings.m_maxBundleSizeInMB * NumOfBytesInMB) / 100;
AZ::u64 bundleSize = 0;
AZ::u64 totalFileSize = 0;
int bundleIndex = 0;
AZStd::string bundleFullPath = bundleFilePath;
AZStd::string tempBundleFilePath = bundleFullPath + "_temp";
AZStd::string tempBundleFilePath = bundleFilePath.Native() + "_temp";
AZStd::vector<AZStd::string> dependentBundleNames;
AZStd::vector<AZStd::string> levelDirs;
@@ -301,7 +292,7 @@ namespace AzToolsFramework
if (fileIO->Exists(bundleFilePath.c_str()))
{
// This will delete both the parent bundle as well as all the dependent bundles mentioned in the manifest file of the parent bundle.
if (!DeleteBundleFiles(bundleFilePath))
if (!DeleteBundleFiles(bundleFilePath.Native()))
{
return false;
}
@@ -390,7 +381,7 @@ namespace AzToolsFramework
// we need to find a bundle which does not exist on disk;
bundleIndex++;
numOfTries--;
dependentBundleFileName = CreateAssetBundleFileName(bundleFilePath, bundleIndex);
dependentBundleFileName = CreateAssetBundleFileName(bundleFilePath.Native(), bundleIndex);
AzFramework::StringFunc::Path::ReplaceFullName(tempBundleFilePath, (dependentBundleFileName + tempBundleFileSuffix).c_str());
} while (numOfTries && fileIO->Exists(tempBundleFilePath.c_str()));
@@ -463,15 +454,7 @@ namespace AzToolsFramework
AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance();
AZStd::string assetFileInfoListPath = assetBundleSettings.m_assetFileInfoListPath;
const char* appRoot = nullptr;
AzFramework::ApplicationRequests::Bus::BroadcastResult(appRoot, &AzFramework::ApplicationRequests::GetAppRoot);
if (AzFramework::StringFunc::Path::IsRelative(assetFileInfoListPath.c_str()))
{
AzFramework::StringFunc::Path::ConstructFull(appRoot, assetFileInfoListPath.c_str(), assetFileInfoListPath, true);
}
AZ::IO::Path assetFileInfoListPath = AZ::IO::Path{ AZStd::string_view{AZ::Utils::GetEnginePath()} } / assetBundleSettings.m_assetFileInfoListPath;
if (!fileIO->Exists(assetFileInfoListPath.c_str()))
{
@@ -15,6 +15,7 @@
#include <source/utils/GUIApplicationManager.h>
#include <source/utils/utils.h>
#include <AzCore/Utils/Utils.h>
#include <AzFramework/IO/LocalFileIO.h>
#include <AzFramework/StringFunc/StringFunc.h>
#include <AzQtComponents/Utilities/DesktopUtilities.h>
@@ -232,8 +233,8 @@ namespace AssetBundler
for (const QJsonValue scanPath : m_watchedFiles + m_watchedFolders)
{
AZStd::string scanFilePathStr = scanPath.toString().toUtf8().data();
AzFramework::StringFunc::Path::ConstructFull(GetCachedEngineRoot().c_str(), scanFilePathStr.c_str(), scanFilePathStr);
auto scanFilePathStr = (AZ::IO::Path(AZStd::string_view{ AZ::Utils::GetEnginePath() })
/ scanPath.toString().toUtf8().data()).LexicallyNormal();
// Check whether the file has already been watched
// Get absolute file paths via QFileInfo to keep consistency in the letter case
@@ -263,8 +264,8 @@ namespace AssetBundler
for (auto itr = scanPaths.begin(); itr != scanPaths.end(); ++itr)
{
QJsonValueRef scanPathValueRef = *itr;
AZStd::string scanPath = scanPathValueRef.toString().toUtf8().data();
AzFramework::StringFunc::Path::ConstructFull(GetCachedEngineRoot().c_str(), scanPath.c_str(), scanPath);
auto scanPath = (AZ::IO::Path(AZStd::string_view{ AZ::Utils::GetEnginePath() })
/ scanPathValueRef.toString().toUtf8().data()).LexicallyNormal();
// Check whether the file is being watched
// Get absolute file paths via QFileInfo to keep consistency in the letter case
@@ -316,13 +317,8 @@ namespace AssetBundler
for (const QJsonValue scanPath : scanPaths[AssetBundlingFileTypes[fileType]].toArray())
{
AZStd::string absoluteScanPath = scanPath.toString().toUtf8().data();
AZStd::replace(absoluteScanPath.begin(), absoluteScanPath.end(), AZ_WRONG_FILESYSTEM_SEPARATOR, AZ_CORRECT_FILESYSTEM_SEPARATOR);
if (AzFramework::StringFunc::Path::IsRelative(absoluteScanPath.c_str()))
{
AzFramework::StringFunc::Path::ConstructFull(GetCachedEngineRoot().c_str(), absoluteScanPath.c_str(), absoluteScanPath);
}
auto absoluteScanPath = (AZ::IO::Path(AZStd::string_view{ AZ::Utils::GetEnginePath() })
/ scanPath.toString().toUtf8().data()).LexicallyNormal();
if (AZ::IO::FileIOBase::GetInstance()->IsDirectory(absoluteScanPath.c_str()))
{
@@ -138,7 +138,7 @@ namespace AssetBundler
m_watchedFolders.insert(m_guiApplicationManager->GetSeedListsFolder().c_str());
// Get the list of default Seed List files
m_filePathToGemNameMap = AssetBundler::GetDefaultSeedListFiles(GetCachedEngineRoot().c_str(), m_guiApplicationManager->GetCurrentProjectName(),
m_filePathToGemNameMap = AssetBundler::GetDefaultSeedListFiles(AZStd::string_view{ AZ::Utils::GetEnginePath() }, m_guiApplicationManager->GetCurrentProjectName(),
m_guiApplicationManager->GetGemInfoList(), m_guiApplicationManager->GetEnabledPlatforms());
// Get the list of default Seeds that are not stored in a Seed List file on-disk
@@ -45,13 +45,6 @@ namespace AssetBundler
{
const char compareVariablePrefix = '$';
GemInfo::GemInfo(AZStd::string name, AZStd::string relativeFilePath, AZStd::string absoluteFilePath)
: m_gemName(name)
, m_relativeFilePath(relativeFilePath)
, m_absoluteFilePath(absoluteFilePath)
{
}
ApplicationManager::ApplicationManager(int* argc, char*** argv, QObject* parent)
: QObject(parent)
, AzToolsFramework::ToolsApplication(argc, argv)
@@ -80,8 +73,6 @@ namespace AssetBundler
m_assetSeedManager = AZStd::make_unique<AzToolsFramework::AssetSeedManager>();
AZ_TracePrintf(AssetBundler::AppWindowName, "\n");
g_cachedEngineRoot = AZ::IO::FixedMaxPath(GetEngineRoot());
// There is no need to update the UserSettings file, so we can avoid a race condition by disabling save on shutdown
AZ::UserSettingsComponentRequestBus::Broadcast(&AZ::UserSettingsComponentRequests::DisableSaveOnFinalize);
return true;
@@ -383,6 +374,13 @@ namespace AssetBundler
{
using namespace AzToolsFramework;
auto validateArgsOutcome = ValidateInputArgs(parser, m_allSeedsArgs);
if (!validateArgsOutcome.IsSuccess())
{
OutputHelpSeeds();
return AZ::Failure(validateArgsOutcome.TakeError());
}
SeedsParams params;
params.m_ignoreFileCase = parser->HasSwitch(IgnoreFileCaseFlag);
@@ -473,6 +471,13 @@ namespace AssetBundler
AZ::Outcome<AssetListsParams, AZStd::string> ApplicationManager::ParseAssetListsCommandData(const AZ::CommandLine* parser)
{
auto validateArgsOutcome = ValidateInputArgs(parser, m_allAssetListsArgs);
if (!validateArgsOutcome.IsSuccess())
{
OutputHelpAssetLists();
return AZ::Failure(validateArgsOutcome.TakeError());
}
AssetListsParams params;
// Read in Platform arg
@@ -536,6 +541,13 @@ namespace AssetBundler
AZ::Outcome<ComparisonRulesParams, AZStd::string> ApplicationManager::ParseComparisonRulesCommandData(const AZ::CommandLine* parser)
{
auto validateArgsOutcome = ValidateInputArgs(parser, m_allComparisonRulesArgs);
if (!validateArgsOutcome.IsSuccess())
{
OutputHelpComparisonRules();
return AZ::Failure(validateArgsOutcome.TakeError());
}
ScopedTraceHandler traceHandler;
ComparisonRulesParams params;
@@ -918,6 +930,13 @@ namespace AssetBundler
AZ::Outcome<ComparisonParams, AZStd::string> ApplicationManager::ParseCompareCommandData(const AZ::CommandLine* parser)
{
auto validateArgsOutcome = ValidateInputArgs(parser, m_allCompareArgs);
if (!validateArgsOutcome.IsSuccess())
{
OutputHelpCompare();
return AZ::Failure(validateArgsOutcome.TakeError());
}
ComparisonParams params;
// Read in Platform arg
@@ -1009,6 +1028,13 @@ namespace AssetBundler
AZ::Outcome<BundleSettingsParams, AZStd::string> ApplicationManager::ParseBundleSettingsCommandData(const AZ::CommandLine* parser)
{
auto validateArgsOutcome = ValidateInputArgs(parser, m_allBundleSettingsArgs);
if (!validateArgsOutcome.IsSuccess())
{
OutputHelpBundleSettings();
return AZ::Failure(validateArgsOutcome.TakeError());
}
BundleSettingsParams params;
// Read in Platform arg
@@ -1213,6 +1239,13 @@ namespace AssetBundler
AZ::Outcome<BundlesParamsList, AZStd::string> ApplicationManager::ParseBundlesCommandData(const AZ::CommandLine* parser)
{
auto validateArgsOutcome = ValidateInputArgs(parser, m_allBundlesArgs);
if (!validateArgsOutcome.IsSuccess())
{
OutputHelpBundles();
return AZ::Failure(validateArgsOutcome.TakeError());
}
auto parseSettingsOutcome = ParseBundleSettingsAndOverrides(parser, BundlesCommand);
if (!parseSettingsOutcome.IsSuccess())
{
@@ -1224,6 +1257,14 @@ namespace AssetBundler
AZ::Outcome<BundleSeedParams, AZStd::string> ApplicationManager::ParseBundleSeedCommandData(const AZ::CommandLine* parser)
{
auto validateArgsOutcome = ValidateInputArgs(parser, m_allBundleSeedArgs);
if (!validateArgsOutcome.IsSuccess())
{
OutputHelpBundleSeed();
return AZ::Failure(validateArgsOutcome.TakeError());
}
BundleSeedParams params;
params.m_addSeedList = GetAddSeedArgList(parser);
@@ -1241,6 +1282,12 @@ namespace AssetBundler
AZ::Outcome<void, AZStd::string> ApplicationManager::ValidateInputArgs(const AZ::CommandLine* parser, const AZStd::vector<const char*>& validArgList)
{
constexpr AZStd::string_view ApplicationArgList = "/O3DE/AzCore/Application/ValidCommandOptions";
AZStd::vector<AZStd::string> validApplicationArgs;
if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry != nullptr)
{
settingsRegistry->GetObject(validApplicationArgs, ApplicationArgList);
}
for (const auto& paramInfo : *parser)
{
// Skip positional arguments
@@ -1258,10 +1305,18 @@ namespace AssetBundler
break;
}
}
for (const auto& validArg : validApplicationArgs)
{
if (AZ::StringFunc::Equal(paramInfo.m_option, validArg))
{
isValidArg = true;
break;
}
}
if (!isValidArg)
{
return AZ::Failure(AZStd::string::format("Unknown argument: \"--%s\" is not an unknown argument for this sub-command.", paramInfo.m_option.c_str()));
return AZ::Failure(AZStd::string::format(R"(Invalid argument: "--%s" is not a valid argument for this sub-command.)", paramInfo.m_option.c_str()));
}
}
@@ -1346,10 +1401,10 @@ namespace AssetBundler
}
// If no platform was specified, defaulting to platforms specified in the asset processor config files
const char* appRoot = nullptr;
AzFramework::ApplicationRequests::Bus::BroadcastResult(appRoot, &AzFramework::ApplicationRequests::GetAppRoot);
AzFramework::PlatformFlags platformFlags = GetEnabledPlatformFlags(GetEngineRoot(), appRoot, AZ::Utils::GetProjectPath().c_str());
AzFramework::PlatformFlags platformFlags = GetEnabledPlatformFlags(
AZStd::string_view{ AZ::Utils::GetEnginePath() },
AZStd::string_view{ AZ::Utils::GetEnginePath() },
AZStd::string_view{ AZ::Utils::GetProjectPath() });
auto platformsString = AzFramework::PlatformHelper::GetCommaSeparatedPlatformList(platformFlags);
AZ_TracePrintf(AppWindowName, "No platform specified, defaulting to platforms ( %s ).\n", platformsString.c_str());
+5 -13
View File
@@ -109,17 +109,15 @@ namespace AssetBundler
const char* AssetCatalogFilename = "assetcatalog.xml";
AZ::IO::FixedMaxPath g_cachedEngineRoot;
const char EngineDirectoryName[] = "Engine";
constexpr auto EngineDirectoryName = AZ::IO::FixedMaxPath("Assets") / "Engine";
const char RestrictedDirectoryName[] = "restricted";
const char PlatformsDirectoryName[] = "Platforms";
const char GemsDirectoryName[] = "Gems";
const char GemsAssetsDirectoryName[] = "Assets";
const char GemsSeedFileName[] = "seedList";
const char EngineSeedFileName[] = "SeedAssetList";
namespace Internal
{
@@ -131,7 +129,7 @@ namespace AssetBundler
AZStd::unordered_map<AZStd::string, AZStd::string>& defaultSeedLists,
AzFramework::PlatformFlags platformFlags)
{
AZ::IO::FixedMaxPath engineRoot(GetCachedEngineRoot());
AZ::IO::FixedMaxPath engineRoot(AZ::Utils::GetEnginePath());
AZ::IO::FixedMaxPath engineRestrictedRoot = engineRoot / RestrictedDirectoryName;
AZ::IO::FixedMaxPath engineLocalPath = AZ::IO::PathView(engineDirectory.LexicallyRelative(engineRoot));
@@ -204,12 +202,6 @@ namespace AssetBundler
}
}
AZ::IO::FixedMaxPath GetCachedEngineRoot()
{
AZ_Error(AppWindowName, !g_cachedEngineRoot.empty(), "Cached Engine Root has not been initialized by the Bundler.");
return g_cachedEngineRoot;
}
void AddPlatformIdentifier(AZStd::string& filePath, const AZStd::string& platformIdentifier)
{
AZStd::string fileName;
@@ -257,11 +249,11 @@ namespace AssetBundler
absoluteEngineSeedFilePath.ReplaceExtension(AzToolsFramework::AssetSeedManager::GetSeedFileExtension());
if (fileIO->Exists(absoluteEngineSeedFilePath.c_str()))
{
defaultSeedLists[absoluteEngineSeedFilePath.Native()] = EngineDirectoryName;
defaultSeedLists[absoluteEngineSeedFilePath.Native()] = EngineDirectoryName.String();
}
// Add Seed Lists from the Platforms directory
Internal::AddPlatformsDirectorySeeds(engineDirectory, EngineDirectoryName, defaultSeedLists, platformFlag);
Internal::AddPlatformsDirectorySeeds(engineDirectory, EngineDirectoryName.String(), defaultSeedLists, platformFlag);
auto absoluteProjectDefaultSeedFilePath = AZ::IO::Path(projectPath) / EngineSeedFileName;
absoluteProjectDefaultSeedFilePath.ReplaceExtension(AzToolsFramework::AssetSeedManager::GetSeedFileExtension());
@@ -122,20 +122,8 @@ namespace AssetBundler
////////////////////////////////////////////////////////////////////////////////////////////
extern const char* AssetCatalogFilename;
extern AZ::IO::FixedMaxPath g_cachedEngineRoot;
static const size_t MaxErrorMessageLength = 4096;
//! This struct stores gem related information
struct GemInfo
{
AZ_CLASS_ALLOCATOR(GemInfo, AZ::SystemAllocator, 0);
GemInfo(AZStd::string name, AZStd::string relativeFilePath, AZStd::string absoluteFilePath);
GemInfo() = default;
AZStd::string m_gemName;
AZStd::string m_relativeFilePath;
AZStd::string m_absoluteFilePath;
};
// The Warning Absorber is used to absorb warnings
// One case that this is being used is during loading of the asset catalog.
@@ -151,9 +139,6 @@ namespace AssetBundler
bool OnPreWarning(const char* window, const char* fileName, int line, const char* func, const char* message) override;
};
// Returns the cached engine root. Throws an error if the cached path has not been initialized by the Bundler Application.
AZ::IO::FixedMaxPath GetCachedEngineRoot();
/**
* Determines the name of the currently enabled game project
* @return Current Project name on success, error message on failure
+8 -7
View File
@@ -88,7 +88,7 @@ namespace AssetBundler
const char RelativeTestFolder[] = "Code/Tools/AssetBundler/tests";
const char GemsFolder[] = "Gems";
const char EngineFolder[] = "Engine";
constexpr auto EngineFolder = AZ::IO::FixedMaxPath("Assets") / "Engine";
const char PlatformsFolder[] = "Platforms";
const char DummyProjectFolder[] = "DummyProject";
@@ -113,13 +113,14 @@ namespace AssetBundler
AZ::SettingsRegistry::Register(&m_registry);
}
AssetBundler::g_cachedEngineRoot = m_data->m_application.get()->GetEngineRoot();
if (AssetBundler::g_cachedEngineRoot.empty())
AZ::IO::FixedMaxPath engineRoot = AZ::Utils::GetEnginePath();
if (engineRoot.empty())
{
GTEST_FATAL_FAILURE_(AZStd::string::format("Unable to locate engine root.\n").c_str());
}
AzFramework::StringFunc::Path::Join(AssetBundler::g_cachedEngineRoot.c_str(), RelativeTestFolder, m_data->m_testEngineRoot);
m_data->m_testEngineRoot = (engineRoot / RelativeTestFolder).LexicallyNormal().String();
m_data->m_localFileIO = aznew AZ::IO::LocalFileIO();
m_data->m_priorFileIO = AZ::IO::FileIOBase::GetInstance();
@@ -131,8 +132,8 @@ namespace AssetBundler
AddGemData(m_data->m_testEngineRoot.c_str(), "GemA");
AddGemData(m_data->m_testEngineRoot.c_str(), "GemB");
AZStd::string absoluteEngineSeedFilePath;
AzFramework::StringFunc::Path::ConstructFull(m_data->m_testEngineRoot.c_str(), EngineFolder, "SeedAssetList", AzToolsFramework::AssetSeedManager::GetSeedFileExtension(), absoluteEngineSeedFilePath, true);
auto absoluteEngineSeedFilePath = m_data->m_testEngineRoot / EngineFolder / "SeedAssetList";
absoluteEngineSeedFilePath.ReplaceExtension(AzToolsFramework::AssetSeedManager::GetSeedFileExtension());
m_data->m_gemSeedFilePairList.emplace_back(AZStd::make_pair(absoluteEngineSeedFilePath, true));
AddGemData(m_data->m_testEngineRoot.c_str(), "GemC", false);
@@ -212,7 +213,7 @@ namespace AssetBundler
AZStd::unique_ptr<AzToolsFramework::ToolsApplication> m_application = {};
AZ::IO::FileIOBase* m_priorFileIO = nullptr;
AZ::IO::FileIOBase* m_localFileIO = nullptr;
AZStd::string m_testEngineRoot;
AZ::IO::Path m_testEngineRoot;
};
const int GemAIndex = 0;
@@ -20,30 +20,32 @@ AZ_POP_DISABLE_WARNING
#include "native/AssetDatabase/AssetDatabase.h"
#include "native/assetprocessor.h"
#include <AzCore/Component/TickBus.h>
#include <AzCore/IO/FileIO.h>
#include <AzCore/IO/Path/Path.h>
#include <AzCore/std/smart_ptr/make_shared.h>
#include <AzCore/std/smart_ptr/shared_ptr.h>
#include <AzCore/std/string/wildcard.h>
#include <AzCore/Utils/Utils.h>
#include <AzCore/XML/rapidxml.h>
#include <AzFramework/API/ApplicationAPI.h>
#include <AzFramework/FileTag/FileTag.h>
#include <AzFramework/FileTag/FileTagBus.h>
#include <AzFramework/IO/LocalFileIO.h>
namespace AssetProcessor
{
const char* EngineFolder = "Engine";
constexpr auto EngineFolder = AZ::IO::FixedMaxPath("Assets") / "Engine";
AZStd::string GetXMLDependenciesFile(const AZStd::string& fullPath, const AZStd::vector<AzFramework::GemInfo>& gemInfoList, AZStd::string& tokenName)
{
AZ::IO::Path xmlDependenciesFileFullPath;
tokenName = EngineFolder;
tokenName = EngineFolder.String();
for (const AzFramework::GemInfo& gemElement : gemInfoList)
{
for (const AZ::IO::Path& absoluteSourcePath : gemElement.m_absoluteSourcePaths)
{
if (AZ::StringFunc::StartsWith(fullPath, absoluteSourcePath.Native()) || AZ::StringFunc::Equal(absoluteSourcePath.Native(), fullPath))
if (AZ::IO::PathView(fullPath).IsRelativeTo(absoluteSourcePath))
{
xmlDependenciesFileFullPath = absoluteSourcePath;
xmlDependenciesFileFullPath /= AzFramework::GemInfo::GetGemAssetFolder();
xmlDependenciesFileFullPath /= AZStd::string::format("%s_Dependencies.xml", gemElement.m_gemName.c_str());;
if (AZ::IO::FileIOBase::GetInstance()->Exists(xmlDependenciesFileFullPath.c_str()))
@@ -57,7 +59,7 @@ namespace AssetProcessor
// if we are here than either the %gemName%_Dependencies.xml file does not exists or the user inputted path is not inside a gems folder,
// in both the cases we will return the engine dependencies file
xmlDependenciesFileFullPath = AZ::IO::FileIOBase::GetInstance()->GetAlias("@devroot@");
xmlDependenciesFileFullPath = AZ::Utils::GetEnginePath();
xmlDependenciesFileFullPath /= EngineFolder;
xmlDependenciesFileFullPath /= "Engine_Dependencies.xml";
@@ -30,7 +30,7 @@ namespace AssetValidation::AssetSeed
constexpr char GemsDirectoryName[] = "Gems";
constexpr char GemsSeedFileName[] = "seedList";
constexpr char EngineSeedFileName[] = "SeedAssetList";
constexpr char EngineDirectoryName[] = "Engine";
constexpr auto EngineDirectoryName = AZ::IO::FixedMaxPath("Assets") / "Engine";
void AddPlatformSeeds(const AZStd::string& rootFolder, AZStd::vector<AZStd::string>& defaultSeedLists, AzFramework::PlatformFlags platformFlags);
@@ -32,20 +32,21 @@ TEST_F(AssetValidationTest, DefaultSeedList_ReturnsExpectedSeedLists)
{
AZStd::vector<AzFramework::GemInfo> gemInfo;
AZStd::string gemSeedList, engineSeedList, projectSeedList;
AZ::IO::Path gemSeedList, engineSeedList, projectSeedList;
ASSERT_TRUE(CreateDummyFile((AZ::IO::Path("mockGem") / AzFramework::GemInfo::GetGemAssetFolder()).c_str(), "seedList", "Mock Gem Seed List", gemSeedList));
ASSERT_TRUE(CreateDummyFile("Engine", "SeedAssetList", "Engine Seed List", engineSeedList));
ASSERT_TRUE(CreateDummyFile((AZ::IO::Path("mockGem") / AzFramework::GemInfo::GetGemAssetFolder()).c_str(), "seedList", "Mock Gem Seed List", gemSeedList.Native()));
ASSERT_TRUE(CreateDummyFile((AZ::IO::Path("Assets") / "Engine").c_str(), "SeedAssetList", "Engine Seed List", engineSeedList.Native()));
AZ::SettingsRegistryInterface::FixedValueString projectName = AZ::Utils::GetProjectName();
ASSERT_FALSE(projectName.empty());
ASSERT_TRUE(CreateDummyFile(projectName.c_str(), "SeedAssetList", "Project Seed List", projectSeedList));
ASSERT_TRUE(CreateDummyFile(projectName.c_str(), "SeedAssetList", "Project Seed List", projectSeedList.Native()));
AzFramework::GemInfo mockGem("MockGem");
mockGem.m_absoluteSourcePaths.push_back((m_tempDir / "mockGem").string().c_str());
gemInfo.push_back(mockGem);
AZStd::vector<AZStd::string> defaultSeedLists = AssetValidation::AssetSeed::GetDefaultSeedListFiles(gemInfo, AzFramework::PlatformFlags::Platform_PC);
AZStd::vector<AZStd::string> defaultSeedStringList = AssetValidation::AssetSeed::GetDefaultSeedListFiles(gemInfo, AzFramework::PlatformFlags::Platform_PC);
AZStd::vector<AZ::IO::Path> defaultSeedLists{ AZStd::make_move_iterator(defaultSeedStringList.begin()), AZStd::make_move_iterator(defaultSeedStringList.end()) };
ASSERT_THAT(defaultSeedLists, ::testing::UnorderedElementsAre(gemSeedList, engineSeedList, projectSeedList));
}
+17
View File
@@ -0,0 +1,17 @@
{
"O3DE" : {
"AzCore": {
"Application": {
"ValidCommandOptions": [
"project-path",
"engine-path",
"project-cache-path",
"regset",
"regremove",
"regdump",
"regdumpall"
]
}
}
}
}