Procházet zdrojové kódy

Add common platform

Signed-off-by: amzn-mike <[email protected]>
amzn-mike před 3 roky
rodič
revize
b673353e41

+ 2 - 0
Code/Tools/AssetProcessor/AssetBuilderSDK/AssetBuilderSDK/AssetBuilderSDK.h

@@ -109,6 +109,8 @@ namespace AssetBuilderSDK
     extern const char* const s_processJobRequestFileName; //!< File name for having job requests send from the Asset Processor.
     extern const char* const s_processJobResponseFileName; //!< File name for having job responses returned to the Asset Processor.
 
+    constexpr const char* CommonPlatformName = "common"; // Use for platform-agnostic jobs
+
     // SubIDs uniquely identify a particular output product of a specific source asset
     // currently we use a scheme where various bits of the subId (which is a 32 bit unsigned) are used to designate different things.
     // we may expand this into a 64-bit "namespace" by adding additional 32 bits at the front at some point, if it becomes necessary.

+ 16 - 0
Code/Tools/AssetProcessor/native/utilities/PlatformConfiguration.cpp

@@ -783,6 +783,9 @@ namespace AssetProcessor
 
         FinalizeEnabledPlatforms();
 
+        // Add the common platform.  This platform is always enabled
+        EnablePlatform(AssetBuilderSDK::PlatformInfo{ AssetBuilderSDK::CommonPlatformName, AZStd::unordered_set<AZStd::string>{ "common" }});
+
         if (scanFolderOverride)
         {
             AZStd::vector<AssetBuilderSDK::PlatformInfo> platforms;
@@ -803,6 +806,7 @@ namespace AssetProcessor
                     true));
             }
         }
+
         // Then read recognizers (which depend on platforms)
         if (!ReadRecognizersFromSettingsRegistry(absoluteAssetRoot, noConfigScanFolders, scanFolderPatterns))
         {
@@ -972,6 +976,12 @@ namespace AssetProcessor
             // Add all enabled platforms
             for (const AssetBuilderSDK::PlatformInfo& platform : m_enabledPlatforms)
             {
+                if(platform.m_identifier == AssetBuilderSDK::CommonPlatformName)
+                {
+                    // The common platform is not included in any scanfolder to avoid builders by-default producing jobs for it
+                    continue;
+                }
+
                 if (AZStd::find(platformsList.begin(), platformsList.end(), platform) == platformsList.end())
                 {
                     platformsList.push_back(platform);
@@ -984,6 +994,12 @@ namespace AssetProcessor
             {
                 for (const AssetBuilderSDK::PlatformInfo& platform : m_enabledPlatforms)
                 {
+                    if(platform.m_identifier == AssetBuilderSDK::CommonPlatformName)
+                    {
+                        // The common platform is not included in any scanfolder to avoid builders by-default producing jobs for it
+                        continue;
+                    }
+
                     bool addPlatform = (QString::compare(identifier, platform.m_identifier.c_str(), Qt::CaseInsensitive) == 0) ||
                         platform.m_tags.find(identifier.toLower().toUtf8().data()) != platform.m_tags.end();