Added builder for energy-management-app for Linux (host) and ESP32 (#31353)

* Added builder for energy-management-app for Linux (host) and ESP32

* Added option to enable test event triggers for EVSE but in a generic way for future.

* Updated expected targets.
diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py
index 6be9da2..aa11f1e 100755
--- a/scripts/build/build/targets.py
+++ b/scripts/build/build/targets.py
@@ -140,6 +140,7 @@
         TargetPart('lit-icd', app=HostApp.LIT_ICD),
         TargetPart('air-quality-sensor', app=HostApp.AIR_QUALITY_SENSOR),
         TargetPart('network-manager', app=HostApp.NETWORK_MANAGER),
+        TargetPart('energy-management', app=HostApp.ENERGY_MANAGEMENT),
     ]
 
     if (HostBoard.NATIVE.PlatformName() == 'darwin'):
@@ -180,6 +181,7 @@
     target.AppendModifier('test', extra_tests=True)
     target.AppendModifier('rpc', enable_rpcs=True)
     target.AppendModifier('with-ui', imgui_ui=True)
+    target.AppendModifier('evse-test-event', enable_test_event_triggers=['EVSE']).OnlyIfRe('-energy-management')
 
     return target
 
@@ -199,6 +201,7 @@
     target.AppendFixedTargets([
         TargetPart('all-clusters', app=Esp32App.ALL_CLUSTERS),
         TargetPart('all-clusters-minimal', app=Esp32App.ALL_CLUSTERS_MINIMAL),
+        TargetPart('energy-management', app=Esp32App.ENERGY_MANAGEMENT),
         TargetPart('ota-provider', app=Esp32App.OTA_PROVIDER),
         TargetPart('ota-requestor', app=Esp32App.OTA_REQUESTOR),
         TargetPart('shell', app=Esp32App.SHELL),
diff --git a/scripts/build/builders/esp32.py b/scripts/build/builders/esp32.py
index 39573a9..b51e23d 100644
--- a/scripts/build/builders/esp32.py
+++ b/scripts/build/builders/esp32.py
@@ -30,6 +30,7 @@
 class Esp32App(Enum):
     ALL_CLUSTERS = auto()
     ALL_CLUSTERS_MINIMAL = auto()
+    ENERGY_MANAGEMENT = auto()
     LIGHT = auto()
     LOCK = auto()
     SHELL = auto()
@@ -45,6 +46,8 @@
             return 'examples/all-clusters-app'
         elif self == Esp32App.ALL_CLUSTERS_MINIMAL:
             return 'examples/all-clusters-minimal-app'
+        elif self == Esp32App.ENERGY_MANAGEMENT:
+            return 'examples/energy-management-app'
         elif self == Esp32App.LIGHT:
             return 'examples/lighting-app'
         elif self == Esp32App.LOCK:
@@ -70,6 +73,8 @@
             return 'chip-all-clusters-app'
         elif self == Esp32App.ALL_CLUSTERS_MINIMAL:
             return 'chip-all-clusters-minimal-app'
+        elif self == Esp32App.ENERGY_MANAGEMENT:
+            return 'chip-energy-management-app'
         elif self == Esp32App.LIGHT:
             return 'chip-lighting-app'
         elif self == Esp32App.LOCK:
diff --git a/scripts/build/builders/host.py b/scripts/build/builders/host.py
index 40f60a0..e11d5c2 100644
--- a/scripts/build/builders/host.py
+++ b/scripts/build/builders/host.py
@@ -77,6 +77,7 @@
     LIT_ICD = auto()
     AIR_QUALITY_SENSOR = auto()
     NETWORK_MANAGER = auto()
+    ENERGY_MANAGEMENT = auto()
 
     def ExamplePath(self):
         if self == HostApp.ALL_CLUSTERS:
@@ -139,6 +140,8 @@
             return 'air-quality-sensor-app/linux'
         elif self == HostApp.NETWORK_MANAGER:
             return 'network-manager-app/linux'
+        elif self == HostApp.ENERGY_MANAGEMENT:
+            return 'energy-management-app/linux'
         else:
             raise Exception('Unknown app type: %r' % self)
 
@@ -239,6 +242,9 @@
         elif self == HostApp.LIT_ICD:
             yield 'lit-icd-app'
             yield 'lit-icd-app.map'
+        elif self == HostApp.ENERGY_MANAGEMENT:
+            yield 'chip-energy-management-app'
+            yield 'chip-energy-management-app.map'
         else:
             raise Exception('Unknown app type: %r' % self)
 
@@ -291,7 +297,8 @@
                  separate_event_loop=True, fuzzing_type: HostFuzzingType = HostFuzzingType.NONE, use_clang=False,
                  interactive_mode=True, extra_tests=False, use_platform_mdns=False, enable_rpcs=False,
                  use_coverage=False, use_dmalloc=False, minmdns_address_policy=None,
-                 minmdns_high_verbosity=False, imgui_ui=False, crypto_library: HostCryptoLibrary = None):
+                 minmdns_high_verbosity=False, imgui_ui=False, crypto_library: HostCryptoLibrary = None,
+                 enable_test_event_triggers=None):
         super(HostBuilder, self).__init__(
             root=os.path.join(root, 'examples', app.ExamplePath()),
             runner=runner)
