@@ -39,8 +39,7 @@ partial class Build : NukeBuild
3939 [ Parameter ( "Configuration to build - Default is 'Debug' (local) or 'Release' (server)" ) ]
4040 readonly Configuration Configuration = IsLocalBuild ? Configuration . Debug : Configuration . Release ;
4141
42-
43- [ Solution ] readonly Solution Solution ;
42+ [ Solution ( GenerateProjects = true ) ] readonly Solution Solution ;
4443 [ GitRepository ] readonly GitRepository GitRepository ;
4544 [ GitVersion ( UpdateBuildNumber = true ) ]
4645 readonly Nuke . Common . Tools . GitVersion . GitVersion GitVersion ;
@@ -63,6 +62,8 @@ partial class Build : NukeBuild
6362
6463 AbsolutePath SetupDirectory => BinDirectory / "SetupFiles" ;
6564
65+ AbsolutePath LicenseDirectory => RootDirectory / "Licenses" ;
66+
6667 AbsolutePath InnoSetupScript => SourceDirectory / "setup" / "LogExpertInstaller.iss" ;
6768
6869 string SetupCommandLineParameter => $ "/dAppVersion=\" { VersionString } \" /O\" { BinDirectory } \" /F\" LogExpert-Setup-{ VersionString } \" ";
@@ -78,7 +79,7 @@ Version Version
7879 patch = AppVeyor . Instance . BuildNumber ;
7980 }
8081
81- return new Version ( 1 , 20 , 0 , patch ) ;
82+ return new Version ( 1 , 21 , 0 , patch ) ;
8283 }
8384 }
8485
@@ -97,7 +98,7 @@ Version Version
9798
9899 [ PathVariable ( "choco.exe" ) ] readonly Tool Chocolatey ;
99100
100- [ Parameter ( "Exlcude directory glob" ) ]
101+ [ Parameter ( "Exclude directory glob" ) ]
101102 string [ ] ExcludeDirectoryGlob => [ "**/pluginsx86" ] ;
102103
103104 [ Parameter ( "My variable" , Name = "my_variable" ) ] string MyVariable = null ;
@@ -289,8 +290,8 @@ protected override void OnBuildInitialized ()
289290 {
290291 string [ ] files = [ "SftpFileSystem.dll" , "Renci.SshNet.dll" ] ;
291292
292- OutputDirectory . GlobFiles ( files . Select ( a => $ "plugins/{ a } ") . ToArray ( ) ) . ForEach ( file => file . CopyToDirectory ( SftpFileSystemPackagex64 , ExistsPolicy . FileOverwrite ) ) ;
293- OutputDirectory . GlobFiles ( files . Select ( a => $ "pluginsx86/{ a } ") . ToArray ( ) ) . ForEach ( file => file . CopyToDirectory ( SftpFileSystemPackagex86 , ExistsPolicy . FileOverwrite ) ) ;
293+ OutputDirectory . GlobFiles ( [ .. files . Select ( a => $ "plugins/{ a } ") ] ) . ForEach ( file => file . CopyToDirectory ( SftpFileSystemPackagex64 , ExistsPolicy . FileOverwrite ) ) ;
294+ OutputDirectory . GlobFiles ( [ .. files . Select ( a => $ "pluginsx86/{ a } ") ] ) . ForEach ( file => file . CopyToDirectory ( SftpFileSystemPackagex86 , ExistsPolicy . FileOverwrite ) ) ;
294295
295296 CompressionExtensions . ZipTo ( SftpFileSystemPackagex64 , BinDirectory / $ "SftpFileSystem.x64.{ VersionString } .zip") ;
296297 CompressionExtensions . ZipTo ( SftpFileSystemPackagex86 , BinDirectory / $ "SftpFileSystem.x86.{ VersionString } .zip") ;
@@ -326,7 +327,7 @@ protected override void OnBuildInitialized ()
326327 } ) ;
327328
328329 Target Pack => _ => _
329- . DependsOn ( BuildChocolateyPackage , CreatePackage , PackageSftpFileSystem , ColumnizerLibCreate ) ;
330+ . DependsOn ( BuildChocolateyPackage , CreatePackage , PackageSftpFileSystem , ColumnizerLibCreate , CopyLicenses ) ;
330331
331332 Target CopyFilesForSetup => _ => _
332333 . DependsOn ( Compile )
@@ -384,7 +385,6 @@ protected override void OnBuildInitialized ()
384385 {
385386 s = s . SetApiKey ( NugetApiKey )
386387 . SetSource ( "https://api.nuget.org/v3/index.json" )
387- . SetApiKey ( NugetApiKey )
388388 . SetTargetPath ( file ) ;
389389
390390 return s ;
@@ -410,19 +410,19 @@ protected override void OnBuildInitialized ()
410410 . Requires ( ( ) => GitHubApiKey )
411411 . Executes ( ( ) =>
412412 {
413- var repositoryInfo = GetGitHubRepositoryInfo ( GitRepository ) ;
413+ var ( gitHubOwner , repositoryName ) = GetGitHubRepositoryInfo ( GitRepository ) ;
414414
415415 Task task = PublishRelease ( s => s
416- . SetArtifactPaths ( BinDirectory . GlobFiles ( "**/*.zip" , "**/*.nupkg" , "**/LogExpert-Setup*.exe" ) . Select ( a => a . ToString ( ) ) . ToArray ( ) )
416+ . SetArtifactPaths ( [ .. BinDirectory . GlobFiles ( "**/*.zip" , "**/*.nupkg" , "**/LogExpert-Setup*.exe" ) . Select ( a => a . ToString ( ) ) ] )
417417 . SetCommitSha ( GitVersion . Sha )
418418 . SetReleaseNotes ( $ "# Changes\r \n " +
419419 $ "# Bugfixes\r \n " +
420420 $ "# Contributors\r \n " +
421421 $ "Thanks to the contributors!\r \n " +
422422 $ "# Infos\r \n " +
423423 $ "It might be necessary to unblock the Executables / Dlls to get everything working, especially Plugins (see #55, #13, #8).")
424- . SetRepositoryName ( repositoryInfo . repositoryName )
425- . SetRepositoryOwner ( repositoryInfo . gitHubOwner )
424+ . SetRepositoryName ( repositoryName )
425+ . SetRepositoryOwner ( gitHubOwner )
426426 . SetTag ( $ "v{ VersionString } ")
427427 . SetToken ( GitHubApiKey )
428428 . SetName ( VersionString )
@@ -479,6 +479,25 @@ protected override void OnBuildInitialized ()
479479 logExpertDocuments . DeleteDirectory ( ) ;
480480 } ) ;
481481
482+ Target CopyLicenses => _ => _
483+ . DependsOn ( Compile )
484+ . Executes ( ( ) =>
485+ {
486+ if ( LicenseDirectory . DirectoryExists ( ) )
487+ {
488+ Log . Information ( "Copying license files to output directory" ) ;
489+
490+ // Copy to main output directory
491+ LicenseDirectory . Copy ( OutputDirectory / "Licenses" , ExistsPolicy . MergeAndOverwriteIfNewer ) ;
492+
493+ Log . Information ( $ "Licenses copied to { OutputDirectory / "Licenses" } ") ;
494+ }
495+ else
496+ {
497+ Log . Warning ( $ "License directory not found at: { LicenseDirectory } ") ;
498+ }
499+ } ) ;
500+
482501 private void ExecuteInnoSetup ( AbsolutePath innoPath )
483502 {
484503 Process proc = new ( ) ;
@@ -497,7 +516,7 @@ private void ExecuteInnoSetup (AbsolutePath innoPath)
497516
498517 if ( proc . ExitCode != 0 )
499518 {
500- Nuke . Common . Assert . True ( true , $ "Error during execution of { innoPath } , exitcode { proc . ExitCode } ") ;
519+ Assert . True ( true , $ "Error during execution of { innoPath } , exitcode { proc . ExitCode } ") ;
501520 }
502521 }
503522
@@ -511,7 +530,7 @@ private void TransformTemplateFile (AbsolutePath path, bool deleteTemplate)
511530 string text = path . ReadAllText ( ) ;
512531 text = text . Replace ( "##version##" , VersionString ) ;
513532
514- AbsolutePath template = $ "{ Regex . Replace ( path , " \\ .template$" , "" ) } ";
533+ AbsolutePath template = $ "{ TemplateRegex ( ) . Replace ( path , "" ) } ";
515534 template . WriteAllText ( text ) ;
516535 if ( deleteTemplate )
517536 {
@@ -533,4 +552,7 @@ private void TransformTemplateFile (AbsolutePath path, bool deleteTemplate)
533552
534553 [ GeneratedRegex ( @"\w\w{2}[_]p?[tso]?[erzliasx]+[_rhe]{5}" , RegexOptions . IgnoreCase , "en-GB" ) ]
535554 private static partial Regex SFTPPlugin ( ) ;
555+
556+ [ GeneratedRegex ( "\\ .template$" ) ]
557+ private static partial Regex TemplateRegex ( ) ;
536558}
0 commit comments