euv_cli/bundle/impl.rs
1use super::*;
2
3/// Inherent implementation of [`NativePlatform`].
4impl NativePlatform {
5 /// Returns the platform name the native builders use on the command
6 /// line and in their artifact directories.
7 ///
8 /// # Returns
9 ///
10 /// - `&'static str` - The platform name.
11 pub fn platform_name(self) -> &'static str {
12 match self {
13 NativePlatform::Macos => PLATFORM_MACOS,
14 NativePlatform::Linux => PLATFORM_LINUX,
15 NativePlatform::Windows => PLATFORM_WINDOWS,
16 NativePlatform::Ios => PLATFORM_IOS,
17 NativePlatform::IosSimulator => PLATFORM_IOS_SIMULATOR,
18 NativePlatform::Android => PLATFORM_ANDROID,
19 }
20 }
21
22 /// Returns the host operating system this platform must be built on.
23 ///
24 /// The Android builder runs on macOS and Linux; the desktop and Apple
25 /// builders each require their own host.
26 ///
27 /// # Returns
28 ///
29 /// - `&'static str` - The required host identifier.
30 pub fn required_host(self) -> &'static str {
31 match self {
32 NativePlatform::Macos => HOST_MACOS,
33 NativePlatform::Linux => HOST_LINUX,
34 NativePlatform::Windows => HOST_WINDOWS,
35 NativePlatform::Ios => HOST_MACOS,
36 NativePlatform::IosSimulator => HOST_MACOS,
37 NativePlatform::Android => "macos or linux",
38 }
39 }
40}
41
42/// Inherent implementation of [`HostOs`].
43impl HostOs {
44 /// Returns the identifier of the host operating system.
45 ///
46 /// # Returns
47 ///
48 /// - `&'static str` - The host identifier.
49 pub fn host_name(self) -> &'static str {
50 match self {
51 HostOs::Macos => HOST_MACOS,
52 HostOs::Linux => HOST_LINUX,
53 HostOs::Windows => HOST_WINDOWS,
54 HostOs::Unsupported => HOST_UNSUPPORTED,
55 }
56 }
57}
58
59/// Inherent implementation of [`NativeTask`].
60impl NativeTask {
61 /// Returns the name of the builder that produces this task's
62 /// deliverable.
63 ///
64 /// # Returns
65 ///
66 /// - `&'static str` - The builder name.
67 pub fn task_name(self) -> &'static str {
68 match self {
69 NativeTask::Android => "android builder",
70 NativeTask::Client => "client builder",
71 }
72 }
73}