1
- #tool "nuget:?package=GitVersion.CommandLine&prerelease&version=4.0.0-beta0012"
2
- #tool "nuget:?package=xunit.runner.console"
3
- #tool "nuget:?package=JetBrains.dotCover.CommandLineTools&version=2018.1.0"
4
- #load "tasks/variables.cake" ;
5
-
6
- var target = Argument ( "target" , "Default" ) ;
7
- var configuration = Argument ( "configuration" , "Release" ) ;
8
- var artifacts = new DirectoryPath ( "./artifacts" ) . MakeAbsolute ( Context . Environment ) ;
9
-
10
- Task ( "Clean" )
11
- . Does ( ( ) =>
12
- {
13
- EnsureDirectoryExists ( artifacts ) ;
14
- CleanDirectory ( artifacts ) ;
15
- } ) ;
1
+ #load "nuget:?package=Rocket.Surgery.Cake.Library&version=0.8.6" ;
16
2
17
3
Task ( "Submodules" )
18
4
. Does ( ( ) => {
@@ -34,149 +20,9 @@ Task("Embed MediatR")
34
20
}
35
21
} ) ;
36
22
37
- Task ( "Restore (Unix)" )
38
- . WithCriteria ( IsRunningOnUnix )
39
- . Does ( ( ) =>
40
- {
41
- MSBuild ( "./LSP.sln" , settings => settings . SetConfiguration ( configuration ) . WithTarget ( "Restore" ) ) ;
42
- } ) ;
43
-
44
- Task ( "Restore (Windows)" )
45
- . WithCriteria ( IsRunningOnWindows )
46
- . Does ( ( ) =>
47
- {
48
- DotNetCoreRestore ( ) ;
49
- } ) ;
50
-
51
- Task ( "Restore" )
52
- . IsDependentOn ( "Restore (Unix)" )
53
- . IsDependentOn ( "Restore (Windows)" ) ;
54
-
55
- Task ( "Build" )
56
- . IsDependentOn ( "Restore" )
57
- . DoesForEach ( GetFiles ( "src/**/*.csproj" ) . Concat ( GetFiles ( "test/**/*.csproj" ) ) , ( project ) =>
58
- {
59
- MSBuild ( project , settings =>
60
- settings
61
- . SetConfiguration ( configuration )
62
- . WithTarget ( "Build" ) ) ;
63
- } ) ;
64
-
65
- Task ( "TestSetup" )
66
- . Does ( ( ) => {
67
- CleanDirectory ( artifacts + "/tests" ) ;
68
- CleanDirectory ( artifacts + "/coverage" ) ;
69
- EnsureDirectoryExists ( artifacts + "/tests" ) ;
70
- EnsureDirectoryExists ( artifacts + "/coverage" ) ;
71
- } ) ;
72
-
73
- Task ( "Test (Unix)" )
74
- . WithCriteria ( IsRunningOnUnix )
75
- . IsDependentOn ( "TestSetup" )
76
- . IsDependentOn ( "Build" )
77
- . DoesForEach ( GetFiles ( "test/*/*.csproj" ) , ( testProject ) =>
78
- {
79
- DotNetCoreTest (
80
- testProject . GetDirectory ( ) . FullPath ,
81
- new DotNetCoreTestSettings ( ) {
82
- NoBuild = true ,
83
- Configuration = configuration ,
84
- Framework = "netcoreapp2.1" ,
85
- EnvironmentVariables = GitVersionEnvironmentVariables ,
86
- TestAdapterPath = "." ,
87
- Logger = $ "\" xunit;LogFilePath={ string . Format ( "{0}/tests/{1}.xml" , artifacts , testProject . GetFilenameWithoutExtension ( ) ) } \" ",
88
- ArgumentCustomization = args => args . Append ( "/p:CollectCoverage=true" ) ,
89
- }
90
- ) ;
91
- } ) ;
92
-
93
- Task ( "Test (Windows)" )
94
- . WithCriteria ( IsRunningOnWindows )
95
- . IsDependentOn ( "TestSetup" )
96
- . IsDependentOn ( "Build" )
97
- . DoesForEach ( GetFiles ( "test/*/*.csproj" ) , ( testProject ) =>
98
- {
99
- DotCoverCover ( tool => {
100
- tool . DotNetCoreTest (
101
- testProject . GetDirectory ( ) . FullPath ,
102
- new DotNetCoreTestSettings ( ) {
103
- NoBuild = true ,
104
- Configuration = configuration ,
105
- Framework = "netcoreapp2.1" ,
106
- EnvironmentVariables = GitVersionEnvironmentVariables ,
107
- TestAdapterPath = "." ,
108
- Logger = $ "\" xunit;LogFilePath={ string . Format ( "{0}/tests/{1}.xml" , artifacts , testProject . GetFilenameWithoutExtension ( ) ) } \" ",
109
- // ArgumentCustomization = args => args.Append("/p:CollectCoverage=true"),
110
- } ) ;
111
- } ,
112
- artifacts + "/coverage/coverage-" + testProject . GetFilenameWithoutExtension ( ) + ".dcvr" ,
113
- new DotCoverCoverSettings ( ) {
114
- TargetWorkingDir = testProject . GetDirectory ( ) ,
115
- WorkingDirectory = testProject . GetDirectory ( ) ,
116
- EnvironmentVariables = GitVersionEnvironmentVariables ,
117
- }
118
- . WithFilter ( "+:OmniSharp.*" )
119
- ) ;
120
- } )
121
- . Finally ( ( ) => {
122
- DotCoverMerge (
123
- GetFiles ( artifacts + "/coverage/*.dcvr" ) ,
124
- artifacts + "/coverage/coverage.dcvr"
125
- ) ;
126
-
127
- DotCoverReport (
128
- artifacts + "/coverage/coverage.dcvr" ,
129
- new FilePath ( artifacts + "/coverage/coverage.html" ) ,
130
- new DotCoverReportSettings {
131
- ReportType = DotCoverReportType . HTML
132
- }
133
- ) ;
134
-
135
- DotCoverReport (
136
- artifacts + "/coverage/coverage.dcvr" ,
137
- new FilePath ( artifacts + "/coverage/coverage.xml" ) ,
138
- new DotCoverReportSettings {
139
- ReportType = DotCoverReportType . DetailedXML
140
- }
141
- ) ;
142
-
143
- var withBom = System . IO . File . ReadAllText ( artifacts + "/coverage/coverage.xml" ) ;
144
- System . IO . File . WriteAllText ( artifacts + "/coverage/coverage.xml" , withBom . Replace ( _byteOrderMarkUtf8 , "" ) ) ;
145
- } ) ;
146
-
147
- Task ( "Test" )
148
- . IsDependentOn ( "Test (Unix)" )
149
- . IsDependentOn ( "Test (Windows)" ) ;
150
-
151
- Task ( "Pack" )
152
- . WithCriteria ( IsRunningOnWindows ) // TODO: Make work on travis
153
- . IsDependentOn ( "Build" )
154
- . Does ( ( ) => EnsureDirectoryExists ( artifacts + "/nuget" ) )
155
- . DoesForEach ( GetFiles ( "src/*/*.csproj" ) , ( project ) => {
156
- DotNetCorePack ( project . FullPath , new DotNetCorePackSettings
157
- {
158
- NoBuild = true ,
159
- IncludeSymbols = true ,
160
- Configuration = configuration ,
161
- EnvironmentVariables = GitVersionEnvironmentVariables ,
162
- OutputDirectory = artifacts + "/nuget"
163
- } ) ;
164
- } ) ;
165
-
166
- Task ( "GitVersion" )
167
- . Does ( ( ) => {
168
- GitVersion ( new GitVersionSettings ( ) {
169
- OutputType = GitVersionOutput . BuildServer
170
- } ) ;
171
- } ) ;
172
-
173
23
Task ( "Default" )
174
24
. IsDependentOn ( "Submodules" )
175
25
. IsDependentOn ( "Embed MediatR" )
176
- . IsDependentOn ( "GitVersion" )
177
- . IsDependentOn ( "Clean" )
178
- . IsDependentOn ( "Build" )
179
- . IsDependentOn ( "Test" )
180
- . IsDependentOn ( "Pack" ) ;
26
+ . IsDependentOn ( "dotnetcore" ) ;
181
27
182
- RunTarget ( target ) ;
28
+ RunTarget ( Target ) ;
0 commit comments