Skip to content

Commit 10c9164

Browse files
Add .NET CLI support
1 parent 76fb465 commit 10c9164

120 files changed

Lines changed: 2284 additions & 695 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ bin/configlet.exe
66
.fake/
77
.paket/paket.exe
88
.vs/
9+
.vscode/
910
tools/
1011
build/
1112
packages/
1213
paket-files
1314
TestResult.xml
1415
junit-results.xml
15-
exercises/obj/
16-
exercises/bin/
16+
obj/
17+
bin/

build.fsx

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,48 @@
1-
// Include Fake library
21
#r "./packages/FAKE/tools/FakeLib.dll"
32

43
open Fake
5-
open Fake.Testing.XUnit2
4+
open Fake.DotNetCli
65

7-
// Directories
8-
let buildDir = "./build/"
9-
let sourceDir = "./exercises/"
6+
let buildDir = "./build/"
7+
let sourceDir = "./exercises/"
8+
let projects = !! (buildDir @@ "*/*.csproj")
9+
let tests = !! (buildDir @@ "**/*Test.cs")
1010

11-
// Files
12-
let solutionFile = buildDir @@ "/exercises.csproj"
13-
let compiledOutput = buildDir @@ "xcsharp.dll"
11+
let restore project = DotNetCli.Restore (fun p ->
12+
{ p with NoCache = true
13+
Project = project })
1414

15-
// Targets
16-
Target "PrepareUnchanged" (fun _ ->
17-
CleanDirs [buildDir]
18-
CopyDir buildDir sourceDir allFiles
19-
)
15+
let build project = DotNetCli.Build (fun p ->
16+
{ p with Project = project })
2017

21-
Target "BuildUnchanged" (fun _ ->
22-
MSBuildRelease buildDir "Build" [solutionFile]
23-
|> Log "Build unchanged output: "
24-
)
18+
let test project = DotNetCli.Test (fun p ->
19+
{ p with Project = project })
2520

26-
Target "PrepareTests" (fun _ ->
27-
CleanDirs [buildDir]
28-
CopyDir buildDir sourceDir allFiles
21+
let restoreAndBuild project =
22+
restore project
23+
build project
2924

30-
let ignorePattern = "Skip\s*=\s*\"Remove to run test\""
25+
let restoreAndTest project =
26+
restore project
27+
test project
3128

32-
!! (buildDir @@ "**/*Test.cs")
33-
|> RegexReplaceInFilesWithEncoding ignorePattern "" System.Text.Encoding.UTF8
29+
Target "Clean" (fun _ ->
30+
CleanDirs [buildDir]
3431
)
3532

36-
Target "BuildTests" (fun _ ->
37-
MSBuildRelease buildDir "Build" [solutionFile]
38-
|> Log "Build tests output: "
33+
Target "Copy" (fun _ ->
34+
CopyDir buildDir sourceDir allFiles
3935
)
4036

4137
Target "Test" (fun _ ->
42-
[compiledOutput]
43-
|> xUnit2 (fun p -> { p with ShadowCopy = false })
38+
let ignorePattern = "Skip\s*=\s*\"Remove to run test\""
39+
RegexReplaceInFilesWithEncoding ignorePattern "" System.Text.Encoding.UTF8 tests
40+
41+
Seq.iter restoreAndTest projects
4442
)
4543

46-
// Build order
47-
"PrepareUnchanged"
48-
==> "BuildUnchanged"
49-
==> "PrepareTests"
50-
==> "BuildTests"
44+
"Clean"
45+
==> "Copy"
5146
==> "Test"
5247

53-
// start build
5448
RunTargetOrDefault "Test"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp1.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170210-02" />
10+
<PackageReference Include="xunit" Version="2.2.0-rc1-build3507" />
11+
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-rc1-build1247" />
12+
</ItemGroup>
13+
14+
</Project>

exercises/acronym/acronym.csproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp1.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170210-02" />
10+
<PackageReference Include="xunit" Version="2.2.0-rc1-build3507" />
11+
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-rc1-build1247" />
12+
</ItemGroup>
13+
14+
</Project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp1.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170210-02" />
10+
<PackageReference Include="xunit" Version="2.2.0-rc1-build3507" />
11+
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-rc1-build1247" />
12+
</ItemGroup>
13+
14+
</Project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp1.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170210-02" />
10+
<PackageReference Include="xunit" Version="2.2.0-rc1-build3507" />
11+
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-rc1-build1247" />
12+
</ItemGroup>
13+
14+
</Project>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp1.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170210-02" />
10+
<PackageReference Include="xunit" Version="2.2.0-rc1-build3507" />
11+
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-rc1-build1247" />
12+
<PackageReference Include="Sprache" Version="2.1.0" />
13+
</ItemGroup>
14+
15+
</Project>

exercises/anagram/anagram.csproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp1.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170210-02" />
10+
<PackageReference Include="xunit" Version="2.2.0-rc1-build3507" />
11+
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-rc1-build1247" />
12+
</ItemGroup>
13+
14+
</Project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp1.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170210-02" />
10+
<PackageReference Include="xunit" Version="2.2.0-rc1-build3507" />
11+
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-rc1-build1247" />
12+
</ItemGroup>
13+
14+
</Project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp1.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0-preview-20170210-02" />
10+
<PackageReference Include="xunit" Version="2.2.0-rc1-build3507" />
11+
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0-rc1-build1247" />
12+
</ItemGroup>
13+
14+
</Project>

0 commit comments

Comments
 (0)