LYN-2537 engine assets (#254)
* LYN-2537 Moved the Engine and Editor folder to be within the EngineAssets folder * Fixed Documentation in bootstrap.cfg to correct the path to the user project specific registry file * Adding a newline to the output of AssetCatalog 'Registering asset..., but type is not set' message * Updating the AssetProcessorPlatformConfig.setreg Scan Folder to detect the @ENGINEROOT@/EngineAssets/Engine path for engine runtime assets and @ENGINEROOT@/EngineAssets/Editor path for engine tool assets * Updating references to Icons and other assets to account for moving the Engine and Editor folder under a single EngineAssets folder * Moving the Engine Settings Registry folder from Engine/Registry -> Registry * Removed the LY_PROJECT_CMAKE_PATH define as it is not portable to other locations. It is hard coded to the project location that was used for the CMake configuration. Furthermore it paths with backslashes within it are treated as escape characters and not a path separator * Updated the LyTestTools asset_processor.py script to copy the exclude.filetag from the EngineAssets/Engine directory now * Fixed Atom Shader Preprocessing when running using an External Project * Updated the TSGenerateAction.cpp to fix the build error with using a renamed variable * Updated the Install_Common.cmake ly_setup_others function to install the EngineAssets directory and the each of the Gem's Assets directory while maintaining the relative directory structure to the Engine Root Also updated the install step to install the Registry folder at the engine root * Fixed the copying of the Registry folder to be in the install root, instead of under a second 'Registry' folder * Moving the AssetProcessorPlatformConfig.setreg file over to the Registry folder * Updated the LyTestTools and C++ code to point that the new location of the AssetProcessorPlatformConfig.setreg file inside of the Registry folder * Renamed Test AssetProcessor*Config.ini files to have the .setreg extension * Converted the AssetProcessor test setreg files from ini format to json format using the SerializeContextTools convert-ini command * Updated the AssetProcessor CMakeLists.txt to copy over the test setreg files to the build folder * Updated the assetprocessor test file list to point at the renamed AsssetProcessor*Config setreg filenames * Removed the Output Prefix code from the AssetProcessor. The complexity that it brought to the AP code is not needed, as users can replicate the behavior by just moving there assets underneath a another folder, underneath the scan folder * Adding back support to read the AssetProcessorPlatformConfig.setreg file from the asset root. This is only needed for C++ UnitTests as they run in an environment where the accessing the Engine Settings Registry is not available * Updating the Install_common.cmake logic to copy any "Assets" folder to the install layout. The Script has also been updated to copy over the "Assets" folder in the Engine Root to the install layout instead of an "EngineAssets" folder * Updating References to EngineAssets source asset folder in code to be the Assets source folder * Moved the Engine Source Asset folder of 'EngineAssets' to a new folder name of 'Assets'. This is inline with the naming scheme we use for Gem asset folders * Adding the EngineFinder.cmake to the AutomatedTesting project to allow it to work in a project centric manner * Updating the LyTestTools copy_assets_to_project function to be able to copy assets with folders to the temporary project root Fixed an issue in LyTestTools where the temporary log directory could have shutil.rmtree being called twice on it leading to an exception which fails an automated test Updated the asset_procesor_gui_tests_2 AddScanFolder test to not use the output prefix, but instead place the source asset root into a subdirectory * Correct the AssetProcessorPlatformConfig Scan Folders for the EngineAssets directory to point at the Assets directory * Updated the asset procesor batch dependency test scan folder to point at the 'Assets' folder instead of 'EngineAssets'
This commit is contained in:
committed by
GitHub
parent
ed74bb9166
commit
3dec5d3b71
@@ -1,9 +0,0 @@
|
||||
[Platforms]
|
||||
;pc=enabled
|
||||
es3=enabled
|
||||
;ios=enabled
|
||||
;osx_gl=enabled
|
||||
;provo=enabled
|
||||
;server=enabled
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"Amazon": {
|
||||
"AssetProcessor": {
|
||||
"Settings": {
|
||||
"Platforms": {
|
||||
"es3": "enabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
[Platforms]
|
||||
;pc=enabled
|
||||
;es3=enabled
|
||||
ios=enabled
|
||||
;osx_gl=enabled
|
||||
;provo=enabled
|
||||
;server=enabled
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"Amazon": {
|
||||
"AssetProcessor": {
|
||||
"Settings": {
|
||||
"Platforms": {
|
||||
"ios": "enabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
[Platforms]
|
||||
;pc=enabled
|
||||
;es3=enabled
|
||||
;ios=enabled
|
||||
;osx_gl=enabled
|
||||
provo=enabled
|
||||
;server=enabled
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"Amazon": {
|
||||
"AssetProcessor": {
|
||||
"Settings": {
|
||||
"Platforms": {
|
||||
"provo": "enabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,7 +178,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
TARGETS
|
||||
AssetProcessor.Tests
|
||||
FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_broken_badplatform/AssetProcessorPlatformConfig.ini
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_broken_badplatform/AssetProcessorPlatformConfig.setreg
|
||||
OUTPUT_SUBDIRECTORY
|
||||
testdata/config_broken_badplatform
|
||||
)
|
||||
@@ -186,7 +186,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
TARGETS
|
||||
AssetProcessor.Tests
|
||||
FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_broken_noscans/AssetProcessorPlatformConfig.ini
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_broken_noscans/AssetProcessorPlatformConfig.setreg
|
||||
OUTPUT_SUBDIRECTORY
|
||||
testdata/config_broken_noscans
|
||||
)
|
||||
@@ -194,7 +194,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
TARGETS
|
||||
AssetProcessor.Tests
|
||||
FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_broken_recognizers/AssetProcessorPlatformConfig.ini
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_broken_recognizers/AssetProcessorPlatformConfig.setreg
|
||||
OUTPUT_SUBDIRECTORY
|
||||
testdata/config_broken_recognizers
|
||||
)
|
||||
@@ -202,7 +202,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
TARGETS
|
||||
AssetProcessor.Tests
|
||||
FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_broken_noplatform/AssetProcessorPlatformConfig.ini
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_broken_noplatform/AssetProcessorPlatformConfig.setreg
|
||||
OUTPUT_SUBDIRECTORY
|
||||
testdata/config_broken_noplatform
|
||||
)
|
||||
@@ -210,7 +210,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
TARGETS
|
||||
AssetProcessor.Tests
|
||||
FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_regular/AssetProcessorPlatformConfig.ini
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_regular/AssetProcessorPlatformConfig.setreg
|
||||
OUTPUT_SUBDIRECTORY
|
||||
testdata/config_regular
|
||||
)
|
||||
@@ -218,7 +218,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
TARGETS
|
||||
AssetProcessor.Tests
|
||||
FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_regular_platform_scanfolder/AssetProcessorPlatformConfig.ini
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/testdata/config_regular_platform_scanfolder/AssetProcessorPlatformConfig.setreg
|
||||
OUTPUT_SUBDIRECTORY
|
||||
testdata/config_regular_platform_scanfolder
|
||||
)
|
||||
@@ -226,7 +226,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
TARGETS
|
||||
AssetProcessor.Tests
|
||||
FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/testdata/EmptyDummyProject/AssetProcessorGamePlatformConfig.ini
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/testdata/EmptyDummyProject/AssetProcessorGamePlatformConfig.setreg
|
||||
OUTPUT_SUBDIRECTORY
|
||||
testdata/EmptyDummyProject
|
||||
)
|
||||
@@ -234,7 +234,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
|
||||
TARGETS
|
||||
AssetProcessor.Tests
|
||||
FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/testdata/DummyProject/AssetProcessorGamePlatformConfig.ini
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/testdata/DummyProject/AssetProcessorGamePlatformConfig.setreg
|
||||
OUTPUT_SUBDIRECTORY
|
||||
testdata/DummyProject
|
||||
)
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
#
|
||||
|
||||
set(FILES
|
||||
testdata/config_broken_badplatform/AssetProcessorPlatformConfig.ini
|
||||
testdata/config_broken_noplatform/AssetProcessorPlatformConfig.ini
|
||||
testdata/config_broken_noscans/AssetProcessorPlatformConfig.ini
|
||||
testdata/config_broken_recognizers/AssetProcessorPlatformConfig.ini
|
||||
testdata/config_regular/AssetProcessorPlatformConfig.ini
|
||||
testdata/config_regular_platform_scanfolder/AssetProcessorPlatformConfig.ini
|
||||
testdata/EmptyDummyProject/AssetProcessorGamePlatformConfig.ini
|
||||
testdata/DummyProject/AssetProcessorGamePlatformConfig.ini
|
||||
testdata/config_broken_badplatform/AssetProcessorPlatformConfig.setreg
|
||||
testdata/config_broken_noplatform/AssetProcessorPlatformConfig.setreg
|
||||
testdata/config_broken_noscans/AssetProcessorPlatformConfig.setreg
|
||||
testdata/config_broken_recognizers/AssetProcessorPlatformConfig.setreg
|
||||
testdata/config_regular/AssetProcessorPlatformConfig.setreg
|
||||
testdata/config_regular_platform_scanfolder/AssetProcessorPlatformConfig.setreg
|
||||
testdata/EmptyDummyProject/AssetProcessorGamePlatformConfig.setreg
|
||||
testdata/DummyProject/AssetProcessorGamePlatformConfig.setreg
|
||||
native/tests/AssetProcessorTest.h
|
||||
native/tests/AssetProcessorTest.cpp
|
||||
native/tests/BaseAssetProcessorTest.h
|
||||
|
||||
@@ -45,7 +45,6 @@ namespace AssetProcessor
|
||||
" ScanFolder TEXT NOT NULL collate nocase, "
|
||||
" DisplayName TEXT NOT NULL collate nocase, "
|
||||
" PortableKey TEXT NOT NULL collate nocase, "
|
||||
" OutputPrefix TEXT NOT NULL collate nocase, "
|
||||
" IsRoot INTEGER NOT NULL);";
|
||||
|
||||
static const char* CREATE_SOURCES_TABLE = "AssetProcessor::CreateSourceTable";
|
||||
@@ -254,14 +253,13 @@ namespace AssetProcessor
|
||||
|
||||
static const char* INSERT_SCANFOLDER = "AssetProcessor::InsertScanFolder";
|
||||
static const char* INSERT_SCANFOLDER_STATEMENT =
|
||||
"INSERT INTO ScanFolders (ScanFolder, DisplayName, PortableKey, OutputPrefix, IsRoot) "
|
||||
"VALUES (:scanfolder, :displayname, :portablekey, :outputprefix, :isroot);";
|
||||
"INSERT INTO ScanFolders (ScanFolder, DisplayName, PortableKey, IsRoot) "
|
||||
"VALUES (:scanfolder, :displayname, :portablekey, :isroot);";
|
||||
|
||||
static const auto s_InsertScanfolderQuery = MakeSqlQuery(INSERT_SCANFOLDER, INSERT_SCANFOLDER_STATEMENT, LOG_NAME,
|
||||
SqlParam<const char*>(":scanfolder"),
|
||||
SqlParam<const char*>(":displayname"),
|
||||
SqlParam<const char*>(":portablekey"),
|
||||
SqlParam<const char*>(":outputprefix"),
|
||||
SqlParam<AZ::s32>(":isroot"));
|
||||
|
||||
static const char* UPDATE_SCANFOLDER = "AssetProcessor::UpdateScanFolder";
|
||||
@@ -270,7 +268,6 @@ namespace AssetProcessor
|
||||
"ScanFolder = :scanfolder, "
|
||||
"DisplayName = :displayname, "
|
||||
"PortableKey = :portablekey, "
|
||||
"OutputPrefix = :outputprefix, "
|
||||
"IsRoot = :isroot "
|
||||
"WHERE "
|
||||
"ScanFolderID = :scanfolderid;";
|
||||
@@ -279,7 +276,6 @@ namespace AssetProcessor
|
||||
SqlParam<const char*>(":scanfolder"),
|
||||
SqlParam<const char*>(":displayname"),
|
||||
SqlParam<const char*>(":portablekey"),
|
||||
SqlParam<const char*>(":outputprefix"),
|
||||
SqlParam<AZ::s32>(":isroot"),
|
||||
SqlParam<AZ::s64>(":scanfolderid"));
|
||||
|
||||
@@ -1051,6 +1047,10 @@ namespace AssetProcessor
|
||||
}
|
||||
}
|
||||
|
||||
// Nothing to do for version `AssetDatabase::DatabaseVersion::RemoveOutputPrefixFromScanFolders`
|
||||
// sqlite doesn't not support altering a table to remove a column
|
||||
// This is fine as the extra OutputPrefix column will not be queried
|
||||
|
||||
if (foundVersion == CurrentDatabaseVersion())
|
||||
{
|
||||
dropAllTables = false;
|
||||
@@ -1433,7 +1433,7 @@ namespace AssetProcessor
|
||||
|
||||
//its not in the database, add it
|
||||
// it is a single statement, do not wrap it in a transaction, this wastes a lot of time.
|
||||
if (!s_InsertScanfolderQuery.BindAndStep(*m_databaseConnection, entry.m_scanFolder.c_str(), entry.m_displayName.c_str(), entry.m_portableKey.c_str(), entry.m_outputPrefix.c_str(), entry.m_isRoot))
|
||||
if (!s_InsertScanfolderQuery.BindAndStep(*m_databaseConnection, entry.m_scanFolder.c_str(), entry.m_displayName.c_str(), entry.m_portableKey.c_str(), entry.m_isRoot))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1457,7 +1457,7 @@ namespace AssetProcessor
|
||||
return false;
|
||||
}
|
||||
|
||||
return s_UpdateScanfolderQuery.BindAndStep(*m_databaseConnection, entry.m_scanFolder.c_str(), entry.m_displayName.c_str(), entry.m_portableKey.c_str(), entry.m_outputPrefix.c_str(), entry.m_isRoot, entry.m_scanFolderID);
|
||||
return s_UpdateScanfolderQuery.BindAndStep(*m_databaseConnection, entry.m_scanFolder.c_str(), entry.m_displayName.c_str(), entry.m_portableKey.c_str(), entry.m_isRoot, entry.m_scanFolderID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -951,17 +951,7 @@ namespace AssetProcessor
|
||||
// the subId part of the assetId will always be set to zero.
|
||||
assetInfo.m_assetId = AZ::Data::AssetId(entry.m_sourceGuid, 0);
|
||||
|
||||
// the Scan Folder may have an output prefix, so we must remove it from the relpath.
|
||||
// this involves deleting the output prefix and the first slash ('editor/') which is why
|
||||
// we remove the length of outputPrefix and one extra character.
|
||||
if (!scanEntry.m_outputPrefix.empty())
|
||||
{
|
||||
assetInfo.m_relativePath = entry.m_sourceName.substr(static_cast<int>(scanEntry.m_outputPrefix.size()) + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
assetInfo.m_relativePath = entry.m_sourceName;
|
||||
}
|
||||
assetInfo.m_relativePath = entry.m_sourceName;
|
||||
AZStd::string absolutePath;
|
||||
AzFramework::StringFunc::Path::Join(scanEntry.m_scanFolder.c_str(), assetInfo.m_relativePath.c_str(), absolutePath);
|
||||
assetInfo.m_sizeBytes = AZ::IO::SystemFile::Length(absolutePath.c_str());
|
||||
@@ -1375,17 +1365,7 @@ namespace AssetProcessor
|
||||
AzToolsFramework::AssetDatabase::ScanFolderDatabaseEntry scanEntry;
|
||||
if (m_db->GetScanFolderByScanFolderID(entry.m_scanFolderPK, scanEntry))
|
||||
{
|
||||
// the Scan Folder may have an output prefix, so we must remove it from the relpath.
|
||||
// this involves deleting the output prefix and the first slash ('editor/') which is why
|
||||
// we remove the length of outputPrefix and one extra character.
|
||||
if (!scanEntry.m_outputPrefix.empty())
|
||||
{
|
||||
relativePath = entry.m_sourceName.substr(static_cast<int>(scanEntry.m_outputPrefix.size()) + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
relativePath = entry.m_sourceName;
|
||||
}
|
||||
relativePath = entry.m_sourceName;
|
||||
|
||||
watchFolder = scanEntry.m_scanFolder;
|
||||
|
||||
@@ -1530,28 +1510,7 @@ namespace AssetProcessor
|
||||
watchFolder = sourceInfo.m_watchFolder.toStdString().c_str();
|
||||
|
||||
AZStd::string sourceNameStr(sourceInfo.m_sourceName.toStdString().c_str());
|
||||
|
||||
// the Scan Folder may have an output prefix, so we must remove it from the relpath.
|
||||
// this involves deleting the output prefix and the first slash ('editor/') which is why
|
||||
// we remove the length of outputPrefix and one extra character.
|
||||
const AssetProcessor::ScanFolderInfo* info = m_platformConfig->GetScanFolderByPath(watchFolder.c_str());
|
||||
if ((info)&&(!info->GetOutputPrefix().isEmpty()))
|
||||
{
|
||||
const int prefixLength = static_cast<int>(info->GetOutputPrefix().length()) + 1;
|
||||
AZ_Assert(sourceNameStr.length() > prefixLength, "Source name [%s] was invalid compared to the output prefix.", sourceNameStr.c_str() != nullptr ? sourceNameStr.c_str() : "");
|
||||
if (sourceNameStr.length() > prefixLength)
|
||||
{
|
||||
assetInfo.m_relativePath = sourceNameStr.substr(prefixLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
assetInfo.m_relativePath.swap(sourceNameStr);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
assetInfo.m_relativePath.swap(sourceNameStr);
|
||||
}
|
||||
assetInfo.m_relativePath.swap(sourceNameStr);
|
||||
|
||||
assetInfo.m_assetId = foundSource->first;
|
||||
|
||||
@@ -1598,15 +1557,7 @@ namespace AssetProcessor
|
||||
return false;
|
||||
}
|
||||
QString databasePath = QString::fromUtf8(sourceDatabaseName);
|
||||
if (!scanFolderInfo->GetOutputPrefix().isEmpty() && databasePath.startsWith(scanFolderInfo->GetOutputPrefix(), Qt::CaseInsensitive))
|
||||
{
|
||||
QString relativePath = databasePath.right(databasePath.length() - scanFolderInfo->GetOutputPrefix().length() - 1); // also eat the slash, hence -1
|
||||
assetInfo.m_relativePath = relativePath.toUtf8().data();
|
||||
}
|
||||
else
|
||||
{
|
||||
assetInfo.m_relativePath = sourceDatabaseName;
|
||||
}
|
||||
assetInfo.m_relativePath = sourceDatabaseName;
|
||||
|
||||
AZStd::string absolutePath;
|
||||
AzFramework::StringFunc::Path::Join(watchFolder, assetInfo.m_relativePath.c_str(), absolutePath);
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace AssetProcessor
|
||||
|
||||
if (!AzFramework::StringFunc::Path::IsRelative(path.c_str()))
|
||||
{
|
||||
if (m_platformConfig->ConvertToRelativePath(QString::fromUtf8(path.c_str()), relativePath, scanFolder, true))
|
||||
if (m_platformConfig->ConvertToRelativePath(QString::fromUtf8(path.c_str()), relativePath, scanFolder))
|
||||
{
|
||||
auto* scanFolderInfo = m_platformConfig->GetScanFolderByPath(scanFolder);
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ Please note that only those seed files will get updated that are active for your
|
||||
else
|
||||
{
|
||||
QString relativePathQString;
|
||||
if (!PlatformConfiguration::ConvertToRelativePath(normalizedSource.c_str(), scanFolderInfo, relativePathQString, false))
|
||||
if (!PlatformConfiguration::ConvertToRelativePath(normalizedSource.c_str(), scanFolderInfo, relativePathQString))
|
||||
{
|
||||
return AZ::Failure(AZStd::string::format("Failed to convert path to relative path. %s\n", normalizedSource.c_str()));
|
||||
}
|
||||
@@ -167,16 +167,6 @@ Please note that only those seed files will get updated that are active for your
|
||||
return AZ::Success();
|
||||
}
|
||||
|
||||
AZStd::string SourceFileRelocator::RemoveDatabasePrefix(const ScanFolderInfo* scanFolder, AZStd::string sourceName)
|
||||
{
|
||||
if (!scanFolder->GetOutputPrefix().isEmpty())
|
||||
{
|
||||
return sourceName.substr(scanFolder->GetOutputPrefix().size() + 1); //+1 to remove the slash after the prefix
|
||||
}
|
||||
|
||||
return sourceName;
|
||||
}
|
||||
|
||||
QHash<QString, int> SourceFileRelocator::GetSources(QStringList pathMatches, const ScanFolderInfo* scanFolderInfo,
|
||||
SourceFileRelocationContainer& sources) const
|
||||
{
|
||||
@@ -188,7 +178,7 @@ Please note that only those seed files will get updated that are active for your
|
||||
PlatformConfiguration::ConvertToRelativePath(file, scanFolderInfo, databaseSourceName);
|
||||
m_stateData->QuerySourceBySourceNameScanFolderID(databaseSourceName.toUtf8().constData(), scanFolderInfo->ScanFolderID(), [this, &sources, &scanFolderInfo, &sourceIndexMap, &databaseSourceName](const AzToolsFramework::AssetDatabase::SourceDatabaseEntry& entry)
|
||||
{
|
||||
sources.emplace_back(entry, GetProductMapForSource(entry.m_sourceID), RemoveDatabasePrefix(scanFolderInfo, entry.m_sourceName), scanFolderInfo);
|
||||
sources.emplace_back(entry, GetProductMapForSource(entry.m_sourceID), entry.m_sourceName, scanFolderInfo);
|
||||
sourceIndexMap[databaseSourceName] = aznumeric_cast<int> (sources.size() - 1);
|
||||
return true;
|
||||
});
|
||||
@@ -357,12 +347,6 @@ Please note that only those seed files will get updated that are active for your
|
||||
|
||||
QString relativeFileName(normalizedSource.c_str());
|
||||
|
||||
//if relative path starts with the output prefix than remove it first
|
||||
if (!scanFolderInfo->GetOutputPrefix().isEmpty() && relativeFileName.startsWith(scanFolderInfo->GetOutputPrefix(), Qt::CaseInsensitive))
|
||||
{
|
||||
relativeFileName = relativeFileName.right(relativeFileName.length() - (scanFolderInfo->GetOutputPrefix().length() + 1)); // adding 1 for slash
|
||||
}
|
||||
|
||||
QDir rooted(scanFolderInfo->ScanPath());
|
||||
QString absolutePath = rooted.absoluteFilePath(relativeFileName);
|
||||
|
||||
@@ -620,7 +604,7 @@ Please note that only those seed files will get updated that are active for your
|
||||
{
|
||||
QString relativePath;
|
||||
QString scanFolderName;
|
||||
m_platformConfig->ConvertToRelativePath(newDestinationPath.c_str(), relativePath, scanFolderName, false);
|
||||
m_platformConfig->ConvertToRelativePath(newDestinationPath.c_str(), relativePath, scanFolderName);
|
||||
|
||||
relocationInfo.m_newAbsolutePath = newDestinationPath;
|
||||
relocationInfo.m_newRelativePath = relativePath.toUtf8().constData();
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace AssetProcessor
|
||||
SourceFileRelocationInfo(const AZStd::string& filePath, const ScanFolderInfo* scanFolder)
|
||||
{
|
||||
QString relFilePath;
|
||||
PlatformConfiguration::ConvertToRelativePath(filePath.c_str(), scanFolder, relFilePath, true);
|
||||
PlatformConfiguration::ConvertToRelativePath(filePath.c_str(), scanFolder, relFilePath);
|
||||
m_oldRelativePath = relFilePath.toUtf8().data();
|
||||
AzFramework::StringFunc::Path::ConstructFull(scanFolder->ScanPath().toUtf8().constData(), m_oldRelativePath.c_str(), m_oldAbsolutePath, false);
|
||||
m_oldAbsolutePath = AssetUtilities::NormalizeFilePath(m_oldAbsolutePath.c_str()).toUtf8().constData();
|
||||
@@ -191,7 +191,6 @@ namespace AssetProcessor
|
||||
SourceFileRelocator(AZStd::shared_ptr<AzToolsFramework::AssetDatabase::AssetDatabaseConnection> stateData, PlatformConfiguration* platformConfiguration);
|
||||
~SourceFileRelocator();
|
||||
|
||||
static AZStd::string RemoveDatabasePrefix(const ScanFolderInfo* scanFolder, AZStd::string sourceName);
|
||||
static void MakePathRelative(const AZStd::string& parentPath, const AZStd::string& childPath, AZStd::string& parentRelative, AZStd::string& childRelative);
|
||||
|
||||
static AZ::Outcome<AZStd::string, AZStd::string> HandleWildcard(AZStd::string_view absFile, AZStd::string_view absSearch, AZStd::string destination);
|
||||
|
||||
@@ -142,11 +142,6 @@ namespace AssetProcessor
|
||||
QString databaseSourceName = QString::fromUtf8(entry.m_sourceName.c_str());
|
||||
QString scanFolderPath = QString::fromUtf8(entry.m_scanFolder.c_str());
|
||||
QString relativeToScanFolderPath = databaseSourceName;
|
||||
if (!entry.m_outputPrefix.empty())
|
||||
{
|
||||
relativeToScanFolderPath = relativeToScanFolderPath.remove(0, static_cast<int>(entry.m_outputPrefix.size()) + 1);
|
||||
}
|
||||
|
||||
QString finalAbsolute = (QString("%1/%2").arg(scanFolderPath).arg(relativeToScanFolderPath));
|
||||
m_sourceFilesInDatabase[finalAbsolute] = { scanFolderPath, relativeToScanFolderPath, databaseSourceName, entry.m_analysisFingerprint.c_str() };
|
||||
|
||||
@@ -173,12 +168,6 @@ namespace AssetProcessor
|
||||
if (scanFolderInfo.ScanFolderID() == entry.m_scanFolderPK)
|
||||
{
|
||||
scanFolderPath = scanFolderInfo.ScanPath();
|
||||
|
||||
if (!scanFolderInfo.GetOutputPrefix().isEmpty())
|
||||
{
|
||||
relativeToScanFolderPath = relativeToScanFolderPath.remove(0, static_cast<int>(scanFolderInfo.GetOutputPrefix().size()) + 1);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -470,12 +459,12 @@ namespace AssetProcessor
|
||||
return;
|
||||
}
|
||||
|
||||
// note that m_SourceFilesInDatabase is a map from (full absolute path) --> (database name for file, which includes outputprefix)
|
||||
// note that m_SourceFilesInDatabase is a map from (full absolute path) --> (database name for file)
|
||||
for (auto iter = m_sourceFilesInDatabase.begin(); iter != m_sourceFilesInDatabase.end(); iter++)
|
||||
{
|
||||
// CheckDeletedSourceFile actually expects the database name as the second value
|
||||
// iter.key is the full path normalized. iter.value is the database path.
|
||||
// we need the relative path too, which involves removing the scan folder outputprefix it present:
|
||||
// we need the relative path too:
|
||||
CheckDeletedSourceFile(
|
||||
iter.key(), iter.value().m_sourceRelativeToWatchFolder, iter.value().m_sourceDatabaseName,
|
||||
AZStd::chrono::system_clock::now());
|
||||
@@ -1633,27 +1622,7 @@ namespace AssetProcessor
|
||||
AzToolsFramework::AssetDatabase::ScanFolderDatabaseEntry scanfolder;
|
||||
if (m_stateData->GetScanFolderByScanFolderID(source.m_scanFolderPK, scanfolder))
|
||||
{
|
||||
// there's one more thing to account for here, and thats the fact that the sourceName may have an outputPrefix appended on to it
|
||||
// so for example, the scan folder might be c:/ly/dev/Gems/Clouds/Assets
|
||||
// but the outputPrefix might be Clouds/Assets, meaning "put it in that folder in the cache instead of just at the root"
|
||||
// When we have an outputprefix, we prepend it to SourceName so that its a unique source
|
||||
// so for example, the sourceName might be Clouds/Assets/blah.tif
|
||||
// if you were to blindly concatenate them you'd end up with c:/ly/dev/Gems/Clouds/Assets/Clouds/Assets/blah.tif
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
// The watch folder is here
|
||||
// ^^^^^^^^^^^^^^
|
||||
// Prefix prepended
|
||||
// ^^^^^^^^
|
||||
// actual name
|
||||
// so remove the output prefix from sourcename if present before doing any source ops on it.
|
||||
|
||||
AZStd::string sourceName(source.m_sourceName);
|
||||
|
||||
if (!scanfolder.m_outputPrefix.empty())
|
||||
{
|
||||
sourceName = sourceName.substr(scanfolder.m_outputPrefix.size() + 1);
|
||||
}
|
||||
AZStd::string fullSourcePath = AZStd::string::format("%s/%s", scanfolder.m_scanFolder.c_str(), sourceName.c_str());
|
||||
AZStd::string fullSourcePath = AZStd::string::format("%s/%s", scanfolder.m_scanFolder.c_str(), source.m_sourceName.c_str());
|
||||
|
||||
AssessFileInternal(fullSourcePath.c_str(), false);
|
||||
}
|
||||
@@ -2001,18 +1970,7 @@ namespace AssetProcessor
|
||||
//remove the jobs associated with these products
|
||||
m_stateData->RemoveJob(oldJobInfo.m_jobID);
|
||||
|
||||
// note that JobRemoved is supposed to emit a jobinfo that is not output-prefixed
|
||||
if (!scanFolder->GetOutputPrefix().isEmpty())
|
||||
{
|
||||
JobInfo newJobInfo(oldJobInfo);
|
||||
QString sourcePathWithPrefix = QString::fromUtf8(oldJobInfo.m_sourceFile.c_str());
|
||||
newJobInfo.m_sourceFile = (sourcePathWithPrefix.right(sourcePathWithPrefix.length() - (scanFolder->GetOutputPrefix().length() + 1))).toUtf8().constData();
|
||||
Q_EMIT JobRemoved(newJobInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_EMIT JobRemoved(oldJobInfo);
|
||||
}
|
||||
Q_EMIT JobRemoved(oldJobInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2239,7 +2197,7 @@ namespace AssetProcessor
|
||||
}
|
||||
|
||||
AzToolsFramework::AssetDatabase::SourceDatabaseEntryContainer sources;
|
||||
QString sourceName = scanFolderInfo->GetOutputPrefix().isEmpty() ? relativePath : QDir::cleanPath(scanFolderInfo->GetOutputPrefix() + QDir::separator() + relativePath);
|
||||
QString sourceName = relativePath;
|
||||
m_stateData->GetSourcesLikeSourceName(sourceName, AzToolsFramework::AssetDatabase::AssetDatabaseConnection::StartsWith, sources);
|
||||
|
||||
AZ_TracePrintf(AssetProcessor::DebugChannel, "CheckDeletedSourceFolder: %i matching files.\n", sources.size());
|
||||
@@ -2250,11 +2208,6 @@ namespace AssetProcessor
|
||||
// reconstruct full path:
|
||||
QString actualRelativePath = source.m_sourceName.c_str();
|
||||
|
||||
if (!scanFolderInfo->GetOutputPrefix().isEmpty())
|
||||
{
|
||||
actualRelativePath = actualRelativePath.right(actualRelativePath.length() - (scanFolderInfo->GetOutputPrefix().length() + 1)); // adding one for separator
|
||||
}
|
||||
|
||||
QString finalPath = scanFolder.absoluteFilePath(actualRelativePath);
|
||||
|
||||
if (!QFile::exists(finalPath))
|
||||
@@ -2513,11 +2466,6 @@ namespace AssetProcessor
|
||||
const ScanFolderInfo* scanFolderInfo = m_platformConfig->GetScanFolderForFile(normalizedPath);
|
||||
|
||||
relativePathToFile = databasePathToFile;
|
||||
// remove output prefix if present to generate relative path
|
||||
if ((scanFolderInfo)&&(!scanFolderInfo->GetOutputPrefix().isEmpty()))
|
||||
{
|
||||
relativePathToFile = relativePathToFile.remove(0, static_cast<int>(scanFolderInfo->GetOutputPrefix().length()) + 1);
|
||||
}
|
||||
|
||||
if (normalizedPath.length() >= AP_MAX_PATH_LEN)
|
||||
{
|
||||
@@ -2537,7 +2485,7 @@ namespace AssetProcessor
|
||||
job.m_jobEntry = JobEntry(
|
||||
QString::fromUtf8(jobInfo.m_watchFolder.c_str()),
|
||||
relativePathToFile,
|
||||
databasePathToFile, // with outputprefix
|
||||
databasePathToFile,
|
||||
jobInfo.m_builderGuid,
|
||||
*platformFromInfo,
|
||||
jobInfo.m_jobKey.c_str(), 0, GenerateNewJobRunKey(),
|
||||
@@ -2646,7 +2594,7 @@ namespace AssetProcessor
|
||||
// to call the expensive function to discover correct case.
|
||||
QString pathRelativeToScanFolder;
|
||||
QString scanFolderPath;
|
||||
m_platformConfig->ConvertToRelativePath(overrider, pathRelativeToScanFolder, scanFolderPath, false /*include output prefix*/);
|
||||
m_platformConfig->ConvertToRelativePath(overrider, pathRelativeToScanFolder, scanFolderPath);
|
||||
AssetUtilities::UpdateToCorrectCase(scanFolderPath, pathRelativeToScanFolder);
|
||||
overrider = QDir(scanFolderPath).absoluteFilePath(pathRelativeToScanFolder);
|
||||
}
|
||||
@@ -3367,10 +3315,6 @@ namespace AssetProcessor
|
||||
newSourceInfo.m_watchFolder = scanFolder->ScanPath();
|
||||
newSourceInfo.m_sourceDatabaseName = databasePathToFile;
|
||||
newSourceInfo.m_sourceRelativeToWatchFolder = databasePathToFile;
|
||||
if (!scanFolder->GetOutputPrefix().isEmpty())
|
||||
{
|
||||
newSourceInfo.m_sourceRelativeToWatchFolder = newSourceInfo.m_sourceRelativeToWatchFolder.remove(0, static_cast<int>(scanFolder->GetOutputPrefix().length()) + 1);
|
||||
}
|
||||
|
||||
{
|
||||
// this scope exists only to narrow the range of m_sourceUUIDToSourceNameMapMutex
|
||||
@@ -3644,12 +3588,6 @@ namespace AssetProcessor
|
||||
continue;
|
||||
}
|
||||
|
||||
//if relative path starts with the output prefix then remove it first
|
||||
if (!scanFolderInfo->GetOutputPrefix().isEmpty() && knownPathBeforeWildcard.startsWith(scanFolderInfo->GetOutputPrefix(), Qt::CaseInsensitive))
|
||||
{
|
||||
knownPathBeforeWildcard = knownPathBeforeWildcard.right(knownPathBeforeWildcard.length() - (scanFolderInfo->GetOutputPrefix().length() + 1)); // adding 1 for slash
|
||||
}
|
||||
|
||||
QDir rooted(scanFolderInfo->ScanPath());
|
||||
QString absolutePath = rooted.absoluteFilePath(knownPathBeforeWildcard);
|
||||
|
||||
@@ -3950,7 +3888,6 @@ namespace AssetProcessor
|
||||
scanFolderFromConfigFile.ScanPath().toUtf8().constData(),
|
||||
scanFolderFromConfigFile.GetDisplayName().toUtf8().constData(),
|
||||
scanFolderFromConfigFile.GetPortableKey().toUtf8().constData(),
|
||||
scanFolderFromConfigFile.GetOutputPrefix().toUtf8().constData(),
|
||||
scanFolderFromConfigFile.IsRoot());
|
||||
//remove this scan path from the scan folders so what is left can deleted
|
||||
m_scanFoldersInDatabase.erase(found);
|
||||
@@ -3962,7 +3899,6 @@ namespace AssetProcessor
|
||||
scanFolderFromConfigFile.ScanPath().toUtf8().constData(),
|
||||
scanFolderFromConfigFile.GetDisplayName().toUtf8().constData(),
|
||||
scanFolderFromConfigFile.GetPortableKey().toUtf8().constData(),
|
||||
scanFolderFromConfigFile.GetOutputPrefix().toUtf8().constData(),
|
||||
scanFolderFromConfigFile.IsRoot());
|
||||
}
|
||||
|
||||
@@ -4006,11 +3942,7 @@ namespace AssetProcessor
|
||||
result.m_sourceDatabaseName = QString::fromUtf8(sourceDatabaseEntry.m_sourceName.c_str());
|
||||
result.m_watchFolder = QString::fromUtf8(scanFolder.m_scanFolder.c_str());
|
||||
result.m_sourceRelativeToWatchFolder = result.m_sourceDatabaseName;
|
||||
if (!scanFolder.m_outputPrefix.empty())
|
||||
{
|
||||
result.m_sourceRelativeToWatchFolder = result.m_sourceRelativeToWatchFolder.remove(0, static_cast<int>(scanFolder.m_outputPrefix.size()) + 1);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
// this scope exists to restrict the duration of the below lock.
|
||||
AZStd::lock_guard<AZStd::mutex> lock(m_sourceUUIDToSourceInfoMapMutex);
|
||||
@@ -4088,16 +4020,7 @@ namespace AssetProcessor
|
||||
{
|
||||
sourceDatabaseEntry.m_scanFolderPK = scanFolder->ScanFolderID();
|
||||
|
||||
if (!scanFolder->GetOutputPrefix().isEmpty())
|
||||
{
|
||||
// replace the "output prefix" part of the file name with the one from the ini file to sort out case sensitivity problems.
|
||||
QString withoutOutputPrefix = relativeSourceFilePath.remove(0, scanFolder->GetOutputPrefix().length() + 1);
|
||||
sourceDatabaseEntry.m_sourceName = AZStd::string::format("%s/%s", scanFolder->GetOutputPrefix().toUtf8().constData(), withoutOutputPrefix.toUtf8().data());
|
||||
}
|
||||
else
|
||||
{
|
||||
sourceDatabaseEntry.m_sourceName = relativeSourceFilePath.toUtf8().constData();
|
||||
}
|
||||
sourceDatabaseEntry.m_sourceName = relativeSourceFilePath.toUtf8().constData();
|
||||
|
||||
sourceDatabaseEntry.m_sourceGuid = AssetUtilities::CreateSafeSourceUUIDFromName(sourceDatabaseEntry.m_sourceName.c_str());
|
||||
|
||||
@@ -4709,7 +4632,7 @@ namespace AssetProcessor
|
||||
|
||||
QString databasePath;
|
||||
QString scanFolderPath;
|
||||
m_platformConfig->ConvertToRelativePath(metaDataFileName, databasePath, scanFolderPath, true);
|
||||
m_platformConfig->ConvertToRelativePath(metaDataFileName, databasePath, scanFolderPath);
|
||||
outFilesToFingerprint.insert(AZStd::make_pair(metaDataFileName.toUtf8().constData(), databasePath.toUtf8().constData()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace AssetProcessor
|
||||
//! Internal structure that will hold all the necessary source info
|
||||
struct SourceFileInfo
|
||||
{
|
||||
QString m_databasePath; // clarification: this is the database path (ie, includes outputprefix)
|
||||
QString m_databasePath; // clarification: this is the database path
|
||||
QString m_pathRelativeToScanFolder;
|
||||
AZ::Uuid m_uuid;
|
||||
const ScanFolderInfo* m_scanFolder{ nullptr };
|
||||
@@ -222,7 +222,7 @@ namespace AssetProcessor
|
||||
//! Emit whenever a new asset is found or an existing asset is updated
|
||||
void AssetMessage(AzFramework::AssetSystem::AssetNotificationMessage message);
|
||||
|
||||
// InputAssetProcessed - uses absolute asset path of input file - no outputprefix
|
||||
// InputAssetProcessed - uses absolute asset path of input file
|
||||
void InputAssetProcessed(QString fullAssetPath, QString platform);
|
||||
|
||||
void RequestInputAssetStatus(QString inputAssetPath, QString platform, QString jobDescription);
|
||||
|
||||
@@ -28,7 +28,6 @@ namespace AssetProcessor
|
||||
QString path,
|
||||
QString displayName,
|
||||
QString portableKey,
|
||||
QString prefix,
|
||||
bool isRoot,
|
||||
bool recurseSubFolders,
|
||||
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms = AZStd::vector<AssetBuilderSDK::PlatformInfo>{},
|
||||
@@ -38,7 +37,6 @@ namespace AssetProcessor
|
||||
: m_scanPath(path)
|
||||
, m_displayName(displayName)
|
||||
, m_portableKey (portableKey)
|
||||
, m_outputPrefix(prefix)
|
||||
, m_isRoot(isRoot)
|
||||
, m_recurseSubFolders(recurseSubFolders)
|
||||
, m_order(order)
|
||||
@@ -62,11 +60,6 @@ namespace AssetProcessor
|
||||
return m_displayName;
|
||||
}
|
||||
|
||||
QString GetOutputPrefix() const
|
||||
{
|
||||
return m_outputPrefix;
|
||||
}
|
||||
|
||||
bool IsRoot() const
|
||||
{
|
||||
return m_isRoot;
|
||||
@@ -110,7 +103,6 @@ namespace AssetProcessor
|
||||
private:
|
||||
QString m_scanPath; // the local path to scan ("C:\\whatever")
|
||||
QString m_displayName; // the display name to show in GUIs that show it.
|
||||
QString m_outputPrefix; // the output prefix to target results into (eg, put things in a certain subfolder of @assets@ rather than the relative to assets itself)
|
||||
QString m_portableKey; // a key that remains the same even if the asset database is moved from computer to computer.
|
||||
bool m_isRoot = false; // is it 'the' root folder?
|
||||
bool m_recurseSubFolders = true;
|
||||
|
||||
@@ -126,7 +126,7 @@ void AssetScannerWorker::ScanForSourceFiles(const ScanFolderInfo& scanFolderInfo
|
||||
{
|
||||
//Entry is a directory
|
||||
m_folderList.insert(AZStd::move(assetFileInfo));
|
||||
ScanFolderInfo tempScanFolderInfo(absPath, "", "", "", false, true);
|
||||
ScanFolderInfo tempScanFolderInfo(absPath, "", "", false, true);
|
||||
ScanForSourceFiles(tempScanFolderInfo, rootScanFolder);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace AssetProcessor
|
||||
public:
|
||||
QueueElementID() = default;
|
||||
|
||||
///! note that inputAssetName is a database name (so includes outputprefix), not a relative path.
|
||||
///! note that inputAssetName is a database name, not a relative path.
|
||||
QueueElementID(QString inputAssetName, QString platform, QString jobDescriptor);
|
||||
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace AssetProcessor
|
||||
RCJob* getItem(int index) const;
|
||||
int GetIndexOfProcessingJob(const QueueElementID& elementId);
|
||||
|
||||
///! EraseJobs expects the database name of the source file. (So with outputprefix)
|
||||
///! EraseJobs expects the database name of the source file.
|
||||
void EraseJobs(QString sourceFileDatabaseName, AZStd::vector<RCJob*>& pendingJobs);
|
||||
|
||||
private:
|
||||
|
||||
@@ -217,7 +217,6 @@ namespace AssetProcessor
|
||||
scanFolderInfo.ScanPath().toStdString().c_str(),
|
||||
scanFolderInfo.GetDisplayName().toStdString().c_str(),
|
||||
scanFolderInfo.GetPortableKey().toStdString().c_str(),
|
||||
scanFolderInfo.GetOutputPrefix().toStdString().c_str(),
|
||||
scanFolderInfo.IsRoot());
|
||||
dbConn->SetScanFolder(newScanFolder);
|
||||
}
|
||||
@@ -230,12 +229,12 @@ namespace AssetProcessor
|
||||
config.EnablePlatform({ "fandango" ,{ "console", "renderer" } }, false);
|
||||
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
|
||||
config.PopulatePlatformsForScanFolder(platforms);
|
||||
// PATH DisplayName PortKey outputfolder root recurse platforms order
|
||||
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", "", false, false, platforms, -6), config, dbConn); // subfolder 4 overrides subfolder3
|
||||
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", "", false, false, platforms, -5), config, dbConn); // subfolder 3 overrides subfolder2
|
||||
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", "", false, true, platforms, -2), config, dbConn); // subfolder 2 overrides subfolder1
|
||||
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", "", false, true, platforms, -1), config, dbConn); // subfolder1 overrides root
|
||||
AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", "", true, false, platforms, 0), config, dbConn); // add the root
|
||||
// PATH DisplayName PortKey root recurse platforms order
|
||||
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", false, false, platforms, -6), config, dbConn); // subfolder 4 overrides subfolder3
|
||||
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", false, false, platforms, -5), config, dbConn); // subfolder 3 overrides subfolder2
|
||||
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", false, true, platforms, -2), config, dbConn); // subfolder 2 overrides subfolder1
|
||||
AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", false, true, platforms, -1), config, dbConn); // subfolder1 overrides root
|
||||
AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", true, false, platforms, 0), config, dbConn); // add the root
|
||||
|
||||
config.AddMetaDataType("exportsettings", QString());
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ namespace AssetProcessorMessagesTests
|
||||
using namespace AzToolsFramework::AssetDatabase;
|
||||
|
||||
// Setup the database with all needed info
|
||||
ScanFolderDatabaseEntry scanfolder1("scanfolder1", "scanfolder1", "scanfolder1", "");
|
||||
ScanFolderDatabaseEntry scanfolder1("scanfolder1", "scanfolder1", "scanfolder1");
|
||||
ASSERT_TRUE(m_dbConn.SetScanFolder(scanfolder1));
|
||||
|
||||
SourceDatabaseEntry source1(scanfolder1.m_scanFolderID, "source1.png", AZ::Uuid::CreateRandom(), "Fingerprint");
|
||||
|
||||
@@ -46,10 +46,10 @@ namespace UnitTests
|
||||
|
||||
m_data->m_fileProcessor = AZStd::make_unique<FileProcessor>(m_data->m_config.get());
|
||||
|
||||
m_data->m_scanFolder = { m_data->m_temporarySourceDir.absolutePath().toUtf8().constData(), "dev", "rootportkey", "" };
|
||||
m_data->m_scanFolder = { m_data->m_temporarySourceDir.absolutePath().toUtf8().constData(), "dev", "rootportkey" };
|
||||
ASSERT_TRUE(m_data->m_connection.SetScanFolder(m_data->m_scanFolder));
|
||||
|
||||
m_data->m_config->AddScanFolder(ScanFolderInfo(m_data->m_temporarySourceDir.absolutePath(), "dev", "rootportkey", "", false, true, m_data->m_config->GetEnabledPlatforms(), 0, m_data->m_scanFolder.m_scanFolderID));
|
||||
m_data->m_config->AddScanFolder(ScanFolderInfo(m_data->m_temporarySourceDir.absolutePath(), "dev", "rootportkey", false, true, m_data->m_config->GetEnabledPlatforms(), 0, m_data->m_scanFolder.m_scanFolderID));
|
||||
|
||||
for (int index = 0; index < 10; ++index)
|
||||
{
|
||||
|
||||
@@ -84,8 +84,8 @@ namespace UnitTests
|
||||
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
|
||||
m_data->m_platformConfig.PopulatePlatformsForScanFolder(platforms);
|
||||
|
||||
m_data->m_scanFolder1 = { tempPath.absoluteFilePath("dev").toUtf8().constData(), "dev", "devKey", ""};
|
||||
m_data->m_scanFolder2 = { tempPath.absoluteFilePath("folder").toUtf8().constData(), "folder", "folderKey", "prefix" };
|
||||
m_data->m_scanFolder1 = { tempPath.absoluteFilePath("dev").toUtf8().constData(), "dev", "devKey"};
|
||||
m_data->m_scanFolder2 = { tempPath.absoluteFilePath("folder").toUtf8().constData(), "folder", "folderKey"};
|
||||
|
||||
ASSERT_TRUE(m_data->m_connection->SetScanFolder(m_data->m_scanFolder1));
|
||||
ASSERT_TRUE(m_data->m_connection->SetScanFolder(m_data->m_scanFolder2));
|
||||
@@ -93,21 +93,19 @@ namespace UnitTests
|
||||
ScanFolderInfo scanFolder1(m_data->m_scanFolder1.m_scanFolder.c_str(),
|
||||
m_data->m_scanFolder1.m_displayName.c_str(),
|
||||
m_data->m_scanFolder1.m_portableKey.c_str(),
|
||||
m_data->m_scanFolder1.m_outputPrefix.c_str(),
|
||||
false, true, platforms, 0, m_data->m_scanFolder1.m_scanFolderID);
|
||||
m_data->m_platformConfig.AddScanFolder(scanFolder1);
|
||||
|
||||
ScanFolderInfo scanFolder2(m_data->m_scanFolder2.m_scanFolder.c_str(),
|
||||
m_data->m_scanFolder2.m_displayName.c_str(),
|
||||
m_data->m_scanFolder2.m_portableKey.c_str(),
|
||||
m_data->m_scanFolder2.m_outputPrefix.c_str(),
|
||||
false, true, platforms, 0, m_data->m_scanFolder2.m_scanFolderID);
|
||||
m_data->m_platformConfig.AddScanFolder(scanFolder2);
|
||||
|
||||
SourceDatabaseEntry sourceFile1 = { m_data->m_scanFolder1.m_scanFolderID, "subfolder1/somefile.tif", AZ::Uuid::CreateRandom(), "AnalysisFingerprint" };
|
||||
SourceDatabaseEntry sourceFile2 = { m_data->m_scanFolder1.m_scanFolderID, "subfolder1/otherfile.tif", AZ::Uuid::CreateRandom(), "AnalysisFingerprint" };
|
||||
SourceDatabaseEntry sourceFile3 = { m_data->m_scanFolder2.m_scanFolderID, "prefix/otherfile.tif", AZ::Uuid::CreateRandom(), "AnalysisFingerprint" };
|
||||
SourceDatabaseEntry sourceFile4 = { m_data->m_scanFolder2.m_scanFolderID, "prefix/a/b/c/d/otherfile.tif", AZ::Uuid::CreateRandom(), "AnalysisFingerprint" };
|
||||
SourceDatabaseEntry sourceFile3 = { m_data->m_scanFolder2.m_scanFolderID, "otherfile.tif", AZ::Uuid::CreateRandom(), "AnalysisFingerprint" };
|
||||
SourceDatabaseEntry sourceFile4 = { m_data->m_scanFolder2.m_scanFolderID, "a/b/c/d/otherfile.tif", AZ::Uuid::CreateRandom(), "AnalysisFingerprint" };
|
||||
SourceDatabaseEntry sourceFile5 = { m_data->m_scanFolder1.m_scanFolderID, "duplicate/file1.tif", AZ::Uuid::CreateRandom(), "AnalysisFingerprint" };
|
||||
SourceDatabaseEntry sourceFile6 = { m_data->m_scanFolder2.m_scanFolderID, "duplicate/file1.tif", AZ::Uuid::CreateRandom(), "AnalysisFingerprint" };
|
||||
SourceDatabaseEntry sourceFile7 = { m_data->m_scanFolder1.m_scanFolderID, "subfolder2/file.tif", AZ::Uuid::CreateRandom(), "AnalysisFingerprint" };
|
||||
@@ -128,7 +126,7 @@ namespace UnitTests
|
||||
ASSERT_TRUE(m_data->m_connection->SetSource(sourceFile11));
|
||||
|
||||
SourceFileDependencyEntry dependency1 = { AZ::Uuid::CreateRandom(), "subfolder1/somefile.tif", "subfolder1/otherfile.tif", SourceFileDependencyEntry::TypeOfDependency::DEP_SourceToSource, false };
|
||||
SourceFileDependencyEntry dependency2 = { AZ::Uuid::CreateRandom(), "subfolder1/otherfile.tif", "prefix/otherfile.tif", SourceFileDependencyEntry::TypeOfDependency::DEP_JobToJob, false };
|
||||
SourceFileDependencyEntry dependency2 = { AZ::Uuid::CreateRandom(), "subfolder1/otherfile.tif", "otherfile.tif", SourceFileDependencyEntry::TypeOfDependency::DEP_JobToJob, false };
|
||||
ASSERT_TRUE(m_data->m_connection->SetSourceFileDependency(dependency1));
|
||||
ASSERT_TRUE(m_data->m_connection->SetSourceFileDependency(dependency2));
|
||||
|
||||
@@ -252,7 +250,7 @@ namespace UnitTests
|
||||
|
||||
const ScanFolderInfo* info;
|
||||
auto result = m_data->m_reporter->GetSourcesByPath(source, relocationContainer, info, excludeMetaDataFiles);
|
||||
ASSERT_EQ(result.IsSuccess(), expectSuccess) << result.GetError().c_str();
|
||||
ASSERT_EQ(result.IsSuccess(), expectSuccess) << (!result.IsSuccess() ? result.GetError().c_str() : "");
|
||||
|
||||
if (expectSuccess)
|
||||
{
|
||||
@@ -423,13 +421,13 @@ namespace UnitTests
|
||||
|
||||
TEST_F(SourceFileRelocatorTest, GetSources_PrefixedFile_Succeeds)
|
||||
{
|
||||
TestGetSourcesByPath("otherfile.tif", { "prefix/otherfile.tif" });
|
||||
TestGetSourcesByPath("otherfile.tif", { "otherfile.tif" });
|
||||
}
|
||||
|
||||
TEST_F(SourceFileRelocatorTest, GetSources_PrefixedAbsFile_Succeeds)
|
||||
{
|
||||
QDir tempDir(m_tempDir.path());
|
||||
TestGetSourcesByPath( tempDir.absoluteFilePath("folder/otherfile.tif").toUtf8().constData(), { "prefix/otherfile.tif" });
|
||||
TestGetSourcesByPath(tempDir.absoluteFilePath("folder/otherfile.tif").toUtf8().constData(), { "otherfile.tif" });
|
||||
}
|
||||
|
||||
TEST_F(SourceFileRelocatorTest, GetSources_Folder_Fails)
|
||||
@@ -664,7 +662,7 @@ namespace UnitTests
|
||||
|
||||
ASSERT_TRUE(m_data->m_reporter->GetSourcesByPath(tempPath.absoluteFilePath(AZStd::string("folder/o*").c_str()).toUtf8().constData(), entryContainer, info));
|
||||
ASSERT_EQ(entryContainer.size(), 1);
|
||||
ASSERT_STREQ(entryContainer[0].m_sourceEntry.m_sourceName.c_str(), "prefix/otherfile.tif");
|
||||
ASSERT_STREQ(entryContainer[0].m_sourceEntry.m_sourceName.c_str(), "otherfile.tif");
|
||||
|
||||
m_data->m_reporter->PopulateDependencies(entryContainer);
|
||||
|
||||
@@ -803,7 +801,7 @@ namespace UnitTests
|
||||
FileUpdateTasks updateTasks;
|
||||
|
||||
ASSERT_TRUE(m_data->m_reporter->GetSourcesByPath(tempPath.absoluteFilePath("folder/*").toUtf8().constData(), entryContainer, info));
|
||||
ASSERT_EQ(entryContainer.size(), 2);
|
||||
ASSERT_EQ(entryContainer.size(), 3);
|
||||
|
||||
m_data->m_reporter->ComputeDestination(entryContainer, info, "*", "someOtherPlace/*", destInfo);
|
||||
m_data->m_reporter->PopulateDependencies(entryContainer);
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace UnitTests
|
||||
// Product: "someproduct4.dds" subid: 4
|
||||
void CreateCoverageTestData()
|
||||
{
|
||||
m_data->m_scanFolder = { "c:/O3DE/dev", "dev", "rootportkey", "" };
|
||||
m_data->m_scanFolder = { "c:/O3DE/dev", "dev", "rootportkey" };
|
||||
ASSERT_TRUE(m_data->m_connection.SetScanFolder(m_data->m_scanFolder));
|
||||
|
||||
m_data->m_sourceFile1 = { m_data->m_scanFolder.m_scanFolderID, "somefile.tif", AZ::Uuid::CreateRandom(), "AnalysisFingerprint1"};
|
||||
@@ -239,7 +239,7 @@ namespace UnitTests
|
||||
// we'll create all of those first (except product) before starting the product test.
|
||||
|
||||
//add a scanfolder. None of this has to exist in real disk, this is a db test only.
|
||||
ScanFolderDatabaseEntry scanFolder {"c:/O3DE/dev", "dev", "rootportkey", ""};
|
||||
ScanFolderDatabaseEntry scanFolder{ "c:/O3DE/dev", "dev", "rootportkey" };
|
||||
EXPECT_TRUE(m_data->m_connection.SetScanFolder(scanFolder));
|
||||
ASSERT_NE(scanFolder.m_scanFolderID, AzToolsFramework::AssetDatabase::InvalidEntryId);
|
||||
|
||||
@@ -278,7 +278,7 @@ namespace UnitTests
|
||||
// to add a product legitimately you have to have a full chain of primary keys, chain is:
|
||||
// ScanFolder --> Source --> job --> product.
|
||||
// we'll create all of those first (except product) before starting the product test.
|
||||
ScanFolderDatabaseEntry scanFolder{ "c:/O3DE/dev", "dev", "rootportkey", "" };
|
||||
ScanFolderDatabaseEntry scanFolder{ "c:/O3DE/dev", "dev", "rootportkey" };
|
||||
ASSERT_TRUE(m_data->m_connection.SetScanFolder(scanFolder));
|
||||
|
||||
SourceDatabaseEntry sourceEntry{ scanFolder.m_scanFolderID, "somefile.tif", AZ::Uuid::CreateRandom(), "fingerprint1" };
|
||||
@@ -323,7 +323,7 @@ namespace UnitTests
|
||||
// this is actually a very common case (same job id, same subID)
|
||||
TEST_F(AssetDatabaseTest, SetProduct_SpecificPK_Succeeds_SameSubID_SameJobID)
|
||||
{
|
||||
ScanFolderDatabaseEntry scanFolder{ "c:/O3DE/dev", "dev", "rootportkey", "" };
|
||||
ScanFolderDatabaseEntry scanFolder{ "c:/O3DE/dev", "dev", "rootportkey"};
|
||||
ASSERT_TRUE(m_data->m_connection.SetScanFolder(scanFolder));
|
||||
SourceDatabaseEntry sourceEntry{ scanFolder.m_scanFolderID, "somefile.tif", AZ::Uuid::CreateRandom(), "fingerprint1" };
|
||||
ASSERT_TRUE(m_data->m_connection.SetSource(sourceEntry));
|
||||
|
||||
+17
-670
@@ -63,13 +63,6 @@ public:
|
||||
friend class GTEST_TEST_CLASS_NAME_(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WildcardMissingFiles_ByName_UpdatesWhenTheyAppear);
|
||||
friend class GTEST_TEST_CLASS_NAME_(AssetProcessorManagerTest, JobDependencyOrderOnce_MultipleJobs_EmitOK);
|
||||
|
||||
friend class GTEST_TEST_CLASS_NAME_(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_BasicTest);
|
||||
friend class GTEST_TEST_CLASS_NAME_(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_UpdateTest);
|
||||
friend class GTEST_TEST_CLASS_NAME_(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_MissingFiles_ByUuid);
|
||||
friend class GTEST_TEST_CLASS_NAME_(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_MissingFiles_ByName);
|
||||
friend class GTEST_TEST_CLASS_NAME_(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_MissingFiles_ByUuid_UpdatesWhenTheyAppear);
|
||||
friend class GTEST_TEST_CLASS_NAME_(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_MissingFiles_ByName_UpdatesWhenTheyAppear);
|
||||
|
||||
friend class GTEST_TEST_CLASS_NAME_(AssetProcessorManagerTest, SourceFileProcessFailure_ClearsFingerprint);
|
||||
|
||||
friend class GTEST_TEST_CLASS_NAME_(AbsolutePathProductDependencyTest, UnresolvedProductPathDependency_AssetProcessedTwice_DoesNotDuplicateDependency);
|
||||
@@ -243,15 +236,10 @@ void AssetProcessorManagerTest::SetUp()
|
||||
|
||||
m_config->EnablePlatform({ "pc", { "host", "renderer", "desktop" } }, true);
|
||||
|
||||
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", "", false, true, m_config->GetEnabledPlatforms() ));
|
||||
|
||||
// add a scan folder that has an output prefix:
|
||||
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", "redirected", false, true, m_config->GetEnabledPlatforms()));
|
||||
|
||||
//adding another scan folder with an output prefix
|
||||
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", "dummy", false, true, m_config->GetEnabledPlatforms()));
|
||||
|
||||
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", "", false, true, m_config->GetEnabledPlatforms()));
|
||||
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", false, true, m_config->GetEnabledPlatforms(), 1));
|
||||
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2/redirected"), "subfolder2", "subfolder2", false, true, m_config->GetEnabledPlatforms()));
|
||||
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", false, true, m_config->GetEnabledPlatforms(), 1));
|
||||
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", false, true, m_config->GetEnabledPlatforms(), 1));
|
||||
m_config->AddMetaDataType("assetinfo", "");
|
||||
AssetRecognizer rec;
|
||||
AssetPlatformSpec specpc;
|
||||
@@ -459,72 +447,6 @@ TEST_F(AssetProcessorManagerTest, DeleteFolder_SignalsDeleteOfContainedFiles)
|
||||
EXPECT_EQ(1, count);
|
||||
}
|
||||
|
||||
TEST_F(AssetProcessorManagerTest, UnitTestForOutPutPrefix)
|
||||
{
|
||||
using namespace AssetProcessor;
|
||||
QDir tempPath(m_tempDir.path());
|
||||
|
||||
UnitTestUtils::CreateDummyFile(tempPath.absoluteFilePath("subfolder2/test.txt"));
|
||||
UnitTestUtils::CreateDummyFile(tempPath.absoluteFilePath("subfolder3/test.txt"));
|
||||
|
||||
int count = 0;
|
||||
auto connection = QObject::connect(m_assetProcessorManager.get(), &AssetProcessorManager::AssetToProcess, [&count](JobDetails jobDetails)
|
||||
{
|
||||
if (jobDetails.m_jobEntry.m_databaseSourceName.compare("redirected/test.txt", Qt::CaseInsensitive) == 0 ||
|
||||
jobDetails.m_jobEntry.m_databaseSourceName.compare("dummy/test.txt", Qt::CaseInsensitive) == 0 )
|
||||
{
|
||||
count++;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
m_isIdling = false;
|
||||
// tell the APM about the files:
|
||||
QMetaObject::invokeMethod(m_assetProcessorManager.get(), "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, tempPath.absoluteFilePath("subfolder2/test.txt")));
|
||||
QMetaObject::invokeMethod(m_assetProcessorManager.get(), "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, tempPath.absoluteFilePath("subfolder3/test.txt")));
|
||||
ASSERT_TRUE(BlockUntilIdle(5000));
|
||||
|
||||
EXPECT_EQ(2, count);
|
||||
|
||||
EXPECT_TRUE(QFile::remove(tempPath.absoluteFilePath("subfolder2/test.txt")));
|
||||
EXPECT_TRUE(QFile::remove(tempPath.absoluteFilePath("subfolder3/test.txt")));
|
||||
|
||||
}
|
||||
|
||||
TEST_F(AssetProcessorManagerTest, UnitTestForOutPutPrefixWithMultipleNotification)
|
||||
{
|
||||
using namespace AssetProcessor;
|
||||
QDir tempPath(m_tempDir.path());
|
||||
|
||||
UnitTestUtils::CreateDummyFile(tempPath.absoluteFilePath("subfolder2/test.txt"));
|
||||
UnitTestUtils::CreateDummyFile(tempPath.absoluteFilePath("subfolder3/test.txt"));
|
||||
|
||||
int count = 0;
|
||||
auto connection = QObject::connect(m_assetProcessorManager.get(), &AssetProcessorManager::AssetToProcess, [&count](JobDetails jobDetails)
|
||||
{
|
||||
if (jobDetails.m_jobEntry.m_databaseSourceName.compare("redirected/test.txt", Qt::CaseInsensitive) == 0 ||
|
||||
jobDetails.m_jobEntry.m_databaseSourceName.compare("dummy/test.txt", Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
m_isIdling = false;
|
||||
// we are putting multiple entries in the pipeline here and testing that we still receive only unique notifications for processing those assets
|
||||
QMetaObject::invokeMethod(m_assetProcessorManager.get(), "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, tempPath.absoluteFilePath("subfolder2/test.txt")));
|
||||
QMetaObject::invokeMethod(m_assetProcessorManager.get(), "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, tempPath.absoluteFilePath("subfolder2/test.txt")));
|
||||
QMetaObject::invokeMethod(m_assetProcessorManager.get(), "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, tempPath.absoluteFilePath("subfolder2/test.txt")));
|
||||
QMetaObject::invokeMethod(m_assetProcessorManager.get(), "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, tempPath.absoluteFilePath("subfolder3/test.txt")));
|
||||
QMetaObject::invokeMethod(m_assetProcessorManager.get(), "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, tempPath.absoluteFilePath("subfolder3/test.txt")));
|
||||
QMetaObject::invokeMethod(m_assetProcessorManager.get(), "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, tempPath.absoluteFilePath("subfolder3/test.txt")));
|
||||
ASSERT_TRUE(BlockUntilIdle(5000));
|
||||
|
||||
EXPECT_EQ(2, count);
|
||||
EXPECT_TRUE(QFile::remove(tempPath.absoluteFilePath("subfolder2/test.txt")));
|
||||
EXPECT_TRUE(QFile::remove(tempPath.absoluteFilePath("subfolder3/test.txt")));
|
||||
}
|
||||
|
||||
TEST_F(AssetProcessorManagerTest, UnitTestForGettingJobInfoBySourceUUIDFailure)
|
||||
{
|
||||
using namespace AzToolsFramework::AssetSystem;
|
||||
@@ -1191,7 +1113,7 @@ TEST_F(AssetProcessorManagerTest, BuilderSDK_API_CreateJobs_HasValidParameters_W
|
||||
{
|
||||
QDir tempPath(m_tempDir.path());
|
||||
// here we push a file change through APM and make sure that "CreateJobs" has correct parameters, with no output redirection
|
||||
QString absPath(tempPath.absoluteFilePath("subfolder2/test_text.txt"));
|
||||
QString absPath(tempPath.absoluteFilePath("subfolder2/redirected/test_text.txt"));
|
||||
UnitTestUtils::CreateDummyFile(absPath);
|
||||
|
||||
m_mockApplicationManager->ResetMockBuilderCreateJobCalls();
|
||||
@@ -1212,7 +1134,7 @@ TEST_F(AssetProcessorManagerTest, BuilderSDK_API_CreateJobs_HasValidParameters_W
|
||||
// subfolder2 has its output redirected in the cache
|
||||
// this test makes sure that the CreateJobs API is completely unaffected by that and none of the internal database stuff
|
||||
// is reflected by the API.
|
||||
EXPECT_STREQ(req.m_watchFolder.c_str(), tempPath.absoluteFilePath("subfolder2").toUtf8().constData());
|
||||
EXPECT_STREQ(req.m_watchFolder.c_str(), tempPath.absoluteFilePath("subfolder2/redirected").toUtf8().constData());
|
||||
EXPECT_STREQ(req.m_sourceFile.c_str(), "test_text.txt"); // only the name should be there, no output prefix.
|
||||
|
||||
EXPECT_NE(req.m_sourceFileUUID, AZ::Uuid::CreateNull());
|
||||
@@ -2354,7 +2276,7 @@ TEST_F(PathDependencyTest, AbsoluteDependencies_Deferred_ResolveCorrectly)
|
||||
// When an absolute path matches a scan folder, the portion of the path matching that scan folder
|
||||
// is replaced with the scan folder's ID.
|
||||
AZStd::string absPathDep1WithScanfolder(AZStd::string::format("$4$%s", relativePathDep1.c_str()));
|
||||
QString absPathDep2(tempPath.absoluteFilePath("subfolder2/dep2.txt"));
|
||||
QString absPathDep2(tempPath.absoluteFilePath("subfolder2/redirected/dep2.txt"));
|
||||
QString absPathDep3(tempPath.absoluteFilePath("subfolder1/dep3.txt"));
|
||||
|
||||
// -------- Make main test asset, with dependencies on products that don't exist yet -----
|
||||
@@ -2375,7 +2297,7 @@ TEST_F(PathDependencyTest, AbsoluteDependencies_Deferred_ResolveCorrectly)
|
||||
// Different scanfolder, same relative file name. This should *not* trigger the dependency. We can't test with another asset in the proper scanfolder because AssetIds are based on relative file name,
|
||||
// which means both assets have the same AssetId and there would be no way to tell which one matched
|
||||
ASSERT_TRUE(ProcessAsset(dep1, { {".asset1"}, {".asset2"} }, {}, "subfolder1/"));
|
||||
ASSERT_TRUE(ProcessAsset(dep2, { {".asset1"}, {".asset2"} }, {}, "subfolder2/")); // subfolder2 has a prefix of "redirected"
|
||||
ASSERT_TRUE(ProcessAsset(dep2, { {".asset1"}, {".asset2"} }, {}, "subfolder2/redirected/"));
|
||||
ASSERT_TRUE(ProcessAsset(dep3, { {".asset1"}, {".asset2"} }, {}, "subfolder1/")); // test a normal dependency with no prefix
|
||||
|
||||
// ---------- Verify that the dependency was recorded, and did not keep the path after resolution ----------
|
||||
@@ -2550,14 +2472,14 @@ TEST_F(PathDependencyTest, AssetProcessed_Impl_DeferredPathResolution_CorrectlyM
|
||||
|
||||
// -------- Make main test asset, with dependencies on products that don't exist yet -----
|
||||
TestAsset primaryFile("test_text");
|
||||
ASSERT_TRUE(ProcessAsset(primaryFile, { { ".asset" }, {} }, { {"test.asset1", ProductPathDependencyType::ProductFile}, {"redirected/test.asset2", ProductPathDependencyType::ProductFile} }));
|
||||
ASSERT_TRUE(ProcessAsset(primaryFile, { { ".asset" }, {} }, { {"test.asset1", ProductPathDependencyType::ProductFile}, {"test.asset2", ProductPathDependencyType::ProductFile} }));
|
||||
|
||||
// create dependees
|
||||
TestAsset dep1("test");
|
||||
TestAsset dep2("test");
|
||||
|
||||
ASSERT_TRUE(ProcessAsset(dep1, { {".asset1"}, {".asset2"} }, {}, "subfolder1/"));
|
||||
ASSERT_TRUE(ProcessAsset(dep2, { {".asset1"}, {".asset2"} }, {}, "subfolder2/")); // subfolder2 has a prefix of "redirected"
|
||||
ASSERT_TRUE(ProcessAsset(dep2, { {".asset1"}, {".asset2"} }, {}, "subfolder2/redirected/"));
|
||||
|
||||
// ---------- Verify that the dependency was recorded, and did not keep the path after resolution ----------
|
||||
AzToolsFramework::AssetDatabase::ProductDependencyDatabaseEntryContainer dependencyContainer;
|
||||
@@ -2575,14 +2497,14 @@ TEST_F(PathDependencyTest, SourceFileDependencyWithPrefix_Deferred_ResolvesCorre
|
||||
// -------- Make main test asset, with dependencies on products that don't exist yet -----
|
||||
TestAsset primaryFile("test_text");
|
||||
|
||||
ASSERT_TRUE(ProcessAsset(primaryFile, { { ".asset" }, {} }, { {"redirected/test.txt", ProductPathDependencyType::SourceFile} }));
|
||||
ASSERT_TRUE(ProcessAsset(primaryFile, { { ".asset" }, {} }, { {"test.txt", ProductPathDependencyType::SourceFile} }));
|
||||
|
||||
// create dependees
|
||||
TestAsset dep1("test");
|
||||
TestAsset dep2("test");
|
||||
|
||||
ASSERT_TRUE(ProcessAsset(dep1, { {".asset1"}, {".asset2"} }, {}, "subfolder1/"));
|
||||
ASSERT_TRUE(ProcessAsset(dep2, { {".asset1"}, {".asset2"} }, {}, "subfolder2/")); // subfolder2 has a prefix of "redirected"
|
||||
ASSERT_TRUE(ProcessAsset(dep2, { {".asset1"}, {".asset2"} }, {}, "subfolder2/redirected/"));
|
||||
|
||||
// ---------- Verify that the dependency was recorded, and did not keep the path after resolution ----------
|
||||
AzToolsFramework::AssetDatabase::ProductDependencyDatabaseEntryContainer dependencyContainer;
|
||||
@@ -2606,12 +2528,12 @@ TEST_F(PathDependencyTest, SourceFileDependencyWithPrefix_Existing_ResolvesCorre
|
||||
TestAsset dep2("test");
|
||||
|
||||
ASSERT_TRUE(ProcessAsset(dep1, { {".asset1"}, {".asset2"} }, {}, "subfolder1/"));
|
||||
ASSERT_TRUE(ProcessAsset(dep2, { {".asset1"}, {".asset2"} }, {}, "subfolder2/")); // subfolder2 has a prefix of "redirected"
|
||||
ASSERT_TRUE(ProcessAsset(dep2, { {".asset1"}, {".asset2"} }, {}, "subfolder2/redirected/"));
|
||||
|
||||
// -------- Make main test asset, with dependencies on products we just created -----
|
||||
TestAsset primaryFile("test_text");
|
||||
|
||||
ASSERT_TRUE(ProcessAsset(primaryFile, { { ".asset" }, {} }, { {"redirected/test.txt", ProductPathDependencyType::SourceFile} }));
|
||||
ASSERT_TRUE(ProcessAsset(primaryFile, { { ".asset" }, {} }, { {"test.txt", ProductPathDependencyType::SourceFile} }));
|
||||
|
||||
// ---------- Verify that the dependency was recorded, and did not keep the path after resolution ----------
|
||||
AzToolsFramework::AssetDatabase::ProductDependencyDatabaseEntryContainer dependencyContainer;
|
||||
@@ -2633,13 +2555,9 @@ void MultiplatformPathDependencyTest::SetUp()
|
||||
m_config->EnablePlatform({ "provo",{ "console" } }, true);
|
||||
QDir tempPath(m_tempDir.path());
|
||||
|
||||
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", "", false, true, m_config->GetEnabledPlatforms() ));
|
||||
|
||||
// add a scan folder that has an output prefix:
|
||||
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", "redirected", false, true, m_config->GetEnabledPlatforms()));
|
||||
|
||||
//adding another scan folder with an output prefix
|
||||
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", "dummy", false, true, m_config->GetEnabledPlatforms()));
|
||||
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", false, true, m_config->GetEnabledPlatforms() ));
|
||||
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", false, true, m_config->GetEnabledPlatforms()));
|
||||
m_config->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", false, true, m_config->GetEnabledPlatforms()));
|
||||
|
||||
m_assetProcessorManager = nullptr; // we need to destroy the previous instance before creating a new one
|
||||
m_assetProcessorManager = AZStd::make_unique<AssetProcessorManager_Test>(m_config.get());
|
||||
@@ -3741,577 +3659,6 @@ TEST_F(AssetProcessorManagerTest, JobDependencyOrderOnce_MultipleJobs_EmitOK)
|
||||
EXPECT_EQ(jobDetails[1].m_jobDependencyList[0].m_jobDependency.m_sourceFile.m_sourceFileDependencyPath, secondRelSourceFile); // there should only be one job dependency
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------------------
|
||||
// The same suite of tests as above, but using a folder with an output prefix instead
|
||||
// ------------------------------------------------------------------------------------------------------------
|
||||
|
||||
TEST_F(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_BasicTest)
|
||||
{
|
||||
// make sure that if we publish some dependencies, they appear:
|
||||
AZ::Uuid dummyBuilderUUID = AZ::Uuid::CreateRandom();
|
||||
QDir tempPath(m_tempDir.path());
|
||||
QString inputDatabasePath = "redirected/outputprefixtest.txt";
|
||||
UnitTestUtils::CreateDummyFile(tempPath.absoluteFilePath("subfolder2/outputprefixtest.txt"));
|
||||
QString absPath(tempPath.absoluteFilePath("subfolder2/outputprefixtest.txt"));
|
||||
QString watchFolderPath = tempPath.absoluteFilePath("subfolder2");
|
||||
const ScanFolderInfo* scanFolder = m_config->GetScanFolderByPath(watchFolderPath);
|
||||
ASSERT_NE(scanFolder, nullptr);
|
||||
ASSERT_STREQ(scanFolder->GetOutputPrefix().toUtf8().constData(), "redirected");
|
||||
|
||||
// the above file (assetProcessorManagerTest.txt) will depend on these four files
|
||||
QString dependsOnFile1_Source = tempPath.absoluteFilePath("subfolder2/a.txt");
|
||||
QString dependsOnFile2_Source = tempPath.absoluteFilePath("subfolder2/b.txt");
|
||||
QString dependsOnFile1_Job = tempPath.absoluteFilePath("subfolder2/c.txt");
|
||||
QString dependsOnFile2_Job = tempPath.absoluteFilePath("subfolder2/d.txt");
|
||||
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile1_Source, QString("tempdata\n")));
|
||||
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile2_Source, QString("tempdata\n")));
|
||||
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile1_Job, QString("tempdata\n")));
|
||||
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile2_Job, QString("tempdata\n")));
|
||||
|
||||
// construct the dummy job to feed to the database updater function:
|
||||
AssetProcessorManager::JobToProcessEntry job;
|
||||
job.m_sourceFileInfo.m_databasePath = inputDatabasePath;
|
||||
job.m_sourceFileInfo.m_pathRelativeToScanFolder = "outputprefixtest.txt";
|
||||
job.m_sourceFileInfo.m_scanFolder = scanFolder;
|
||||
job.m_sourceFileInfo.m_uuid = AssetUtilities::CreateSafeSourceUUIDFromName(job.m_sourceFileInfo.m_databasePath.toUtf8().data());
|
||||
|
||||
// note that we have to "prime" the map with the UUIDs to the source info for this to work:
|
||||
AZ::Uuid uuidOfB = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/b.txt");
|
||||
AZ::Uuid uuidOfD = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/d.txt");
|
||||
m_assetProcessorManager->m_sourceUUIDToSourceInfoMap[uuidOfB] = { watchFolderPath, "b.txt", "redirected/b.txt" };
|
||||
m_assetProcessorManager->m_sourceUUIDToSourceInfoMap[uuidOfD] = { watchFolderPath, "d.txt", "redirected/d.txt" };
|
||||
|
||||
// each file we will take a different approach to publishing: rel path, and UUID:
|
||||
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "a.txt", AZ::Uuid::CreateNull() }));
|
||||
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "", uuidOfB }));
|
||||
|
||||
// it is currently assumed that the only fields that we care about in JobDetails is the builder busId and the job dependencies themselves:
|
||||
JobDetails newDetails;
|
||||
newDetails.m_assetBuilderDesc.m_busId = dummyBuilderUUID;
|
||||
|
||||
AssetBuilderSDK::SourceFileDependency dep1 = { "c.txt", AZ::Uuid::CreateNull() };
|
||||
AssetBuilderSDK::JobDependency jobDep1("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep1);
|
||||
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep1));
|
||||
|
||||
AssetBuilderSDK::SourceFileDependency dep2 = { "",uuidOfD };
|
||||
AssetBuilderSDK::JobDependency jobDep2("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep2);
|
||||
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep2));
|
||||
|
||||
job.m_jobsToAnalyze.push_back(newDetails);
|
||||
|
||||
// this is the one line that this unit test is really testing:
|
||||
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job);
|
||||
|
||||
// the rest of this test now performs a series of queries to verify the database was correctly set.
|
||||
// this indirectly verifies the QueryAbsolutePathDependenciesRecursive function also but it has its own dedicated tests, above.
|
||||
AssetProcessor::SourceFilesForFingerprintingContainer deps;
|
||||
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_SourceToSource, false);
|
||||
// the above function includes the actual source, as an absolute path.
|
||||
EXPECT_EQ(deps.size(), 3);
|
||||
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile1_Source.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile2_Source.toUtf8().constData()), deps.end());
|
||||
|
||||
deps.clear();
|
||||
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_JobToJob, false);
|
||||
// the above function includes the actual source, as an absolute path.
|
||||
EXPECT_EQ(deps.size(), 3);
|
||||
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile1_Job.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile2_Job.toUtf8().constData()), deps.end());
|
||||
|
||||
deps.clear();
|
||||
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_Any, false);
|
||||
// the above function includes the actual source, as an absolute path.
|
||||
EXPECT_EQ(deps.size(), 5);
|
||||
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile1_Source.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile2_Source.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile1_Job.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile2_Job.toUtf8().constData()), deps.end());
|
||||
|
||||
// make sure the corresponding values in the map are also correct (ie, database path only)
|
||||
EXPECT_STREQ(deps[absPath.toUtf8().constData()].c_str(), "redirected/outputprefixtest.txt");
|
||||
EXPECT_STREQ(deps[dependsOnFile1_Source.toUtf8().constData()].c_str(), "redirected/a.txt");
|
||||
EXPECT_STREQ(deps[dependsOnFile2_Source.toUtf8().constData()].c_str(), "redirected/b.txt");
|
||||
EXPECT_STREQ(deps[dependsOnFile1_Job.toUtf8().constData()].c_str(), "redirected/c.txt");
|
||||
EXPECT_STREQ(deps[dependsOnFile2_Job.toUtf8().constData()].c_str(), "redirected/d.txt");
|
||||
}
|
||||
|
||||
TEST_F(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_UpdateTest)
|
||||
{
|
||||
// make sure that if we remove dependencies that are published, they disappear.
|
||||
// so the first part of this test is to put some data in there, the same as before:
|
||||
|
||||
AZ::Uuid dummyBuilderUUID = AZ::Uuid::CreateRandom();
|
||||
QDir tempPath(m_tempDir.path());
|
||||
QString absPath(tempPath.absoluteFilePath("subfolder2/outputprefixtest.txt"));
|
||||
UnitTestUtils::CreateDummyFile(absPath);
|
||||
QString inputDatabasePath = "redirected/outputprefixtest.txt";
|
||||
QString watchFolderPath = tempPath.absoluteFilePath("subfolder2");
|
||||
const ScanFolderInfo* scanFolder = m_config->GetScanFolderByPath(watchFolderPath);
|
||||
ASSERT_NE(scanFolder, nullptr);
|
||||
|
||||
// the above file (assetProcessorManagerTest.txt) will depend on these four files:
|
||||
QString dependsOnFile1_Source = tempPath.absoluteFilePath("subfolder2/a.txt");
|
||||
QString dependsOnFile2_Source = tempPath.absoluteFilePath("subfolder2/b.txt");
|
||||
QString dependsOnFile1_Job = tempPath.absoluteFilePath("subfolder2/c.txt");
|
||||
QString dependsOnFile2_Job = tempPath.absoluteFilePath("subfolder2/d.txt");
|
||||
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile1_Source, QString("tempdata\n")));
|
||||
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile2_Source, QString("tempdata\n")));
|
||||
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile1_Job, QString("tempdata\n")));
|
||||
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile2_Job, QString("tempdata\n")));
|
||||
|
||||
// construct the dummy job to feed to the database updater function:
|
||||
AssetProcessorManager::JobToProcessEntry job;
|
||||
job.m_sourceFileInfo.m_databasePath = inputDatabasePath;
|
||||
job.m_sourceFileInfo.m_pathRelativeToScanFolder = "outputprefixtest.txt";
|
||||
job.m_sourceFileInfo.m_scanFolder = scanFolder;
|
||||
job.m_sourceFileInfo.m_uuid = AssetUtilities::CreateSafeSourceUUIDFromName(job.m_sourceFileInfo.m_databasePath.toUtf8().data());
|
||||
|
||||
// note that we have to "prime" the map with the UUIDs to the source info for this to work:
|
||||
AZ::Uuid uuidOfB = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/b.txt");
|
||||
AZ::Uuid uuidOfD = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/d.txt");
|
||||
m_assetProcessorManager->m_sourceUUIDToSourceInfoMap[uuidOfB] = { watchFolderPath, "b.txt", "redirected/b.txt" };
|
||||
m_assetProcessorManager->m_sourceUUIDToSourceInfoMap[uuidOfD] = { watchFolderPath, "d.txt", "redirected/d.txt" };
|
||||
|
||||
// each file we will take a different approach to publishing: rel path, and UUID:
|
||||
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "a.txt", AZ::Uuid::CreateNull() }));
|
||||
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "", uuidOfB }));
|
||||
|
||||
// it is currently assumed that the only fields that we care about in JobDetails is the builder busId and the job dependencies themselves:
|
||||
JobDetails newDetails;
|
||||
newDetails.m_assetBuilderDesc.m_busId = dummyBuilderUUID;
|
||||
|
||||
AssetBuilderSDK::SourceFileDependency dep1 = { "c.txt", AZ::Uuid::CreateNull() };
|
||||
AssetBuilderSDK::JobDependency jobDep1("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep1);
|
||||
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep1));
|
||||
|
||||
AssetBuilderSDK::SourceFileDependency dep2 = { "",uuidOfD };
|
||||
AssetBuilderSDK::JobDependency jobDep2("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep2);
|
||||
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep2));
|
||||
job.m_jobsToAnalyze.push_back(newDetails);
|
||||
|
||||
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job);
|
||||
|
||||
// in this test, though, we delete some after pushing them in there, and update it again:
|
||||
job.m_sourceFileDependencies.pop_back(); // erase the 'b' dependency.
|
||||
job.m_jobsToAnalyze[0].m_jobDependencyList.pop_back(); // erase the 'd' dependency, which is by guid.
|
||||
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job);
|
||||
|
||||
// now make sure that the same queries omit b and d:
|
||||
AssetProcessor::SourceFilesForFingerprintingContainer deps;
|
||||
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_SourceToSource, false);
|
||||
// the above function includes the actual source, as an absolute path.
|
||||
EXPECT_EQ(deps.size(), 2);
|
||||
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile1_Source.toUtf8().constData()), deps.end());
|
||||
|
||||
deps.clear();
|
||||
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_JobToJob, false);
|
||||
// the above function includes the actual source, as an absolute path.
|
||||
EXPECT_EQ(deps.size(), 2);
|
||||
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile1_Job.toUtf8().constData()), deps.end());
|
||||
|
||||
deps.clear();
|
||||
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_Any, false);
|
||||
// the above function includes the actual source, as an absolute path.
|
||||
EXPECT_EQ(deps.size(), 3);
|
||||
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile1_Source.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile1_Job.toUtf8().constData()), deps.end());
|
||||
}
|
||||
|
||||
TEST_F(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_MissingFiles_ByUuid)
|
||||
{
|
||||
// make sure that if we publish some dependencies, they do not appear if missing.
|
||||
AZ::Uuid dummyBuilderUUID = AZ::Uuid::CreateRandom();
|
||||
QDir tempPath(m_tempDir.path());
|
||||
QString absPath(tempPath.absoluteFilePath("subfolder2/outputprefixtest.txt"));
|
||||
UnitTestUtils::CreateDummyFile(absPath);
|
||||
QString inputDatabasePath = "redirected/outputprefixtest.txt";
|
||||
QString watchFolderPath = tempPath.absoluteFilePath("subfolder2");
|
||||
const ScanFolderInfo* scanFolder = m_config->GetScanFolderByPath(watchFolderPath);
|
||||
ASSERT_NE(scanFolder, nullptr);
|
||||
|
||||
// the above file (assetProcessorManagerTest.txt) will depend on these four files:
|
||||
QString dependsOnFile1_Source = tempPath.absoluteFilePath("subfolder2/a.txt");
|
||||
QString dependsOnFile2_Source = tempPath.absoluteFilePath("subfolder2/b.txt");
|
||||
QString dependsOnFile1_Job = tempPath.absoluteFilePath("subfolder2/c.txt");
|
||||
QString dependsOnFile2_Job = tempPath.absoluteFilePath("subfolder2/d.txt");
|
||||
|
||||
// in this case, we are only creating file b, and d (which are input by UUID)
|
||||
// and we will be missing a and c, which are input by name.
|
||||
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile2_Source, QString("tempdata\n")));
|
||||
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile2_Job, QString("tempdata\n")));
|
||||
|
||||
// construct the dummy job to feed to the database updater function:
|
||||
AssetProcessorManager::JobToProcessEntry job;
|
||||
job.m_sourceFileInfo.m_databasePath = inputDatabasePath;
|
||||
job.m_sourceFileInfo.m_pathRelativeToScanFolder = "outputprefixtest.txt";
|
||||
job.m_sourceFileInfo.m_scanFolder = scanFolder;
|
||||
job.m_sourceFileInfo.m_uuid = AssetUtilities::CreateSafeSourceUUIDFromName(job.m_sourceFileInfo.m_databasePath.toUtf8().data());
|
||||
|
||||
// note that we have to "prime" the map with the UUIDs to the source info for this to work:
|
||||
AZ::Uuid uuidOfB = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/b.txt");
|
||||
AZ::Uuid uuidOfD = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/d.txt");
|
||||
m_assetProcessorManager->m_sourceUUIDToSourceInfoMap[uuidOfB] = { watchFolderPath, "b.txt", "redirected/b.txt" };
|
||||
m_assetProcessorManager->m_sourceUUIDToSourceInfoMap[uuidOfD] = { watchFolderPath, "d.txt", "redirected/d.txt" };
|
||||
|
||||
// each file we will take a different approach to publishing: rel path, and UUID:
|
||||
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "a.txt", AZ::Uuid::CreateNull() }));
|
||||
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "", uuidOfB }));
|
||||
|
||||
// it is currently assumed that the only fields that we care about in JobDetails is the builder busId and the job dependencies themselves:
|
||||
JobDetails newDetails;
|
||||
newDetails.m_assetBuilderDesc.m_busId = dummyBuilderUUID;
|
||||
|
||||
AssetBuilderSDK::SourceFileDependency dep1 = { "c.txt", AZ::Uuid::CreateNull() };
|
||||
AssetBuilderSDK::JobDependency jobDep1("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep1);
|
||||
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep1));
|
||||
|
||||
AssetBuilderSDK::SourceFileDependency dep2 = { "",uuidOfD };
|
||||
AssetBuilderSDK::JobDependency jobDep2("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep2);
|
||||
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep2));
|
||||
|
||||
job.m_jobsToAnalyze.push_back(newDetails);
|
||||
|
||||
// this is the one line that this unit test is really testing:
|
||||
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job);
|
||||
|
||||
// the rest of this test now performs a series of queries to verify the database was correctly set.
|
||||
// this indirectly verifies the QueryAbsolutePathDependenciesRecursive function also but it has its own dedicated tests, above.
|
||||
AssetProcessor::SourceFilesForFingerprintingContainer deps;
|
||||
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_SourceToSource, false);
|
||||
|
||||
EXPECT_EQ(deps.size(), 2);
|
||||
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile2_Source.toUtf8().constData()), deps.end()); // b
|
||||
|
||||
deps.clear();
|
||||
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_JobToJob, false);
|
||||
// the above function includes the actual source, as an absolute path.
|
||||
EXPECT_EQ(deps.size(), 2);
|
||||
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile2_Job.toUtf8().constData()), deps.end()); // d
|
||||
|
||||
deps.clear();
|
||||
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_Any, false);
|
||||
// the above function includes the actual source, as an absolute path.
|
||||
EXPECT_EQ(deps.size(), 3);
|
||||
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile2_Source.toUtf8().constData()), deps.end()); // b
|
||||
EXPECT_NE(deps.find(dependsOnFile2_Job.toUtf8().constData()), deps.end()); // d
|
||||
}
|
||||
|
||||
TEST_F(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_MissingFiles_ByName)
|
||||
{
|
||||
AZ::Uuid dummyBuilderUUID = AZ::Uuid::CreateRandom();
|
||||
QDir tempPath(m_tempDir.path());
|
||||
QString absPath(tempPath.absoluteFilePath("subfolder2/outputprefixtest.txt"));
|
||||
UnitTestUtils::CreateDummyFile(absPath);
|
||||
QString inputDatabasePath = "redirected/outputprefixtest.txt";
|
||||
QString watchFolderPath = tempPath.absoluteFilePath("subfolder2");
|
||||
const ScanFolderInfo* scanFolder = m_config->GetScanFolderByPath(watchFolderPath);
|
||||
ASSERT_NE(scanFolder, nullptr);
|
||||
|
||||
// the above file (assetProcessorManagerTest.txt) will depend on these four files:
|
||||
QString dependsOnFile1_Source = tempPath.absoluteFilePath("subfolder2/a.txt");
|
||||
QString dependsOnFile2_Source = tempPath.absoluteFilePath("subfolder2/b.txt");
|
||||
QString dependsOnFile1_Job = tempPath.absoluteFilePath("subfolder2/c.txt");
|
||||
QString dependsOnFile2_Job = tempPath.absoluteFilePath("subfolder2/d.txt");
|
||||
|
||||
// in this case, we are only creating file a, and c, which are input by name
|
||||
// and we we will be making b and d missing, which are input by UUID.
|
||||
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile1_Source, QString("tempdata\n")));
|
||||
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile1_Job, QString("tempdata\n")));
|
||||
|
||||
// construct the dummy job to feed to the database updater function:
|
||||
AssetProcessorManager::JobToProcessEntry job;
|
||||
job.m_sourceFileInfo.m_databasePath = inputDatabasePath;
|
||||
job.m_sourceFileInfo.m_pathRelativeToScanFolder = "outputprefixtest.txt";
|
||||
job.m_sourceFileInfo.m_scanFolder = scanFolder;
|
||||
job.m_sourceFileInfo.m_uuid = AssetUtilities::CreateSafeSourceUUIDFromName(job.m_sourceFileInfo.m_databasePath.toUtf8().data());
|
||||
|
||||
// note that we have to "prime" the map with the UUIDs to the source info for this to work:
|
||||
AZ::Uuid uuidOfB = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/b.txt");
|
||||
AZ::Uuid uuidOfD = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/d.txt");
|
||||
|
||||
// each file we will take a different approach to publishing: rel path, and UUID:
|
||||
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "a.txt", AZ::Uuid::CreateNull() }));
|
||||
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "", uuidOfB }));
|
||||
|
||||
// it is currently assumed that the only fields that we care about in JobDetails is the builder busId and the job dependencies themselves:
|
||||
JobDetails newDetails;
|
||||
newDetails.m_assetBuilderDesc.m_busId = dummyBuilderUUID;
|
||||
|
||||
AssetBuilderSDK::SourceFileDependency dep1 = { "c.txt", AZ::Uuid::CreateNull() };
|
||||
AssetBuilderSDK::JobDependency jobDep1("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep1);
|
||||
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep1));
|
||||
|
||||
AssetBuilderSDK::SourceFileDependency dep2 = { "",uuidOfD };
|
||||
AssetBuilderSDK::JobDependency jobDep2("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep2);
|
||||
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep2));
|
||||
|
||||
job.m_jobsToAnalyze.push_back(newDetails);
|
||||
|
||||
// this is the one line that this unit test is really testing:
|
||||
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job);
|
||||
|
||||
// the rest of this test now performs a series of queries to verify the database was correctly set.
|
||||
// this indirectly verifies the QueryAbsolutePathDependenciesRecursive function also but it has its own dedicated tests, above.
|
||||
AssetProcessor::SourceFilesForFingerprintingContainer deps;
|
||||
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_SourceToSource, false);
|
||||
|
||||
// we should find all of the deps, but none of the placeholder
|
||||
EXPECT_EQ(deps.size(), 2);
|
||||
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile1_Source.toUtf8().constData()), deps.end()); // a
|
||||
|
||||
deps.clear();
|
||||
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_JobToJob, false);
|
||||
EXPECT_EQ(deps.size(), 2);
|
||||
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile1_Job.toUtf8().constData()), deps.end()); // c
|
||||
|
||||
deps.clear();
|
||||
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_Any, false);
|
||||
EXPECT_EQ(deps.size(), 3);
|
||||
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile1_Source.toUtf8().constData()), deps.end()); // a
|
||||
EXPECT_NE(deps.find(dependsOnFile1_Job.toUtf8().constData()), deps.end()); // c
|
||||
}
|
||||
|
||||
|
||||
TEST_F(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_MissingFiles_ByUuid_UpdatesWhenTheyAppear)
|
||||
{
|
||||
// this test makes sure that when files DO appear that were previously placeholders, the database is updated
|
||||
// so the strategy here is to have files b, and d missing, which are declared as dependencies by UUID.
|
||||
// then, we make them re-appear later, and check that the database has updated them appropriately.
|
||||
|
||||
AZ::Uuid dummyBuilderUUID = AZ::Uuid::CreateRandom();
|
||||
QDir tempPath(m_tempDir.path());
|
||||
QString absPath(tempPath.absoluteFilePath("subfolder2/outputprefixtest.txt"));
|
||||
UnitTestUtils::CreateDummyFile(absPath);
|
||||
QString inputDatabasePath = "redirected/outputprefixtest.txt";
|
||||
QString watchFolderPath = tempPath.absoluteFilePath("subfolder2");
|
||||
const ScanFolderInfo* scanFolder = m_config->GetScanFolderByPath(watchFolderPath);
|
||||
ASSERT_NE(scanFolder, nullptr);
|
||||
|
||||
// the above file (assetProcessorManagerTest.txt) will depend on these four files:
|
||||
QString dependsOnFile1_Source = tempPath.absoluteFilePath("subfolder2/a.txt");
|
||||
QString dependsOnFile2_Source = tempPath.absoluteFilePath("subfolder2/b.txt");
|
||||
QString dependsOnFile1_Job = tempPath.absoluteFilePath("subfolder2/c.txt");
|
||||
QString dependsOnFile2_Job = tempPath.absoluteFilePath("subfolder2/d.txt");
|
||||
|
||||
// in this case, we are only creating file b, and d, which are addressed by UUID.
|
||||
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile1_Source, QString("tempdata\n")));
|
||||
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile1_Job, QString("tempdata\n")));
|
||||
|
||||
// construct the dummy job to feed to the database updater function:
|
||||
AssetProcessorManager::JobToProcessEntry job;
|
||||
job.m_sourceFileInfo.m_databasePath = inputDatabasePath;
|
||||
job.m_sourceFileInfo.m_pathRelativeToScanFolder = "outputprefixtest.txt";
|
||||
job.m_sourceFileInfo.m_scanFolder = scanFolder;
|
||||
job.m_sourceFileInfo.m_uuid = AssetUtilities::CreateSafeSourceUUIDFromName(job.m_sourceFileInfo.m_databasePath.toUtf8().data());
|
||||
|
||||
AZ::Uuid uuidOfD = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/d.txt");
|
||||
AZ::Uuid uuidOfB = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/b.txt");
|
||||
|
||||
// each file we will take a different approach to publishing: rel path, and UUID:
|
||||
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "a.txt", AZ::Uuid::CreateNull() }));
|
||||
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "", uuidOfB }));
|
||||
|
||||
// it is currently assumed that the only fields that we care about in JobDetails is the builder busId and the job dependencies themselves:
|
||||
JobDetails newDetails;
|
||||
newDetails.m_assetBuilderDesc.m_busId = dummyBuilderUUID;
|
||||
|
||||
AssetBuilderSDK::SourceFileDependency dep1 = { "c.txt", AZ::Uuid::CreateNull() };
|
||||
AssetBuilderSDK::JobDependency jobDep1("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep1);
|
||||
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep1));
|
||||
|
||||
AssetBuilderSDK::SourceFileDependency dep2 = { "",uuidOfD };
|
||||
AssetBuilderSDK::JobDependency jobDep2("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep2);
|
||||
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep2));
|
||||
|
||||
job.m_jobsToAnalyze.push_back(newDetails);
|
||||
|
||||
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job);
|
||||
// so at this point, the database should be in the same state as after the UpdateSourceFileDependenciesDatabase_MissingFiles_ByUuid test
|
||||
// which was already verified, by that test.
|
||||
|
||||
// now that the database has placeholders, we expect them to resolve themselves when we provide the actual files:
|
||||
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile2_Source, QString("tempdata\n")));
|
||||
// now that B exists, we pretend a job came in to process B. (it doesn't require dependencies to be declared)
|
||||
// note that we have to "prime" the map with the UUIDs to the source info for this to work:
|
||||
m_assetProcessorManager->m_sourceUUIDToSourceInfoMap[uuidOfB] = { watchFolderPath, "b.txt", "redirected/b.txt" };
|
||||
|
||||
AssetProcessorManager::JobToProcessEntry job2;
|
||||
job2.m_sourceFileInfo.m_databasePath = "redirected/b.txt";
|
||||
job2.m_sourceFileInfo.m_pathRelativeToScanFolder = "b.txt";
|
||||
job2.m_sourceFileInfo.m_scanFolder = scanFolder;
|
||||
job2.m_sourceFileInfo.m_uuid = uuidOfB;
|
||||
|
||||
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job2);
|
||||
|
||||
// b should no longer be a placeholder, so both A and B should be present as their actual path.
|
||||
AssetProcessor::SourceFilesForFingerprintingContainer deps;
|
||||
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_SourceToSource, false);
|
||||
EXPECT_EQ(deps.size(), 3);
|
||||
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile1_Source.toUtf8().constData()), deps.end()); // a
|
||||
EXPECT_NE(deps.find(dependsOnFile2_Source.toUtf8().constData()), deps.end()); // b
|
||||
|
||||
// but d should still be a placeholder, since we have not declared it yet.
|
||||
deps.clear();
|
||||
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_JobToJob, false);
|
||||
EXPECT_EQ(deps.size(), 2);
|
||||
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile1_Job.toUtf8().constData()), deps.end()); // c
|
||||
|
||||
// in addition, we expect to have the original file that depends on B appear in the analysis queue, since something it depends on appeared:
|
||||
QString normalizedSourcePath = AssetUtilities::NormalizeFilePath(absPath);
|
||||
EXPECT_TRUE(m_assetProcessorManager->m_alreadyActiveFiles.contains(normalizedSourcePath));
|
||||
|
||||
// now make d exist too and pretend a job came in to process it:
|
||||
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile2_Job, QString("tempdata\n"))); // create file D
|
||||
AssetProcessorManager::JobToProcessEntry job3;
|
||||
job3.m_sourceFileInfo.m_databasePath = "redirected/d.txt";
|
||||
job3.m_sourceFileInfo.m_pathRelativeToScanFolder = "d.txt";
|
||||
job3.m_sourceFileInfo.m_scanFolder = scanFolder;
|
||||
job3.m_sourceFileInfo.m_uuid = uuidOfD;
|
||||
m_assetProcessorManager->m_sourceUUIDToSourceInfoMap[uuidOfD] = { watchFolderPath, "d.txt", "redirected/d.txt" };
|
||||
|
||||
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job3);
|
||||
|
||||
// all files should now be present:
|
||||
deps.clear();
|
||||
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_Any, false);
|
||||
EXPECT_EQ(deps.size(), 5);
|
||||
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile1_Source.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile2_Source.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile1_Job.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile2_Job.toUtf8().constData()), deps.end());
|
||||
}
|
||||
|
||||
|
||||
TEST_F(AssetProcessorManagerTest, UpdateSourceFileDependenciesDatabase_WithOutputPrefix_MissingFiles_ByName_UpdatesWhenTheyAppear)
|
||||
{
|
||||
// this test makes sure that when files DO appear that were previously placeholders, the database is updated
|
||||
// so the strategy here is to have files a, and c missing, which are declared as dependencies by name.
|
||||
// then, we make them re-appear later, and check that the database has updated them appropriately.
|
||||
|
||||
AZ::Uuid dummyBuilderUUID = AZ::Uuid::CreateRandom();
|
||||
QDir tempPath(m_tempDir.path());
|
||||
QString absPath(tempPath.absoluteFilePath("subfolder2/outputprefixtest.txt"));
|
||||
UnitTestUtils::CreateDummyFile(absPath);
|
||||
QString inputDatabasePath = "redirected/outputprefixtest.txt";
|
||||
QString watchFolderPath = tempPath.absoluteFilePath("subfolder2");
|
||||
const ScanFolderInfo* scanFolder = m_config->GetScanFolderByPath(watchFolderPath);
|
||||
ASSERT_NE(scanFolder, nullptr);
|
||||
|
||||
// the above file (assetProcessorManagerTest.txt) will depend on these four files:
|
||||
QString dependsOnFile1_Source = tempPath.absoluteFilePath("subfolder2/a.txt");
|
||||
QString dependsOnFile2_Source = tempPath.absoluteFilePath("subfolder2/b.txt");
|
||||
QString dependsOnFile1_Job = tempPath.absoluteFilePath("subfolder2/c.txt");
|
||||
QString dependsOnFile2_Job = tempPath.absoluteFilePath("subfolder2/d.txt");
|
||||
|
||||
// in this case, we are only creating file b, and d, which are addressed by UUID.
|
||||
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile2_Source, QString("tempdata\n")));
|
||||
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile2_Job, QString("tempdata\n")));
|
||||
|
||||
// construct the dummy job to feed to the database updater function:
|
||||
AssetProcessorManager::JobToProcessEntry job;
|
||||
job.m_sourceFileInfo.m_databasePath = inputDatabasePath;
|
||||
job.m_sourceFileInfo.m_pathRelativeToScanFolder = "outputprefixtest.txt";
|
||||
job.m_sourceFileInfo.m_scanFolder = scanFolder;
|
||||
job.m_sourceFileInfo.m_uuid = AssetUtilities::CreateSafeSourceUUIDFromName(job.m_sourceFileInfo.m_databasePath.toUtf8().data());
|
||||
|
||||
// note that we have to "prime" the map with the UUIDs to the source info for this to work:
|
||||
AZ::Uuid uuidOfB = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/b.txt");
|
||||
AZ::Uuid uuidOfD = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/d.txt");
|
||||
m_assetProcessorManager->m_sourceUUIDToSourceInfoMap[uuidOfB] = { watchFolderPath, "b.txt", "redirected/b.txt" };
|
||||
m_assetProcessorManager->m_sourceUUIDToSourceInfoMap[uuidOfD] = { watchFolderPath, "d.txt", "redirected/d.txt" };
|
||||
|
||||
// each file we will take a different approach to publishing: rel path, and UUID:
|
||||
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "a.txt", AZ::Uuid::CreateNull() }));
|
||||
job.m_sourceFileDependencies.push_back(AZStd::make_pair<AZ::Uuid, AssetBuilderSDK::SourceFileDependency>(dummyBuilderUUID, { "", uuidOfB }));
|
||||
|
||||
// it is currently assumed that the only fields that we care about in JobDetails is the builder busId and the job dependencies themselves:
|
||||
JobDetails newDetails;
|
||||
newDetails.m_assetBuilderDesc.m_busId = dummyBuilderUUID;
|
||||
|
||||
AssetBuilderSDK::SourceFileDependency dep1 = { "c.txt", AZ::Uuid::CreateNull() };
|
||||
AssetBuilderSDK::JobDependency jobDep1("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep1);
|
||||
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep1));
|
||||
|
||||
AssetBuilderSDK::SourceFileDependency dep2 = { "",uuidOfD };
|
||||
AssetBuilderSDK::JobDependency jobDep2("pc build", "pc", AssetBuilderSDK::JobDependencyType::Order, dep2);
|
||||
newDetails.m_jobDependencyList.push_back(JobDependencyInternal(jobDep2));
|
||||
|
||||
job.m_jobsToAnalyze.push_back(newDetails);
|
||||
|
||||
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job);
|
||||
// so at this point, the database should be in the same state as after the UpdateSourceFileDependenciesDatabase_MissingFiles_ByUuid test
|
||||
// which was already verified, by that test.
|
||||
|
||||
// now that the database has placeholders, we expect them to resolve themselves when we provide the actual files:
|
||||
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile1_Source, QString("tempdata\n")));
|
||||
// now that A exists, we pretend a job came in to process a. (it doesn't require dependencies to be declared)
|
||||
AZ::Uuid uuidOfA = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/a.txt");
|
||||
AssetProcessorManager::JobToProcessEntry job2;
|
||||
job2.m_sourceFileInfo.m_databasePath = "redirected/a.txt";
|
||||
job2.m_sourceFileInfo.m_pathRelativeToScanFolder = "a.txt";
|
||||
job2.m_sourceFileInfo.m_scanFolder = scanFolder;
|
||||
job2.m_sourceFileInfo.m_uuid = uuidOfA;
|
||||
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job2);
|
||||
|
||||
// a should no longer be a placeholder
|
||||
AssetProcessor::SourceFilesForFingerprintingContainer deps;
|
||||
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_SourceToSource, false);
|
||||
EXPECT_EQ(deps.size(), 3);
|
||||
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile1_Source.toUtf8().constData()), deps.end()); // a
|
||||
EXPECT_NE(deps.find(dependsOnFile2_Source.toUtf8().constData()), deps.end()); // b
|
||||
deps.clear();
|
||||
|
||||
// c should still be a placeholder and thus should not appear in the results.
|
||||
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_JobToJob, false);
|
||||
EXPECT_EQ(deps.size(), 2);
|
||||
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile2_Job.toUtf8().constData()), deps.end()); // d
|
||||
|
||||
// in addition, we expect to have the original file that depends on A appear in the analysis queue, since something it depends on appeared:
|
||||
QString normalizedSourcePath = AssetUtilities::NormalizeFilePath(absPath);
|
||||
EXPECT_TRUE(m_assetProcessorManager->m_alreadyActiveFiles.contains(normalizedSourcePath));
|
||||
|
||||
// now make c exist too and pretend a job came in to process it:
|
||||
ASSERT_TRUE(UnitTestUtils::CreateDummyFile(dependsOnFile1_Job, QString("tempdata\n")));
|
||||
AZ::Uuid uuidOfC = AssetUtilities::CreateSafeSourceUUIDFromName("redirected/c.txt");
|
||||
AssetProcessorManager::JobToProcessEntry job3;
|
||||
job3.m_sourceFileInfo.m_databasePath = "redirected/c.txt";
|
||||
job3.m_sourceFileInfo.m_pathRelativeToScanFolder = "c.txt";
|
||||
job3.m_sourceFileInfo.m_scanFolder = scanFolder;
|
||||
job3.m_sourceFileInfo.m_uuid = uuidOfC;
|
||||
|
||||
m_assetProcessorManager.get()->UpdateSourceFileDependenciesDatabase(job3);
|
||||
|
||||
// all files should now be present:
|
||||
deps.clear();
|
||||
m_assetProcessorManager.get()->QueryAbsolutePathDependenciesRecursive(inputDatabasePath, deps, AzToolsFramework::AssetDatabase::SourceFileDependencyEntry::DEP_Any, false);
|
||||
EXPECT_EQ(deps.size(), 5);
|
||||
EXPECT_NE(deps.find(absPath.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile1_Source.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile2_Source.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile1_Job.toUtf8().constData()), deps.end());
|
||||
EXPECT_NE(deps.find(dependsOnFile2_Job.toUtf8().constData()), deps.end());
|
||||
}
|
||||
|
||||
TEST_F(AssetProcessorManagerTest, SourceFile_With_NonASCII_Characters_Fail_Job_OK)
|
||||
{
|
||||
// This test ensures that asset processor manager detects a source file that has non-ASCII characters
|
||||
|
||||
@@ -74,10 +74,10 @@ namespace AssetProcessor
|
||||
m_platformConfig.reset(new AssetProcessor::PlatformConfiguration());
|
||||
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
|
||||
m_platformConfig.get()->PopulatePlatformsForScanFolder(platforms);
|
||||
// PATH DisplayName PortKey outputfolder root recurse platforms
|
||||
m_platformConfig.get()->AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "", "ap1", "", true, false, platforms));
|
||||
m_platformConfig.get()->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "", "ap2", "", false, true, platforms));
|
||||
m_platformConfig.get()->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "", "ap3", "", false, true, platforms));
|
||||
// PATH DisplayName PortKey root recurse platforms
|
||||
m_platformConfig.get()->AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "", "ap1", true, false, platforms));
|
||||
m_platformConfig.get()->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "", "ap2", false, true, platforms));
|
||||
m_platformConfig.get()->AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "", "ap3", false, true, platforms));
|
||||
|
||||
m_assetScanner.reset(new AssetScanner_Test(m_platformConfig.get()));
|
||||
|
||||
|
||||
+18
-23
@@ -170,7 +170,7 @@ TEST_F(PlatformConfigurationUnitTests, TestReadScanFolderRoot_FromSettingsRegist
|
||||
EXPECT_TRUE(settingsRegistry->Get(scanOrder, AZ::SettingsRegistryInterface::FixedValueString(AssetProcessor::AssetProcessorSettingsKey)
|
||||
+ "/ScanFolder SettingsRegistryTest/order"));
|
||||
|
||||
// These test values come from the <dev_root>/Engine/Registry/AssetProcessorPlatformConfig.setreg file
|
||||
// These test values come from the <dev_root>/Registry/AssetProcessorPlatformConfig.setreg file
|
||||
EXPECT_STREQ("_TestPath", watchPath.c_str());
|
||||
EXPECT_FALSE(recurseScanFolder);
|
||||
EXPECT_EQ(20000, scanOrder);
|
||||
@@ -200,7 +200,7 @@ public:
|
||||
m_config.reset();
|
||||
PlatformConfigurationUnitTests::TearDown();
|
||||
}
|
||||
|
||||
|
||||
AZStd::vector<AssetBuilderSDK::PlatformInfo> m_platforms;
|
||||
AZStd::unique_ptr<UnitTestPlatformConfiguration> m_config;
|
||||
AZStd::unique_ptr<QTemporaryDir> m_tempEngineRoot = nullptr; // this actually creates the folder in its constructor, so hold off until setup..
|
||||
@@ -213,8 +213,8 @@ TEST_F(PlatformConfigurationUnitTests_OnePCHostFixture, GetScanFolderForFile_Roo
|
||||
using namespace AzToolsFramework::AssetSystem;
|
||||
using namespace AssetProcessor;
|
||||
|
||||
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1"), "ScanFolder1", "sf1", "", true, false, m_platforms), true); // a root folder that has watched subfolders, not recursive
|
||||
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1/Editor"), "Editor", "sf2", "", false, true, m_platforms), true); // a child folder that exists within that scan folder.
|
||||
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1"), "ScanFolder1", "sf1", true, false, m_platforms), true); // a root folder that has watched subfolders, not recursive
|
||||
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1/Editor"), "Editor", "sf2", false, true, m_platforms), true); // a child folder that exists within that scan folder.
|
||||
|
||||
const ScanFolderInfo* info = m_config->GetScanFolderForFile(m_tempPath.filePath("scanfolder1/something.txt"));
|
||||
|
||||
@@ -229,8 +229,8 @@ TEST_F(PlatformConfigurationUnitTests_OnePCHostFixture, GetScanFolderForFile_Sub
|
||||
using namespace AzToolsFramework::AssetSystem;
|
||||
using namespace AssetProcessor;
|
||||
|
||||
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1"), "ScanFolder1", "sf1", "", true, false, m_platforms), true); // a root folder that has watched subfolders, not recursive
|
||||
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1/Editor"), "Editor ScanFolder", "sf2", "", false, true, m_platforms), true); // a child folder that exists within that scan folder.
|
||||
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1"), "ScanFolder1", "sf1", true, false, m_platforms), true); // a root folder that has watched subfolders, not recursive
|
||||
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1/Editor"), "Editor ScanFolder", "sf2", false, true, m_platforms), true); // a child folder that exists within that scan folder.
|
||||
|
||||
const ScanFolderInfo* info = m_config->GetScanFolderForFile(m_tempPath.filePath("scanfolder1/Editor/something.txt"));
|
||||
|
||||
@@ -254,8 +254,8 @@ TEST_F(PlatformConfigurationUnitTests_OnePCHostFixture, GetOverridingFile_Exists
|
||||
QString differentCaseDummyFileName = m_tempPath.absoluteFilePath("scanfolder2/testcase.txt");
|
||||
UnitTestUtils::CreateDummyFile(caseSensitiveDummyFileName, QString("testcase1\n"));
|
||||
UnitTestUtils::CreateDummyFile(differentCaseDummyFileName, QString("testcase2\n"));
|
||||
m_config->AddScanFolder(ScanFolderInfo(scanfolder1Path, "ScanFolder1", "sf1", "", false, true, m_platforms), true);
|
||||
m_config->AddScanFolder(ScanFolderInfo(scanfolder2Path, "ScanFolder2", "sf2", "", false, true, m_platforms), true);
|
||||
m_config->AddScanFolder(ScanFolderInfo(scanfolder1Path, "ScanFolder1", "sf1", false, true, m_platforms), true);
|
||||
m_config->AddScanFolder(ScanFolderInfo(scanfolder2Path, "ScanFolder2", "sf2", false, true, m_platforms), true);
|
||||
|
||||
// Perform the test by asking it whether anyone overrides "testcase" (lowercase) in scanfolder 2.
|
||||
QString overrider = m_config->GetOverridingFile("testcase.txt", scanfolder2Path);
|
||||
@@ -278,9 +278,9 @@ TEST_F(PlatformConfigurationUnitTests_OnePCHostFixture, GetOverridingFile_Exists
|
||||
QString differentCaseDummyFileName = m_tempPath.absoluteFilePath("scanfolder2/testcase.txt");
|
||||
UnitTestUtils::CreateDummyFile(caseSensitiveDummyFileName, QString("testcase1\n"));
|
||||
UnitTestUtils::CreateDummyFile(differentCaseDummyFileName, QString("testcase2\n"));
|
||||
m_config->AddScanFolder(ScanFolderInfo(scanfolder1Path, "ScanFolder1", "sf1", "", false, true, m_platforms), true);
|
||||
m_config->AddScanFolder(ScanFolderInfo(scanfolder2Path, "ScanFolder2", "sf2", "", false, true, m_platforms), true);
|
||||
|
||||
m_config->AddScanFolder(ScanFolderInfo(scanfolder1Path, "ScanFolder1", "sf1", false, true, m_platforms), true);
|
||||
m_config->AddScanFolder(ScanFolderInfo(scanfolder2Path, "ScanFolder2", "sf2", false, true, m_platforms), true);
|
||||
|
||||
// Perform the test by asking it whether the existing real winning file is being overridden by anyone.
|
||||
QString overrider = m_config->GetOverridingFile("TestCase.tXt", scanfolder1Path);
|
||||
|
||||
@@ -297,8 +297,8 @@ TEST_F(PlatformConfigurationUnitTests_OnePCHostFixture, GetOverridingFile_DoesNo
|
||||
QString scanfolder1Path = m_tempPath.filePath("scanfolder1");
|
||||
QString scanfolder2Path = m_tempPath.filePath("scanfolder2");
|
||||
|
||||
m_config->AddScanFolder(ScanFolderInfo(scanfolder1Path, "ScanFolder1", "sf1", "", false, true, m_platforms), true);
|
||||
m_config->AddScanFolder(ScanFolderInfo(scanfolder2Path, "ScanFolder2", "sf2", "", false, true, m_platforms), true);
|
||||
m_config->AddScanFolder(ScanFolderInfo(scanfolder1Path, "ScanFolder1", "sf1", false, true, m_platforms), true);
|
||||
m_config->AddScanFolder(ScanFolderInfo(scanfolder2Path, "ScanFolder2", "sf2", false, true, m_platforms), true);
|
||||
|
||||
// Perform the test by asking it whether anyone overrides "testcase" (lowercase) in scanfolder 2.
|
||||
QString overrider = m_config->GetOverridingFile("doesntExist.txt", scanfolder2Path);
|
||||
@@ -314,8 +314,8 @@ TEST_F(PlatformConfigurationUnitTests_OnePCHostFixture, FindFirstMatchingFile_Do
|
||||
// create two scan folders, since its order dependent, the ScanFolder1 is the "winner" in tie breakers.
|
||||
QString scanfolder1Path = m_tempPath.filePath("scanfolder1");
|
||||
QString scanfolder2Path = m_tempPath.filePath("scanfolder2");
|
||||
m_config->AddScanFolder(ScanFolderInfo(scanfolder1Path, "ScanFolder1", "sf1", "", false, true, m_platforms), true);
|
||||
m_config->AddScanFolder(ScanFolderInfo(scanfolder2Path, "ScanFolder2", "sf2", "", false, true, m_platforms), true);
|
||||
m_config->AddScanFolder(ScanFolderInfo(scanfolder1Path, "ScanFolder1", "sf1", false, true, m_platforms), true);
|
||||
m_config->AddScanFolder(ScanFolderInfo(scanfolder2Path, "ScanFolder2", "sf2", false, true, m_platforms), true);
|
||||
|
||||
// Perform the test by asking it whether anyone overrides "testcase" (lowercase) in scanfolder 2.
|
||||
QString foundFile = m_config->FindFirstMatchingFile("doesntExist.txt");
|
||||
@@ -325,7 +325,7 @@ TEST_F(PlatformConfigurationUnitTests_OnePCHostFixture, FindFirstMatchingFile_Do
|
||||
|
||||
// note that we do not guarantee that FindFirstMatchingFile always returns the correct case, as it is a super hot path
|
||||
// function, and the only time case could be incorrect is in the situation where a file with different case overrides
|
||||
// an underlying file, ie,
|
||||
// an underlying file, ie,
|
||||
// Engine/EngineAssets/Textures/StartScreen.tif
|
||||
// MyGame/EngineAssets/textures/startscreen.tif <-- would override the above because game has higher / more important priority.
|
||||
|
||||
@@ -335,8 +335,8 @@ TEST_F(PlatformConfigurationUnitTests_OnePCHostFixture, GetScanFolderForFile_Sub
|
||||
using namespace AzToolsFramework::AssetSystem;
|
||||
using namespace AssetProcessor;
|
||||
|
||||
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1"), "ScanFolder1", "sf1", "", true, false, m_platforms), true); // a root folder that has watched subfolders, not recursive
|
||||
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1/Editor"), "Editor ScanFolder", "sf2", "", false, true, m_platforms), true); // a child folder that exists within that scan folder.
|
||||
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1"), "ScanFolder1", "sf1", true, false, m_platforms), true); // a root folder that has watched subfolders, not recursive
|
||||
m_config->AddScanFolder(ScanFolderInfo(m_tempPath.filePath("scanfolder1/Editor"), "Editor ScanFolder", "sf2", false, true, m_platforms), true); // a child folder that exists within that scan folder.
|
||||
|
||||
const ScanFolderInfo* info = m_config->GetScanFolderForFile(m_tempPath.filePath("scanfolder1/Editor"));
|
||||
ASSERT_TRUE(info);
|
||||
@@ -363,20 +363,17 @@ TEST_F(PlatformConfigurationUnitTests, TestFailReadConfigFile_RegularScanfolder)
|
||||
ASSERT_EQ(config.GetScanFolderCount(), 3); // the two, and then the one that has the same data as prior but different identifier.
|
||||
QString scanName = AssetUtilities::ComputeProjectPath() + " Scan Folder";
|
||||
ASSERT_EQ(config.GetScanFolderAt(0).GetDisplayName(), scanName);
|
||||
ASSERT_EQ(config.GetScanFolderAt(0).GetOutputPrefix(), QString());
|
||||
ASSERT_EQ(config.GetScanFolderAt(0).RecurseSubFolders(), true);
|
||||
ASSERT_EQ(config.GetScanFolderAt(0).GetOrder(), 0);
|
||||
ASSERT_EQ(config.GetScanFolderAt(0).GetPortableKey(), QString("Game"));
|
||||
|
||||
ASSERT_EQ(config.GetScanFolderAt(1).GetDisplayName(), QString("FeatureTests"));
|
||||
ASSERT_EQ(config.GetScanFolderAt(1).GetOutputPrefix(), QString("featuretestsoutputfolder")); // to prove its not related to display name
|
||||
ASSERT_EQ(config.GetScanFolderAt(1).RecurseSubFolders(), false);
|
||||
ASSERT_EQ(config.GetScanFolderAt(1).GetOrder(), 5000);
|
||||
// this proves that the featuretests name is used instead of the output prefix
|
||||
ASSERT_EQ(config.GetScanFolderAt(1).GetPortableKey(), QString("FeatureTests"));
|
||||
|
||||
ASSERT_EQ(config.GetScanFolderAt(2).GetDisplayName(), QString("FeatureTests2"));
|
||||
ASSERT_EQ(config.GetScanFolderAt(2).GetOutputPrefix(), QString("featuretestsoutputfolder")); // to prove its not related to display name
|
||||
ASSERT_EQ(config.GetScanFolderAt(2).RecurseSubFolders(), false);
|
||||
ASSERT_EQ(config.GetScanFolderAt(2).GetOrder(), 6000);
|
||||
// this proves that the featuretests name is used instead of the output prefix
|
||||
@@ -613,7 +610,6 @@ TEST_F(PlatformConfigurationUnitTests, Test_GemHandling)
|
||||
|
||||
ASSERT_EQ(2, config.GetScanFolderCount());
|
||||
EXPECT_FALSE(config.GetScanFolderAt(0).IsRoot());
|
||||
EXPECT_TRUE(config.GetScanFolderAt(0).GetOutputPrefix().isEmpty());
|
||||
EXPECT_TRUE(config.GetScanFolderAt(0).RecurseSubFolders());
|
||||
// the first one is a game gem, so its order should be above 1 but below 100.
|
||||
EXPECT_GE(config.GetScanFolderAt(0).GetOrder(), 100);
|
||||
@@ -623,7 +619,6 @@ TEST_F(PlatformConfigurationUnitTests, Test_GemHandling)
|
||||
|
||||
expectedScanFolder = tempPath.absoluteFilePath("Gems/LmbrCentral/v2/Assets");
|
||||
EXPECT_FALSE(config.GetScanFolderAt(1).IsRoot() );
|
||||
EXPECT_TRUE(config.GetScanFolderAt(1).GetOutputPrefix().isEmpty());
|
||||
EXPECT_TRUE(config.GetScanFolderAt(1).RecurseSubFolders());
|
||||
EXPECT_GT(config.GetScanFolderAt(1).GetOrder(), config.GetScanFolderAt(0).GetOrder());
|
||||
EXPECT_EQ(0, config.GetScanFolderAt(1).ScanPath().compare(expectedScanFolder, Qt::CaseInsensitive));
|
||||
|
||||
@@ -247,54 +247,3 @@ TEST_F(RCcontrollerTest_Simple, SameJobIsCompletedMultipleTimes_CompletesWithout
|
||||
ASSERT_EQ(m_errorAbsorber->m_numAssertsAbsorbed, 4); // Expected that there are 4 errors related to the files not existing on disk. Error message: GenerateFingerprint was called but no input files were requested for fingerprinting.
|
||||
ASSERT_EQ(m_errorAbsorber->m_numErrorsAbsorbed, 0);
|
||||
}
|
||||
|
||||
// makes sure to expose parts of RCJob to the unit test
|
||||
class TestRCJob : public AssetProcessor::RCJob
|
||||
{
|
||||
friend class GTEST_TEST_CLASS_NAME_(RCcontrollerTest, BuilderSDK_API_ProcessJob_HasValidParameters_WithOutputFolder);
|
||||
public:
|
||||
explicit TestRCJob(QObject* parent = 0) : AssetProcessor::RCJob(parent) {};
|
||||
};
|
||||
|
||||
TEST_F(RCcontrollerTest, BuilderSDK_API_ProcessJob_HasValidParameters_WithOutputFolder)
|
||||
{
|
||||
// this test makes sure that the BuilderSDK API is not exposed to any database internals.
|
||||
|
||||
AZ::Uuid sourceUUID = AZ::Uuid::CreateRandom();
|
||||
AZ::Uuid builderGuid = AZ::Uuid::CreateRandom();
|
||||
|
||||
AssetBuilderSDK::ProcessJobRequest req;
|
||||
{
|
||||
// note that this scope is intentional. job.Init(jobDetails) below is actually a by-ref operation that destroys JobDetails in the process.
|
||||
AssetProcessor::JobDetails jobDetails;
|
||||
|
||||
// the crux of this test: the database source name differs from the relative path to watch folder:
|
||||
jobDetails.m_jobEntry.m_pathRelativeToWatchFolder = "SomeThing.tif"; // case sensitive
|
||||
|
||||
// Note that while this is an OS-SPECIFIC path, this unit test does not actually invoke the file system at all
|
||||
// and only operates on in-memory structures, so it should work on every platform.
|
||||
jobDetails.m_jobEntry.m_watchFolderPath = "c:/test/a/B/c"; // just to make sure case is preserved
|
||||
jobDetails.m_jobEntry.m_databaseSourceName = "somepath/SomeThing.tif"; // case sensitive but outputprefixes are generally lowcase
|
||||
|
||||
jobDetails.m_jobEntry.m_sourceFileUUID = sourceUUID;
|
||||
jobDetails.m_jobEntry.m_platformInfo = { "ios",{ "mobile", "renderer" } };
|
||||
jobDetails.m_jobEntry.m_jobRunKey = 1;
|
||||
jobDetails.m_jobEntry.m_jobKey = "tiff";
|
||||
jobDetails.m_jobEntry.m_builderGuid = builderGuid;
|
||||
|
||||
TestRCJob job;
|
||||
job.Init(jobDetails);
|
||||
job.PopulateProcessJobRequest(req);
|
||||
}
|
||||
|
||||
EXPECT_STREQ(req.m_sourceFile.c_str(), "SomeThing.tif");
|
||||
EXPECT_STREQ(req.m_watchFolder.c_str(), "c:/test/a/B/c");
|
||||
|
||||
// the crux of the test, tested: make sure that it does not contain 'somepath' in there just becuase its part of the Database Source Name.
|
||||
EXPECT_STREQ(req.m_fullPath.c_str(), "c:/test/a/B/c/SomeThing.tif");
|
||||
EXPECT_EQ(req.m_builderGuid, builderGuid);
|
||||
EXPECT_TRUE(req.m_platformInfo.HasTag("renderer"));
|
||||
EXPECT_TRUE(req.m_platformInfo.HasTag("mobile"));
|
||||
EXPECT_STREQ(req.m_platformInfo.m_identifier.c_str(), "ios");
|
||||
EXPECT_EQ(req.m_sourceFileUUID, sourceUUID);
|
||||
}
|
||||
|
||||
@@ -54,13 +54,6 @@ namespace AssetProcessor
|
||||
QDir scanFolder(file->m_scanFolderInfo.m_scanFolder.c_str());
|
||||
QString sourceName = file->m_sourceInfo.m_sourceName.c_str();
|
||||
|
||||
// If a scan folder has a prefix, then source files in those scan folders will have that
|
||||
// prefix prepended in the asset database. Strip that prefix off for building the actual absolute path to the file.
|
||||
if (!file->m_scanFolderInfo.m_outputPrefix.empty())
|
||||
{
|
||||
QRegExp prefixRemovalRegex(QString("^%1/").arg(file->m_scanFolderInfo.m_outputPrefix.c_str()));
|
||||
sourceName.remove(prefixRemovalRegex);
|
||||
}
|
||||
return scanFolder.filePath(sourceName);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "SourceAssetTreeItemData.h"
|
||||
|
||||
#include <AzCore/Component/TickBus.h>
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <native/utilities/assetUtils.h>
|
||||
|
||||
|
||||
@@ -62,19 +63,8 @@ namespace AssetProcessor
|
||||
}
|
||||
|
||||
|
||||
AZStd::string fullPath = source.m_sourceName;
|
||||
auto fullPath = AZ::IO::Path(scanFolder.m_scanFolder) / source.m_sourceName;
|
||||
|
||||
// The source assets should look like they do on disk.
|
||||
// If the scan folder has an output prefix, strip it from the source file's path in the database, before
|
||||
// the scan folder path is prepended to the source file.
|
||||
if (!scanFolder.m_outputPrefix.empty())
|
||||
{
|
||||
AZStd::string prefixPath = scanFolder.m_outputPrefix;
|
||||
AzFramework::StringFunc::Append(prefixPath, AZ_CORRECT_DATABASE_SEPARATOR);
|
||||
AzFramework::StringFunc::Replace(fullPath, prefixPath.c_str(), "", false, true);
|
||||
}
|
||||
|
||||
AzFramework::StringFunc::AssetDatabasePath::Join(scanFolder.m_scanFolder.c_str(), fullPath.c_str(), fullPath, true, false);
|
||||
|
||||
// It's common for Open 3D Engine game projects and scan folders to be in a subfolder
|
||||
// of the engine install. To improve readability of the source files, strip out
|
||||
@@ -85,7 +75,7 @@ namespace AssetProcessor
|
||||
}
|
||||
if (m_assetRootSet)
|
||||
{
|
||||
AzFramework::StringFunc::Replace(fullPath, m_assetRoot.absolutePath().toUtf8(), "");
|
||||
AzFramework::StringFunc::Replace(fullPath.Native(), m_assetRoot.absolutePath().toUtf8(), "");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ void AssetProcessingStateDataUnitTest::DataTest(AssetProcessor::AssetDatabaseCon
|
||||
scanFolders.clear();
|
||||
|
||||
//add a scanfolder
|
||||
scanFolder = ScanFolderDatabaseEntry("c:/O3DE/dev", "dev", "rootportkey", "");
|
||||
scanFolder = ScanFolderDatabaseEntry("c:/O3DE/dev", "dev", "rootportkey");
|
||||
UNIT_TEST_EXPECT_TRUE(stateData->SetScanFolder(scanFolder));
|
||||
if (scanFolder.m_scanFolderID == AzToolsFramework::AssetDatabase::InvalidEntryId)
|
||||
{
|
||||
@@ -158,7 +158,7 @@ void AssetProcessingStateDataUnitTest::DataTest(AssetProcessor::AssetDatabaseCon
|
||||
|
||||
//add the same folder again, should not add another because it already exists, so we should get the same id
|
||||
// not only that, but the path should update.
|
||||
ScanFolderDatabaseEntry dupeScanFolder = ScanFolderDatabaseEntry("c:/O3DE/dev2", "dev", "rootportkey", "");
|
||||
ScanFolderDatabaseEntry dupeScanFolder("c:/O3DE/dev2", "dev", "rootportkey");
|
||||
dupeScanFolder.m_scanFolderID = AzToolsFramework::AssetDatabase::InvalidEntryId;
|
||||
UNIT_TEST_EXPECT_TRUE(stateData->SetScanFolder(dupeScanFolder));
|
||||
if (!(dupeScanFolder == scanFolder))
|
||||
@@ -200,7 +200,7 @@ void AssetProcessingStateDataUnitTest::DataTest(AssetProcessor::AssetDatabaseCon
|
||||
}
|
||||
|
||||
//add another folder
|
||||
ScanFolderDatabaseEntry gameScanFolderEntry("c:/O3DE/game", "game", "gameportkey", "");
|
||||
ScanFolderDatabaseEntry gameScanFolderEntry("c:/O3DE/game", "game", "gameportkey");
|
||||
UNIT_TEST_EXPECT_TRUE(stateData->SetScanFolder(gameScanFolderEntry));
|
||||
if (gameScanFolderEntry.m_scanFolderID == AzToolsFramework::AssetDatabase::InvalidEntryId ||
|
||||
gameScanFolderEntry.m_scanFolderID == scanFolder.m_scanFolderID)
|
||||
@@ -230,7 +230,7 @@ void AssetProcessingStateDataUnitTest::DataTest(AssetProcessor::AssetDatabaseCon
|
||||
UNIT_TEST_EXPECT_TRUE(ScanFoldersContainScanFolderID(scanFolders, scanFolder.m_scanFolderID));
|
||||
|
||||
//add another folder again
|
||||
gameScanFolderEntry = ScanFolderDatabaseEntry("c:/O3DE/game", "game", "gameportkey2", "");
|
||||
gameScanFolderEntry = ScanFolderDatabaseEntry("c:/O3DE/game", "game", "gameportkey2");
|
||||
UNIT_TEST_EXPECT_TRUE(stateData->SetScanFolder(gameScanFolderEntry));
|
||||
if (gameScanFolderEntry.m_scanFolderID == AzToolsFramework::AssetDatabase::InvalidEntryId ||
|
||||
gameScanFolderEntry.m_scanFolderID == scanFolder.m_scanFolderID)
|
||||
@@ -258,7 +258,7 @@ void AssetProcessingStateDataUnitTest::DataTest(AssetProcessor::AssetDatabaseCon
|
||||
///////////////////////////////////////////////////////////
|
||||
//setup for sources tests
|
||||
//for the rest of the test lets add the original scan folder
|
||||
scanFolder = ScanFolderDatabaseEntry("c:/O3DE/dev", "dev", "devkey2", "");
|
||||
scanFolder = ScanFolderDatabaseEntry("c:/O3DE/dev", "dev", "devkey2");
|
||||
UNIT_TEST_EXPECT_TRUE(stateData->SetScanFolder(scanFolder));
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
@@ -370,7 +370,7 @@ void AssetProcessingStateDataUnitTest::DataTest(AssetProcessor::AssetDatabaseCon
|
||||
UNIT_TEST_EXPECT_TRUE(SourcesContainSourceGuid(sources, source.m_sourceGuid));
|
||||
|
||||
//add the same source again, but change the scan folder. This should NOT add a new source - even if we don't know what the sourceID is:
|
||||
ScanFolderDatabaseEntry scanfolder2 = ScanFolderDatabaseEntry("c:/O3DE/dev2", "dev2", "devkey3", "");
|
||||
ScanFolderDatabaseEntry scanfolder2 = ScanFolderDatabaseEntry("c:/O3DE/dev2", "dev2", "devkey3");
|
||||
UNIT_TEST_EXPECT_TRUE(stateData->SetScanFolder(scanfolder2));
|
||||
|
||||
SourceDatabaseEntry dupeSource2(source);
|
||||
@@ -554,7 +554,7 @@ void AssetProcessingStateDataUnitTest::DataTest(AssetProcessor::AssetDatabaseCon
|
||||
////////////////////////////////////////////////////////////////
|
||||
//Setup for jobs tests by having a scan folder and some sources
|
||||
//Add a scan folder
|
||||
scanFolder = ScanFolderDatabaseEntry("c:/O3DE/dev", "dev", "devkey3", "");
|
||||
scanFolder = ScanFolderDatabaseEntry("c:/O3DE/dev", "dev", "devkey3");
|
||||
UNIT_TEST_EXPECT_TRUE(stateData->SetScanFolder(scanFolder));
|
||||
|
||||
//Add some sources
|
||||
|
||||
@@ -46,7 +46,6 @@ namespace AssetProcessor
|
||||
friend class AssetProcessorManagerUnitTests;
|
||||
friend class AssetProcessorManagerUnitTests_JobKeys;
|
||||
friend class AssetProcessorManagerUnitTests_JobDependencies_Fingerprint;
|
||||
friend class AssetProcessorManagerUnitTests_CheckOutputFolders;
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
|
||||
|
||||
public:
|
||||
@@ -64,7 +63,6 @@ namespace AssetProcessor
|
||||
REGISTER_UNIT_TEST(AssetProcessorManagerUnitTests)
|
||||
REGISTER_UNIT_TEST(AssetProcessorManagerUnitTests_JobKeys)
|
||||
REGISTER_UNIT_TEST(AssetProcessorManagerUnitTests_JobDependencies_Fingerprint)
|
||||
REGISTER_UNIT_TEST(AssetProcessorManagerUnitTests_CheckOutputFolders)
|
||||
#endif // AZ_TRAIT_DISABLE_FAILED_ASSET_PROCESSOR_TESTS
|
||||
|
||||
|
||||
@@ -247,11 +245,11 @@ namespace AssetProcessor
|
||||
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
|
||||
config.PopulatePlatformsForScanFolder(platforms);
|
||||
// PATH DisplayName PortKey outputfolder root recurse platforms order
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", "", false, false, platforms, -6)); // subfolder 4 overrides subfolder3
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", "", false, false, platforms,-5)); // subfolder 3 overrides subfolder2
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", "", false, true, platforms, -2)); // subfolder 2 overrides subfolder1
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", "", false, true, platforms, -1)); // subfolder1 overrides root
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", "", true, false, platforms, 0)); // add the root
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", false, false, platforms, -6)); // subfolder 4 overrides subfolder3
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", false, false, platforms,-5)); // subfolder 3 overrides subfolder2
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", false, true, platforms, -2)); // subfolder 2 overrides subfolder1
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", false, true, platforms, -1)); // subfolder1 overrides root
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", true, false, platforms, 0)); // add the root
|
||||
|
||||
|
||||
config.AddMetaDataType("exportsettings", QString());
|
||||
@@ -2325,8 +2323,8 @@ namespace AssetProcessor
|
||||
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
|
||||
config.PopulatePlatformsForScanFolder(platforms);
|
||||
// PATH DisplayName PortKey outputfolder root recurse order
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", "", false, true, platforms,-1)); // subfolder1 overrides root
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", "", true, false, platforms, 0)); // add the root
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", false, true, platforms,-1)); // subfolder1 overrides root
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", true, false, platforms, 0)); // add the root
|
||||
|
||||
AssetProcessorManager_Test apm(&config);
|
||||
|
||||
@@ -2534,11 +2532,11 @@ namespace AssetProcessor
|
||||
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
|
||||
config.PopulatePlatformsForScanFolder(platforms);
|
||||
// PATH DisplayName PortKey outputfolder root recurse platforms order
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", "", false, false, platforms, -6)); // subfolder 4 overrides subfolder3
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", "", false, false, platforms, -5)); // subfolder 3 overrides subfolder2
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", "", false, true, platforms, -2)); // subfolder 2 overrides subfolder1
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", "", false, true, platforms, -1)); // subfolder1 overrides root
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", "", true, false, platforms, 0)); // add the root
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", false, false, platforms, -6)); // subfolder 4 overrides subfolder3
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "subfolder3", "subfolder3", false, false, platforms, -5)); // subfolder 3 overrides subfolder2
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "subfolder2", "subfolder2", false, true, platforms, -2)); // subfolder 2 overrides subfolder1
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", false, true, platforms, -1)); // subfolder1 overrides root
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", true, false, platforms, 0)); // add the root
|
||||
|
||||
{
|
||||
// create this, which will write those scan folders into the db as-is
|
||||
@@ -2584,13 +2582,13 @@ namespace AssetProcessor
|
||||
config2.PopulatePlatformsForScanFolder(platforms2);
|
||||
// PATH DisplayName PortKey outputfolder root recurse platforms order
|
||||
// case 1: same absolute path, but the same portable key - should use same ID as before.
|
||||
config2.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", "", false, false, platforms2, -6)); // subfolder 4 overrides subfolder3
|
||||
config2.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "subfolder4", "subfolder4", false, false, platforms2, -6)); // subfolder 4 overrides subfolder3
|
||||
|
||||
// case 2: A new absolute path, but same portable key - should use same id as before
|
||||
config2.AddScanFolder(ScanFolderInfo(tempPath.filePath("newfolder3"), "subfolder3", "subfolder3", "", false, false, platforms2, -5)); // subfolder 3 overrides subfolder2
|
||||
config2.AddScanFolder(ScanFolderInfo(tempPath.filePath("newfolder3"), "subfolder3", "subfolder3", false, false, platforms2, -5)); // subfolder 3 overrides subfolder2
|
||||
|
||||
// case 3: same absolute path, new portable key - should use a new ID
|
||||
config2.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder3", "newfolder3", "", false, false, platforms2, -5)); // subfolder 3 overrides subfolder2
|
||||
config2.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder3", "newfolder3", false, false, platforms2, -5)); // subfolder 3 overrides subfolder2
|
||||
|
||||
// case 4: subfolder2 is missing - it should be gone.
|
||||
|
||||
@@ -2775,8 +2773,8 @@ namespace AssetProcessor
|
||||
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
|
||||
config.PopulatePlatformsForScanFolder(platforms);
|
||||
// PATH DisplayName PortKey outputfolder root recurse order
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", "", false, true, platforms, -1)); // subfolder1 overrides root
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", "", true, false, platforms, 0)); // add the root
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", false, true, platforms, -1)); // subfolder1 overrides root
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "tempfolder", true, false, platforms, 0)); // add the root
|
||||
|
||||
AssetProcessorManager_Test apm(&config);
|
||||
|
||||
@@ -3083,255 +3081,6 @@ namespace AssetProcessor
|
||||
Q_EMIT UnitTestPassed();
|
||||
}
|
||||
|
||||
void AssetProcessorManagerUnitTests_CheckOutputFolders::StartTest()
|
||||
{
|
||||
MockAssetBuilderInfoHandler mockAssetBuilderInfoHandler;
|
||||
|
||||
QDir oldRoot;
|
||||
AssetUtilities::ComputeAssetRoot(oldRoot);
|
||||
AssetUtilities::ResetAssetRoot();
|
||||
|
||||
// the canonicalization of the path here is to get around the fact that on some platforms
|
||||
// the "temporary" folder location could be junctioned into some other folder and getting "QDir::current()"
|
||||
// and other similar functions may actually return a different string but still be referring to the same folder
|
||||
QTemporaryDir dir;
|
||||
QDir tempPath(dir.path());
|
||||
QString canonicalTempDirPath = AssetUtilities::NormalizeDirectoryPath(tempPath.canonicalPath());
|
||||
UnitTestUtils::ScopedDir changeDir(canonicalTempDirPath);
|
||||
tempPath = QDir(canonicalTempDirPath);
|
||||
|
||||
QString gameName = AssetUtilities::ComputeProjectName(AssetProcessorManagerTestGameProject);
|
||||
|
||||
// update the engine root
|
||||
AssetUtilities::ResetAssetRoot();
|
||||
QDir newRoot;
|
||||
AssetUtilities::ComputeAssetRoot(newRoot, &tempPath);
|
||||
|
||||
UNIT_TEST_EXPECT_FALSE(gameName.isEmpty());
|
||||
|
||||
PlatformConfiguration config;
|
||||
config.EnablePlatform({ "pc",{ "desktop", "renderer" } }, true);
|
||||
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
|
||||
config.PopulatePlatformsForScanFolder(platforms);
|
||||
// PATH DisplayName PortKey outputfolder root recurse platforms order
|
||||
|
||||
// note: the crux of this test is that we ar redirecting output into the cache at a different location instead of default.
|
||||
// so our scan folder has a "redirected" folder.
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "subfolder1", "subfolder1", "redirected", false, true, platforms, -1));
|
||||
|
||||
AssetProcessorManager_Test apm(&config);
|
||||
|
||||
QDir cacheRoot;
|
||||
UNIT_TEST_EXPECT_TRUE(AssetUtilities::ComputeProjectCacheRoot(cacheRoot));
|
||||
|
||||
QList<JobDetails> processResults;
|
||||
QList<QPair<QString, QString> > changedInputResults;
|
||||
QList< AzFramework::AssetSystem::AssetNotificationMessage > assetMessages;
|
||||
|
||||
bool idling = false;
|
||||
|
||||
connect(&apm, &AssetProcessorManager::AssetToProcess,
|
||||
this, [&processResults](JobDetails details)
|
||||
{
|
||||
processResults.push_back(AZStd::move(details));
|
||||
});
|
||||
|
||||
connect(&apm, &AssetProcessorManager::AssetMessage,
|
||||
this, [&assetMessages](AzFramework::AssetSystem::AssetNotificationMessage message)
|
||||
{
|
||||
assetMessages.push_back( message);
|
||||
});
|
||||
|
||||
connect(&apm, &AssetProcessorManager::InputAssetProcessed,
|
||||
this, [&changedInputResults](QString relativePath, QString platform)
|
||||
{
|
||||
changedInputResults.push_back(QPair<QString, QString>(relativePath, platform));
|
||||
});
|
||||
|
||||
connect(&apm, &AssetProcessorManager::AssetProcessorManagerIdleState,
|
||||
this, [&idling](bool state)
|
||||
{
|
||||
idling = state;
|
||||
}
|
||||
);
|
||||
|
||||
QString sourceFile = tempPath.absoluteFilePath("subfolder1/basefile.foo");
|
||||
CreateDummyFile(sourceFile);
|
||||
|
||||
mockAssetBuilderInfoHandler.m_numberOfJobsToCreate = 1; //Create two jobs for this file
|
||||
|
||||
QMetaObject::invokeMethod(&apm, "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, sourceFile));
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(BlockUntil(idling, 5000));
|
||||
|
||||
// block until no more events trickle in:
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents);
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 1);
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_databaseSourceName == "redirected/basefile.foo");
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_pathRelativeToWatchFolder == "basefile.foo");
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_watchFolderPath == tempPath.filePath("subfolder1"));
|
||||
|
||||
QStringList pcouts;
|
||||
pcouts.push_back(cacheRoot.filePath(QString("pc/redirected/basefile.arc1")));
|
||||
|
||||
// Create the product files for the first job
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(pcouts[0], "product1"));
|
||||
|
||||
// Invoke Asset Processed for pc platform for the first job
|
||||
AssetBuilderSDK::ProcessJobResponse response;
|
||||
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(pcouts[0].toUtf8().constData()));
|
||||
|
||||
QMetaObject::invokeMethod(&apm, "AssetProcessed", Qt::QueuedConnection, Q_ARG(JobEntry, processResults[0].m_jobEntry), Q_ARG(AssetBuilderSDK::ProcessJobResponse, response));
|
||||
|
||||
// let events bubble through:
|
||||
UNIT_TEST_EXPECT_TRUE(BlockUntil(idling, 5000));
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages.size() == 1);
|
||||
UNIT_TEST_EXPECT_TRUE(changedInputResults.size() == 1);
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_platform == "pc");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_data == "redirected/basefile.arc1");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_type == AzFramework::AssetSystem::AssetNotificationMessage::AssetChanged);
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(AssetUtilities::NormalizeFilePath(changedInputResults[0].first) == AssetUtilities::NormalizeFilePath(sourceFile));
|
||||
|
||||
// ------------- TEST 1: Modified source file
|
||||
|
||||
processResults.clear();
|
||||
pcouts.clear();
|
||||
assetMessages.clear();
|
||||
changedInputResults.clear();
|
||||
|
||||
// now, the test is set up. we can now start poking that file and make sure we emit the appropriate messages.
|
||||
// first, lets modify the file and make sure we get the build request.
|
||||
|
||||
#if defined(AZ_PLATFORM_WINDOWS)
|
||||
QThread::msleep(30); // give at least some milliseconds so that the files never share the same timestamp exactly
|
||||
#else
|
||||
// on some file systems such as HFS (commonly used on Apple devices, the file time resolution is only a second.
|
||||
// We are forcing a wait here of at least a second to make sure that the file modtime
|
||||
// actually changes.
|
||||
QThread::msleep(1001);
|
||||
#endif // defined (AZ_PLATFORM_WINDOWS)
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(sourceFile, "new data!"));
|
||||
|
||||
QMetaObject::invokeMethod(&apm, "AssessModifiedFile", Qt::QueuedConnection, Q_ARG(QString, sourceFile));
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(BlockUntil(idling, 5000));
|
||||
|
||||
// block until no more events trickle in:
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents);
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 1);
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_pathRelativeToWatchFolder == "basefile.foo");
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_databaseSourceName == "redirected/basefile.foo");
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_watchFolderPath == tempPath.absoluteFilePath("subfolder1"));
|
||||
|
||||
pcouts.push_back(cacheRoot.filePath(QString("pc/redirected/basefile.arc1")));
|
||||
|
||||
// Create the product files for the first job
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(pcouts[0], "product1"));
|
||||
|
||||
// Invoke Asset Processed for pc platform for the first job
|
||||
response.m_outputProducts.clear();
|
||||
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(pcouts[0].toUtf8().constData()));
|
||||
|
||||
QMetaObject::invokeMethod(&apm, "AssetProcessed", Qt::QueuedConnection, Q_ARG(JobEntry, processResults[0].m_jobEntry), Q_ARG(AssetBuilderSDK::ProcessJobResponse, response));
|
||||
|
||||
// let events bubble through:
|
||||
UNIT_TEST_EXPECT_TRUE(BlockUntil(idling, 5000));
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages.size() == 1);
|
||||
UNIT_TEST_EXPECT_TRUE(changedInputResults.size() == 1);
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_platform == "pc");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_data == "redirected/basefile.arc1");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_type == AzFramework::AssetSystem::AssetNotificationMessage::AssetChanged);
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(AssetUtilities::NormalizeFilePath(changedInputResults[0].first) == AssetUtilities::NormalizeFilePath(sourceFile));
|
||||
|
||||
// ------------- TEST 2: Deleted product
|
||||
|
||||
processResults.clear();
|
||||
pcouts.clear();
|
||||
assetMessages.clear();
|
||||
changedInputResults.clear();
|
||||
|
||||
QString deletedProductPath = cacheRoot.filePath(QString("pc/redirected/basefile.arc1"));
|
||||
|
||||
QFile::remove(deletedProductPath);
|
||||
|
||||
QMetaObject::invokeMethod(&apm, "AssessDeletedFile", Qt::QueuedConnection, Q_ARG(QString, deletedProductPath));
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(BlockUntil(idling, 5000));
|
||||
|
||||
// block until no more events trickle in:
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents);
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages.size() == 0); // asset removed is delayed until actual processing occurs.
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(processResults.size() == 1);
|
||||
UNIT_TEST_EXPECT_TRUE((processResults[0].m_jobEntry.m_platformInfo.m_identifier == "pc"));
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_pathRelativeToWatchFolder == "basefile.foo");
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_databaseSourceName == "redirected/basefile.foo");
|
||||
UNIT_TEST_EXPECT_TRUE(processResults[0].m_jobEntry.m_watchFolderPath == tempPath.absoluteFilePath("subfolder1"));
|
||||
|
||||
pcouts.push_back(cacheRoot.filePath(QString("pc/redirected/basefile.arc1")));
|
||||
|
||||
// Create the product files for the first job
|
||||
UNIT_TEST_EXPECT_TRUE(CreateDummyFile(pcouts[0], "product1"));
|
||||
|
||||
// Invoke Asset Processed for pc platform for the first job
|
||||
response.m_outputProducts.clear();
|
||||
response.m_resultCode = AssetBuilderSDK::ProcessJobResult_Success;
|
||||
response.m_outputProducts.push_back(AssetBuilderSDK::JobProduct(pcouts[0].toUtf8().constData()));
|
||||
|
||||
changedInputResults.clear();
|
||||
assetMessages.clear();
|
||||
|
||||
QMetaObject::invokeMethod(&apm, "AssetProcessed", Qt::QueuedConnection, Q_ARG(JobEntry, processResults[0].m_jobEntry), Q_ARG(AssetBuilderSDK::ProcessJobResponse, response));
|
||||
|
||||
// let events bubble through:
|
||||
UNIT_TEST_EXPECT_TRUE(BlockUntil(idling, 5000));
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages.size() == 1);
|
||||
UNIT_TEST_EXPECT_TRUE(changedInputResults.size() == 1);
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_platform == "pc");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_data == "redirected/basefile.arc1");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_type == AzFramework::AssetSystem::AssetNotificationMessage::AssetChanged);
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(AssetUtilities::NormalizeFilePath(changedInputResults[0].first) == AssetUtilities::NormalizeFilePath(sourceFile));
|
||||
|
||||
// ------------- TEST 3: Deleted source - the products should end up deleted!
|
||||
|
||||
processResults.clear();
|
||||
pcouts.clear();
|
||||
assetMessages.clear();
|
||||
changedInputResults.clear();
|
||||
|
||||
QString deletedSourcePath = sourceFile;
|
||||
QFile::remove(deletedSourcePath);
|
||||
QMetaObject::invokeMethod(&apm, "AssessDeletedFile", Qt::QueuedConnection, Q_ARG(QString, deletedSourcePath));
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(BlockUntil(idling, 5000));
|
||||
|
||||
// block until no more events trickle in:
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents);
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages.size() == 1);
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_platform == "pc");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_data == "redirected/basefile.arc1");
|
||||
UNIT_TEST_EXPECT_TRUE(assetMessages[0].m_type == AzFramework::AssetSystem::AssetNotificationMessage::AssetRemoved);
|
||||
|
||||
// also ensure file is actually gone!
|
||||
UNIT_TEST_EXPECT_TRUE(!QFile::exists(deletedProductPath));
|
||||
|
||||
Q_EMIT UnitTestPassed();
|
||||
}
|
||||
void AssetProcessorManagerUnitTests_JobDependencies_Fingerprint::GetMatchingBuildersInfo(const AZStd::string& assetPath, AssetProcessor::BuilderInfoList& builderInfoList)
|
||||
{
|
||||
AZ_UNUSED(assetPath);
|
||||
|
||||
@@ -45,14 +45,6 @@ Q_SIGNALS:
|
||||
virtual void StartTest() override;
|
||||
};
|
||||
|
||||
class AssetProcessorManagerUnitTests_CheckOutputFolders
|
||||
: public UnitTestRun
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
virtual void StartTest() override;
|
||||
|
||||
};
|
||||
class AssetProcessorManagerUnitTests_JobDependencies_Fingerprint
|
||||
: public UnitTestRun
|
||||
, public AssetProcessor::AssetBuilderInfoBus::Handler
|
||||
|
||||
@@ -65,10 +65,10 @@ void AssetScannerUnitTest::StartTest()
|
||||
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
|
||||
config.PopulatePlatformsForScanFolder(platforms);
|
||||
// PATH DisplayName PortKey outputfolder root recurse platforms
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "ap1", "", true, false, platforms)); // note: "Recurse" set to false.
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "", "ap2", "", false, true, platforms));
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "", "ap3", "", false, true, platforms));
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "", "ap4", "", false, false, platforms)); // note: "Recurse" set to false.
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "ap1", true, false, platforms)); // note: "Recurse" set to false.
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "", "ap2", false, true, platforms));
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "", "ap3", false, true, platforms));
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "", "ap4", false, false, platforms)); // note: "Recurse" set to false.
|
||||
AssetScanner scanner(&config);
|
||||
|
||||
QList<AssetFileInfo> filesFound;
|
||||
|
||||
@@ -69,20 +69,20 @@ void PlatformConfigurationTests::StartTest()
|
||||
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
|
||||
config.PopulatePlatformsForScanFolder(platforms);
|
||||
|
||||
// PATH DisplayName PortKey outputfolder root recurse platforms, isunittesting
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "", "sf3", "", false, false, platforms), true); // subfolder 3 overrides subfolder2
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "", "sf4", "", false, true, platforms), true); // subfolder 2 overrides subfolder1
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "", "sf1", "subfolder1", false, true, platforms), true); // subfolder1 overrides root
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "", "sf4", "", false, true, platforms), true); // subfolder4 overrides subfolder5
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder5"), "", "sf5", "b/c", false, true, platforms), true); // subfolder5 overrides subfolder6
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder6"), "", "sf6", "b/c", false, true, platforms), true); // subfolder6 overrides subfolder7
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder7"), "", "sf7", "", false, true, platforms), true); // subfolder7 overrides subfolder8
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder8/x"), "", "sf8", "", false, true, platforms), true); // subfolder8 overrides root
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "temp", "", true, false, platforms), true); // add the root
|
||||
// PATH DisplayName PortKey root recurse platforms, isunittesting
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder3"), "", "sf3", false, false, platforms), true); // subfolder 3 overrides subfolder2
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder2"), "", "sf4", false, true, platforms), true); // subfolder 2 overrides subfolder1
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder1"), "", "sf1", false, true, platforms), true); // subfolder1 overrides root
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder4"), "", "sf4", false, true, platforms), true); // subfolder4 overrides subfolder5
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder5"), "", "sf5", false, true, platforms), true); // subfolder5 overrides subfolder6
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder6"), "", "sf6", false, true, platforms), true); // subfolder6 overrides subfolder7
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder7"), "", "sf7", false, true, platforms), true); // subfolder7 overrides subfolder8
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("subfolder8/x"), "", "sf8", false, true, platforms), true); // subfolder8 overrides root
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.absolutePath(), "temp", "temp", true, false, platforms), true); // add the root
|
||||
|
||||
// these are checked for later.
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("GameName"), "gn", "", "", false, true, platforms), true);
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("GameNameButWithExtra"), "gnbwe", "", "WithExtra", false, true, platforms), true);
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("GameName"), "gn", "", false, true, platforms), true);
|
||||
config.AddScanFolder(ScanFolderInfo(tempPath.filePath("GameNameButWithExtra"), "gnbwe", "", false, true, platforms), true);
|
||||
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ void PlatformConfigurationTests::StartTest()
|
||||
UNIT_TEST_EXPECT_TRUE(config.GetOverridingFile("rootfile3.txt", tempPath.absolutePath()) == tempPath.absoluteFilePath("subfolder3/rootfile3.txt"));
|
||||
UNIT_TEST_EXPECT_TRUE(config.GetOverridingFile("subfolder1/whatever.txt", tempPath.filePath("subfolder1")) == QString());
|
||||
UNIT_TEST_EXPECT_TRUE(AssetUtilities::NormalizeFilePath(config.GetOverridingFile("subfolder1/override.txt", tempPath.filePath("subfolder1"))) == AssetUtilities::NormalizeFilePath(tempPath.absoluteFilePath("subfolder2/subfolder1/override.txt")));
|
||||
UNIT_TEST_EXPECT_TRUE(AssetUtilities::NormalizeFilePath(config.GetOverridingFile("b/c/a/testfile.txt", tempPath.filePath("subfolder6"))) == AssetUtilities::NormalizeFilePath(tempPath.absoluteFilePath("subfolder5/a/testfile.txt")));
|
||||
UNIT_TEST_EXPECT_TRUE(AssetUtilities::NormalizeFilePath(config.GetOverridingFile("a/testfile.txt", tempPath.filePath("subfolder6"))) == AssetUtilities::NormalizeFilePath(tempPath.absoluteFilePath("subfolder4/a/testfile.txt")));
|
||||
UNIT_TEST_EXPECT_TRUE(AssetUtilities::NormalizeFilePath(config.GetOverridingFile("a/testfile.txt", tempPath.filePath("subfolder7"))) == AssetUtilities::NormalizeFilePath(tempPath.absoluteFilePath("subfolder4/a/testfile.txt")));
|
||||
UNIT_TEST_EXPECT_TRUE(AssetUtilities::NormalizeFilePath(config.GetOverridingFile("a/testfile.txt", tempPath.filePath("subfolder8/x"))) == AssetUtilities::NormalizeFilePath(tempPath.absoluteFilePath("subfolder4/a/testfile.txt")));
|
||||
|
||||
@@ -183,7 +183,6 @@ void PlatformConfigurationTests::StartTest()
|
||||
// different regex rule should not interfere
|
||||
UNIT_TEST_EXPECT_TRUE(config.FindFirstMatchingFile("test/test.format") == tempPath.filePath("subfolder1/test/test.format"));
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(config.FindFirstMatchingFile("b/c/a/testfile.txt") == tempPath.filePath("subfolder5/a/testfile.txt"));
|
||||
UNIT_TEST_EXPECT_TRUE(config.FindFirstMatchingFile("a/testfile.txt") == tempPath.filePath("subfolder4/a/testfile.txt"));
|
||||
|
||||
// ---------------------------- GetScanFolderForFile -----------------
|
||||
@@ -198,15 +197,6 @@ void PlatformConfigurationTests::StartTest()
|
||||
UNIT_TEST_EXPECT_TRUE(config.GetScanFolderForFile(tempPath.filePath("rootfile2.txt")));
|
||||
UNIT_TEST_EXPECT_TRUE(config.GetScanFolderForFile(tempPath.filePath("rootfile2.txt"))->ScanPath() == tempPath.absolutePath());
|
||||
|
||||
// test of output prefix lookup
|
||||
UNIT_TEST_EXPECT_TRUE(config.GetScanFolderForFile(tempPath.filePath("subfolder1/whatever.txt"))->GetOutputPrefix() == "subfolder1");
|
||||
|
||||
// make sure that it does not mistake the GameName folder and the GameNameWithExtra folder for each other.
|
||||
|
||||
UNIT_TEST_EXPECT_TRUE(config.GetScanFolderForFile(tempPath.filePath("GameNameButWithExtra/somefile.meo"))->GetOutputPrefix() == "WithExtra");
|
||||
UNIT_TEST_EXPECT_TRUE(config.GetScanFolderForFile(tempPath.filePath("GameName/otherfile.meo"))->GetOutputPrefix() == "");
|
||||
|
||||
|
||||
// -------------------------- ConvertToRelativePath ------------------------------
|
||||
|
||||
QString fileName;
|
||||
@@ -238,9 +228,9 @@ void PlatformConfigurationTests::StartTest()
|
||||
UNIT_TEST_EXPECT_TRUE(fileName == "aaa/bbb/ccc/ddd/basefile.txt");
|
||||
UNIT_TEST_EXPECT_TRUE(scanFolderPath == tempPath.filePath("subfolder2"));
|
||||
|
||||
// verify that output relative paths include output prefix
|
||||
// verify that output relative paths
|
||||
UNIT_TEST_EXPECT_TRUE(config.ConvertToRelativePath(tempPath.absoluteFilePath("subfolder1/whatever.txt"), fileName, scanFolderPath));
|
||||
UNIT_TEST_EXPECT_TRUE(fileName == "subfolder1/whatever.txt");
|
||||
UNIT_TEST_EXPECT_TRUE(fileName == "whatever.txt");
|
||||
UNIT_TEST_EXPECT_TRUE(scanFolderPath == tempPath.filePath("subfolder1"));
|
||||
}
|
||||
|
||||
|
||||
@@ -520,7 +520,7 @@ void RCcontrollerUnitTests::RunRCControllerTests()
|
||||
|
||||
AZ::Uuid uuidOfSource = AZ::Uuid("{D013122E-CF2C-4534-A87D-F82570FBC2CD}");
|
||||
MockRCJob rcJob;
|
||||
ScanFolderInfo scanFolderInfo("samplepath", "sampledisplayname", "samplekey", "", false, false);
|
||||
ScanFolderInfo scanFolderInfo("samplepath", "sampledisplayname", "samplekey", false, false);
|
||||
AssetProcessor::JobDetails jobDetailsToInitWith;
|
||||
jobDetailsToInitWith.m_jobEntry.m_watchFolderPath = tempPath.absoluteFilePath("subfolder4");
|
||||
jobDetailsToInitWith.m_jobEntry.m_databaseSourceName = jobDetailsToInitWith.m_jobEntry.m_pathRelativeToWatchFolder = "needsLock.tiff";
|
||||
|
||||
@@ -470,7 +470,7 @@ void ApplicationManager::PopulateApplicationDependencies()
|
||||
QDir assetRoot;
|
||||
AssetUtilities::ComputeAssetRoot(assetRoot);
|
||||
|
||||
QString globalConfigPath = assetRoot.filePath("AssetProcessorPlatformConfig.setreg");
|
||||
QString globalConfigPath = assetRoot.filePath("Registry/AssetProcessorPlatformConfig.setreg");
|
||||
m_filesOfInterest.push_back(globalConfigPath);
|
||||
|
||||
QString gamePlatformConfigPath = QDir(AssetUtilities::ComputeProjectPath()).filePath("AssetProcessorGamePlatformConfig.setreg");
|
||||
|
||||
@@ -216,10 +216,6 @@ namespace AssetProcessor
|
||||
{
|
||||
scanFolderEntry.m_watchPath = value;
|
||||
}
|
||||
else if (valueName == "output")
|
||||
{
|
||||
scanFolderEntry.m_outputPrefix = value;
|
||||
}
|
||||
else if (valueName == "display" && !value.empty())
|
||||
{
|
||||
scanFolderEntry.m_scanFolderDisplayName = value;
|
||||
@@ -784,7 +780,6 @@ namespace AssetProcessor
|
||||
scanFolder,
|
||||
AZStd::string::format("ScanFolderParam %zu", idx).c_str(),
|
||||
AZStd::string::format("SF%zu", idx).c_str(),
|
||||
"",
|
||||
false,
|
||||
true,
|
||||
platforms,
|
||||
@@ -1079,10 +1074,6 @@ namespace AssetProcessor
|
||||
AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
|
||||
PopulatePlatformsForScanFolder(platforms, includeIdentifiers, excludeIdentifiers);
|
||||
|
||||
|
||||
// Normalize the OutputPrefix to use PosixPathSeparators
|
||||
scanFolderEntry.m_outputPrefix = AZ::IO::PathView(scanFolderEntry.m_outputPrefix, AZ::IO::PosixPathSeparator).LexicallyNormal().String();
|
||||
|
||||
const bool isEngineRoot = scanFolderEntry.m_watchPath == engineRoot;
|
||||
// If the scan folder happens to be the engine root, it is not recursive
|
||||
scanFolderEntry.m_isRecursive = scanFolderEntry.m_isRecursive && !isEngineRoot;
|
||||
@@ -1093,7 +1084,6 @@ namespace AssetProcessor
|
||||
QString::fromUtf8(scanFolderEntry.m_watchPath.c_str(), aznumeric_cast<int>(scanFolderEntry.m_watchPath.Native().size())),
|
||||
QString::fromUtf8(scanFolderEntry.m_scanFolderDisplayName.c_str(), aznumeric_cast<int>(scanFolderEntry.m_scanFolderDisplayName.size())),
|
||||
QString::fromUtf8(scanFolderEntry.m_scanFolderIdentifier.c_str(), aznumeric_cast<int>(scanFolderEntry.m_scanFolderIdentifier.size())),
|
||||
QString::fromUtf8(scanFolderEntry.m_outputPrefix.c_str(), aznumeric_cast<int>(scanFolderEntry.m_outputPrefix.size())),
|
||||
isEngineRoot,
|
||||
scanFolderEntry.m_isRecursive,
|
||||
platforms,
|
||||
@@ -1318,7 +1308,7 @@ namespace AssetProcessor
|
||||
}
|
||||
}
|
||||
|
||||
bool PlatformConfiguration::ConvertToRelativePath(QString fullFileName, QString& databaseSourceName, QString& scanFolderName, bool includeOutputPrefix) const
|
||||
bool PlatformConfiguration::ConvertToRelativePath(QString fullFileName, QString& databaseSourceName, QString& scanFolderName) const
|
||||
{
|
||||
const ScanFolderInfo* info = GetScanFolderForFile(fullFileName);
|
||||
|
||||
@@ -1327,13 +1317,13 @@ namespace AssetProcessor
|
||||
scanFolderName = info->ScanPath();
|
||||
scanFolderName.replace(AZ_WRONG_DATABASE_SEPARATOR, AZ_CORRECT_DATABASE_SEPARATOR);
|
||||
|
||||
return ConvertToRelativePath(fullFileName, info, databaseSourceName, includeOutputPrefix);
|
||||
return ConvertToRelativePath(fullFileName, info, databaseSourceName);
|
||||
}
|
||||
// did not find it.
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PlatformConfiguration::ConvertToRelativePath(const QString& fullFileName, const ScanFolderInfo* scanFolderInfo, QString& databaseSourceName, bool includeOutputPrefix)
|
||||
bool PlatformConfiguration::ConvertToRelativePath(const QString& fullFileName, const ScanFolderInfo* scanFolderInfo, QString& databaseSourceName)
|
||||
{
|
||||
if(!scanFolderInfo)
|
||||
{
|
||||
@@ -1346,20 +1336,7 @@ namespace AssetProcessor
|
||||
relPath = fullFileName.right(fullFileName.length() - scanFolderInfo->ScanPath().length() - 1); // also eat the slash, hence -1
|
||||
}
|
||||
|
||||
if ((scanFolderInfo->GetOutputPrefix().isEmpty()) || (!includeOutputPrefix))
|
||||
{
|
||||
databaseSourceName = relPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
databaseSourceName = scanFolderInfo->GetOutputPrefix();
|
||||
|
||||
if (!relPath.isEmpty())
|
||||
{
|
||||
databaseSourceName += '/';
|
||||
databaseSourceName += relPath;
|
||||
}
|
||||
}
|
||||
databaseSourceName = relPath;
|
||||
|
||||
databaseSourceName.replace(AZ_WRONG_DATABASE_SEPARATOR, AZ_CORRECT_DATABASE_SEPARATOR);
|
||||
|
||||
@@ -1380,11 +1357,6 @@ namespace AssetProcessor
|
||||
return QString();
|
||||
}
|
||||
QString tempRelativeName(relativeName);
|
||||
//if relative path starts with the output prefix than remove it first
|
||||
if (!scanFolderInfo.GetOutputPrefix().isEmpty() && tempRelativeName.startsWith(scanFolderInfo.GetOutputPrefix(), Qt::CaseInsensitive))
|
||||
{
|
||||
tempRelativeName = tempRelativeName.right(tempRelativeName.length() - scanFolderInfo.GetOutputPrefix().length() - 1); // also eat the slash, hence -1
|
||||
}
|
||||
|
||||
if ((!scanFolderInfo.RecurseSubFolders()) && (tempRelativeName.contains('/')))
|
||||
{
|
||||
@@ -1418,11 +1390,6 @@ namespace AssetProcessor
|
||||
|
||||
QString tempRelativeName(relativeName);
|
||||
|
||||
//if relative path starts with the output prefix than remove it first
|
||||
if (!scanFolderInfo.GetOutputPrefix().isEmpty() && tempRelativeName.startsWith(scanFolderInfo.GetOutputPrefix(), Qt::CaseInsensitive))
|
||||
{
|
||||
tempRelativeName = tempRelativeName.right(tempRelativeName.length() - scanFolderInfo.GetOutputPrefix().length() - 1); // also eat the slash, hence -1
|
||||
}
|
||||
if ((!scanFolderInfo.RecurseSubFolders()) && (tempRelativeName.contains('/')))
|
||||
{
|
||||
// the name is a deeper relative path, but we don't recurse this scan folder, so it can't win
|
||||
@@ -1566,7 +1533,6 @@ namespace AssetProcessor
|
||||
// Watched folder: (absolute path to the gem /Assets/ folder) MUST BE CORRECT CASE
|
||||
// Display name: "Gems/GemName/Assets" // uppercase, for human eyes
|
||||
// portable Key: "gemassets-(UUID Of Gem)"
|
||||
// Output Prefix: "" // empty string - this means put it in @assets@ as per default
|
||||
// Is Root: False
|
||||
// Recursive: True
|
||||
QString gemFolder = gemDir.absoluteFilePath(AzFramework::GemInfo::GetGemAssetFolder());
|
||||
@@ -1576,7 +1542,6 @@ namespace AssetProcessor
|
||||
|
||||
QString assetBrowserDisplayName = AzFramework::GemInfo::GetGemAssetFolder(); // Gems always use assets folder as their displayname...
|
||||
QString portableKey = QString("gemassets-%1").arg(gemNameAsUuid);
|
||||
QString outputPrefix; // empty intentionally here
|
||||
bool isRoot = false;
|
||||
bool isRecursive = true;
|
||||
gemOrder++;
|
||||
@@ -1586,7 +1551,6 @@ namespace AssetProcessor
|
||||
gemFolder,
|
||||
assetBrowserDisplayName,
|
||||
portableKey,
|
||||
outputPrefix,
|
||||
isRoot,
|
||||
isRecursive,
|
||||
platforms,
|
||||
|
||||
@@ -128,7 +128,6 @@ namespace AssetProcessor
|
||||
AZ::IO::Path m_watchPath{ AZ::IO::PosixPathSeparator };
|
||||
AZStd::vector<AZStd::string> m_includeIdentifiers;
|
||||
AZStd::vector<AZStd::string> m_excludeIdentifiers;
|
||||
AZStd::string m_outputPrefix;
|
||||
int m_scanOrder{};
|
||||
bool m_isRecursive{};
|
||||
};
|
||||
@@ -290,10 +289,9 @@ namespace AssetProcessor
|
||||
//! ----> [textures/texture1.tga] found under [c:/dev/mygame]
|
||||
//! c:/dev/engine/models/box01.mdl
|
||||
//! ----> [models/box01.mdl] found under[c:/dev/engine]
|
||||
//! note that this does return a database source path by default, which includes the output prefix of the scan folder if present
|
||||
//! You can override this by setting includeOutputPrefix = false;
|
||||
bool ConvertToRelativePath(QString fullFileName, QString& databaseSourceName, QString& scanFolderName, bool includeOutputPrefix = true) const;
|
||||
static bool ConvertToRelativePath(const QString& fullFileName, const ScanFolderInfo* scanFolderInfo, QString& databaseSourceName, bool includeOutputPrefix = true);
|
||||
//! note that this does return a database source path by default
|
||||
bool ConvertToRelativePath(QString fullFileName, QString& databaseSourceName, QString& scanFolderName) const;
|
||||
static bool ConvertToRelativePath(const QString& fullFileName, const ScanFolderInfo* scanFolderInfo, QString& databaseSourceName);
|
||||
|
||||
//! given a full file name (assumed already fed through the normalization funciton), return the first matching scan folder
|
||||
const AssetProcessor::ScanFolderInfo* GetScanFolderForFile(const QString& fullFileName) const;
|
||||
|
||||
@@ -562,8 +562,8 @@ namespace AssetUtilities
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ_Warning(AssetProcessor::ConsoleChannel, false, "Invalid server address, please check the AssetProcessorPlatformConfig.setreg file \
|
||||
to ensure that the address is correct. Asset Processor won't be running in server mode.");
|
||||
AZ_Warning(AssetProcessor::ConsoleChannel, false, "Invalid server address, please check the AssetProcessorPlatformConfig.setreg file"
|
||||
" to ensure that the address is correct. Asset Processor won't be running in server mode.");
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -804,7 +804,7 @@ to ensure that the address is correct. Asset Processor won't be running in serve
|
||||
{
|
||||
QThread::msleep(AssetUtilsInternal::g_RetryWaitInterval);
|
||||
}
|
||||
|
||||
|
||||
} while (!timer.hasExpired(waitTimeinSeconds * 1000));
|
||||
|
||||
AZ_TracePrintf(AssetProcessor::ConsoleChannel, "Failed to create output directory: %s after %d retries.\n", dir.absolutePath().toUtf8().data(), retries);
|
||||
@@ -1075,7 +1075,7 @@ to ensure that the address is correct. Asset Processor won't be running in serve
|
||||
{
|
||||
// it is assumed that m_fingerprintFilesList contains the original file and all dependencies, and is in a stable order without duplicates
|
||||
// CRC32 is not an effective hash for this purpose, so we will build a string and then use SHA1 on it.
|
||||
|
||||
|
||||
// to avoid resizing and copying repeatedly we will keep track of the largest reserved capacity ever needed for this function, and reserve that much data
|
||||
static size_t s_largestFingerprintCapacitySoFar = 1;
|
||||
AZStd::string fingerprintString;
|
||||
@@ -1207,7 +1207,7 @@ to ensure that the address is correct. Asset Processor won't be running in serve
|
||||
// the navigation system can still be writing to this file when hashing begins, causing the EoF marker to change.
|
||||
AZ::IO::SizeType remainingToRead = AZStd::min(readStream.GetLength() - readStream.GetCurPos(), aznumeric_cast<AZ::IO::SizeType>(AZ_ARRAY_SIZE(buffer)));
|
||||
bytesRead = readStream.Read(remainingToRead, buffer);
|
||||
|
||||
|
||||
if(bytesReadOut)
|
||||
{
|
||||
*bytesReadOut += bytesRead;
|
||||
@@ -1234,7 +1234,7 @@ to ensure that the address is correct. Asset Processor won't be running in serve
|
||||
}
|
||||
|
||||
std::uint64_t AdjustTimestamp(QDateTime timestamp)
|
||||
{
|
||||
{
|
||||
timestamp = timestamp.toUTC();
|
||||
|
||||
auto timeMilliseconds = timestamp.toMSecsSinceEpoch();
|
||||
@@ -1250,7 +1250,7 @@ to ensure that the address is correct. Asset Processor won't be running in serve
|
||||
{
|
||||
bool fileFound = false;
|
||||
AssetProcessor::FileStateInfo fileStateInfo;
|
||||
|
||||
|
||||
auto* fileStateInterface = AZ::Interface<AssetProcessor::IFileStateRequests>::Get();
|
||||
if (fileStateInterface)
|
||||
{
|
||||
@@ -1277,7 +1277,7 @@ to ensure that the address is correct. Asset Processor won't be running in serve
|
||||
{
|
||||
fileIdentifier = AdjustTimestamp(lastModifiedTime);
|
||||
}
|
||||
|
||||
|
||||
// its possible that the dependency has moved to a different file with the same modtime/hash
|
||||
// so we add the size of it too.
|
||||
// its also possible that it moved to a different file with the same modtime/hash AND size,
|
||||
@@ -1324,7 +1324,7 @@ to ensure that the address is correct. Asset Processor won't be running in serve
|
||||
}
|
||||
|
||||
QDir tempRoot;
|
||||
|
||||
|
||||
if (!CreateTempRootFolder(startFolder, tempRoot))
|
||||
{
|
||||
result.clear();
|
||||
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
; this is an override config that should "add" the provo platform
|
||||
; and "remove" the server platform.
|
||||
|
||||
[Platform provo]
|
||||
tags=console, renderer
|
||||
|
||||
[Platforms]
|
||||
server=disabled
|
||||
provo=enabled
|
||||
|
||||
; this ONLY overrides the "provo" value
|
||||
; becuase this is being loaded on top of the defaults, this should LEAVE the others
|
||||
; as they are.
|
||||
[RC i_caf]
|
||||
provo=copy
|
||||
|
||||
; this will remove "mov" from the default configuration
|
||||
[RC mov]
|
||||
ignore=true
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"Amazon": {
|
||||
"AssetProcessor": {
|
||||
"Settings": {
|
||||
"Platform provo": {
|
||||
"tags": "console, renderer"
|
||||
},
|
||||
"Platforms": {
|
||||
"server": "disabled",
|
||||
"provo": "enabled"
|
||||
},
|
||||
"RC i_caf": {
|
||||
"provo": "copy"
|
||||
},
|
||||
"RC mov": {
|
||||
"ignore": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"Amazon": {
|
||||
"AssetProcessor": {
|
||||
"Settings": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-22
@@ -1,22 +0,0 @@
|
||||
; Used by unit tests. This is a broken configuration file.
|
||||
|
||||
[Platform pc]
|
||||
tags=tools,renderer
|
||||
|
||||
[Platform osx_gl]
|
||||
tags=tools,renderer
|
||||
|
||||
[Platforms]
|
||||
es3=enabled ; note - bad platform - its not one of the above ones!
|
||||
|
||||
; without a scan folder, it is an invalid file.
|
||||
[ScanFolder Game]
|
||||
watch=@PROJECTROOT@
|
||||
recursive=1
|
||||
order=0
|
||||
|
||||
; without at least one recognizer, its not an invalid file. (this is not what this unit test is checking)
|
||||
[RC i_caf]
|
||||
glob=*.i_caf
|
||||
params=copy
|
||||
priority=5
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"Amazon": {
|
||||
"AssetProcessor": {
|
||||
"Settings": {
|
||||
"Platform pc": {
|
||||
"tags": "tools,renderer"
|
||||
},
|
||||
"Platform osx_gl": {
|
||||
"tags": "tools,renderer"
|
||||
},
|
||||
"Platforms": {
|
||||
"es3": "enabled"
|
||||
},
|
||||
"ScanFolder Game": {
|
||||
"watch": "@PROJECTROOT@",
|
||||
"recursive": 1,
|
||||
"order": 0
|
||||
},
|
||||
"RC i_caf": {
|
||||
"glob": "*.i_caf",
|
||||
"params": "copy",
|
||||
"priority": 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-13
@@ -1,13 +0,0 @@
|
||||
; Used by unit tests. This is a broken configuration file.
|
||||
|
||||
; without a scan folder, it is an invalid file.
|
||||
[ScanFolder Game]
|
||||
watch=@PROJECTROOT@
|
||||
recursive=1
|
||||
order=0
|
||||
|
||||
; without at least one recognizer, its an invalid file.
|
||||
[RC i_caf]
|
||||
glob=*.i_caf
|
||||
params=copy
|
||||
priority=5
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"Amazon": {
|
||||
"AssetProcessor": {
|
||||
"Settings": {
|
||||
"ScanFolder Game": {
|
||||
"watch": "@PROJECTROOT@",
|
||||
"recursive": 1,
|
||||
"order": 0
|
||||
},
|
||||
"RC i_caf": {
|
||||
"glob": "*.i_caf",
|
||||
"params": "copy",
|
||||
"priority": 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
; Used by unit tests. This is a broken configuration file.
|
||||
|
||||
[Platform pc]
|
||||
tags=tools,renderer
|
||||
|
||||
[Platform osx_gl]
|
||||
tags=tools,renderer
|
||||
|
||||
; without a scan folder, it is an invalid file.
|
||||
|
||||
; without at least one recognizer, its not an invalid file. (this is not what this unit test is checking)
|
||||
[RC i_caf]
|
||||
glob=*.i_caf
|
||||
params=copy
|
||||
priority=5
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"Amazon": {
|
||||
"AssetProcessor": {
|
||||
"Settings": {
|
||||
"Platform pc": {
|
||||
"tags": "tools,renderer"
|
||||
},
|
||||
"Platform osx_gl": {
|
||||
"tags": "tools,renderer"
|
||||
},
|
||||
"RC i_caf": {
|
||||
"glob": "*.i_caf",
|
||||
"params": "copy",
|
||||
"priority": 5
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-16
@@ -1,16 +0,0 @@
|
||||
; Used by unit tests. This is a broken configuration file.
|
||||
|
||||
[Platform pc]
|
||||
tags=tools,renderer
|
||||
|
||||
[Platform osx_gl]
|
||||
tags=tools,renderer
|
||||
|
||||
; without a scan folder, it is an invalid file.
|
||||
[ScanFolder Game]
|
||||
watch=@PROJECTROOT@
|
||||
recursive=1
|
||||
order=0
|
||||
|
||||
; without at least one recognizer, its an invalid file.
|
||||
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"Amazon": {
|
||||
"AssetProcessor": {
|
||||
"Settings": {
|
||||
"Platform pc": {
|
||||
"tags": "tools,renderer"
|
||||
},
|
||||
"Platform osx_gl": {
|
||||
"tags": "tools,renderer"
|
||||
},
|
||||
"ScanFolder Game": {
|
||||
"watch": "@PROJECTROOT@",
|
||||
"recursive": 1,
|
||||
"order": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-109
@@ -1,109 +0,0 @@
|
||||
; this is a regular config file that ought to load successfully.
|
||||
|
||||
[Platform pc]
|
||||
tags=tools,renderer
|
||||
|
||||
[Platform es3]
|
||||
tags=android,mobile,renderer
|
||||
|
||||
[Platform osx_gl]
|
||||
tags=tools,renderer
|
||||
|
||||
[Platform server]
|
||||
tags=server
|
||||
|
||||
; for the purposes of this test, we enable only server and es3, but we make sure the CURRENT_PLATFORM is auto enabled.
|
||||
|
||||
[Platforms]
|
||||
;pc=enabled
|
||||
es3=enabled
|
||||
;ios=enabled
|
||||
;osx_gl=enabled
|
||||
;provo=enabled
|
||||
server=enabled
|
||||
|
||||
; ---- The number of worker jobs, 0 means use the number of Logical Cores
|
||||
[Jobs]
|
||||
minJobs=1
|
||||
maxJobs=0
|
||||
|
||||
[MetaDataTypes]
|
||||
exportsettings=
|
||||
animsettings=i_caf
|
||||
Animations/SkeletonList.xml=i_caf
|
||||
cbc=abc
|
||||
fbx.assetinfo=fbx
|
||||
|
||||
[ScanFolder Game]
|
||||
watch=@PROJECTROOT@
|
||||
; use a special display name here to make sure macros work
|
||||
display=@PROJECTROOT@ Scan Folder
|
||||
recursive=1
|
||||
order=0
|
||||
|
||||
; this test makes sure that those macros make sense and are present as well as that order is preserved.
|
||||
; it also makes sure that the friendly name ("FeatureTests") is used, if no display is present and does not lose its case.
|
||||
[ScanFolder FeatureTests]
|
||||
watch=@PROJECTROOT@FeatureTests
|
||||
output=featuretestsoutputfolder
|
||||
recursive=0
|
||||
order=5000
|
||||
|
||||
; this test makes sure that the scan folders system uses the portable key of the scan Folder to find duplicates.
|
||||
; (which is constructed from its name in the square brackets)
|
||||
; instead of other attributes such as the watch folder, or output prefix.
|
||||
[ScanFolder FeatureTests2]
|
||||
watch=@PROJECTROOT@FeatureTests
|
||||
output=featuretestsoutputfolder
|
||||
recursive=0
|
||||
order=6000
|
||||
|
||||
[Exclude HoldFiles]
|
||||
pattern=.*\\/Levels\\/.*_hold\\/.*
|
||||
|
||||
[Exclude TempFiles]
|
||||
pattern=.*\\/\\$tmp[0-9]*_.*
|
||||
|
||||
[RC i_caf]
|
||||
glob=*.i_caf
|
||||
params=defaultparams
|
||||
; server should not appear
|
||||
server=skip
|
||||
; es3 should have this overridden
|
||||
es3=mobile
|
||||
; host should have defaultparams
|
||||
; make sure priority is used.
|
||||
priority=5
|
||||
checkServer=true
|
||||
|
||||
[RC caf]
|
||||
glob=*.caf
|
||||
params=copy
|
||||
; all platforms with 'renderer' tag should have these params applied. (so host platform and es3 but not server)
|
||||
renderer=rendererparams
|
||||
|
||||
[RC mov]
|
||||
glob=*.mov
|
||||
params=copy
|
||||
; this one proves that platforms override more broader tags (es3 has both the es3 platform and the renderer tag)
|
||||
es3=platformspecificoverride
|
||||
; hosts should use this
|
||||
renderer=rendererparams
|
||||
|
||||
; this tests to make sure that even if "params" is missing, it is assumed to be default operation
|
||||
; this is because if you wanted to skip a platform, we have a specific verb for that ('skip') and simply omitting the defaults means
|
||||
; that you just want the default behavior. only the platforms indicated have a role
|
||||
[RC rend]
|
||||
glob=*.rend
|
||||
renderer=rendererparams
|
||||
|
||||
; this tests to make sure that even if you have no params at all, it is assumed to be default operation
|
||||
[RC alldefault]
|
||||
glob=*.alldefault
|
||||
|
||||
; this tests to make sure if you set default to skip you can still specify one platform to compile on
|
||||
[RC skipallbutone]
|
||||
glob=*.files
|
||||
params=skip
|
||||
server=copy
|
||||
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
{
|
||||
"Amazon": {
|
||||
"AssetProcessor": {
|
||||
"Settings": {
|
||||
"Platform pc": {
|
||||
"tags": "tools,renderer"
|
||||
},
|
||||
"Platform es3": {
|
||||
"tags": "android,mobile,renderer"
|
||||
},
|
||||
"Platform osx_gl": {
|
||||
"tags": "tools,renderer"
|
||||
},
|
||||
"Platform server": {
|
||||
"tags": "server"
|
||||
},
|
||||
"Platforms": {
|
||||
"es3": "enabled",
|
||||
"server": "enabled"
|
||||
},
|
||||
"Jobs": {
|
||||
"minJobs": 1,
|
||||
"maxJobs": 0
|
||||
},
|
||||
"MetaDataTypes": {
|
||||
"animsettings": "i_caf",
|
||||
"Animations/SkeletonList.xml": "i_caf",
|
||||
"cbc": "abc",
|
||||
"fbx.assetinfo": "fbx"
|
||||
},
|
||||
"ScanFolder Game": {
|
||||
"watch": "@PROJECTROOT@",
|
||||
"display": "@PROJECTROOT@ Scan Folder",
|
||||
"recursive": 1,
|
||||
"order": 0
|
||||
},
|
||||
"ScanFolder FeatureTests": {
|
||||
"watch": "@PROJECTROOT@FeatureTests",
|
||||
"output": "featuretestsoutputfolder",
|
||||
"recursive": 0,
|
||||
"order": 5000
|
||||
},
|
||||
"ScanFolder FeatureTests2": {
|
||||
"watch": "@PROJECTROOT@FeatureTests",
|
||||
"output": "featuretestsoutputfolder",
|
||||
"recursive": 0,
|
||||
"order": 6000
|
||||
},
|
||||
"Exclude HoldFiles": {
|
||||
"pattern": ".*\\\\/Levels\\\\/.*_hold\\\\/.*"
|
||||
},
|
||||
"Exclude TempFiles": {
|
||||
"pattern": ".*\\\\/\\\\$tmp[0-9]*_.*"
|
||||
},
|
||||
"RC i_caf": {
|
||||
"glob": "*.i_caf",
|
||||
"params": "defaultparams",
|
||||
"server": "skip",
|
||||
"es3": "mobile",
|
||||
"priority": 5,
|
||||
"checkServer": true
|
||||
},
|
||||
"RC caf": {
|
||||
"glob": "*.caf",
|
||||
"params": "copy",
|
||||
"renderer": "rendererparams"
|
||||
},
|
||||
"RC mov": {
|
||||
"glob": "*.mov",
|
||||
"params": "copy",
|
||||
"es3": "platformspecificoverride",
|
||||
"renderer": "rendererparams"
|
||||
},
|
||||
"RC rend": {
|
||||
"glob": "*.rend",
|
||||
"renderer": "rendererparams"
|
||||
},
|
||||
"RC alldefault": {
|
||||
"glob": "*.alldefault"
|
||||
},
|
||||
"RC skipallbutone": {
|
||||
"glob": "*.files",
|
||||
"params": "skip",
|
||||
"server": "copy"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-129
@@ -1,129 +0,0 @@
|
||||
; this is a regular config file that ought to load successfully.
|
||||
|
||||
[Platform pc]
|
||||
tags=tools,renderer
|
||||
|
||||
[Platform es3]
|
||||
tags=android,mobile,renderer
|
||||
|
||||
[Platform ios]
|
||||
tags=mobile,renderer
|
||||
|
||||
[Platform osx_gl]
|
||||
tags=tools,renderer
|
||||
|
||||
[Platform server]
|
||||
tags=server
|
||||
|
||||
; we define an test platform in order to make sure that it does NOT show up anywhere
|
||||
[Platform test]
|
||||
tags=console,renderer
|
||||
|
||||
; for the purposes of this test, we enable only server and es3, but we make sure the CURRENT_PLATFORM is auto enabled.
|
||||
|
||||
[Platforms]
|
||||
;pc=enabled
|
||||
es3=enabled
|
||||
ios=enabled
|
||||
;osx_gl=enabled
|
||||
;test=enabled
|
||||
server=enabled
|
||||
|
||||
; ---- The number of worker jobs, 0 means use the number of Logical Cores
|
||||
[Jobs]
|
||||
minJobs=1
|
||||
maxJobs=0
|
||||
|
||||
[MetaDataTypes]
|
||||
exportsettings=
|
||||
animsettings=i_caf
|
||||
Animations/SkeletonList.xml=i_caf
|
||||
cbc=abc
|
||||
fbx.assetinfo=fbx
|
||||
|
||||
[ScanFolder Game]
|
||||
watch=@PROJECTROOT@
|
||||
display=gameoutput
|
||||
recursive=1
|
||||
order=0
|
||||
|
||||
[ScanFolder Editor]
|
||||
watch=@ENGINEROOT@/Editor
|
||||
display=editoroutput
|
||||
recursive=1
|
||||
order=30000
|
||||
include=tools,renderer
|
||||
exclude=ios
|
||||
|
||||
[ScanFolder Folder1]
|
||||
watch=@ENGINEROOT@/Folder1
|
||||
display=folder1output
|
||||
recursive=1
|
||||
order=50000
|
||||
include=es3
|
||||
|
||||
[ScanFolder Folder2]
|
||||
watch=@ENGINEROOT@/Folder2
|
||||
display=folder2output
|
||||
recursive=1
|
||||
order=60000
|
||||
exclude=es3
|
||||
|
||||
[ScanFolder Folder3]
|
||||
watch=@ENGINEROOT@/Folder3
|
||||
display=folder3output
|
||||
recursive=1
|
||||
order=70000
|
||||
include=test
|
||||
|
||||
|
||||
|
||||
[Exclude HoldFiles]
|
||||
pattern=.*\\/Levels\\/.*_hold\\/.*
|
||||
|
||||
[Exclude TempFiles]
|
||||
pattern=.*\\/\\$tmp[0-9]*_.*
|
||||
|
||||
[RC i_caf]
|
||||
glob=*.i_caf
|
||||
params=defaultparams
|
||||
; server should not appear
|
||||
server=skip
|
||||
; es3 should have this overridden
|
||||
es3=mobile
|
||||
test=copy
|
||||
; host should have defaultparams
|
||||
; make sure priority is used.
|
||||
priority=5
|
||||
|
||||
[RC caf]
|
||||
glob=*.caf
|
||||
params=copy
|
||||
; all platforms with 'renderer' tag should have these params applied. (so host platform and es3 but not server)
|
||||
renderer=rendererparams
|
||||
|
||||
[RC mov]
|
||||
glob=*.mov
|
||||
params=copy
|
||||
; this one proves that platforms override more broader tags (es3 has both the es3 platform and the renderer tag)
|
||||
es3=platformspecificoverride
|
||||
; hosts should use this
|
||||
renderer=rendererparams
|
||||
|
||||
; this tests to make sure that even if "params" is missing, it is assumed to be default operation
|
||||
; this is because if you wanted to skip a platform, we have a specific verb for that ('skip') and simply omitting the defaults means
|
||||
; that you just want the default behavior. only the platforms indicated have a role
|
||||
[RC rend]
|
||||
glob=*.rend
|
||||
renderer=rendererparams
|
||||
|
||||
; this tests to make sure that even if you have no params at all, it is assumed to be default operation
|
||||
[RC alldefault]
|
||||
glob=*.alldefault
|
||||
|
||||
; this tests to make sure if you set default to skip you can still specify one platform to compile on
|
||||
[RC skipallbutone]
|
||||
glob=*.files
|
||||
params=skip
|
||||
server=copy
|
||||
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
{
|
||||
"Amazon": {
|
||||
"AssetProcessor": {
|
||||
"Settings": {
|
||||
"Platform pc": {
|
||||
"tags": "tools,renderer"
|
||||
},
|
||||
"Platform es3": {
|
||||
"tags": "android,mobile,renderer"
|
||||
},
|
||||
"Platform ios": {
|
||||
"tags": "mobile,renderer"
|
||||
},
|
||||
"Platform osx_gl": {
|
||||
"tags": "tools,renderer"
|
||||
},
|
||||
"Platform server": {
|
||||
"tags": "server"
|
||||
},
|
||||
"Platform test": {
|
||||
"tags": "console,renderer"
|
||||
},
|
||||
"Platforms": {
|
||||
"es3": "enabled",
|
||||
"ios": "enabled",
|
||||
"server": "enabled"
|
||||
},
|
||||
"Jobs": {
|
||||
"minJobs": 1,
|
||||
"maxJobs": 0
|
||||
},
|
||||
"MetaDataTypes": {
|
||||
"animsettings": "i_caf",
|
||||
"Animations/SkeletonList.xml": "i_caf",
|
||||
"cbc": "abc",
|
||||
"fbx.assetinfo": "fbx"
|
||||
},
|
||||
"ScanFolder Game": {
|
||||
"watch": "@PROJECTROOT@",
|
||||
"display": "gameoutput",
|
||||
"recursive": 1,
|
||||
"order": 0
|
||||
},
|
||||
"ScanFolder Editor": {
|
||||
"watch": "@ENGINEROOT@/Editor",
|
||||
"display": "editoroutput",
|
||||
"recursive": 1,
|
||||
"order": 30000,
|
||||
"include": "tools,renderer",
|
||||
"exclude": "ios"
|
||||
},
|
||||
"ScanFolder Folder1": {
|
||||
"watch": "@ENGINEROOT@/Folder1",
|
||||
"display": "folder1output",
|
||||
"recursive": 1,
|
||||
"order": 50000,
|
||||
"include": "es3"
|
||||
},
|
||||
"ScanFolder Folder2": {
|
||||
"watch": "@ENGINEROOT@/Folder2",
|
||||
"display": "folder2output",
|
||||
"recursive": 1,
|
||||
"order": 60000,
|
||||
"exclude": "es3"
|
||||
},
|
||||
"ScanFolder Folder3": {
|
||||
"watch": "@ENGINEROOT@/Folder3",
|
||||
"display": "folder3output",
|
||||
"recursive": 1,
|
||||
"order": 70000,
|
||||
"include": "test"
|
||||
},
|
||||
"Exclude HoldFiles": {
|
||||
"pattern": ".*\\\\/Levels\\\\/.*_hold\\\\/.*"
|
||||
},
|
||||
"Exclude TempFiles": {
|
||||
"pattern": ".*\\\\/\\\\$tmp[0-9]*_.*"
|
||||
},
|
||||
"RC i_caf": {
|
||||
"glob": "*.i_caf",
|
||||
"params": "defaultparams",
|
||||
"server": "skip",
|
||||
"es3": "mobile",
|
||||
"test": "copy",
|
||||
"priority": 5
|
||||
},
|
||||
"RC caf": {
|
||||
"glob": "*.caf",
|
||||
"params": "copy",
|
||||
"renderer": "rendererparams"
|
||||
},
|
||||
"RC mov": {
|
||||
"glob": "*.mov",
|
||||
"params": "copy",
|
||||
"es3": "platformspecificoverride",
|
||||
"renderer": "rendererparams"
|
||||
},
|
||||
"RC rend": {
|
||||
"glob": "*.rend",
|
||||
"renderer": "rendererparams"
|
||||
},
|
||||
"RC alldefault": {
|
||||
"glob": "*.alldefault"
|
||||
},
|
||||
"RC skipallbutone": {
|
||||
"glob": "*.files",
|
||||
"params": "skip",
|
||||
"server": "copy"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,21 @@
|
||||
<RCC>
|
||||
<qresource prefix="/SceneUI/Graph">
|
||||
<file alias="MeshIcon.png">../../../../Editor/Icons/AssetImporter/mesh_on.png</file>
|
||||
<file alias="AnimationIcon.png">../../../../Editor/Icons/AssetImporter/animation_on.png</file>
|
||||
<file alias="BoneIcon.png">../../../../Editor/Icons/AssetImporter/skeleton_on.png</file>
|
||||
<file alias="MeshIcon.png">../../../../Assets/Editor/Icons/AssetImporter/mesh_on.png</file>
|
||||
<file alias="AnimationIcon.png">../../../../Assets/Editor/Icons/AssetImporter/animation_on.png</file>
|
||||
<file alias="BoneIcon.png">../../../../Assets/Editor/Icons/AssetImporter/skeleton_on.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/SceneUI/Manifest">
|
||||
<file alias="TreeIcon.png">../../../../Editor/Icons/AssetImporter/tree.png</file>
|
||||
<file alias="MeshGroupIcon.png">../../../../Editor/Icons/AssetImporter/mesh.png</file>
|
||||
<file alias="AnimationGroupIcon.png">../../../../Editor/Icons/AssetImporter/animation.png</file>
|
||||
<file alias="SkeletonGroupIcon.png">../../../../Editor/Icons/AssetImporter/skeleton.png</file>
|
||||
<file alias="SkinGroupIcon.png">../../../../Editor/Icons/AssetImporter/skin.png</file>
|
||||
<file alias="TreeIcon.png">../../../../Assets/Editor/Icons/AssetImporter/tree.png</file>
|
||||
<file alias="MeshGroupIcon.png">../../../../Assets/Editor/Icons/AssetImporter/mesh.png</file>
|
||||
<file alias="AnimationGroupIcon.png">../../../../Assets/Editor/Icons/AssetImporter/animation.png</file>
|
||||
<file alias="SkeletonGroupIcon.png">../../../../Assets/Editor/Icons/AssetImporter/skeleton.png</file>
|
||||
<file alias="SkinGroupIcon.png">../../../../Assets/Editor/Icons/AssetImporter/skin.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/SceneUI/Common">
|
||||
<file alias="WarningIcon.png">../../../../Editor/Styles/StyleSheetImages/info_icon.png</file>
|
||||
<file alias="ErrorIcon.png">../../../../Editor/Styles/StyleSheetImages/error_icon.png</file>
|
||||
<file alias="AssertIcon.png">../../../../Editor/Icons/Assets/Lua.png</file>
|
||||
<file alias="ExpandIcon.png">../../../../Editor/Icons/PropertyEditor/group_closed.png</file>
|
||||
<file alias="CollapseIcon.png">../../../../Editor/Icons/PropertyEditor/group_open.png</file>
|
||||
<file alias="WarningIcon.png">../../../../Assets/Editor/Styles/StyleSheetImages/info_icon.png</file>
|
||||
<file alias="ErrorIcon.png">../../../../Assets/Editor/Styles/StyleSheetImages/error_icon.png</file>
|
||||
<file alias="AssertIcon.png">../../../../Assets/Editor/Icons/Assets/Lua.png</file>
|
||||
<file alias="ExpandIcon.png">../../../../Assets/Editor/Icons/PropertyEditor/group_closed.png</file>
|
||||
<file alias="CollapseIcon.png">../../../../Assets/Editor/Icons/PropertyEditor/group_open.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
Reference in New Issue
Block a user