2
2
using static FileUtils ;
3
3
using System . Xml . Linq ;
4
4
5
- public static class BuildContext
6
- {
7
- static BuildContext ( )
8
- {
9
- Owner = "filipw" ;
10
- ProjectName = "dotnet-script" ;
11
- Root = FileUtils . GetScriptFolder ( ) ;
12
-
13
- DotnetScriptProjectFolder = Path . Combine ( Root , ".." , "src" , "Dotnet.Script" ) ;
14
- DotnetScriptCoreProjectFolder = Path . Combine ( Root , ".." , "src" , "Dotnet.Script.Core" ) ;
15
- DotnetScriptDependencyModelProjectFolder = Path . Combine ( Root , ".." , "src" , "Dotnet.Script.DependencyModel" ) ;
16
- DotnetScriptDependencyModelNuGetProjectFolder = Path . Combine ( Root , ".." , "src" , "Dotnet.Script.DependencyModel.NuGet" ) ;
17
- TestProjectFolder = Path . Combine ( Root , ".." , "src" , "Dotnet.Script.Tests" ) ;
18
-
19
- var artifactsFolder = CreateDirectory ( Root , "Artifacts" ) ;
20
- GitHubArtifactsFolder = CreateDirectory ( artifactsFolder , "GitHub" ) ;
21
- NuGetArtifactsFolder = CreateDirectory ( artifactsFolder , "NuGet" ) ;
22
- ChocolateyArtifactsFolder = CreateDirectory ( artifactsFolder , "Chocolatey" ) ;
23
- PublishArtifactsFolder = CreateDirectory ( artifactsFolder , "Publish" , ProjectName ) ;
24
- PublishArchiveFolder = Path . Combine ( PublishArtifactsFolder , ".." ) ;
25
-
26
- PathToReleaseNotes = Path . Combine ( GitHubArtifactsFolder , "ReleaseNotes.md" ) ;
27
-
28
- Version = ReadVersion ( ) ;
29
-
30
- PathToGitHubReleaseAsset = Path . Combine ( GitHubArtifactsFolder , $ "{ ProjectName } .{ Version } .zip") ;
31
-
32
- string ReadVersion ( )
33
- {
34
- var projectFile = XDocument . Load ( Directory . GetFiles ( DotnetScriptProjectFolder , "*.csproj" ) . Single ( ) ) ;
35
- var versionPrefix = projectFile . Descendants ( "VersionPrefix" ) . SingleOrDefault ( ) ? . Value ;
36
- var versionSuffix = projectFile . Descendants ( "VersionSuffix" ) . SingleOrDefault ( ) ? . Value ;
37
-
38
- if ( versionSuffix != null )
39
- {
40
- return $ "{ versionPrefix } -{ versionSuffix } ";
41
- }
42
- else
43
- {
44
- return versionPrefix ;
45
- }
46
- }
47
- }
5
+ private static string Version ;
6
+
7
+ public static string GitHubArtifactsFolder ;
8
+
9
+ public static string GitHubReleaseAsset ;
10
+
11
+ public static string GitHubReleaseNoteAsset ;
12
+
13
+ public static string NuGetArtifactsFolder ;
14
+
15
+ public static string ChocolateyArtifactsFolder ;
48
16
49
- private static string Version { get ; }
17
+ public static string PublishArtifactsFolder ;
50
18
51
- public static string GitHubArtifactsFolder { get ; }
19
+ public static string PublishArchiveFolder ;
52
20
53
- public static string GitHubReleaseAsset { get ; }
21
+ public static string DotnetScriptProjectFolder ;
54
22
55
- public static string GitHubReleaseNoteAsset { get ; }
23
+ public static string DotnetScriptCoreProjectFolder ;
56
24
57
- public static string NuGetArtifactsFolder { get ; }
25
+ public static string DotnetScriptDependencyModelProjectFolder ;
58
26
59
- public static string ChocolateyArtifactsFolder { get ; }
27
+ public static string DotnetScriptDependencyModelNuGetProjectFolder ;
60
28
61
- public static string PublishArtifactsFolder { get ; }
29
+ public static string Root ;
62
30
63
- public static string PublishArchiveFolder { get ; }
31
+ public static string TestProjectFolder ;
64
32
65
- public static string DotnetScriptProjectFolder { get ; }
33
+ public static string PathToReleaseNotes ;
66
34
67
- public static string DotnetScriptCoreProjectFolder { get ; }
35
+ public static string PathToGitHubReleaseAsset ;
68
36
69
- public static string DotnetScriptDependencyModelProjectFolder { get ; }
37
+ public static string Owner ;
70
38
71
- public static string DotnetScriptDependencyModelNuGetProjectFolder { get ; }
39
+ public static string ProjectName ;
72
40
73
- public static string Root { get ; }
41
+ Owner = "filipw" ;
42
+ ProjectName = "dotnet-script" ;
43
+ Root = FileUtils . GetScriptFolder ( ) ;
74
44
45
+ DotnetScriptProjectFolder = Path . Combine ( Root , ".." , "src" , "Dotnet.Script" ) ;
46
+ DotnetScriptCoreProjectFolder = Path . Combine ( Root , ".." , "src" , "Dotnet.Script.Core" ) ;
47
+ DotnetScriptDependencyModelProjectFolder = Path . Combine ( Root , ".." , "src" , "Dotnet.Script.DependencyModel" ) ;
48
+ DotnetScriptDependencyModelNuGetProjectFolder = Path . Combine ( Root , ".." , "src" , "Dotnet.Script.DependencyModel.NuGet" ) ;
49
+ TestProjectFolder = Path . Combine ( Root , ".." , "src" , "Dotnet.Script.Tests" ) ;
75
50
76
- public static string TestProjectFolder { get ; }
51
+ var artifactsFolder = CreateDirectory ( Root , "Artifacts" ) ;
52
+ GitHubArtifactsFolder = CreateDirectory ( artifactsFolder , "GitHub" ) ;
53
+ NuGetArtifactsFolder = CreateDirectory ( artifactsFolder , "NuGet" ) ;
54
+ ChocolateyArtifactsFolder = CreateDirectory ( artifactsFolder , "Chocolatey" ) ;
55
+ PublishArtifactsFolder = CreateDirectory ( artifactsFolder , "Publish" , ProjectName ) ;
56
+ PublishArchiveFolder = Path . Combine ( PublishArtifactsFolder , ".." ) ;
77
57
78
- public static string PathToReleaseNotes { get ; }
58
+ PathToReleaseNotes = Path . Combine ( GitHubArtifactsFolder , "ReleaseNotes.md" ) ;
79
59
80
- public static string PathToGitHubReleaseAsset { get ; }
81
- public static string Owner { get ; }
82
- public static string ProjectName { get ; }
83
- }
60
+ Version = ReadVersion ( ) ;
61
+
62
+ PathToGitHubReleaseAsset = Path . Combine ( GitHubArtifactsFolder , $ "{ ProjectName } .{ Version } .zip") ;
63
+
64
+ string ReadVersion ( )
65
+ {
66
+ var projectFile = XDocument . Load ( Directory . GetFiles ( DotnetScriptProjectFolder , "*.csproj" ) . Single ( ) ) ;
67
+ var versionPrefix = projectFile . Descendants ( "VersionPrefix" ) . SingleOrDefault ( ) ? . Value ;
68
+ var versionSuffix = projectFile . Descendants ( "VersionSuffix" ) . SingleOrDefault ( ) ? . Value ;
69
+
70
+ if ( versionSuffix != null )
71
+ {
72
+ return $ "{ versionPrefix } -{ versionSuffix } ";
73
+ }
74
+ else
75
+ {
76
+ return versionPrefix ;
77
+ }
78
+ }
0 commit comments