@@ -5,7 +5,6 @@ namespace DotNetNuke.Build
55{
66 using System ;
77 using System . Globalization ;
8- using System . IO ;
98
109 using Cake . Common ;
1110 using Cake . Common . Build ;
@@ -19,8 +18,6 @@ namespace DotNetNuke.Build
1918 using Cake . Frosting ;
2019 using Cake . Json ;
2120
22- using Path = System . IO . Path ;
23-
2421 /// <inheritdoc />
2522 public class Context : FrostingContext
2623 {
@@ -45,30 +42,26 @@ public Context(ICakeContext context)
4542 //////////////////////////////////////////////////////////////////////
4643
4744 // Define directories.
48- this . RootFolder = "./" ;
49- this . RootDir = context . MakeAbsolute ( context . Directory ( this . RootFolder ) ) ;
45+ this . RootDir = context . MakeAbsolute ( context . Directory ( "./" ) ) ;
5046 context . Verbose ( $ "RootDir: { this . RootDir } ") ;
5147
52- this . TempFolder = "./Temp/" ;
53- this . TempDir = context . Directory ( this . TempFolder ) ;
48+ this . TempDir = context . Directory ( "./Temp/" ) ;
5449 context . Information ( $ "TempDir: { this . TempDir } ") ;
5550
56- this . ArtifactsFolder = "./Artifacts/" ;
57- this . ArtifactsDir = context . Directory ( this . ArtifactsFolder ) ;
51+ this . ArtifactsDir = context . Directory ( "./Artifacts/" ) ;
5852 context . Information ( $ "ArtifactsDir: { this . ArtifactsDir } ") ;
5953
60- this . WebsiteFolder = "./Website/" ;
61- this . WebsiteDir = context . Directory ( this . WebsiteFolder ) ;
54+ this . WebsiteDir = context . Directory ( "./Website/" ) ;
6255 context . Information ( $ "WebsiteDir: { this . WebsiteDir } ") ;
6356
6457 // Global information variables
6558 this . IsRunningInCI = false ;
6659
67- this . DnnSolutionPath = "./DNN_Platform.sln" ;
60+ this . DnnSolutionPath = context . File ( "./DNN_Platform.sln" ) ;
6861
6962 this . SqlDataProviderExists = false ;
7063
71- const string settingsFile = "./settings.local.json" ;
64+ var settingsFile = context . File ( "./settings.local.json" ) ;
7265 this . Settings = LoadSettings ( context , settingsFile ) ;
7366 this . WriteSettings ( context , settingsFile ) ;
7467
@@ -101,35 +94,23 @@ public Context(ICakeContext context)
10194 public bool SqlDataProviderExists { get ; set ; }
10295
10396 /// <summary>Gets or sets the path to the DNN solution.</summary>
104- public string DnnSolutionPath { get ; set ; }
97+ public FilePath DnnSolutionPath { get ; set ; }
10598
10699 /// <summary>Gets or sets a value indicating whether this build is running in a CI environment.</summary>
107100 public bool IsRunningInCI { get ; set ; }
108101
109102 /// <summary>Gets or sets the path to the root of the repository.</summary>
110103 public DirectoryPath RootDir { get ; set ; }
111104
112- /// <summary>Gets or sets the relative path to the root of the repository.</summary>
113- public string RootFolder { get ; set ; }
114-
115105 /// <summary>Gets or sets the path to the website directory.</summary>
116106 public ConvertableDirectoryPath WebsiteDir { get ; set ; }
117107
118- /// <summary>Gets or sets the relative path to the website directory.</summary>
119- public string WebsiteFolder { get ; set ; }
120-
121108 /// <summary>Gets or sets the path to the artifacts directory.</summary>
122109 public ConvertableDirectoryPath ArtifactsDir { get ; set ; }
123110
124- /// <summary>Gets or sets the relative path to the artifacts directory.</summary>
125- public string ArtifactsFolder { get ; set ; }
126-
127111 /// <summary>Gets or sets the path to the temp directory.</summary>
128112 public ConvertableDirectoryPath TempDir { get ; set ; }
129113
130- /// <summary>Gets or sets the relative path to the temp directory.</summary>
131- public string TempFolder { get ; set ; }
132-
133114 /// <summary>Gets or sets the build configuration, e.g. Debug or Release.</summary>
134115 public string BuildConfiguration { get ; set ; }
135116
@@ -176,22 +157,22 @@ public string GetProductVersion()
176157 return this . ProductVersion ;
177158 }
178159
179- private static LocalSettings LoadSettings ( ICakeContext context , string settingsFile )
160+ private static LocalSettings LoadSettings ( ICakeContext context , FilePath settingsFile )
180161 {
181- if ( File . Exists ( settingsFile ) )
162+ if ( context . FileExists ( settingsFile ) )
182163 {
183- context . Information ( ( FormattableLogActionEntry log ) => log ( $ "Loading settings from { Path . GetFullPath ( settingsFile ) } ") ) ;
164+ context . Information ( ( FormattableLogActionEntry log ) => log ( $ "Loading settings from { settingsFile . FullPath } ") ) ;
184165 return context . DeserializeJsonFromFile < LocalSettings > ( settingsFile ) ;
185166 }
186167
187- context . Information ( ( FormattableLogActionEntry log ) => log ( $ "Did not find settings file { Path . GetFullPath ( settingsFile ) } ") ) ;
168+ context . Information ( ( FormattableLogActionEntry log ) => log ( $ "Did not find settings file { settingsFile . FullPath } ") ) ;
188169 return new LocalSettings ( ) ;
189170 }
190171
191- private void WriteSettings ( ICakeContext context , string settingsFile )
172+ private void WriteSettings ( ICakeContext context , FilePath settingsFile )
192173 {
193174 context . SerializeJsonToPrettyFile ( settingsFile , this . Settings ) ;
194- context . Information ( ( FormattableLogActionEntry log ) => log ( $ "Saved settings to { Path . GetFullPath ( settingsFile ) } ") ) ;
175+ context . Information ( ( FormattableLogActionEntry log ) => log ( $ "Saved settings to { settingsFile . FullPath } ") ) ;
195176 context . Debug ( log => log ( "{0}" , $ "Settings: { context . SerializeJson ( this . Settings ) } ") ) ;
196177 }
197178 }
0 commit comments