@@ -5,7 +5,11 @@ using System.Threading.Tasks;
5
5
var target = Argument ( "target" , "Default" ) ;
6
6
var exercise = Argument < string > ( "exercise" , null ) ;
7
7
8
- var sourceDir = "./exercises" ;
8
+ var exercisesSourceDir = "./exercises" ;
9
+ var exercisesBuildDir = "./build/exercises" ;
10
+
11
+ var generatorsSourceDir = "./generators" ;
12
+
9
13
var buildDir = "./build" ;
10
14
11
15
var parallelOptions = new ParallelOptions
@@ -22,14 +26,14 @@ Task("Clean")
22
26
Task ( "CopyExercises" )
23
27
. IsDependentOn ( "Clean" )
24
28
. Does ( ( ) => {
25
- CopyDirectory ( $ "{ sourceDir } /{ exercise } ", $ "{ buildDir } /{ exercise } ") ;
29
+ CopyDirectory ( $ "{ exercisesSourceDir } /{ exercise } ", $ "{ exercisesBuildDir } /{ exercise } ") ;
26
30
} ) ;
27
31
28
32
Task ( "EnableAllTests" )
29
33
. IsDependentOn ( "CopyExercises" )
30
34
. Does ( ( ) => {
31
35
var skipRegex = new Regex ( @"Skip\s*=\s*""Remove to run test""" , RegexOptions . Compiled ) ;
32
- var testFiles = GetFiles ( buildDir + "/*/*Test.cs" ) ;
36
+ var testFiles = GetFiles ( exercisesBuildDir + "/*/*Test.cs" ) ;
33
37
34
38
foreach ( var testFile in testFiles ) {
35
39
var contents = System . IO . File . ReadAllText ( testFile . FullPath ) ;
@@ -47,17 +51,17 @@ Task("TestRefactoringProjects")
47
51
// These projects have a working default implementation, and have
48
52
// all the tests enabled. These should pass without any changes.
49
53
var refactoringProjects =
50
- GetFiles ( buildDir + "/*/TreeBuilding.csproj" )
51
- + GetFiles ( buildDir + "/*/Ledger.csproj" )
52
- + GetFiles ( buildDir + "/*/Markdown.csproj" ) ;
54
+ GetFiles ( exercisesBuildDir + "/*/TreeBuilding.csproj" )
55
+ + GetFiles ( exercisesBuildDir + "/*/Ledger.csproj" )
56
+ + GetFiles ( exercisesBuildDir + "/*/Markdown.csproj" ) ;
53
57
54
58
Parallel . ForEach ( refactoringProjects , parallelOptions , ( project ) => DotNetCoreTest ( project . FullPath ) ) ;
55
59
} ) ;
56
60
57
61
Task ( "ReplaceStubWithExample" )
58
62
. IsDependentOn ( "TestRefactoringProjects" )
59
63
. Does ( ( ) => {
60
- var allProjects = GetFiles ( buildDir + "/*/*.csproj" ) ;
64
+ var allProjects = GetFiles ( exercisesBuildDir + "/*/*.csproj" ) ;
61
65
62
66
foreach ( var project in allProjects ) {
63
67
var projectDir = project . GetDirectory ( ) ;
@@ -73,12 +77,18 @@ Task("ReplaceStubWithExample")
73
77
Task ( "TestUsingExampleImplementation" )
74
78
. IsDependentOn ( "ReplaceStubWithExample" )
75
79
. Does ( ( ) => {
76
- var allProjects = GetFiles ( buildDir + "/*/*.csproj" ) ;
80
+ var allProjects = GetFiles ( exercisesBuildDir + "/*/*.csproj" ) ;
77
81
Parallel . ForEach ( allProjects , parallelOptions , ( project ) => DotNetCoreTest ( project . FullPath ) ) ;
78
82
} ) ;
79
83
84
+ Task ( "BuildGeneratorsSolution" )
85
+ . Does ( ( ) => {
86
+ DotNetCoreBuild ( generatorsSourceDir + "/Generators.csproj" ) ;
87
+ } ) ;
88
+
80
89
Task ( "Default" )
81
90
. IsDependentOn ( "TestUsingExampleImplementation" )
91
+ . IsDependentOn ( "BuildGeneratorsSolution" )
82
92
. Does ( ( ) => { } ) ;
83
93
84
94
RunTarget ( target ) ;
0 commit comments