re-add WinGenericLauncher for custom .exe launchers instead of the hard-coded ones (i.e. able to use 'MaterialEditor.exe' instead of 'Editor.exe' for a WinLauncher class)
This commit is contained in:
@@ -17,7 +17,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
# Supported platforms.
|
||||
ALL_PLATFORM_OPTIONS = ['android', 'ios', 'linux', 'mac', 'windows']
|
||||
ALL_LAUNCHER_OPTIONS = ['android', 'base', 'mac', 'windows', 'windows_editor', 'windows_dedicated']
|
||||
ALL_LAUNCHER_OPTIONS = ['android', 'base', 'mac', 'windows', 'windows_editor', 'windows_dedicated', 'windows_generic']
|
||||
ANDROID = False
|
||||
IOS = False # Not implemented - see SPEC-2505
|
||||
LINUX = sys.platform.startswith('linux') # Not implemented - see SPEC-2501
|
||||
@@ -38,11 +38,13 @@ if WINDOWS:
|
||||
HOST_OS_EDITOR = 'windows_editor'
|
||||
HOST_OS_DEDICATED_SERVER = 'windows_dedicated'
|
||||
import ly_test_tools.mobile.android
|
||||
from ly_test_tools.launchers import AndroidLauncher, WinLauncher, DedicatedWinLauncher, WinEditor
|
||||
from ly_test_tools.launchers import (
|
||||
AndroidLauncher, WinLauncher, DedicatedWinLauncher, WinEditor, WinGenericLauncher)
|
||||
ANDROID = ly_test_tools.mobile.android.can_run_android()
|
||||
LAUNCHERS['windows'] = WinLauncher
|
||||
LAUNCHERS['windows_editor'] = WinEditor
|
||||
LAUNCHERS['windows_dedicated'] = DedicatedWinLauncher
|
||||
LAUNCHERS['windows_generic'] = WinGenericLauncher
|
||||
LAUNCHERS['android'] = AndroidLauncher
|
||||
elif MAC:
|
||||
HOST_OS_PLATFORM = 'mac'
|
||||
|
||||
@@ -281,6 +281,21 @@ def _dedicated_launcher(request, workspace, launcher_platform, level=""):
|
||||
|
||||
return launcher
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def generic_launcher(workspace, request, crash_log_watchdog):
|
||||
# type: (...) -> ly_test_tools.launchers.platforms.base.Launcher
|
||||
return _generic_launcher(
|
||||
workspace=workspace,
|
||||
launcher_platform=get_fixture_argument(request, 'launcher_platform', HOST_OS_PLATFORM),
|
||||
exe_file_name=get_fixture_argument(request, 'exe_file_name', ''))
|
||||
|
||||
|
||||
def _generic_launcher(workspace, launcher_platform, exe_file_name):
|
||||
"""Separate implementation to call directly during unit tests"""
|
||||
return ly_test_tools.launchers.launcher_helper.create_generic_launcher(workspace, launcher_platform, exe_file_name)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def automatic_process_killer(request):
|
||||
# type: (_pytest.fixtures.SubRequest) -> ly_process_killer
|
||||
|
||||
@@ -61,3 +61,19 @@ def create_editor(workspace, launcher_platform=ly_test_tools.HOST_OS_EDITOR, arg
|
||||
"""
|
||||
launcher_class = ly_test_tools.LAUNCHERS.get(launcher_platform, ly_test_tools.HOST_OS_EDITOR)
|
||||
return launcher_class(workspace, args)
|
||||
|
||||
|
||||
def create_generic_launcher(workspace, launcher_platform, exe_file_name, args=None):
|
||||
# type: (ly_test_tools.managers.workspace.WorkspaceManager, str, str, List[str]) -> Launcher
|
||||
"""
|
||||
Create a generic launcher compatible with the specified workspace.
|
||||
Allows custom .exe files to serve as the launcher instead of ones listed in the ly_test_tools.LAUNCHERS constant
|
||||
|
||||
:param workspace: lumberyard workspace to use
|
||||
:param launcher_platform: the platform to target for a launcher (i.e. 'windows' for WinLauncher)
|
||||
:param exe_file_name: .exe file name which has to be launched for this launcher (i.e. 'MaterialEditor.exe')
|
||||
:param args: List of arguments to pass to the launcher's 'args' argument during construction
|
||||
:return: Launcher instance.
|
||||
"""
|
||||
launcher_class = ly_test_tools.LAUNCHERS.get(launcher_platform, ly_test_tools.HOST_OS_PLATFORM)
|
||||
return launcher_class(workspace, exe_file_name, args)
|
||||
|
||||
@@ -203,3 +203,19 @@ class WinEditor(WinLauncher):
|
||||
"""
|
||||
assert self.workspace.project is not None
|
||||
return os.path.join(self.workspace.paths.build_directory(), "Editor.exe")
|
||||
|
||||
|
||||
class WinGenericLauncher(WinLauncher):
|
||||
|
||||
def __init__(self, build, exe_file_name, args=None):
|
||||
super(WinGenericLauncher, self).__init__(build, args)
|
||||
self.exe_file_name = exe_file_name
|
||||
|
||||
def binary_path(self):
|
||||
"""
|
||||
Return full path to the .exe file for this build's configuration and project
|
||||
|
||||
:return: full path to the given exe file
|
||||
"""
|
||||
assert self.workspace.project is not None
|
||||
return os.path.join(self.workspace.paths.build_directory(), f"{self.exe_file_name}.exe")
|
||||
|
||||
Reference in New Issue
Block a user