55using Nuke . Common . ProjectModel ;
66using Nuke . Common . Tooling ;
77using Nuke . Common . Tools . AzureKeyVault ;
8- using Nuke . Common . Tools . AzureKeyVault . Attributes ;
98using Nuke . Common . Tools . Coverlet ;
109using Nuke . Common . Tools . DocFX ;
1110using Nuke . Common . Tools . DotNet ;
2423using System . Xml . Linq ;
2524using System . Xml . XPath ;
2625using static Nuke . Common . ChangeLog . ChangelogTasks ;
27- using static Nuke . Common . IO . FileSystemTasks ;
28- using static Nuke . Common . IO . PathConstruction ;
2926using static Nuke . Common . IO . XmlTasks ;
3027using static Nuke . Common . Tools . DocFX . DocFXTasks ;
3128using static Nuke . Common . Tools . DotNet . DotNetTasks ;
3431using static Nuke . GitHub . ChangeLogExtensions ;
3532using static Nuke . GitHub . GitHubTasks ;
3633using static Nuke . WebDocu . WebDocuTasks ;
37- using static Nuke . Common . IO . TextTasks ;
3834
3935class Build : NukeBuild
4036{
4137 public static int Main ( ) => Execute < Build > ( x => x . Compile ) ;
4238
43- [ KeyVaultSettings (
44- BaseUrlParameterName = nameof ( KeyVaultBaseUrl ) ,
45- ClientIdParameterName = nameof ( KeyVaultClientId ) ,
46- ClientSecretParameterName = nameof ( KeyVaultClientSecret ) ) ]
47- readonly KeyVaultSettings KeyVaultSettings ;
39+ [ AzureKeyVaultConfiguration (
40+ BaseUrlParameterName = nameof ( KeyVaultBaseUrl ) ,
41+ ClientIdParameterName = nameof ( KeyVaultClientId ) ,
42+ ClientSecretParameterName = nameof ( KeyVaultClientSecret ) ,
43+ TenantIdParameterName = nameof ( KeyVaultTenantId ) ) ]
44+ readonly AzureKeyVaultConfiguration KeyVaultSettings ;
4845
49- [ KeyVault ] readonly KeyVault KeyVault ;
46+ [ AzureKeyVault ] readonly AzureKeyVault KeyVault ;
5047
5148 [ Parameter ] readonly string KeyVaultBaseUrl ;
5249 [ Parameter ] readonly string KeyVaultClientId ;
5350 [ Parameter ] readonly string KeyVaultClientSecret ;
51+ [ Parameter ] readonly string KeyVaultTenantId ;
5452
5553 [ GitVersion ( Framework = "net6.0" ) ] readonly GitVersion GitVersion ;
5654 [ GitRepository ] readonly GitRepository GitRepository ;
5755
58- [ KeyVaultSecret ] readonly string DocuBaseUrl ;
59- [ KeyVaultSecret ] readonly string PublicMyGetSource ;
60- [ KeyVaultSecret ] readonly string PublicMyGetApiKey ;
61- [ KeyVaultSecret ] readonly string NuGetApiKey ;
62- [ KeyVaultSecret ( "LightQuery-DocuApiKey" ) ] readonly string DocuApiKey ;
63- [ KeyVaultSecret ] readonly string GitHubAuthenticationToken ;
64- [ KeyVaultSecret ] readonly string DanglCiCdTeamsWebhookUrl ;
56+ [ AzureKeyVaultSecret ] readonly string DocuBaseUrl ;
57+ [ AzureKeyVaultSecret ] readonly string DanglPublicFeedSource ;
58+ [ AzureKeyVaultSecret ] readonly string FeedzAccessToken ;
59+ [ AzureKeyVaultSecret ] readonly string NuGetApiKey ;
60+ [ AzureKeyVaultSecret ( "LightQuery-DocuApiKey" ) ] readonly string DocuApiKey ;
61+ [ AzureKeyVaultSecret ] readonly string GitHubAuthenticationToken ;
62+ [ AzureKeyVaultSecret ] readonly string DanglCiCdTeamsWebhookUrl ;
6563
6664 [ Parameter ] readonly string Configuration = IsLocalBuild ? "Debug" : "Release" ;
6765
@@ -100,14 +98,14 @@ void SendTeamsMessage(string title, string message, bool isError)
10098 Target Clean => _ => _
10199 . Executes ( ( ) =>
102100 {
103- GlobDirectories ( SourceDirectory / "LightQuery" , "**/bin" , "**/obj" ) . ForEach ( DeleteDirectory ) ;
104- GlobDirectories ( SourceDirectory / "LightQuery.Client" , "**/bin" , "**/obj" ) . ForEach ( DeleteDirectory ) ;
105- GlobDirectories ( SourceDirectory / "LightQuery.EntityFrameworkCore" , "**/bin" , "**/obj" ) . ForEach ( DeleteDirectory ) ;
106- GlobDirectories ( SourceDirectory / "LightQuery.Shared" , "**/bin" , "**/obj" ) . ForEach ( DeleteDirectory ) ;
107- GlobDirectories ( SourceDirectory / "LightQuery.NSwag" , "**/bin" , "**/obj" ) . ForEach ( DeleteDirectory ) ;
108- GlobDirectories ( SourceDirectory / "LightQuery.Swashbuckle" , "**/bin" , "**/obj" ) . ForEach ( DeleteDirectory ) ;
109- GlobDirectories ( RootDirectory / "test" , "**/bin" , "**/obj" ) . ForEach ( DeleteDirectory ) ;
110- EnsureCleanDirectory ( OutputDirectory ) ;
101+ ( SourceDirectory / "LightQuery" ) . GlobDirectories ( "**/bin" , "**/obj" ) . ForEach ( d => d . DeleteDirectory ( ) ) ;
102+ ( SourceDirectory / "LightQuery.Client" ) . GlobDirectories ( "**/bin" , "**/obj" ) . ForEach ( d => d . DeleteDirectory ( ) ) ;
103+ ( SourceDirectory / "LightQuery.EntityFrameworkCore" ) . GlobDirectories ( "**/bin" , "**/obj" ) . ForEach ( d => d . DeleteDirectory ( ) ) ;
104+ ( SourceDirectory / "LightQuery.Shared" ) . GlobDirectories ( "**/bin" , "**/obj" ) . ForEach ( d => d . DeleteDirectory ( ) ) ;
105+ ( SourceDirectory / "LightQuery.NSwag" ) . GlobDirectories ( "**/bin" , "**/obj" ) . ForEach ( d => d . DeleteDirectory ( ) ) ;
106+ ( SourceDirectory / "LightQuery.Swashbuckle" ) . GlobDirectories ( "**/bin" , "**/obj" ) . ForEach ( d => d . DeleteDirectory ( ) ) ;
107+ ( RootDirectory / "test" ) . GlobDirectories ( "**/bin" , "**/obj" ) . ForEach ( d => d . DeleteDirectory ( ) ) ;
108+ OutputDirectory . CreateOrCleanDirectory ( ) ;
111109 } ) ;
112110
113111 Target Restore => _ => _
@@ -149,7 +147,8 @@ void SendTeamsMessage(string title, string message, bool isError)
149147 . DependsOn ( Compile )
150148 . Executes ( ( ) =>
151149 {
152- var testProjects = GlobFiles ( SolutionDirectory / "test" , "**/*.csproj" )
150+ var testProjects = ( SolutionDirectory / "test" ) . GlobFiles ( "**/*.csproj" )
151+ . Select ( t => t . ToString ( ) )
153152 . Where ( t => ! t . EndsWith ( "LightQuery.IntegrationTestsServer.csproj" ) )
154153 . ToList ( ) ;
155154
@@ -211,9 +210,9 @@ void SendTeamsMessage(string title, string message, bool isError)
211210 }
212211 } ) ;
213212
214- private void MakeSourceEntriesRelativeInCoberturaFormat ( string coberturaReportPath )
213+ private void MakeSourceEntriesRelativeInCoberturaFormat ( AbsolutePath coberturaReportPath )
215214 {
216- var originalText = ReadAllText ( coberturaReportPath ) ;
215+ var originalText = coberturaReportPath . ReadAllText ( ) ;
217216 var xml = XDocument . Parse ( originalText ) ;
218217
219218 var xDoc = XDocument . Load ( coberturaReportPath ) ;
@@ -275,15 +274,16 @@ IEnumerable<string> GetTestFrameworksForProjectFile(string projectFile)
275274
276275 Target Push => _ => _
277276 . DependsOn ( Pack )
278- . Requires ( ( ) => PublicMyGetSource )
279- . Requires ( ( ) => PublicMyGetApiKey )
277+ . Requires ( ( ) => DanglPublicFeedSource )
278+ . Requires ( ( ) => FeedzAccessToken )
280279 . Requires ( ( ) => NuGetApiKey )
281280 . Requires ( ( ) => Configuration . EqualsOrdinalIgnoreCase ( "Release" ) )
282281 . OnlyWhenDynamic ( ( ) => Jenkins . Instance == null
283282 || Jenkins . Instance . ChangeId == null )
284283 . Executes ( ( ) =>
285284 {
286- var packages = GlobFiles ( OutputDirectory , "*.nupkg" )
285+ var packages = OutputDirectory . GlobFiles ( "*.nupkg" )
286+ . Select ( p => p . ToString ( ) )
287287 . Where ( x => ! x . EndsWith ( "symbols.nupkg" ) )
288288 . ToList ( ) ;
289289 Assert . NotEmpty ( packages ) ;
@@ -292,8 +292,8 @@ IEnumerable<string> GetTestFrameworksForProjectFile(string projectFile)
292292 {
293293 DotNetNuGetPush ( s => s
294294 . SetTargetPath ( x )
295- . SetSource ( PublicMyGetSource )
296- . SetApiKey ( PublicMyGetApiKey ) ) ;
295+ . SetSource ( DanglPublicFeedSource )
296+ . SetApiKey ( FeedzAccessToken ) ) ;
297297
298298 if ( GitVersion . BranchName . Equals ( "master" ) || GitVersion . BranchName . Equals ( "origin/master" ) )
299299 {
@@ -376,7 +376,7 @@ IEnumerable<string> GetTestFrameworksForProjectFile(string projectFile)
376376 var completeChangeLog = $ "## { releaseTag } " + Environment . NewLine + latestChangeLog ;
377377
378378 var repositoryInfo = GetGitHubRepositoryInfo ( GitRepository ) ;
379- var nuGetPackages = GlobFiles ( OutputDirectory , "*.nupkg" ) . ToArray ( ) ;
379+ var nuGetPackages = OutputDirectory . GlobFiles ( "*.nupkg" ) . Select ( f => f . ToString ( ) ) . ToArray ( ) ;
380380 Assert . NotEmpty ( nuGetPackages ) ;
381381
382382 await PublishRelease ( x => x
@@ -391,7 +391,7 @@ await PublishRelease(x => x
391391
392392 void PrependFrameworkToTestresults ( )
393393 {
394- var testResults = GlobFiles ( OutputDirectory , "*testresults*.xml" ) . ToList ( ) ;
394+ var testResults = OutputDirectory . GlobFiles ( "*testresults*.xml" ) . ToList ( ) ;
395395 Serilog . Log . Debug ( $ "Found { testResults . Count } test result files on which to append the framework.") ;
396396 foreach ( var testResultFile in testResults )
397397 {
@@ -438,7 +438,7 @@ void PrependFrameworkToTestresults()
438438 }
439439
440440 firstXdoc . Save ( OutputDirectory / "testresults.xml" ) ;
441- testResults . ForEach ( DeleteFile ) ;
441+ testResults . ForEach ( d => d . DeleteFile ( ) ) ;
442442 }
443443
444444 string GetFrameworkNameFromFilename ( string filename )
@@ -454,9 +454,9 @@ string GetFrameworkNameFromFilename(string filename)
454454 . Executes ( ( ) =>
455455 {
456456 var ngAppDir = SourceDirectory / "ng-lightquery" ;
457- DeleteDirectory ( ngAppDir / "dist" ) ;
458- DeleteDirectory ( ngAppDir / "coverage" ) ;
459- DeleteFile ( ngAppDir / "karma-results.xml" ) ;
457+ ( ngAppDir / "dist" ) . DeleteDirectory ( ) ;
458+ ( ngAppDir / "coverage" ) . DeleteDirectory ( ) ;
459+ ( ngAppDir / "karma-results.xml" ) . DeleteFile ( ) ;
460460
461461 Npm ( "ci" , ngAppDir ) ;
462462 Npm ( "run test:ci" , ngAppDir ) ;
@@ -469,7 +469,7 @@ string GetFrameworkNameFromFilename(string filename)
469469 {
470470 var ngAppDir = SourceDirectory / "ng-lightquery" ;
471471 var ngLibraryDir = ngAppDir / "dist" / "ng-lightquery" ;
472- DeleteDirectory ( ngAppDir / "dist" ) ;
472+ ( ngAppDir / "dist" ) . DeleteDirectory ( ) ;
473473
474474 Npm ( "ci" , ngAppDir ) ;
475475
0 commit comments