Skip to content

Add MonoEngine and compatible platforms (WASM/ANDROID) #24930

@fMichaleczek

Description

@fMichaleczek

Summary of the new feature / enhancement

For CoreClr, we have 4 platform Windows, MacOS, Linux and FreeBSD in a PR

Variable Description PowerShell dotnet API
IsCoreClr Platform.IsCoreClr true
IsWindows Platform.IsWindows OperatingSystem.IsWindows()
IsLinux Platform.IsLinux OperatingSystem.IsLinux()
IsMacOS Platform.IsMacOS OperatingSystem.IsMacOS()
IsFreeBSD PR20041 Platform.IsFreeBSD OperatingSystem.IsFreeBSD()

For net9.0, we have more platforms herited from MonoEngine and compatible with the Microsoft.PowerShell.Sdk

Based on the System.OperatingSystem Methods and the RidGraph, we should add the following platforms and variables :

Variable Description PowerShell dotnet API
IsMonoRuntime dotnet/Mono Platform.IsMonoRuntime typeof(object).Assembly.GetType("Mono.RuntimeStructs") != null;
IsBrowser dotnet/Browser-Wasm Blazor Wasm Platform.IsBrowser OperatingSystem.IsBrowser()
IsWasi dotnet/Wasi-Wasm Platform.IsWasi OperatingSystem.IsWasi()
IsAndroid dotnet/Android + termux-packages + Avalonia + MAUI Platform.IsAndroid OperatingSystem.IsAndroid()

Proposed technical implementation details (optional)

Step 1

  • Add all the missing platforms PR/24934

Step 2

  • Add each global variable Is*
    OR
  • Stop declaring Is* variables and move to another syntax like a PSDrive $is:Windows or a hashtable $Is.Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugNeeds-TriageThe issue is new and needs to be triaged by a work group.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions