App Launchers
Stay organized with collections
Save and categorize content based on your preferences.
The app launcher framework is used to run an executable on a given platform,
allowing its output/results to be used by other scripts or tools.
Making an App Launcher
In order to use this framework for your platform, there must be a method called
"GetLauncher()" in the PlatformConfig class that your platform's
"gyp_configuration.py" file refers to. It should load and return a module
containing a class called "Launcher." This class must inherit from the
AbstractLauncher class in abstract_launcher.py,
and must implement at minimum the following abstract methods:
- Run(): Runs the executable, logs its output, and returns its return code.
Generally, any app installation work is also done in this method.
- Kill(): Kills the currently running executable and cleans up any leftover
resources such as threads, processes, etc.
Once the above steps are implemented, tools that use this framework, such as
Starboard's unit test runner, should work
properly for your platform. For an example of a Launcher class, see
this Linux implementation. For an example
of the corresponding "GetLauncher()" method, see
this gyp_configuration.py file.
Using an App Launcher
In order to use this framework in a Python tool, it must import
abstract_launcher.py and call "abstract_launcher.LauncherFactory()." This
method returns a Launcher object from the platform specified by its "platform"
argument. To run the launcher, call its "Run()" method, and to stop it, call
its "Kill()" method. If your tools need to access the Launcher's output while
the executable is still running, have it start "Run()" in a separate thread;
this will allow the main thread to easily read from the Launcher's output file.
For an example of creating and using a Launcher, see
this example.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-12-12 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-12-12 UTC."],[[["The app launcher framework enables execution of platform-specific executables and utilizes their output in other tools or scripts."],["Platforms need a `GetLauncher()` method within their `PlatformConfig` class and a `Launcher` class inheriting from `AbstractLauncher` to integrate with the framework."],["`Launcher` implementations must include `Run()` for execution and cleanup and `Kill()` for process termination and resource management."],["Tools using the framework utilize `LauncherFactory()` to obtain a platform-specific `Launcher` object and then call `Run()` and `Kill()` for control."],["For concurrent output access, execute `Run()` in a separate thread, allowing the main thread to read from the launcher's output file."]]],["The app launcher framework enables running executables and utilizing their results across platforms. To implement it, define a `GetLauncher()` method in the `PlatformConfig` class that returns a `Launcher` class. This `Launcher` must inherit from `AbstractLauncher` and implement `Run()` to execute and log the output, and `Kill()` to stop it. Tools utilize the framework by importing `abstract_launcher.py`, creating a `Launcher` object with `LauncherFactory()`, then using its `Run()` and `Kill()` methods.\n"]]