@@ -392,6 +399,10 @@
         if crypto_library:
             self.extra_gn_options.append(crypto_library.gn_argument)
 
+        if enable_test_event_triggers is not None:
+            if 'EVSE' in enable_test_event_triggers:
+                self.extra_gn_options.append('chip_enable_energy_evse_trigger=true')
+
         if self.board == HostBoard.ARM64:
             if not use_clang:
                 raise Exception("Cross compile only supported using clang")
diff --git a/scripts/build/testdata/all_targets_linux_x64.txt b/scripts/build/testdata/all_targets_linux_x64.txt
index 9edc019..fa8b84e 100644
--- a/scripts/build/testdata/all_targets_linux_x64.txt
+++ b/scripts/build/testdata/all_targets_linux_x64.txt
@@ -7,10 +7,10 @@
 ti-cc13x4_26x4-{all-clusters,lighting,lock,pump,pump-controller}[-mtd][-ftd]
 cyw30739-cyw930739m2evb_01-{light,lock,ota-requestor,switch}
 efr32-{brd4161a,brd4187c,brd4186c,brd4163a,brd4164a,brd4166a,brd4170a,brd4186a,brd4187a,brd4304a,brd4338a}-{window-covering,switch,unit-test,light,lock,thermostat,pump}[-rpc][-with-ota-requestor][-icd][-low-power][-shell][-no_logging][-openthread_mtd][-enable_heap_monitoring][-no_openthread_cli][-show_qr_code][-wifi][-rs911x][-wf200][-wifi_ipv4][-917_soc][-additional_data_advertising][-use_ot_lib][-use_ot_coap_lib][-no-version][-skip_rps_generation]
-esp32-{m5stack,c3devkit,devkitc,qemu}-{all-clusters,all-clusters-minimal,ota-provider,ota-requestor,shell,light,lock,bridge,temperature-measurement,ota-requestor,tests}[-rpc][-ipv6only][-tracing]
+esp32-{m5stack,c3devkit,devkitc,qemu}-{all-clusters,all-clusters-minimal,energy-management,ota-provider,ota-requestor,shell,light,lock,bridge,temperature-measurement,ota-requestor,tests}[-rpc][-ipv6only][-tracing]
 genio-lighting-app
 linux-fake-tests[-mbedtls][-boringssl][-asan][-tsan][-ubsan][-libfuzzer][-ossfuzz][-coverage][-dmalloc][-clang]
-linux-{x64,arm64}-{rpc-console,all-clusters,all-clusters-minimal,chip-tool,thermostat,java-matter-controller,kotlin-matter-controller,minmdns,light,lock,shell,ota-provider,ota-requestor,simulated-app1,simulated-app2,python-bindings,tv-app,tv-casting-app,bridge,tests,chip-cert,address-resolve-tool,contact-sensor,dishwasher,microwave-oven,refrigerator,rvc,air-purifier,lit-icd,air-quality-sensor,network-manager}[-nodeps][-platform-mdns][-minmdns-verbose][-libnl][-same-event-loop][-no-interactive][-ipv6only][-no-ble][-no-wifi][-no-thread][-mbedtls][-boringssl][-asan][-tsan][-ubsan][-libfuzzer][-ossfuzz][-coverage][-dmalloc][-clang][-test][-rpc][-with-ui]
+linux-{x64,arm64}-{rpc-console,all-clusters,all-clusters-minimal,chip-tool,thermostat,java-matter-controller,kotlin-matter-controller,minmdns,light,lock,shell,ota-provider,ota-requestor,simulated-app1,simulated-app2,python-bindings,tv-app,tv-casting-app,bridge,tests,chip-cert,address-resolve-tool,contact-sensor,dishwasher,microwave-oven,refrigerator,rvc,air-purifier,lit-icd,air-quality-sensor,network-manager,energy-management}[-nodeps][-platform-mdns][-minmdns-verbose][-libnl][-same-event-loop][-no-interactive][-ipv6only][-no-ble][-no-wifi][-no-thread][-mbedtls][-boringssl][-asan][-tsan][-ubsan][-libfuzzer][-ossfuzz][-coverage][-dmalloc][-clang][-test][-rpc][-with-ui][-evse-test-event]
 linux-x64-efr32-test-runner[-clang]
 imx-{chip-tool,lighting-app,thermostat,all-clusters-app,all-clusters-minimal-app,ota-provider-app}[-release]
 infineon-psoc6-{lock,light,all-clusters,all-clusters-minimal}[-ota][-updateimage]