1313[ ShutdownDotNetAfterServerBuild ]
1414class Build : NukeBuild
1515{
16- public static int Main ( ) => Execute < Build > ( x => x . Generate ) ;
16+ Solution Solution ;
17+
18+ public static int Main ( ) => Execute < Build > ( x => x . Compile ) ;
1719
1820 [ Parameter ( "NuGet API Key for io.juenger.GitLabClient Package" , Name = "NUGET_API_KEY_GITLABCLIENT" ) ]
1921 readonly string NuGetApiKey ;
@@ -51,27 +53,42 @@ class Build : NukeBuild
5153 . DependsOn ( Setup )
5254 . Executes ( ( ) =>
5355 {
54- // NpmTasks.Npm("exec @openapitools/openapi-generator-cli generate -g csharp-netcore " +
55- // "--additional-properties=targetFramework=net5.0 " +
56- // "--additional-properties=packageName=IO.Juenger.GitLabClient " +
57- // "-i ./openapi.yaml " +
58- // $"-o {OutputDirectory}");
59-
6056 OpenApiGeneratorCli ( "generate -g csharp-netcore " +
6157 "--additional-properties=targetFramework=net5.0 " +
6258 "--additional-properties=packageName=Io.Juenger.GitLabClient " +
6359 "-i ./openapi.yaml " +
6460 $ "-o { OutputDirectory } ") ;
61+
62+ var solutionFile = OutputDirectory / "Io.Juenger.GitLabClient.sln" ;
63+ Solution = ProjectModelTasks . ParseSolution ( solutionFile ) ;
6564 } ) ;
6665
67- Target Pack => _ => _
66+ Target Restore => _ => _
6867 . DependsOn ( Generate )
6968 . Executes ( ( ) =>
7069 {
71- var solutionFile = OutputDirectory / "Io.Juenger.GitLabClient.sln" ;
72- var solution = ProjectModelTasks . ParseSolution ( solutionFile ) ;
73-
74- var packableProjects = solution
70+ DotNetRestore ( settings => settings . SetProjectFile ( Solution ) ) ;
71+ } ) ;
72+
73+ Target Compile => _ => _
74+ . DependsOn ( Restore )
75+ . Executes ( ( ) =>
76+ {
77+ DotNetBuild ( settings =>
78+ settings
79+ . SetProjectFile ( Solution )
80+ . SetConfiguration ( Configuration )
81+ . SetAssemblyVersion ( GitVersion ? . AssemblySemVer )
82+ . SetFileVersion ( GitVersion ? . AssemblySemFileVer )
83+ . SetInformationalVersion ( GitVersion ? . InformationalVersion )
84+ . EnableNoRestore ( ) ) ;
85+ } ) ;
86+
87+ Target Pack => _ => _
88+ . DependsOn ( Compile )
89+ . Executes ( ( ) =>
90+ {
91+ var packableProjects = Solution
7592 . AllProjects
7693 . Where ( project => project . GetProperty < bool > ( "IsPackable" ) ) ?? Enumerable . Empty < Project > ( ) ;
7794
@@ -85,7 +102,7 @@ class Build : NukeBuild
85102 "This library provides client to GitLab's web API.\n " +
86103 "It is generated from an OpenAPI specification by using the tool openapi-generator-cli." )
87104 . SetAuthors ( "Christian Jünger" )
88- . SetProperty ( "PackageLicenseExpression" , "MIT" )
105+ // .SetProperty("PackageLicenseExpression", "MIT")
89106 . SetRepositoryUrl ( "https://github.com/cjuenger/gitlab-openapi" )
90107 . SetOutputDirectory ( PackageOutputDirectory )
91108 . SetConfiguration ( Configuration )
0 commit comments