From 507a305f67a86f344d2c174bf0e6acf186369067 Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Fri, 12 Nov 2021 12:25:29 -0800 Subject: [PATCH] Cleanup before merge Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- Code/Framework/AzCore/Tests/Jobs.cpp | 98 ------------------- .../Entity/PrefabEntityOwnershipService.cpp | 13 --- .../AzFramework/azframework_files.cmake | 1 - scripts/cleanup/unusued_compilation.py | 25 +++-- 4 files changed, 17 insertions(+), 120 deletions(-) delete mode 100644 Code/Framework/AzFramework/AzFramework/Entity/PrefabEntityOwnershipService.cpp diff --git a/Code/Framework/AzCore/Tests/Jobs.cpp b/Code/Framework/AzCore/Tests/Jobs.cpp index 041f4970d1..20c960535d 100644 --- a/Code/Framework/AzCore/Tests/Jobs.cpp +++ b/Code/Framework/AzCore/Tests/Jobs.cpp @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -1398,103 +1397,6 @@ namespace UnitTest run(); } - using JobLegacyJobExecutorIsRunning = DefaultJobManagerSetupFixture; - TEST_F(JobLegacyJobExecutorIsRunning, Test) - { - // Note: Legacy JobExecutor exists as an adapter to Legacy CryEngine jobs. - // When writing new jobs instead favor direct use of the AZ::Job type family - AZ::LegacyJobExecutor jobExecutor; - EXPECT_FALSE(jobExecutor.IsRunning()); - - // Completion fences and IsRunning() - { - jobExecutor.PushCompletionFence(); - EXPECT_TRUE(jobExecutor.IsRunning()); - jobExecutor.PopCompletionFence(); - EXPECT_FALSE(jobExecutor.IsRunning()); - } - - AZStd::atomic_bool jobExecuted{ false }; - AZStd::binary_semaphore jobSemaphore; - - jobExecutor.StartJob([&jobSemaphore, &jobExecuted] - { - // Wait until the test thread releases - jobExecuted = true; - jobSemaphore.acquire(); - } - ); - EXPECT_TRUE(jobExecutor.IsRunning()); - - // Allow the job to complete - jobSemaphore.release(); - - // Wait for completion - jobExecutor.WaitForCompletion(); - EXPECT_FALSE(jobExecutor.IsRunning()); - EXPECT_TRUE(jobExecuted); - } - - using JobLegacyJobExecutorWaitForCompletion = DefaultJobManagerSetupFixture; - TEST_F(JobLegacyJobExecutorWaitForCompletion, Test) - { - // Note: Legacy JobExecutor exists as an adapter to Legacy CryEngine jobs. - // When writing new jobs instead favor direct use of the AZ::Job type family - AZ::LegacyJobExecutor jobExecutor; - - // Semaphores used to park job threads until released - const AZ::u32 numParkJobs = AZ::JobContext::GetGlobalContext()->GetJobManager().GetNumWorkerThreads(); - AZStd::vector jobSemaphores(numParkJobs); - - // Data destination for workers - const AZ::u32 workJobCount = numParkJobs * 2; - AZStd::vector jobData(workJobCount, 0); - - // Touch completion multiple times as a test of correctly transitioning in and out of the all jobs completed state - AZ::u32 NumCompletionCycles = 5; - for (AZ::u32 completionItrIdx = 0; completionItrIdx < NumCompletionCycles; ++completionItrIdx) - { - // Intentionally park every job thread - for (auto& jobSemaphore : jobSemaphores) - { - jobExecutor.StartJob([&jobSemaphore] - { - jobSemaphore.acquire(); - } - ); - } - EXPECT_TRUE(jobExecutor.IsRunning()); - - // Kick off verifiable "work" jobs - for (AZ::u32 i = 0; i < workJobCount; ++i) - { - jobExecutor.StartJob([i, &jobData] - { - jobData[i] = i + 1; - } - ); - } - EXPECT_TRUE(jobExecutor.IsRunning()); - - // Now released our parked job threads - for (auto& jobSemaphore : jobSemaphores) - { - jobSemaphore.release(); - } - - // And wait for all jobs to finish - jobExecutor.WaitForCompletion(); - EXPECT_FALSE(jobExecutor.IsRunning()); - - // Verify our workers ran and clear data - for (size_t i = 0; i < workJobCount; ++i) - { - EXPECT_EQ(jobData[i], i + 1); - jobData[i] = 0; - } - } - } - class JobCompletionCompleteNotScheduled : public DefaultJobManagerSetupFixture { diff --git a/Code/Framework/AzFramework/AzFramework/Entity/PrefabEntityOwnershipService.cpp b/Code/Framework/AzFramework/AzFramework/Entity/PrefabEntityOwnershipService.cpp deleted file mode 100644 index 9b2c432332..0000000000 --- a/Code/Framework/AzFramework/AzFramework/Entity/PrefabEntityOwnershipService.cpp +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include - -namespace AzFramework -{ -} diff --git a/Code/Framework/AzFramework/AzFramework/azframework_files.cmake b/Code/Framework/AzFramework/AzFramework/azframework_files.cmake index 9af049a7c1..9693d75b06 100644 --- a/Code/Framework/AzFramework/AzFramework/azframework_files.cmake +++ b/Code/Framework/AzFramework/AzFramework/azframework_files.cmake @@ -121,7 +121,6 @@ set(FILES Entity/SliceGameEntityOwnershipService.cpp Entity/SliceGameEntityOwnershipServiceBus.h Entity/PrefabEntityOwnershipService.h - Entity/PrefabEntityOwnershipService.cpp Components/ComponentAdapter.h Components/ComponentAdapter.inl Components/ComponentAdapterHelpers.h diff --git a/scripts/cleanup/unusued_compilation.py b/scripts/cleanup/unusued_compilation.py index 25fa4ca3ce..0d188aaa6f 100644 --- a/scripts/cleanup/unusued_compilation.py +++ b/scripts/cleanup/unusued_compilation.py @@ -14,7 +14,12 @@ sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../bui import ci_build EXTENSIONS_OF_INTEREST = ('.c', '.cc', '.cpp', '.cxx', '.h', '.hpp', '.hxx', '.inl') -EXCLUSIONS = ('AZ_DECLARE_MODULE_CLASS') +EXCLUSIONS = ( + 'AZ_DECLARE_MODULE_CLASS(', + 'REGISTER_QT_CLASS_DESC(', + 'TEST(', + 'TEST_F(' +) def create_filelist(path): filelist = set() @@ -42,6 +47,13 @@ def is_excluded(file): normalized_file = os.path.normpath(file) if '\\Platform\\' in normalized_file and not '\\Windows\\' in normalized_file: return True + if '\\Template\\' in normalized_file: + return True + with open(file, 'r') as file: + contents = file.readlines() + for exclusion_term in EXCLUSIONS: + if exclusion_term in contents: + return True return False def filter_from_processed(filelist, filter_file_path): @@ -49,11 +61,7 @@ def filter_from_processed(filelist, filter_file_path): return # nothing to filter with open(filter_file_path, 'r') as filter_file: - try: - processed_files = [s.strip() for s in filter_file.readlines()] - except UnicodeDecodeError as err: - print('Error reading file {}, err: {}'.format(filter_file_path, err)) - sys.exit(1) + processed_files = [s.strip() for s in filter_file.readlines()] filelist -= set(processed_files) filelist = [f for f in filelist if not is_excluded(f)] @@ -65,10 +73,11 @@ def cleanup_unused_compilation(path): # starting over. Removing the "unusued_compilation_processed.txt" will start over. filter_file_path = os.path.join(os.getcwd(), 'unusued_compilation_processed.txt') filter_from_processed(filelist, filter_file_path) + sorted_filelist = sorted(filelist) # 3. For each file - total_files = len(filelist) + total_files = len(sorted_filelist) current_files = 1 - for file in filelist: + for file in sorted_filelist: print(f"[{current_files}/{total_files}] Trying {file}") # b. create backup shutil.copy(file, file + '.bak')