@@ -26,7 +26,7 @@ private static string config(string @default = null, [CallerMemberName] string k
2626 public const string TemplateJsonVersion = "3.1.1648" ;
2727
2828 public static readonly string SBOMManifestToolPath = Path . GetFullPath ( "../ManifestTool/Microsoft.ManifestTool.dll" ) ;
29-
29+
3030 public static readonly string SrcProjectPath = Path . GetFullPath ( "../src/Azure.Functions.Cli/" ) ;
3131
3232 public static readonly string ConstantsFile = Path . Combine ( SrcProjectPath , "Common" , "Constants.cs" ) ;
@@ -79,6 +79,43 @@ private static string config(string @default = null, [CallerMemberName] string k
7979 "win7-x64"
8080 } ;
8181
82+ private static readonly string [ ] _linPowershellRuntimes = new [ ]
83+ {
84+ "linux" ,
85+ "linux-x64" ,
86+ "unix" ,
87+ "linux-musl-x64"
88+ } ;
89+
90+ private static readonly string [ ] _osxPowershellRuntimes = new [ ]
91+ {
92+ "osx" ,
93+ "osx-x64" ,
94+ "unix"
95+ } ;
96+
97+ private static readonly string [ ] _osxARMPowershellRuntimes = new [ ]
98+ {
99+ "osx" ,
100+ "osx-arm64" ,
101+ "unix"
102+ } ;
103+
104+ private static Dictionary < string , string [ ] > GetPowerShellRuntimes ( )
105+ {
106+ var runtimes = new Dictionary < string , string [ ] >
107+ {
108+ { "win-x86" , _winPowershellRuntimes } ,
109+ { "win-x64" , _winPowershellRuntimes } ,
110+ { "win-arm64" , _winPowershellRuntimes } ,
111+ { "linux-x64" , _linPowershellRuntimes } ,
112+ { "osx-x64" , _osxPowershellRuntimes } ,
113+ { "osx-arm64" , _osxARMPowershellRuntimes }
114+ } ;
115+
116+ return runtimes ;
117+ }
118+
82119 public static readonly Dictionary < string , Dictionary < string , string [ ] > > ToolsRuntimeToPowershellRuntimes = new Dictionary < string , Dictionary < string , string [ ] > >
83120 {
84121 {
@@ -88,8 +125,8 @@ private static string config(string @default = null, [CallerMemberName] string k
88125 { "win-x86" , _winPowershellRuntimes } ,
89126 { "win-x64" , _winPowershellRuntimes } ,
90127 { "win-arm64" , _winPowershellRuntimes } ,
91- { "linux-x64" , new [ ] { "linux" , "linux-x64" , "unix" , "linux-musl-x64" } } ,
92- { "osx-x64" , new [ ] { "osx" , "osx-x64" , "unix" } } ,
128+ { "linux-x64" , _linPowershellRuntimes } ,
129+ { "osx-x64" , _osxPowershellRuntimes } ,
93130 // NOTE: PowerShell 7.0 does not support arm. First version supporting it is 7.2
94131 // https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-macos?view=powershell-7.2#supported-versions
95132 // That being said, we might as well include "osx" and "unix" since it'll hardly affect package size and should lead to more accurate error messages
@@ -98,15 +135,11 @@ private static string config(string @default = null, [CallerMemberName] string k
98135 } ,
99136 {
100137 "7.2" ,
101- new Dictionary < string , string [ ] >
102- {
103- { "win-x86" , _winPowershellRuntimes } ,
104- { "win-x64" , _winPowershellRuntimes } ,
105- { "win-arm64" , _winPowershellRuntimes } ,
106- { "linux-x64" , new [ ] { "linux" , "linux-x64" , "unix" , "linux-musl-x64" } } ,
107- { "osx-x64" , new [ ] { "osx" , "osx-x64" , "unix" } } ,
108- { "osx-arm64" , new [ ] { "osx" , "osx-arm64" , "unix" } }
109- }
138+ GetPowerShellRuntimes ( )
139+ } ,
140+ {
141+ "7.4" ,
142+ GetPowerShellRuntimes ( )
110143 }
111144 } ;
112145
0 commit comments