Ver Fonte

Add missing files from addressing PR comments

Signed-off-by: John <[email protected]>
John há 4 anos atrás
pai
commit
c145a9a74a

+ 3 - 0
Code/Tools/TestImpactFramework/Frontend/Console/Code/CMakeLists.txt

@@ -19,6 +19,9 @@ ly_add_target(
             Include
         PRIVATE
             Source
+    COMPILE_DEFINITIONS
+        PRIVATE
+            ${LY_TEST_IMPACT_CONFIG_FILE_PATH_DEFINITION}
     BUILD_DEPENDENCIES
         PUBLIC
             AZ::TestImpact.Runtime.Static

+ 3 - 116
cmake/TestImpactFramework/ConsoleFrontendConfig.in

@@ -70,6 +70,9 @@
       },
       "test_target_meta": {
         "file": "${test_target_type_file}"
+      },
+      "gem_target": {
+        "file": "${gem_target_file}"
       }
     }
   },
@@ -87,122 +90,6 @@
      
     ],
     "shard": [
-      {
-        "policy": "fixture_contiguous",
-        "target": "AzCore.Tests"
-      },
-      {
-        "policy": "fixture_contiguous",
-        "target": "AzToolsFramework.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "Framework.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "LmbrCentral.Editor.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "EditorLib.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "PhysX.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "ImageProcessing.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "Atom_RPI.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "Atom_RHI.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "AzManipulatorFramework.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "WhiteBox.Editor.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "ImageProcessing.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "AzManipulatorTestFramework.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "AtomCore.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "ImageProcessingAtom.Editor.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "EditorPythonBindings.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "Atom_Utils.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "AudioEngineWwise.Editor.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "Multiplayer.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "LmbrCentral.Tests"
-      },
-      {
-        "policy": "fixture_contiguous",
-        "target": "LyMetricsShared.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "PhysX.Editor.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "ComponentEntityEditorPlugin.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "DeltaCataloger.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "GradientSignal.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "LyShine.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "EMotionFX.Editor.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "EMotionFX.Tests"
-      },
-      {
-        "policy": "test_interleaved",
-        "target": "CrySystem.Tests"
-      }
     ]
   }
 }

+ 7 - 0
cmake/TestImpactFramework/EnumeratedGemTargets.in

@@ -0,0 +1,7 @@
+{
+  "gems": {
+    [
+${enumerated_gem_targets}
+    ]
+  }
+}

+ 57 - 16
cmake/TestImpactFramework/LYTestImpactFramework.cmake

@@ -24,12 +24,15 @@ set(LY_TEST_IMPACT_PYTHON_COVERAGE_STATIC_TARGET "PythonCoverage.Editor.Static")
 # Name of test impact framework console target
 set(LY_TEST_IMPACT_CONSOLE_TARGET "TestImpact.Frontend.Console")
 
-# Directory for non-persistent test impact data trashed with each generation of build system
+# Directory for test impact artifacts and data
 set(LY_TEST_IMPACT_WORKING_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/TestImpactFramework")
 
-# Directory for temporary files generated at runtime
+# Directory for artifacts generated at runtime
 set(LY_TEST_IMPACT_TEMP_DIR "${LY_TEST_IMPACT_WORKING_DIR}/Temp")
 
+# Directory for files that persist between runtime runs
+set(LY_TEST_IMPACT_PERSISTENT_DIR "${LY_TEST_IMPACT_WORKING_DIR}/Persistent")
+
 # Directory for static artifacts produced as part of the build system generation process
 set(LY_TEST_IMPACT_ARTIFACT_DIR "${LY_TEST_IMPACT_WORKING_DIR}/Artifact")
 
@@ -39,9 +42,18 @@ set(LY_TEST_IMPACT_SOURCE_TARGET_MAPPING_DIR "${LY_TEST_IMPACT_ARTIFACT_DIR}/Map
 # Directory for build target dependency/depender graphs
 set(LY_TEST_IMPACT_TARGET_DEPENDENCY_DIR "${LY_TEST_IMPACT_ARTIFACT_DIR}/Dependency")
 
-# Master test enumeration file for all test types
+# Main test enumeration file for all test types
 set(LY_TEST_IMPACT_TEST_TYPE_FILE "${LY_TEST_IMPACT_ARTIFACT_DIR}/TestType/All.tests")
 
+# Main gem target file for all shared library gems
+set(LY_TEST_IMPACT_GEM_TARGET_FILE "${LY_TEST_IMPACT_ARTIFACT_DIR}/BuildType/All.gems")
+
+# Path to the config file for each build configuration
+set(LY_TEST_IMPACT_CONFIG_FILE_PATH "${LY_TEST_IMPACT_PERSISTENT_DIR}/tiaf.$<CONFIG>.json")
+
+# Preprocessor directive for the config file path
+set(LY_TEST_IMPACT_CONFIG_FILE_PATH_DEFINITION "LY_TEST_IMPACT_DEFAULT_CONFIG_FILE=\"${LY_TEST_IMPACT_CONFIG_FILE_PATH}\"")
+
 #! ly_test_impact_rebase_file_to_repo_root: rebases the relative and/or absolute path to be relative to repo root directory and places the resulting path in quotes.
 #
 # \arg:INPUT_FILE the file to rebase
@@ -215,7 +227,7 @@ function(ly_test_impact_extract_python_test_params COMPOSITE_TEST COMPOSITE_SUIT
     set(${TEST_SUITES} ${test_suites} PARENT_SCOPE)
 endfunction()
 
-#! ly_test_impact_write_test_enumeration_file: exports the master test lists to file.
+#! ly_test_impact_write_test_enumeration_file: exports the main test list to file.
 # 
 # \arg:TEST_ENUMERATION_TEMPLATE_FILE path to test enumeration template file
 function(ly_test_impact_write_test_enumeration_file TEST_ENUMERATION_TEMPLATE_FILE)
@@ -265,6 +277,33 @@ function(ly_test_impact_write_test_enumeration_file TEST_ENUMERATION_TEMPLATE_FI
     configure_file(${TEST_ENUMERATION_TEMPLATE_FILE} ${LY_TEST_IMPACT_TEST_TYPE_FILE})
 endfunction()
 
+#! ly_test_impact_write_gem_target_enumeration_file: exports the main gem target list to file.
+#
+# \arg:GEM_TARGET_TEMPLATE_FILE path to source to gem target template file
+function(ly_test_impact_write_gem_target_enumeration_file GEM_TARGET_TEMPLATE_FILE)
+    get_property(LY_ALL_TARGETS GLOBAL PROPERTY LY_ALL_TARGETS)
+
+    set(enumerated_gem_targets "")
+    # Walk the build targets
+    foreach(aliased_target ${LY_ALL_TARGETS})
+
+        unset(target)
+        ly_de_alias_target(${aliased_target} target)
+
+        get_target_property(gem_module ${target} GEM_MODULE)
+        get_target_property(target_type ${target} TYPE)
+        if("${gem_module}" STREQUAL "TRUE")
+            if("${target_type}" STREQUAL "SHARED_LIBRARY" OR "${target_type}" STREQUAL "MODULE_LIBRARY")
+                list(APPEND enumerated_gem_targets "      \"${target}\"")
+            endif()
+        endif()
+    endforeach()
+    string (REPLACE ";" ",\n" enumerated_gem_targets "${enumerated_gem_targets}")
+     # Write out source to target mapping file
+     set(mapping_path "${LY_TEST_IMPACT_GEM_TARGET_FILE}")
+     configure_file(${GEM_TARGET_TEMPLATE_FILE} ${mapping_path})
+endfunction()
+
 #! ly_test_impact_export_source_target_mappings: exports the static source to target mappings to file.
 #
 # \arg:MAPPING_TEMPLATE_FILE path to source to target template file
@@ -276,6 +315,7 @@ function(ly_test_impact_export_source_target_mappings MAPPING_TEMPLATE_FILE)
 
         unset(target)
         ly_de_alias_target(${aliased_target} target)
+
         message(TRACE "Exporting static source file mappings for ${target}")
         
         # Target name and path relative to root
@@ -336,9 +376,8 @@ endfunction()
 #! ly_test_impact_write_config_file: writes out the test impact framework config file using the data derived from the build generation process.
 # 
 # \arg:CONFIG_TEMPLATE_FILE path to the runtime configuration template file
-# \arg:PERSISTENT_DATA_DIR path to the test impact framework persistent data directory
 # \arg:BIN_DIR path to repo binary output directory
-function(ly_test_impact_write_config_file CONFIG_TEMPLATE_FILE PERSISTENT_DATA_DIR BIN_DIR)
+function(ly_test_impact_write_config_file CONFIG_TEMPLATE_FILE BIN_DIR)
     # Platform this config file is being generated for
     set(platform ${PAL_PLATFORM_NAME})
 
@@ -369,16 +408,19 @@ function(ly_test_impact_write_config_file CONFIG_TEMPLATE_FILE PERSISTENT_DATA_D
     set(temp_dir "${LY_TEST_IMPACT_TEMP_DIR}")
 
     # Active persistent data dir
-    set(active_dir "${PERSISTENT_DATA_DIR}/active")
+    set(active_dir "${LY_TEST_IMPACT_PERSISTENT_DIR}/active")
 
     # Historic persistent data dir
-    set(historic_dir "${PERSISTENT_DATA_DIR}/historic")
+    set(historic_dir "${LY_TEST_IMPACT_PERSISTENT_DIR}/historic")
 
     # Source to target mappings dir
     set(source_target_mapping_dir "${LY_TEST_IMPACT_SOURCE_TARGET_MAPPING_DIR}")
     
     # Test type artifact file
     set(test_target_type_file "${LY_TEST_IMPACT_TEST_TYPE_FILE}")
+
+    # Gem target file
+    set(gem_target_file "${LY_TEST_IMPACT_GEM_TARGET_FILE}")
     
     # Build dependency artifact dir
     set(target_dependency_dir "${LY_TEST_IMPACT_TARGET_DEPENDENCY_DIR}")
@@ -392,13 +434,10 @@ function(ly_test_impact_write_config_file CONFIG_TEMPLATE_FILE PERSISTENT_DATA_D
     
     # Write out entire config contents to a file in the build directory of the test impact framework console target
     file(GENERATE
-        OUTPUT "${PERSISTENT_DATA_DIR}/$<TARGET_FILE_BASE_NAME:${LY_TEST_IMPACT_CONSOLE_TARGET}>.$<CONFIG>.json" 
+        OUTPUT "${LY_TEST_IMPACT_CONFIG_FILE_PATH}" 
         CONTENT ${config_file}
     )
 
-    # Set the above config file as the default config file to use for the test impact framework console target
-    target_compile_definitions(${LY_TEST_IMPACT_CONSOLE_STATIC_TARGET} PUBLIC "LY_TEST_IMPACT_DEFAULT_CONFIG_FILE=\"${PERSISTENT_DATA_DIR}/$<TARGET_FILE_BASE_NAME:${LY_TEST_IMPACT_CONSOLE_TARGET}>.$<CONFIG>.json\"")
-    target_compile_definitions(${LY_TEST_IMPACT_PYTHON_COVERAGE_STATIC_TARGET} PRIVATE "LY_TEST_IMPACT_DEFAULT_CONFIG_FILE=\"${PERSISTENT_DATA_DIR}/$<TARGET_FILE_BASE_NAME:${LY_TEST_IMPACT_CONSOLE_TARGET}>.$<CONFIG>.json\"")
     message(DEBUG "Test impact framework post steps complete")
 endfunction()
 
@@ -408,13 +447,11 @@ function(ly_test_impact_post_step)
         return()
     endif()
 
-    # Directory per build config for persistent test impact data (to be checked in)
-    set(persistent_data_dir "${LY_TEST_IMPACT_WORKING_DIR}/persistent")
     # Directory for binaries built for this profile
     set(bin_dir "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>")
 
     # Erase any existing non-persistent data to avoid getting test impact framework out of sync with current repo state
-    file(REMOVE_RECURSE "${LY_TEST_IMPACT_WORKING_DIR}")
+    file(REMOVE_RECURSE "${LY_TEST_IMPACT_TEMP_DIR}")
 
     # Export the soruce to target mapping files
     ly_test_impact_export_source_target_mappings(
@@ -426,10 +463,14 @@ function(ly_test_impact_post_step)
         "cmake/TestImpactFramework/EnumeratedTests.in"
     )
 
+    # Export the enumerated gems
+    ly_test_impact_write_gem_target_enumeration_file(
+        "cmake/TestImpactFramework/EnumeratedGemTargets.in"
+    )
+
     # Write out the configuration file
     ly_test_impact_write_config_file(
         "cmake/TestImpactFramework/ConsoleFrontendConfig.in"
-        ${persistent_data_dir}
         ${bin_dir}
     )