1
+ using System . Runtime . InteropServices ;
1
2
using Cake . Common . Build . AzurePipelines ;
2
3
using Xunit ;
4
+ using ProcessArchitecture = System . Runtime . InteropServices . Architecture ;
3
5
4
6
namespace Common . Utilities ;
5
7
@@ -12,6 +14,7 @@ public static IEnumerable<string> ExecuteCommand(this ICakeContext context, File
12
14
{
13
15
processSettings . WorkingDirectory = workDir ;
14
16
}
17
+
15
18
context . StartProcess ( exe , processSettings , out var redirectedOutput ) ;
16
19
return redirectedOutput . ToList ( ) ;
17
20
}
@@ -79,6 +82,12 @@ public static string GetOS(this ICakeContext context)
79
82
return string . Empty ;
80
83
}
81
84
85
+ public static bool IsRunningOnAmd64 ( this ICakeContext _ )
86
+ => RuntimeInformation . ProcessArchitecture == ProcessArchitecture . X64 ;
87
+
88
+ public static bool IsRunningOnArm64 ( this ICakeContext _ ) =>
89
+ RuntimeInformation . ProcessArchitecture == ProcessArchitecture . Arm64 ;
90
+
82
91
public static string GetBuildAgent ( this ICakeContext context )
83
92
{
84
93
var buildSystem = context . BuildSystem ( ) ;
@@ -142,6 +151,7 @@ public static string GetBranchName(this ICakeContext context)
142
151
{
143
152
repositoryBranch = buildSystem . GitHubActions . Environment . Workflow . Ref . Replace ( "refs/heads/" , "" ) ;
144
153
}
154
+
145
155
return repositoryBranch ;
146
156
}
147
157
@@ -161,6 +171,7 @@ public static string GetRepositoryName(this ICakeContext context)
161
171
{
162
172
repositoryName = buildSystem . GitHubActions . Environment . Workflow . Repository ;
163
173
}
174
+
164
175
return repositoryName ;
165
176
}
166
177
@@ -172,6 +183,7 @@ public static string GetRepositoryName(this ICakeContext context)
172
183
context . GetFiles ( $ "src/GitVersion.App/bin/{ Constants . DefaultConfiguration } /{ Constants . NetVersionLatest } /gitversion.dll") . SingleOrDefault ( ) ;
173
184
public static FilePath ? GetGitVersionDotnetToolLocation ( this ICakeContext context ) =>
174
185
context . MakeAbsolute ( Paths . Tools . Combine ( "gitversion" ) . CombineWithFilePath ( "gitversion.dll" ) ) ;
186
+
175
187
public static FilePath ? GetSchemaDotnetToolLocation ( this ICakeContext context ) =>
176
188
context . MakeAbsolute ( Paths . Tools . Combine ( "schema" ) . CombineWithFilePath ( "schema.dll" ) ) ;
177
189
}
0 commit comments