{ghi7403} cleaning up file handles and warnings for PYI files (#7461)

* {ghi7403} cleaning up file handles and warnings for PYI files

Cleaning up file handles and warnings for PYI files while writing how
to the python_symbols folder. The warnings are clogging up the Jenkins
logs making it hard to find real errors.


Signed-off-by: Allen Jackson <23512001+jackalbe@users.noreply.github.com>

* fixing empty shared pointer failures during tests that do not
set up the logging PYI logging

Signed-off-by: Allen Jackson <23512001+jackalbe@users.noreply.github.com>
This commit is contained in:
Allen Jackson
2022-02-08 09:11:25 -06:00
committed by GitHub
parent 1db12ca463
commit 46a435b877
2 changed files with 44 additions and 39 deletions
@@ -27,6 +27,11 @@ namespace AZ
namespace EditorPythonBindings
{
namespace Internal
{
struct FileHandle;
}
//! Exports Python symbols to the log folder for Python script developers to include into their local projects
class PythonLogSymbolsComponent
: public AZ::Component
@@ -77,11 +82,13 @@ namespace EditorPythonBindings
AZStd::string_view FetchPythonTypeAndTraits(const AZ::TypeId& typeId, AZ::u32 traits);
private:
using ModuleSet = AZStd::unordered_set<AZStd::string>;
using GlobalFunctionEntry = AZStd::pair<const AZ::BehaviorMethod*, AZStd::string>;
using GlobalFunctionList = AZStd::vector<GlobalFunctionEntry>;
using GlobalFunctionMap = AZStd::unordered_map<AZStd::string_view, GlobalFunctionList>;
using TypeMap = AZStd::unordered_map<AZ::TypeId, AZStd::string>;
using FileHandlePtr = AZStd::shared_ptr<Internal::FileHandle>;
AZStd::string m_basePath;
ModuleSet m_moduleSet;
@@ -92,8 +99,8 @@ namespace EditorPythonBindings
AZStd::string FetchMapType(const AZ::TypeId& typeId);
AZStd::string FetchOutcomeType(const AZ::TypeId& typeId);
AZStd::string TypeNameFallback(const AZ::TypeId& typeId);
AZ::IO::HandleType OpenInitFileAt(AZStd::string_view moduleName);
AZ::IO::HandleType OpenModuleAt(AZStd::string_view moduleName);
FileHandlePtr OpenInitFileAt(AZStd::string_view moduleName);
FileHandlePtr OpenModuleAt(AZStd::string_view moduleName);
void WriteMethod(AZ::IO::HandleType handle, AZStd::string_view methodName, const AZ::BehaviorMethod& behaviorMethod, const AZ::BehaviorClass* behaviorClass);
void WriteProperty(AZ::IO::HandleType handle, int level, AZStd::string_view propertyName, const AZ::BehaviorProperty& property, const AZ::BehaviorClass* behaviorClass);
};