Skip to content

Commit

Permalink
add 3 CoreCLR projects: one executable for the worker, one library to…
Browse files Browse the repository at this point in the history
… write the first code, one test project. There arewith scripts to build on Windows - look at README.md
  • Loading branch information
Stan Iliev committed Jan 29, 2016
1 parent 837e27e commit eecce37
Show file tree
Hide file tree
Showing 16 changed files with 231 additions and 26 deletions.
32 changes: 6 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,12 @@
# You've added your first ReadMe file!
A README.md file is intended to quickly orient readers to what your project can do. New to Markdown? [Learn more](http://go.microsoft.com/fwlink/p/?LinkId=524306&clcid=0x409)

## Edit this ReadMe and commit your change to a topic branch
In Git, branches are cheap. You should use them whenever you're making changes to your repository. Edit this file by clicking on the edit icon.
install .NET core by following instructions on https://dotnet.github.io/getting-started/

Then make some changes to this ReadMe file.

> Make some **edits** to _this_ blockquote
"build.cmd" will sync all packages and build everything but the tests

When you are done, click the dropdown arrow next to the save button - that will allow you to commit your changes to a new branch.
"run.cmd" will run the vstsworker

## Create a pull request to contribute your changes back into master
Pull requests are the way to move changes from a topic branch back into the master branch.
"test.cmd" will sync test packages, build and run the xunit tests. Run "build" before "test".
the failed tests are printed, the full results are in src\tests\bin\Debug\dnxcore50\win7-x64\testResults.xml

Click on the **Pull Requests** page in the **CODE** hub, then click "New Pull Request" to create a new pull request from your topic branch to the master branch.

When you are done adding details, click "Create Pull request". Once a pull request is sent, reviewers can see your changes, recommend modifications, or even push follow-up commits.

First time creating a pull request? [Learn more](http://go.microsoft.com/fwlink/?LinkId=533211&clcid=0x409)

### Congratulations! You've completed the grand tour of the CODE hub!

# Next steps

If you haven't done so yet:
* [Install Visual Studio](http://go.microsoft.com/fwlink/?LinkId=309297&clcid=0x409&slcid=0x409)
* [Install Git](http://git-scm.com/downloads)

Then clone this repo to your local machine to get started with your own project.

Happy coding!
"clean.cmd" will delete all temporary files -> should be run before commiting code
4 changes: 4 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off
dotnet restore src/corelib
dotnet restore src/vstsworker
dotnet build src/vstsworker
18 changes: 18 additions & 0 deletions clean.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@echo off
pushd src\vstsworker
rmdir bin /s /q
rmdir obj /s /q
del project.lock.json
popd

pushd src\tests
rmdir bin /s /q
rmdir obj /s /q
del project.lock.json
popd

pushd src\corelib
rmdir bin /s /q
rmdir obj /s /q
del project.lock.json
popd
5 changes: 5 additions & 0 deletions run.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@echo off
pushd src\vstsworker
dotnet run
popd

9 changes: 9 additions & 0 deletions src/corelib/NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="dotnet-core" value="https://www.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
16 changes: 16 additions & 0 deletions src/corelib/Playground.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace coreagent.play
{
public class SomeClass
{
static public void Print()
{
Console.WriteLine("Print something");
}
}
}

15 changes: 15 additions & 0 deletions src/corelib/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": false,
"define": [ "DOTNET5_4" ]
},

"dependencies": {
"NETStandard.Library": "1.0.0-rc3-23727"
},

"frameworks": {
"dotnet54": { }
}
}
10 changes: 10 additions & 0 deletions src/tests/NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="dotnet-core" value="https://www.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="dotnet-buildtools" value="https://www.myget.org/F/dotnet-buildtools/api/v3/index.json" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
30 changes: 30 additions & 0 deletions src/tests/firsttest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using Xunit;

namespace MyFirstDnxUnitTests
{
public class Class1
{
[Fact]
public void PassingTest()
{
Assert.Equal(4, Add(2, 2));
}

[Fact]
public void FailingTest()
{
Assert.Equal(5, Add(2, 2));
}

int Add(int x, int y)
{
return x + y;
}

public static void Main()
{
Console.WriteLine("Dummy Entrypoint.");
}
}
}
22 changes: 22 additions & 0 deletions src/tests/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": false,
"define": [ "DOTNET5_4" ]
},

"dependencies": {
"corelib": { "target": "project" },
"NETStandard.Library": "1.0.0-rc3-23727",

"xunit": "2.1.0",
"xunit.console.netcore": "1.0.2-prerelease-00101",
"xunit.netcore.extensions": "1.0.0-prerelease-00153",
"xunit.runner.utility": "2.1.0"
},
"frameworks": {
"dnxcore50": {
"imports": "portable-net451+win8"
}
}
}
41 changes: 41 additions & 0 deletions src/tests/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
run tests with:
corerun "xunit.console.netcore.exe" "tests.dll" -xml "testResults.xml" -notrait category=failing

{
"version": "1.0.0-*",

"compilationOptions": {
"emitEntryPoint": true
},

"commands": {
"test": "xunit.runner.dnx"
},

"testRunner": "xunit",

"dependencies": {
"NETStandard.Library": "1.0.0-rc3-23727",

"xunit.runner.visualstudio": "2.1.0",
"xunit.runner.dnx": "2.1.0-rc1-build204",
"xunit.runners": "2.0.0",

"xunit": "2.1.0",
"xunit.console.netcore": "1.0.2-prerelease-00101",
"xunit.netcore.extensions": "1.0.0-prerelease-*",
"xunit.runner.utility": "2.1.0"
},
"frameworks": {
"dnxcore50": {
"imports": "portable-net451+win8"
}
}
}


"xunit": "2.1.0",
"xunit.console.netcore": "1.0.2-prerelease-00101",
"xunit.netcore.extensions": "1.0.0-prerelease-00153",
"xunit.runner.utility": "2.1.0"

9 changes: 9 additions & 0 deletions src/vstsworker/NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="dotnet-core" value="https://www.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
15 changes: 15 additions & 0 deletions src/vstsworker/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Threading;

namespace Microsoft.TeamFoundation.DistributedTask.Worker
{
class Program
{
static void Main()
{
coreagent.play.SomeClass.Print();
}
}
}
20 changes: 20 additions & 0 deletions src/vstsworker/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true,
"define": [ "DOTNET5_4" ]
},

"commands": {
"vstsworker": "vstsworker"
},

"dependencies": {
"corelib": { "target": "project" },
"NETStandard.Library": "1.0.0-rc3-23727"
},

"frameworks": {
"dnxcore50": { }
}
}
2 changes: 2 additions & 0 deletions src/vstsworker/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@


9 changes: 9 additions & 0 deletions test.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@echo off
pushd src\tests
dotnet restore
dotnet build
dotnet publish
pushd bin\Debug\dnxcore50\win7-x64
corerun "xunit.console.netcore.exe" "tests.dll" -xml "testResults.xml" -notrait category=failing
popd
popd

0 comments on commit eecce37

Please sign in to comment.