25
25
using static Nuke . Common . Tools . Git . GitTasks ;
26
26
using static Nuke . Common . Tools . MSBuild . MSBuildTasks ;
27
27
using Nuke . Common . CI ;
28
+ using System . ComponentModel . Design . Serialization ;
28
29
29
30
[ GitHubActions (
30
31
name : "Build" ,
@@ -56,31 +57,30 @@ class Build : NukeBuild
56
57
57
58
58
59
readonly string ModuleName = "Dnn.Modules.ModuleCreator" ;
59
- readonly IReadOnlyCollection < string > InstallFiles ;
60
- readonly IReadOnlyCollection < string > BinaryFiles ;
61
- readonly bool IsInDesktopModules ;
62
- readonly AbsolutePath ArtifactsDirectory ;
63
- readonly AbsolutePath StagingDirectory ;
64
- readonly AbsolutePath DeployDirectory ;
65
- readonly AbsolutePath DnnModuleInstallDirectory ;
60
+ IReadOnlyCollection < string > InstallFiles ;
61
+ IReadOnlyCollection < string > BinaryFiles ;
62
+ bool IsInDesktopModules ;
63
+ readonly AbsolutePath ArtifactsDirectory = RootDirectory / "Artifacts" ;
64
+ readonly AbsolutePath StagingDirectory = RootDirectory / "Artifacts" / "Staging" ;
65
+ readonly AbsolutePath DeployDirectory = RootDirectory . Parent / "Admin" / "ModuleCreator" ;
66
+ readonly AbsolutePath DnnModuleInstallDirectory = RootDirectory . Parent . Parent / "Install" / "Module" ;
66
67
string ModuleBranch ;
67
68
68
- public Build ( )
69
- {
70
- using ( var block = Logger . Block ( "Info" ) )
69
+ Target SetupVariables => _ => _
70
+ . Before ( Package )
71
+ . Executes ( ( ) =>
71
72
{
72
- Logger . Normal ( Configuration ) ;
73
- }
74
- InstallFiles = GlobFiles ( RootDirectory , "*.txt" , "*.dnn" ) ;
75
- ArtifactsDirectory = RootDirectory / "Artifacts" ;
76
- StagingDirectory = ArtifactsDirectory / "Staging" ;
77
- BinaryFiles = GlobFiles ( RootDirectory / "bin" / Configuration . ToString ( ) , $ "{ ModuleName } .dll") ;
78
- IsInDesktopModules = RootDirectory . Parent . ToString ( ) . EndsWith ( "DesktopModules" ) ;
79
- DeployDirectory = IsInDesktopModules ? RootDirectory . Parent / "Admin" / "ModuleCreator" : null ;
80
- DnnModuleInstallDirectory = RootDirectory . Parent . Parent / "Install" / "Module" ;
81
- }
73
+ using ( var block = Logger . Block ( "Info" ) )
74
+ {
75
+ Logger . Normal ( Configuration ) ;
76
+ }
77
+ InstallFiles = GlobFiles ( RootDirectory , "*.txt" , "*.dnn" ) ;
78
+ BinaryFiles = GlobFiles ( RootDirectory / "bin" / Configuration . ToString ( ) , $ "{ ModuleName } .dll") ;
79
+ IsInDesktopModules = RootDirectory . Parent . ToString ( ) . EndsWith ( "DesktopModules" ) ;
80
+ } ) ;
82
81
83
82
Target Clean => _ => _
83
+ . DependsOn ( SetupVariables )
84
84
. Before ( Restore )
85
85
. Before ( Package )
86
86
. Executes ( ( ) =>
@@ -89,6 +89,7 @@ public Build()
89
89
} ) ;
90
90
91
91
Target Restore => _ => _
92
+ . DependsOn ( SetupVariables )
92
93
. Executes ( ( ) =>
93
94
{
94
95
var project = Solution . GetProject ( ModuleName ) ;
@@ -97,6 +98,7 @@ public Build()
97
98
} ) ;
98
99
99
100
Target SetManifestVersions => _ => _
101
+ . DependsOn ( SetupVariables )
100
102
. Executes ( ( ) =>
101
103
{
102
104
var manifests = GlobFiles ( RootDirectory , "**/*.dnn" ) ;
@@ -124,6 +126,7 @@ public Build()
124
126
Target TagRelease => _ => _
125
127
. OnlyWhenDynamic ( ( ) => ModuleBranch == "main" || ModuleBranch . StartsWith ( "release" ) )
126
128
. OnlyWhenDynamic ( ( ) => ! string . IsNullOrEmpty ( GithubToken ) )
129
+ . DependsOn ( SetupVariables )
127
130
. DependsOn ( SetBranch )
128
131
. Executes ( ( ) =>
129
132
{
@@ -149,6 +152,7 @@ public Build()
149
152
} ) ;
150
153
151
154
Target SetBranch => _ => _
155
+ . DependsOn ( SetupVariables )
152
156
. Executes ( ( ) =>
153
157
{
154
158
ModuleBranch = GitRepository . Branch . StartsWith ( "refs/" ) ? GitRepository . Branch . Substring ( 11 ) : GitRepository . Branch ;
@@ -167,7 +171,9 @@ public Build()
167
171
. Produces ( ArtifactsDirectory / "*.zip" )
168
172
. Executes ( ( ) =>
169
173
{
170
- Logger . Normal ( "Configuration: " , Configuration . ToString ( ) ) ;
174
+ var configuration = IsLocalBuild ? "Debug" : "Release" ;
175
+ Logger . Normal ( IsLocalBuild ) ;
176
+ Logger . Normal ( "Configuration: " , configuration ) ;
171
177
EnsureCleanDirectory ( StagingDirectory ) ;
172
178
Compress ( RootDirectory , StagingDirectory / "Resources.zip" , f =>
173
179
f . Extension == ".ascx" ||
@@ -177,7 +183,7 @@ public Build()
177
183
f . Extension == ".css" ||
178
184
f . Directory . ToString ( ) . Contains ( "Templates" ) ) ;
179
185
180
- var symbolFiles = GlobFiles ( RootDirectory / "bin" / Configuration . ToString ( ) , $ "{ ModuleName } .pdb") ;
186
+ var symbolFiles = GlobFiles ( RootDirectory / "bin" / configuration . ToString ( ) , $ "{ ModuleName } .pdb") ;
181
187
Logger . Normal ( "Symbol Files: " , symbolFiles ) ;
182
188
Helpers . AddFilesToZip ( StagingDirectory / "Symbols.zip" , symbolFiles ) ;
183
189
0 commit comments