Merge branch 'rel/1.0.0' of https://github.com/dotnet/cli into cli-x86-support
This commit is contained in:
commit
01d2656be1
132 changed files with 4399 additions and 527 deletions
39
Documentation/issue-filing-guide.md
Normal file
39
Documentation/issue-filing-guide.md
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
Filing issues for .NET Core CLI
|
||||||
|
===============================
|
||||||
|
|
||||||
|
As you may notice based on our issues page, the CLI repo is what is known as a
|
||||||
|
"high-profile" and "high-volume" repo; we
|
||||||
|
get a lot of issues. This, in turn, may mean that some issues get
|
||||||
|
lost in the noise and/or are not reacted on with the needed speed.
|
||||||
|
|
||||||
|
In order to help with the above situation, we need to have a certain way to file
|
||||||
|
issues so that the core team of maintainers can react as fast as
|
||||||
|
possible and can triage effectively.
|
||||||
|
|
||||||
|
The below steps are something that we believe is not a huge increase in process,
|
||||||
|
but would help us react much faster to any issues that are filed.
|
||||||
|
|
||||||
|
1. Check if the [known issues](known-issues.md) cover the issue you are running
|
||||||
|
into. We are collecting issues that are known and that have workarounds, so it
|
||||||
|
could be that you can get unblocked pretty easily.
|
||||||
|
|
||||||
|
2. Add a label to determine which type of issue it is. If it is a defect, use
|
||||||
|
the "bug" label, if it is a suggestion for a feature, use the "enhancement"
|
||||||
|
label. This helps the team get to defects more effectively.
|
||||||
|
|
||||||
|
3. Unless you are sure in which milestone the issue falls into, leave it blank.
|
||||||
|
|
||||||
|
4. /cc the person that the issue should be assigned to (or @blackdwarf) so that person
|
||||||
|
would get notified. In this way the correct person can immediately jump on the
|
||||||
|
issue and triage it.
|
||||||
|
|
||||||
|
5. For bugs, please be as concrete as possible on what is working, what
|
||||||
|
is not working. Things like operating system, the version of the tools, the
|
||||||
|
version of the installer and when you installed all help us determine the
|
||||||
|
potential problem and allows us to easily reproduce the problem at hand.
|
||||||
|
|
||||||
|
6. For enhancements please be as concrete as possible on what is the addition
|
||||||
|
you would like to see, what scenario it covers and especially why the current
|
||||||
|
tools cannot satisfy that scenario.
|
||||||
|
|
||||||
|
Thanks and happy filing! :)
|
|
@ -13,6 +13,8 @@ There are two runtime configuration files for a particular application. Given a
|
||||||
* `MyApp.config.json` - An **optional** configuration file containing runtime configuration settings.
|
* `MyApp.config.json` - An **optional** configuration file containing runtime configuration settings.
|
||||||
* `MyApp.deps.json` - A list of dependencies, as well as compilation context data and compilation dependencies. Not technically required, but required to use the servicing or package cache/shared package install features.
|
* `MyApp.deps.json` - A list of dependencies, as well as compilation context data and compilation dependencies. Not technically required, but required to use the servicing or package cache/shared package install features.
|
||||||
|
|
||||||
|
**IMPORTANT**: Portable Applications, i.e. those published without a specific RID, have some adjustments to this spec which is covered at the end.
|
||||||
|
|
||||||
## File format
|
## File format
|
||||||
|
|
||||||
The files are both JSON files stored in UTF-8 encoding. Below are sample files. Note that not all sections are required and some will be opt-in only (see below for more details). The `.config.json` file is completely optional, and in the `.deps.json` file, only the `runtimeTarget`, `targets` and `libraries` sections are required (and within the `targets` section, only the runtime-specific target is required).
|
The files are both JSON files stored in UTF-8 encoding. Below are sample files. Note that not all sections are required and some will be opt-in only (see below for more details). The `.config.json` file is completely optional, and in the `.deps.json` file, only the `runtimeTarget`, `targets` and `libraries` sections are required (and within the `targets` section, only the runtime-specific target is required).
|
||||||
|
@ -30,12 +32,15 @@ The files are both JSON files stored in UTF-8 encoding. Below are sample files.
|
||||||
### [appname].deps.json
|
### [appname].deps.json
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"runtimeTarget": "DNXCore,Version=v5.0/osx.10.10-x64",
|
"runtimeTarget": {
|
||||||
|
"name": ".NETStandardApp,Version=v1.5/osx.10.10-x64",
|
||||||
|
"portable": false
|
||||||
|
},
|
||||||
"compilationOptions": {
|
"compilationOptions": {
|
||||||
"defines": [ "DEBUG" ]
|
"defines": [ "DEBUG" ]
|
||||||
},
|
},
|
||||||
"targets": {
|
"targets": {
|
||||||
"DNXCore,Version=v5.0": {
|
".NETStandardApp,Version=v1.5": {
|
||||||
"MyApp/1.0": {
|
"MyApp/1.0": {
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -55,7 +60,7 @@ The files are both JSON files stored in UTF-8 encoding. Below are sample files.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"DNXCore,Version=v5.0/osx.10.10-x64": {
|
".NETStandardApp,Version=v1.5/osx.10.10-x64": {
|
||||||
"MyApp/1.0": {
|
"MyApp/1.0": {
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -97,7 +102,16 @@ The files are both JSON files stored in UTF-8 encoding. Below are sample files.
|
||||||
"System.Banana/1.0": {
|
"System.Banana/1.0": {
|
||||||
"type": "package",
|
"type": "package",
|
||||||
"sha512": "[base64 string]"
|
"sha512": "[base64 string]"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"runtimes": {
|
||||||
|
".NETStandardApp,Version=v1.5": {
|
||||||
|
"win7-x64": [ ],
|
||||||
|
"win7-x86": [ ],
|
||||||
|
"win8-x64": [ "win7-x64" ],
|
||||||
|
"win8-x86": [ "win7-x64" ],
|
||||||
|
"etc...": [ "etc..." ]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -127,7 +141,6 @@ As an example, here is a possible `project.json` file:
|
||||||
"compilationOptions": {
|
"compilationOptions": {
|
||||||
"allowUnsafe": true
|
"allowUnsafe": true
|
||||||
},
|
},
|
||||||
|
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"net451": {
|
"net451": {
|
||||||
"compilationOptions": {
|
"compilationOptions": {
|
||||||
|
@ -140,7 +153,6 @@ As an example, here is a possible `project.json` file:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"Debug": {
|
"Debug": {
|
||||||
"compilationOptions": {
|
"compilationOptions": {
|
||||||
|
@ -162,17 +174,17 @@ When this project is built for `dnxcore50` in the `Debug` configuration, the out
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### `runtimeTarget` property (`.deps.json`)
|
### `runtimeTarget` Section (`.deps.json`)
|
||||||
|
|
||||||
This property contains the name of the target from `targets` that should be used by the runtime. This is present to simplify `corehost` so that it does not have to parse or understand target names.
|
This property contains the name of the target from `targets` that should be used by the runtime as well as a boolean indicating if this is a "portable" deployment, meaning there are runtime-specific assets within "subtargets" (see description of portable apps below) or if it is a "standalone" deployment meaning that all the assets are in a single target and published for a single RID. This is present to simplify `corehost` so that it does not have to parse or understand target names and the meaning thereof.
|
||||||
|
|
||||||
### `targets` Section (`.deps.json`)
|
### `targets` Section (`.deps.json`)
|
||||||
|
|
||||||
This section contains subsetted data from the input `project.lock.json`.
|
This section contains subsetted data from the input `project.lock.json`.
|
||||||
|
|
||||||
Each property under `targets` describes a "target", which is a collection of libraries required by the application when run or compiled in a certain framework and platform context. A target **must** specify a Framework name, and **may** specify a Runtime Identifier. Targets without Runtime Identifiers represent the dependencies and assets used for compiling the application for a particular framework. Targets with Runtime Identifiers represent the dependencies and assets used for running the application under a particular framework and on the platform defined by the Runtime Identifier. In the example above, the `DNXCore,Version=v5.0` target lists the dependencies and assets used to compile the application for `dnxcore50`, and the `DNXCore,Version=v5.0/osx.10.10-x64` target lists the dependencies and assets used to run the application on `dnxcore50` on a 64-bit Mac OS X 10.10 machine.
|
Each property under `targets` describes a "target", which is a collection of libraries required by the application when run or compiled in a certain framework and platform context. A target **must** specify a Framework name, and **may** specify a Runtime Identifier. Targets without Runtime Identifiers represent the dependencies and assets used for compiling the application for a particular framework. Targets with Runtime Identifiers represent the dependencies and assets used for running the application under a particular framework and on the platform defined by the Runtime Identifier. In the example above, the `.NETStandardApp,Version=v1.5` target lists the dependencies and assets used to compile the application for `dnxcore50`, and the `.NETStandardApp,Version=v1.5/osx.10.10-x64` target lists the dependencies and assets used to run the application on `dnxcore50` on a 64-bit Mac OS X 10.10 machine.
|
||||||
|
|
||||||
There will always be two targets in the `runtime.config.json` file: A compilation target, and a runtime target. The compilation target will be named with the framework name used for the compilation (`DNXCore,Version=v5.0` in the example above). The runtime target will be named with the framework name and runtime identifier used to execute the application (`DNXCore,Version=v5.0/osx.10.10-x64` in the example above). However, the runtime target will also be identified by name in the `runtimeOptions` section, so that `corehost` need not parse and understand target names.
|
There will always be two targets in the `runtime.config.json` file: A compilation target, and a runtime target. The compilation target will be named with the framework name used for the compilation (`.NETStandardApp,Version=v1.5` in the example above). The runtime target will be named with the framework name and runtime identifier used to execute the application (`.NETStandardApp,Version=v1.5/osx.10.10-x64` in the example above). However, the runtime target will also be identified by name in the `runtimeOptions` section, so that `corehost` need not parse and understand target names.
|
||||||
|
|
||||||
The content of each target property in the JSON is a JSON object. Each property of that JSON object represents a single dependency required by the application when compiled for/run on that target. The name of the property contains the ID and Version of the dependency in the form `[Id]/[Version]`. The content of the property is another JSON object containing metadata about the dependency.
|
The content of each target property in the JSON is a JSON object. Each property of that JSON object represents a single dependency required by the application when compiled for/run on that target. The name of the property contains the ID and Version of the dependency in the form `[Id]/[Version]`. The content of the property is another JSON object containing metadata about the dependency.
|
||||||
|
|
||||||
|
@ -198,6 +210,10 @@ This section contains a union of all the dependencies found in the various targe
|
||||||
|
|
||||||
**Open Question**: We could probably exclude projects from this set in order to reduce duplication. The main reason this is a separate section is because that's how the lock file is formatted and we want to try an keep this format the same if possible.
|
**Open Question**: We could probably exclude projects from this set in order to reduce duplication. The main reason this is a separate section is because that's how the lock file is formatted and we want to try an keep this format the same if possible.
|
||||||
|
|
||||||
|
## `runtimes` Section
|
||||||
|
|
||||||
|
This section contains data gathered from the `runtime.json` files in packages during the restore process. It is used by the "portable" deployment model to encode the fallbacks through various RIDs. For example, `corehost` may detect that the current RID is `win8-x64`, due to running on Windows 8 in a 64-bit process. However, packages in the portable deployment model may provide assets for the `win7-x64` RID. In this case, `corehost` needs to know that `win8-x64` can load `win7-x64` assets. This data is encoded in the `runtimes` section of the deps file. The data is stored separately per Target Framework Moniker (though in practice, a `.deps.json` file will only ever have one entry; this is done simply to mirror the `project.lock.json` format). When running a particular target (as defined by `runtimeTarget`), where `portable` is set to `true`, only the `runtimes` entry matching that target name should be used.
|
||||||
|
|
||||||
## How the file is used
|
## How the file is used
|
||||||
|
|
||||||
The file is read by two different components:
|
The file is read by two different components:
|
||||||
|
@ -215,7 +231,7 @@ Some of the sections in the `.deps.json` file contain data used for runtime comp
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"targets": {
|
"targets": {
|
||||||
"DNXCore,Version=v5.0/osx.10.10-x64": {
|
".NETStandardApp,Version=v1.5/osx.10.10-x64": {
|
||||||
"MyApp/1.0": {
|
"MyApp/1.0": {
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -261,3 +277,76 @@ Some of the sections in the `.deps.json` file contain data used for runtime comp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Portable Deployment Model
|
||||||
|
|
||||||
|
An application can be deployed in a "portable" deployment model. In this case, the RID-specific assets of packages are published within a folder structure that preserves the RID metadata. However, `corehost` does not use this folder structure, rather it reads data from the `.deps.json` file. Also, during deployment, the `.exe` file (`corehost` renamed) is not deployed.
|
||||||
|
|
||||||
|
In a `portable` target, the package entries may have an additional `subtargets` section detailing RID-specific assets. The `corehost` application should use this data, along with the current RID and the fallback data defined in the `runtimes` section to select one **and only one** "subtarget" out of each package individually. The most specific subtarget should always be selected. In practice, this means selecting the first RID shown on the appropriate line in `runtimes`. For example, given a package containing the following subtargets:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"targets": {
|
||||||
|
".NETStandardApp,Version=v1.5": {
|
||||||
|
"System.Data.SqlClient/4.0.0": {
|
||||||
|
"compile": {
|
||||||
|
"ref/netstandard1.5/System.Data.SqlClient.dll": {}
|
||||||
|
},
|
||||||
|
"subtargets": {
|
||||||
|
"runtime": {
|
||||||
|
"runtimes/unix/lib/netstandard1.5/System.Data.SqlClient.dll": { "rid": "unix" },
|
||||||
|
"runtimes/win7-x64/lib/netstandard1.5/System.Data.SqlClient.dll": { "rid": "win7-x64" },
|
||||||
|
"runtimes/win7-x86/lib/netstandard1.5/System.Data.SqlClient.dll": { "rid": "win7-x86" }
|
||||||
|
},
|
||||||
|
"native": {
|
||||||
|
"runtimes/win7-x64/native/sni.dll": { "rid": "win7-x64" },
|
||||||
|
"runtimes/win7-x86/native/sni.dll": { "rid": "win7-x86" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"runtimes": {
|
||||||
|
".NETStandardApp,Version=v1.5": {
|
||||||
|
"win7-x64": [ ],
|
||||||
|
"win7-x86": [ ],
|
||||||
|
"win8-x64": [ "win7-x64" ],
|
||||||
|
"win8-x86": [ "win7-x86" ],
|
||||||
|
"win81-x64": [ "win7-x64" ],
|
||||||
|
"win81-x86": [ "win7-x86" ],
|
||||||
|
"win10-x64": [ "win7-x64" ],
|
||||||
|
"win10-x86": [ "win7-x86" ],
|
||||||
|
"osx.10.10-x64": [ "osx", "unix" ],
|
||||||
|
"osx.10.11-x64": [ "osx", "unix" ],
|
||||||
|
"rhel.7-x64": [ "linux-x64", "unix" ],
|
||||||
|
"rhel.7.1-x64": [ "linux-x64", "unix" ],
|
||||||
|
"rhel.7.2-x64": [ "linux-x64", "unix" ],
|
||||||
|
"rhel.7.3-x64": [ "linux-x64", "unix" ],
|
||||||
|
"centos.7-x64": [ "linux-x64", "unix" ],
|
||||||
|
"centos.7.1-x64": [ "linux-x64", "unix" ],
|
||||||
|
"debian.8-x64": [ "linux-x64", "unix" ],
|
||||||
|
"ubuntu.14.04-x64": [ "linux-x64", "unix" ],
|
||||||
|
"ubuntu.14.10-x64": [ "linux-x64", "unix" ],
|
||||||
|
"ubuntu.15.04-x64": [ "linux-x64", "unix" ],
|
||||||
|
"linuxmint.17-x64": [ "linux-x64", "unix" ],
|
||||||
|
"linuxmint.17.1-x64": [ "linux-x64", "unix" ],
|
||||||
|
"linuxmint.17.2-x64": [ "linux-x64", "unix" ],
|
||||||
|
"linuxmint.17.3-x64": [ "linux-x64", "unix" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
(How the data in `runtimes` was generated is beyond the scope of this document, `dotnet-publish` and NuGet will work together to ensure the appropriate data is present).
|
||||||
|
|
||||||
|
Consider `corehost` running on `debian.8-x64`. When setting up the TPA and native library lists, it will do the following for `System.Data.SqlClient`:
|
||||||
|
|
||||||
|
1. Add all entries from the root `runtime` and `native` sections (not present in the example). This is the current behavior
|
||||||
|
2. Add all appropriate entries from the `subtargets.runtime` and `subtargets.native` sections, based on the `rid` property of each item:
|
||||||
|
1. Attempt to locate any item (in both lists) for `debian.8-x64`. If any asset is matched, take **only** the items matching that RID exactly and add them to the appropriate lists
|
||||||
|
2. Reattempt the previous step using the first RID in the list provided by `runtimes.".NETStandardApp,Version=v1.5"."debian.8-x64"` (in this case `linux-x64`). If any asset is matched, take **only** the items matching that RID exactly and add them to the appropriate lists
|
||||||
|
3. Continue to reattempt the previous search for each RID in the list, from left to right until a match is found or the list is exhausted. Exhausting the list without finding an asset, when a `subtargets` section is present is **not** an error.
|
||||||
|
|
||||||
|
Note one important aspect about asset resolution: The resolution scope is **per-package**, **not per-application**, **nor per-asset**. For each individual package, the most appropriate RID is selected, and **all** assets taken from that package must match the selected RID exactly. For example, if a package provides both a `linux-x64` and a `unix` RID (in the `debian.8-x64` example above), **only** the `linux-x64` asset would be selected for that package. However, if a different package provides only a `unix` RID, then the asset from the `unix` RID would be selected.
|
||||||
|
|
||||||
|
The path to subtarget assets is resolved in the same way as normal assets with **one exception**. When searching app-local, rather than just looking for the simple file name in the app-local directory, subtarget assets are expected to be located in subdirectories matching their relative path information in the lock file. So the `native` `sni.dll` asset for `win7-x64` in the above example would be located at `APPROOT/runtimes/win7-x64/native/sni.dll`, rather than the normal app-local path of `APPROOT/sni.dll`
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio 14
|
# Visual Studio 14
|
||||||
VisualStudioVersion = 14.0.24720.0
|
VisualStudioVersion = 14.0.25020.0
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{ED2FE3E2-F7E7-4389-8231-B65123F2076F}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{ED2FE3E2-F7E7-4389-8231-B65123F2076F}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
|
||||||
src\Microsoft.Extensions.EnvironmentAbstractions\project.json = src\Microsoft.Extensions.EnvironmentAbstractions\project.json
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5A29E8E3-A0FC-4C57-81DD-297B56D1A119}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5A29E8E3-A0FC-4C57-81DD-297B56D1A119}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
@ -22,8 +18,6 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Compiler.C
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.ProjectModel.Workspaces", "src\Microsoft.DotNet.ProjectModel.Workspaces\Microsoft.DotNet.ProjectModel.Workspaces.xproj", "{BD7833F8-3209-4682-BF75-B4BCA883E279}"
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.ProjectModel.Workspaces", "src\Microsoft.DotNet.ProjectModel.Workspaces\Microsoft.DotNet.ProjectModel.Workspaces.xproj", "{BD7833F8-3209-4682-BF75-B4BCA883E279}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Runtime", "src\Microsoft.DotNet.Runtime\Microsoft.DotNet.Runtime.xproj", "{DB29F219-DC92-4AF7-A2EE-E89FFBB3F5F0}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Extensions.Testing.Abstractions", "src\Microsoft.Extensions.Testing.Abstractions\Microsoft.Extensions.Testing.Abstractions.xproj", "{DCDFE282-03DE-4DBC-B90C-CC3CE3EC8162}"
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Extensions.Testing.Abstractions", "src\Microsoft.Extensions.Testing.Abstractions\Microsoft.Extensions.Testing.Abstractions.xproj", "{DCDFE282-03DE-4DBC-B90C-CC3CE3EC8162}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.ProjectModel.Loader", "src\Microsoft.DotNet.ProjectModel.Loader\Microsoft.DotNet.ProjectModel.Loader.xproj", "{C7AF0290-EF0D-44DC-9EDC-600803B664F8}"
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.ProjectModel.Loader", "src\Microsoft.DotNet.ProjectModel.Loader\Microsoft.DotNet.ProjectModel.Loader.xproj", "{C7AF0290-EF0D-44DC-9EDC-600803B664F8}"
|
||||||
|
@ -64,16 +58,10 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Cli.Build.
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-compile.UnitTests", "test\dotnet-compile.UnitTests\dotnet-compile.UnitTests.xproj", "{920B71D8-62DA-4F5E-8A26-926C113F1D97}"
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-compile.UnitTests", "test\dotnet-compile.UnitTests\dotnet-compile.UnitTests.xproj", "{920B71D8-62DA-4F5E-8A26-926C113F1D97}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TestApp", "TestAssets\TestProjects\TestApp\TestApp.xproj", "{58808BBC-371E-47D6-A3D0-4902145EDA4E}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TestAppWithArgs", "TestAssets\TestProjects\TestAppWithArgs\TestAppWithArgs.xproj", "{DA8E0E9E-A6D6-4583-864C-8F40465E3A48}"
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TestAppWithArgs", "TestAssets\TestProjects\TestAppWithArgs\TestAppWithArgs.xproj", "{DA8E0E9E-A6D6-4583-864C-8F40465E3A48}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TestAppWithContents", "TestAssets\TestProjects\TestAppWithContents\TestAppWithContents.xproj", "{0138CB8F-4AA9-4029-A21E-C07C30F425BA}"
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TestAppWithContents", "TestAssets\TestProjects\TestAppWithContents\TestAppWithContents.xproj", "{0138CB8F-4AA9-4029-A21E-C07C30F425BA}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TestLibrary", "TestAssets\TestProjects\TestLibrary\TestLibrary.xproj", "{947DD232-8D9B-4B78-9C6A-94F807D2DD58}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "TestProjectToProjectDependencies", "TestAssets\TestProjects\TestProjectToProjectDependencies\TestProjectToProjectDependencies.xproj", "{947DD232-8D9B-4B78-9C6A-94F807D22222}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.InternalAbstractions", "src\Microsoft.DotNet.InternalAbstractions\Microsoft.DotNet.InternalAbstractions.xproj", "{BD4F0750-4E81-4AD2-90B5-E470881792C3}"
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.InternalAbstractions", "src\Microsoft.DotNet.InternalAbstractions\Microsoft.DotNet.InternalAbstractions.xproj", "{BD4F0750-4E81-4AD2-90B5-E470881792C3}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.ProjectModel.Tests", "test\Microsoft.DotNet.ProjectModel.Tests\Microsoft.DotNet.ProjectModel.Tests.xproj", "{0745410A-6629-47EB-AAB5-08D6288CAD72}"
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.ProjectModel.Tests", "test\Microsoft.DotNet.ProjectModel.Tests\Microsoft.DotNet.ProjectModel.Tests.xproj", "{0745410A-6629-47EB-AAB5-08D6288CAD72}"
|
||||||
|
@ -82,7 +70,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Installer", "Installer", "{
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Cli.Msi.Tests", "test\Installer\Microsoft.DotNet.Cli.Msi.Tests\Microsoft.DotNet.Cli.Msi.Tests.xproj", "{0B31C336-149D-471A-B7B1-27B0F1E80F83}"
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Cli.Msi.Tests", "test\Installer\Microsoft.DotNet.Cli.Msi.Tests\Microsoft.DotNet.Cli.Msi.Tests.xproj", "{0B31C336-149D-471A-B7B1-27B0F1E80F83}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Extensions.DependencyModel.Tests", "..\cli1\test\Microsoft.Extensions.DependencyModel.Tests\Microsoft.Extensions.DependencyModel.Tests.xproj", "{4A4711D8-4312-49FC-87B5-4F183F4C6A51}"
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Extensions.DependencyModel.Tests", "test\Microsoft.Extensions.DependencyModel.Tests\Microsoft.Extensions.DependencyModel.Tests.xproj", "{4A4711D8-4312-49FC-87B5-4F183F4C6A51}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.TestFramework", "src\Microsoft.DotNet.TestFramework\Microsoft.DotNet.TestFramework.xproj", "{0724ED7C-56E3-4604-9970-25E600611383}"
|
||||||
|
EndProject
|
||||||
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "dotnet-test.UnitTests", "test\dotnet-test.UnitTests\dotnet-test.UnitTests.xproj", "{857274AC-E741-4266-A7FD-14DEE0C1CC96}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -160,22 +152,6 @@ Global
|
||||||
{BD7833F8-3209-4682-BF75-B4BCA883E279}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
{BD7833F8-3209-4682-BF75-B4BCA883E279}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||||
{BD7833F8-3209-4682-BF75-B4BCA883E279}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
{BD7833F8-3209-4682-BF75-B4BCA883E279}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||||
{BD7833F8-3209-4682-BF75-B4BCA883E279}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
{BD7833F8-3209-4682-BF75-B4BCA883E279}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||||
{DB29F219-DC92-4AF7-A2EE-E89FFBB3F5F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{DB29F219-DC92-4AF7-A2EE-E89FFBB3F5F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{DB29F219-DC92-4AF7-A2EE-E89FFBB3F5F0}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{DB29F219-DC92-4AF7-A2EE-E89FFBB3F5F0}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{DB29F219-DC92-4AF7-A2EE-E89FFBB3F5F0}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{DB29F219-DC92-4AF7-A2EE-E89FFBB3F5F0}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{DB29F219-DC92-4AF7-A2EE-E89FFBB3F5F0}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{DB29F219-DC92-4AF7-A2EE-E89FFBB3F5F0}.MinSizeRel|x64.Build.0 = Debug|Any CPU
|
|
||||||
{DB29F219-DC92-4AF7-A2EE-E89FFBB3F5F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{DB29F219-DC92-4AF7-A2EE-E89FFBB3F5F0}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{DB29F219-DC92-4AF7-A2EE-E89FFBB3F5F0}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{DB29F219-DC92-4AF7-A2EE-E89FFBB3F5F0}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
{DB29F219-DC92-4AF7-A2EE-E89FFBB3F5F0}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{DB29F219-DC92-4AF7-A2EE-E89FFBB3F5F0}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{DB29F219-DC92-4AF7-A2EE-E89FFBB3F5F0}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{DB29F219-DC92-4AF7-A2EE-E89FFBB3F5F0}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
|
||||||
{DCDFE282-03DE-4DBC-B90C-CC3CE3EC8162}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{DCDFE282-03DE-4DBC-B90C-CC3CE3EC8162}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{DCDFE282-03DE-4DBC-B90C-CC3CE3EC8162}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{DCDFE282-03DE-4DBC-B90C-CC3CE3EC8162}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{DCDFE282-03DE-4DBC-B90C-CC3CE3EC8162}.Debug|x64.ActiveCfg = Debug|Any CPU
|
{DCDFE282-03DE-4DBC-B90C-CC3CE3EC8162}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
@ -432,22 +408,6 @@ Global
|
||||||
{920B71D8-62DA-4F5E-8A26-926C113F1D97}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
{920B71D8-62DA-4F5E-8A26-926C113F1D97}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||||
{920B71D8-62DA-4F5E-8A26-926C113F1D97}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
{920B71D8-62DA-4F5E-8A26-926C113F1D97}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||||
{920B71D8-62DA-4F5E-8A26-926C113F1D97}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
{920B71D8-62DA-4F5E-8A26-926C113F1D97}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||||
{58808BBC-371E-47D6-A3D0-4902145EDA4E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{58808BBC-371E-47D6-A3D0-4902145EDA4E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{58808BBC-371E-47D6-A3D0-4902145EDA4E}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{58808BBC-371E-47D6-A3D0-4902145EDA4E}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{58808BBC-371E-47D6-A3D0-4902145EDA4E}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{58808BBC-371E-47D6-A3D0-4902145EDA4E}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{58808BBC-371E-47D6-A3D0-4902145EDA4E}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{58808BBC-371E-47D6-A3D0-4902145EDA4E}.MinSizeRel|x64.Build.0 = Debug|Any CPU
|
|
||||||
{58808BBC-371E-47D6-A3D0-4902145EDA4E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{58808BBC-371E-47D6-A3D0-4902145EDA4E}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{58808BBC-371E-47D6-A3D0-4902145EDA4E}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{58808BBC-371E-47D6-A3D0-4902145EDA4E}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
{58808BBC-371E-47D6-A3D0-4902145EDA4E}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{58808BBC-371E-47D6-A3D0-4902145EDA4E}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{58808BBC-371E-47D6-A3D0-4902145EDA4E}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{58808BBC-371E-47D6-A3D0-4902145EDA4E}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
|
||||||
{DA8E0E9E-A6D6-4583-864C-8F40465E3A48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{DA8E0E9E-A6D6-4583-864C-8F40465E3A48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{DA8E0E9E-A6D6-4583-864C-8F40465E3A48}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{DA8E0E9E-A6D6-4583-864C-8F40465E3A48}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{DA8E0E9E-A6D6-4583-864C-8F40465E3A48}.Debug|x64.ActiveCfg = Debug|Any CPU
|
{DA8E0E9E-A6D6-4583-864C-8F40465E3A48}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
@ -480,38 +440,6 @@ Global
|
||||||
{0138CB8F-4AA9-4029-A21E-C07C30F425BA}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
{0138CB8F-4AA9-4029-A21E-C07C30F425BA}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||||
{0138CB8F-4AA9-4029-A21E-C07C30F425BA}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
{0138CB8F-4AA9-4029-A21E-C07C30F425BA}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||||
{0138CB8F-4AA9-4029-A21E-C07C30F425BA}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
{0138CB8F-4AA9-4029-A21E-C07C30F425BA}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D2DD58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D2DD58}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D2DD58}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D2DD58}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D2DD58}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D2DD58}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D2DD58}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D2DD58}.MinSizeRel|x64.Build.0 = Debug|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D2DD58}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D2DD58}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D2DD58}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D2DD58}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D2DD58}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D2DD58}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D2DD58}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D2DD58}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D22222}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D22222}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D22222}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D22222}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D22222}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D22222}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D22222}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D22222}.MinSizeRel|x64.Build.0 = Debug|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D22222}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D22222}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D22222}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D22222}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D22222}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D22222}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D22222}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D22222}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
|
||||||
{BD4F0750-4E81-4AD2-90B5-E470881792C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{BD4F0750-4E81-4AD2-90B5-E470881792C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{BD4F0750-4E81-4AD2-90B5-E470881792C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{BD4F0750-4E81-4AD2-90B5-E470881792C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{BD4F0750-4E81-4AD2-90B5-E470881792C3}.Debug|x64.ActiveCfg = Debug|Any CPU
|
{BD4F0750-4E81-4AD2-90B5-E470881792C3}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
@ -528,6 +456,22 @@ Global
|
||||||
{BD4F0750-4E81-4AD2-90B5-E470881792C3}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
{BD4F0750-4E81-4AD2-90B5-E470881792C3}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||||
{BD4F0750-4E81-4AD2-90B5-E470881792C3}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
{BD4F0750-4E81-4AD2-90B5-E470881792C3}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||||
{BD4F0750-4E81-4AD2-90B5-E470881792C3}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
{BD4F0750-4E81-4AD2-90B5-E470881792C3}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.MinSizeRel|x64.Build.0 = Debug|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||||
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.Debug|x64.ActiveCfg = Debug|Any CPU
|
{4A4711D8-4312-49FC-87B5-4F183F4C6A51}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
@ -560,6 +504,38 @@ Global
|
||||||
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||||
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||||
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
{0B31C336-149D-471A-B7B1-27B0F1E80F83}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||||
|
{857274AC-E741-4266-A7FD-14DEE0C1CC96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{857274AC-E741-4266-A7FD-14DEE0C1CC96}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{857274AC-E741-4266-A7FD-14DEE0C1CC96}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{857274AC-E741-4266-A7FD-14DEE0C1CC96}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{857274AC-E741-4266-A7FD-14DEE0C1CC96}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{857274AC-E741-4266-A7FD-14DEE0C1CC96}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{857274AC-E741-4266-A7FD-14DEE0C1CC96}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{857274AC-E741-4266-A7FD-14DEE0C1CC96}.MinSizeRel|x64.Build.0 = Debug|Any CPU
|
||||||
|
{857274AC-E741-4266-A7FD-14DEE0C1CC96}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{857274AC-E741-4266-A7FD-14DEE0C1CC96}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{857274AC-E741-4266-A7FD-14DEE0C1CC96}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{857274AC-E741-4266-A7FD-14DEE0C1CC96}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{857274AC-E741-4266-A7FD-14DEE0C1CC96}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{857274AC-E741-4266-A7FD-14DEE0C1CC96}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{857274AC-E741-4266-A7FD-14DEE0C1CC96}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{857274AC-E741-4266-A7FD-14DEE0C1CC96}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||||
|
{0724ED7C-56E3-4604-9970-25E600611383}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{0724ED7C-56E3-4604-9970-25E600611383}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{0724ED7C-56E3-4604-9970-25E600611383}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{0724ED7C-56E3-4604-9970-25E600611383}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{0724ED7C-56E3-4604-9970-25E600611383}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{0724ED7C-56E3-4604-9970-25E600611383}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{0724ED7C-56E3-4604-9970-25E600611383}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{0724ED7C-56E3-4604-9970-25E600611383}.MinSizeRel|x64.Build.0 = Debug|Any CPU
|
||||||
|
{0724ED7C-56E3-4604-9970-25E600611383}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{0724ED7C-56E3-4604-9970-25E600611383}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{0724ED7C-56E3-4604-9970-25E600611383}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{0724ED7C-56E3-4604-9970-25E600611383}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{0724ED7C-56E3-4604-9970-25E600611383}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{0724ED7C-56E3-4604-9970-25E600611383}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{0724ED7C-56E3-4604-9970-25E600611383}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{0724ED7C-56E3-4604-9970-25E600611383}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -569,7 +545,6 @@ Global
|
||||||
{303677D5-7312-4C3F-BAEE-BEB1A9BD9FE6} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
{303677D5-7312-4C3F-BAEE-BEB1A9BD9FE6} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||||
{A16958E1-24C7-4F1E-B317-204AD91625DD} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
{A16958E1-24C7-4F1E-B317-204AD91625DD} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||||
{BD7833F8-3209-4682-BF75-B4BCA883E279} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
{BD7833F8-3209-4682-BF75-B4BCA883E279} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||||
{DB29F219-DC92-4AF7-A2EE-E89FFBB3F5F0} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
|
||||||
{DCDFE282-03DE-4DBC-B90C-CC3CE3EC8162} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
{DCDFE282-03DE-4DBC-B90C-CC3CE3EC8162} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||||
{C7AF0290-EF0D-44DC-9EDC-600803B664F8} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
{C7AF0290-EF0D-44DC-9EDC-600803B664F8} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||||
{08A68C6A-86F6-4ED2-89A7-B166D33E9F85} = {0722D325-24C8-4E83-B5AF-0A083E7F0749}
|
{08A68C6A-86F6-4ED2-89A7-B166D33E9F85} = {0722D325-24C8-4E83-B5AF-0A083E7F0749}
|
||||||
|
@ -587,14 +562,14 @@ Global
|
||||||
{D7B9695D-23EB-4EA8-B8AB-707A0092E1D5} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3}
|
{D7B9695D-23EB-4EA8-B8AB-707A0092E1D5} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3}
|
||||||
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3}
|
{49BEB486-AB5A-4416-91EA-8CD34ABB0C9D} = {88278B81-7649-45DC-8A6A-D3A645C5AFC3}
|
||||||
{920B71D8-62DA-4F5E-8A26-926C113F1D97} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
{920B71D8-62DA-4F5E-8A26-926C113F1D97} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||||
{58808BBC-371E-47D6-A3D0-4902145EDA4E} = {713CBFBB-5392-438D-B766-A9A585EF1BB8}
|
|
||||||
{DA8E0E9E-A6D6-4583-864C-8F40465E3A48} = {713CBFBB-5392-438D-B766-A9A585EF1BB8}
|
{DA8E0E9E-A6D6-4583-864C-8F40465E3A48} = {713CBFBB-5392-438D-B766-A9A585EF1BB8}
|
||||||
{0138CB8F-4AA9-4029-A21E-C07C30F425BA} = {713CBFBB-5392-438D-B766-A9A585EF1BB8}
|
{0138CB8F-4AA9-4029-A21E-C07C30F425BA} = {713CBFBB-5392-438D-B766-A9A585EF1BB8}
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D2DD58} = {713CBFBB-5392-438D-B766-A9A585EF1BB8}
|
|
||||||
{947DD232-8D9B-4B78-9C6A-94F807D22222} = {713CBFBB-5392-438D-B766-A9A585EF1BB8}
|
|
||||||
{BD4F0750-4E81-4AD2-90B5-E470881792C3} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
{BD4F0750-4E81-4AD2-90B5-E470881792C3} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||||
{4A4711D8-4312-49FC-87B5-4F183F4C6A51} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
{4A4711D8-4312-49FC-87B5-4F183F4C6A51} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||||
|
{0745410A-6629-47EB-AAB5-08D6288CAD72} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||||
{0E3300A4-DF54-40BF-87D8-E7658330C288} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
{0E3300A4-DF54-40BF-87D8-E7658330C288} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||||
{0B31C336-149D-471A-B7B1-27B0F1E80F83} = {0E3300A4-DF54-40BF-87D8-E7658330C288}
|
{0B31C336-149D-471A-B7B1-27B0F1E80F83} = {0E3300A4-DF54-40BF-87D8-E7658330C288}
|
||||||
|
{857274AC-E741-4266-A7FD-14DEE0C1CC96} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||||
|
{0724ED7C-56E3-4604-9970-25E600611383} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
34
README.md
34
README.md
|
@ -6,7 +6,14 @@ This repo contains the source code for cross-platform [.NET Core](http://github.
|
||||||
|
|
||||||
New to .NET CLI?
|
New to .NET CLI?
|
||||||
------------
|
------------
|
||||||
Check out our http://dotnet.github.io/getting-started/
|
Check out our http://dotnet.github.io/getting-started/ page.
|
||||||
|
|
||||||
|
Found an issue?
|
||||||
|
---------------
|
||||||
|
You can consult the [known issues page](Documentation/known-issues.md) to find out the current issues and
|
||||||
|
to see the workarounds.
|
||||||
|
|
||||||
|
If you don't find your issue, please file one! However, given that this is a very high-frequency repo, we've setup some [basic guidelines](Documentation/issue-filing-guide.md) to help you. Please consult those first.
|
||||||
|
|
||||||
Build Status
|
Build Status
|
||||||
------------
|
------------
|
||||||
|
@ -24,10 +31,10 @@ Installers
|
||||||
|**Installers**|[Download Debian Package](https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-ubuntu-x64.latest.deb)|[Download Msi](https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-win-x64.latest.exe)|[Download Pkg](https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-osx-x64.latest.pkg) |N/A |
|
|**Installers**|[Download Debian Package](https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-ubuntu-x64.latest.deb)|[Download Msi](https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-win-x64.latest.exe)|[Download Pkg](https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-osx-x64.latest.pkg) |N/A |
|
||||||
|**Binaries**|[Download tar file](https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/Latest/dotnet-ubuntu-x64.latest.tar.gz)|[Download zip file](https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/Latest/dotnet-win-x64.latest.zip)|[Download tar file](https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/Latest/dotnet-osx-x64.latest.tar.gz) |[Download tar file](https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/Latest/dotnet-centos-x64.latest.tar.gz) |
|
|**Binaries**|[Download tar file](https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/Latest/dotnet-ubuntu-x64.latest.tar.gz)|[Download zip file](https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/Latest/dotnet-win-x64.latest.zip)|[Download tar file](https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/Latest/dotnet-osx-x64.latest.tar.gz) |[Download tar file](https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/Latest/dotnet-centos-x64.latest.tar.gz) |
|
||||||
|
|
||||||
Interested in .NET Core + ASP.NET 5 RC bits?
|
Interested in .NET Core + ASP.NET Core 1.0 RC1 bits?
|
||||||
----------------------------------------
|
----------------------------------------------------
|
||||||
|
|
||||||
This toolchain is independent from the DNX-based .NET Core + ASP.NET 5 RC bits. If you are looking for .NET Core + ASP.NET 5 RC bits, you can find instructions on the http://get.asp.net/.
|
This toolchain is independent from the DNX-based .NET Core + ASP.NET Core 1.0 RC1 bits. If you are looking for .NET Core + ASP.NET Core 1.0 RC1 bits, you can find instructions on the http://get.asp.net/.
|
||||||
|
|
||||||
Docker
|
Docker
|
||||||
------
|
------
|
||||||
|
@ -53,19 +60,8 @@ Then you can either run from source or compile the sample. Running from source i
|
||||||
Compiling to IL is done using:
|
Compiling to IL is done using:
|
||||||
|
|
||||||
dotnet build
|
dotnet build
|
||||||
This will drop a binary in `./bin/[configuration]/[framework]/[binary name]` that you can just run.
|
|
||||||
|
|
||||||
Finally, you can also try out native compilation using RyuJIT as shown below:
|
This will drop a binary in `./bin/[configuration]/[framework]/[rid]/[binary name]` that you can just run.
|
||||||
|
|
||||||
dotnet build --native
|
|
||||||
|
|
||||||
The following command will perform native compilation using the C++ Codegenerator:
|
|
||||||
|
|
||||||
dotnet build --native --cpp
|
|
||||||
|
|
||||||
If you are in Windows, make sure that you run the above command inside the *VS 2015 x64 Native Tools* prompt, otherwise you will get errors. This command will drop a native single binary in `./bin/[configuration]/[framework]/native/[binary name]` that you can run.
|
|
||||||
|
|
||||||
**Note:** At this point, only the `helloworld` and `dotnetbot` samples will work with native compilation.
|
|
||||||
|
|
||||||
For more details, please refer to the [documentation](https://github.com/dotnet/corert/tree/master/Documentation).
|
For more details, please refer to the [documentation](https://github.com/dotnet/corert/tree/master/Documentation).
|
||||||
|
|
||||||
|
@ -74,11 +70,7 @@ Building from source
|
||||||
|
|
||||||
If you are building from source, take note that the build depends on NuGet packages hosted on Myget, so if it is down, the build may fail. If that happens, you can always see the [Myget status page](http://status.myget.org/) for more info.
|
If you are building from source, take note that the build depends on NuGet packages hosted on Myget, so if it is down, the build may fail. If that happens, you can always see the [Myget status page](http://status.myget.org/) for more info.
|
||||||
|
|
||||||
Known issues
|
Read over the [contributing guidelines](https://github.com/dotnet/cli/tree/master/CONTRIBUTING.md) and [developer documentation](https://github.com/dotnet/cli/tree/master/Documentation) for prerequisites for building from source.
|
||||||
------------
|
|
||||||
|
|
||||||
You can also consult the [known issues page](Documentation/known-issues.md) to find out the current issues and
|
|
||||||
to see the workarounds.
|
|
||||||
|
|
||||||
Questions & Comments
|
Questions & Comments
|
||||||
--------------------
|
--------------------
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.0.24720" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.24720</VisualStudioVersion>
|
||||||
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectGuid>6d84ef36-a5d5-4eaf-b38b-ced635473785</ProjectGuid>
|
||||||
|
<RootNamespace>DependencyContextValidator</RootNamespace>
|
||||||
|
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||||
|
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||||
|
</Project>
|
|
@ -0,0 +1,65 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Microsoft.Extensions.DependencyModel
|
||||||
|
{
|
||||||
|
public static class DependencyContextValidator
|
||||||
|
{
|
||||||
|
private static void Error(string message)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CheckMetadata(Library library)
|
||||||
|
{
|
||||||
|
if (string.Equals(library.LibraryType, "package", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(library.PackageName) ||
|
||||||
|
string.IsNullOrWhiteSpace(library.Hash) ||
|
||||||
|
string.IsNullOrWhiteSpace(library.Version))
|
||||||
|
{
|
||||||
|
Error($"Empty metadata for {library.GetType().ToString()} {library.PackageName}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Validate(bool full)
|
||||||
|
{
|
||||||
|
var context = DependencyContext.Default;
|
||||||
|
if (full)
|
||||||
|
{
|
||||||
|
if (!context.CompileLibraries.Any())
|
||||||
|
{
|
||||||
|
Error("Compilation libraries empty");
|
||||||
|
}
|
||||||
|
foreach (var compilationLibrary in context.CompileLibraries)
|
||||||
|
{
|
||||||
|
CheckMetadata(compilationLibrary);
|
||||||
|
var resolvedPaths = compilationLibrary.ResolveReferencePaths();
|
||||||
|
foreach (var resolvedPath in resolvedPaths)
|
||||||
|
{
|
||||||
|
if (!File.Exists(resolvedPath))
|
||||||
|
{
|
||||||
|
Error($"Compilataion library resolved to non existent path {resolvedPath}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var runtimeLibrary in context.RuntimeLibraries)
|
||||||
|
{
|
||||||
|
CheckMetadata(runtimeLibrary);
|
||||||
|
foreach (var runtimeAssembly in runtimeLibrary.Assemblies)
|
||||||
|
{
|
||||||
|
var assembly = Assembly.Load(runtimeAssembly.Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"version": "1.0.0-*",
|
||||||
|
"dependencies": {
|
||||||
|
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||||
|
"Microsoft.Extensions.DependencyModel": {
|
||||||
|
"target": "project",
|
||||||
|
"version": "1.0.0-*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"frameworks": {
|
||||||
|
"dnxcore50": { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace TestApp
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Microsoft.Extensions.DependencyModel.DependencyContextValidator.Validate(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"version": "1.0.0-*",
|
||||||
|
"compilationOptions": {
|
||||||
|
"emitEntryPoint": true,
|
||||||
|
"preserveCompilationContext": true
|
||||||
|
},
|
||||||
|
|
||||||
|
"dependencies": {
|
||||||
|
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||||
|
"DependencyContextValidator": "1.0.0-*"
|
||||||
|
},
|
||||||
|
|
||||||
|
"frameworks": {
|
||||||
|
"dnxcore50": { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace TestApp
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Microsoft.Extensions.DependencyModel.DependencyContextValidator.Validate(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"version": "1.0.0-*",
|
||||||
|
"compilationOptions": {
|
||||||
|
"emitEntryPoint": true,
|
||||||
|
},
|
||||||
|
|
||||||
|
"dependencies": {
|
||||||
|
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||||
|
"DependencyContextValidator": "1.0.0-*"
|
||||||
|
},
|
||||||
|
|
||||||
|
"frameworks": {
|
||||||
|
"dnxcore50": { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"projects": [ ".", "../../../src" ]
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ namespace ConsoleApplication
|
||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
.WriteLine("NET451");
|
Console.WriteLine("NET451");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"dummy1": { },
|
"net451": { },
|
||||||
"net451": { }
|
"net45": { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,8 @@ namespace TestApp
|
||||||
{
|
{
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
public static int Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Console.WriteLine(TestLibrary.Helper.GetMessage());
|
|
||||||
return 100;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"projects": [ "."]
|
"projects": [ "." ]
|
||||||
}
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace TestApp
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public static int Main(string[] args)
|
||||||
|
{
|
||||||
|
Console.WriteLine(TestLibrary.Helper.GetMessage());
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,10 +4,11 @@
|
||||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>947dd232-8d9b-4b78-9c6a-94f807d22222</ProjectGuid>
|
<ProjectGuid>58808bbc-371e-47d6-a3d0-4902145eda4e</ProjectGuid>
|
||||||
<RootNamespace>TestProjectToProjectDependencies</RootNamespace>
|
<RootNamespace>TestApp</RootNamespace>
|
||||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -16,4 +17,4 @@
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||||
</Project>
|
</Project>
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"version": "1.0.0-*",
|
||||||
|
"compilationOptions": {
|
||||||
|
"emitEntryPoint": true,
|
||||||
|
"preserveCompilationContext": true
|
||||||
|
},
|
||||||
|
|
||||||
|
"dependencies": {
|
||||||
|
"TestLibrary": { "target":"project", "version":"1.0.0-*" },
|
||||||
|
|
||||||
|
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||||
|
},
|
||||||
|
|
||||||
|
"frameworks": {
|
||||||
|
"dnxcore50": { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
noautobuild
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<doc>
|
||||||
|
<assembly>
|
||||||
|
<name>TestLibraryWithConfiguration</name>
|
||||||
|
</assembly>
|
||||||
|
<members>
|
||||||
|
<member name="M:TestLibrary.Helper.GetMessage">
|
||||||
|
<summary>
|
||||||
|
Gets the message from the helper. This comment is here to help test XML documentation file generation, please do not remove it.
|
||||||
|
</summary>
|
||||||
|
<returns>A message</returns>
|
||||||
|
</member>
|
||||||
|
</members>
|
||||||
|
</doc>
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"frameworks": {
|
||||||
|
"dnxcore50": {
|
||||||
|
"bin": {
|
||||||
|
"assembly": "bin\\{configuration}\\dnxcore50\\TestLibrary.dll",
|
||||||
|
"pdb": "bin\\{configuration}\\dnxcore50\\TestLibrary.pdb"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"projects": [ "."]
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ConsoleApplication
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public static void Main()
|
||||||
|
{
|
||||||
|
Console.WriteLine("Hello World!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"version": "1.0.0-*",
|
||||||
|
"compilationOptions": {
|
||||||
|
"emitEntryPoint": false
|
||||||
|
},
|
||||||
|
|
||||||
|
"dependencies": { },
|
||||||
|
|
||||||
|
"frameworks": {
|
||||||
|
"net20": { },
|
||||||
|
"net35": { },
|
||||||
|
"net40": { },
|
||||||
|
"net461": { },
|
||||||
|
"dnxcore50": {
|
||||||
|
"dependencies": {
|
||||||
|
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"projects": [ "src", "test" ]
|
"projects": [ "src", "test" ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import jobs.generation.Utilities;
|
||||||
def project = GithubProject
|
def project = GithubProject
|
||||||
def branch = GithubBranchName
|
def branch = GithubBranchName
|
||||||
|
|
||||||
def osList = ['Ubuntu', 'OSX', 'Windows_NT', 'CentOS7.1']
|
def osList = ['Ubuntu', 'OSX', 'Windows_NT', 'Windows_2016', 'CentOS7.1']
|
||||||
|
|
||||||
def static getBuildJobName(def configuration, def os) {
|
def static getBuildJobName(def configuration, def os) {
|
||||||
return configuration.toLowerCase() + '_' + os.toLowerCase()
|
return configuration.toLowerCase() + '_' + os.toLowerCase()
|
||||||
|
@ -28,6 +28,9 @@ def static getBuildJobName(def configuration, def os) {
|
||||||
if (os == 'Windows_NT') {
|
if (os == 'Windows_NT') {
|
||||||
buildCommand = ".\\build.cmd -Configuration ${lowerConfiguration} Default"
|
buildCommand = ".\\build.cmd -Configuration ${lowerConfiguration} Default"
|
||||||
}
|
}
|
||||||
|
else if (os == 'Windows_2016') {
|
||||||
|
buildCommand = ".\\build.cmd -Configuration ${lowerConfiguration} -RunInstallerTestsInDocker Default"
|
||||||
|
}
|
||||||
else if (os == 'Ubuntu') {
|
else if (os == 'Ubuntu') {
|
||||||
buildCommand = "./build.sh --skip-prereqs --configuration ${lowerConfiguration} --docker ubuntu Default"
|
buildCommand = "./build.sh --skip-prereqs --configuration ${lowerConfiguration} --docker ubuntu Default"
|
||||||
}
|
}
|
||||||
|
@ -39,7 +42,7 @@ def static getBuildJobName(def configuration, def os) {
|
||||||
def newJob = job(Utilities.getFullJobName(project, jobName, isPR)) {
|
def newJob = job(Utilities.getFullJobName(project, jobName, isPR)) {
|
||||||
// Set the label.
|
// Set the label.
|
||||||
steps {
|
steps {
|
||||||
if (os == 'Windows_NT') {
|
if (os == 'Windows_NT' || os == 'Windows_2016') {
|
||||||
// Batch
|
// Batch
|
||||||
batchFile(buildCommand)
|
batchFile(buildCommand)
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,39 +8,40 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
{
|
{
|
||||||
public class AnsiConsole
|
public class AnsiConsole
|
||||||
{
|
{
|
||||||
private AnsiConsole(TextWriter writer, bool useConsoleColor)
|
private AnsiConsole(TextWriter writer)
|
||||||
{
|
{
|
||||||
Writer = writer;
|
Writer = writer;
|
||||||
|
|
||||||
_useConsoleColor = useConsoleColor;
|
OriginalForegroundColor = Console.ForegroundColor;
|
||||||
if (_useConsoleColor)
|
|
||||||
{
|
|
||||||
OriginalForegroundColor = Console.ForegroundColor;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int _boldRecursion;
|
private int _boldRecursion;
|
||||||
private bool _useConsoleColor;
|
|
||||||
|
public static AnsiConsole GetOutput()
|
||||||
public static AnsiConsole GetOutput(bool useConsoleColor)
|
|
||||||
{
|
{
|
||||||
return new AnsiConsole(Console.Out, useConsoleColor);
|
return new AnsiConsole(Console.Out);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AnsiConsole GetError(bool useConsoleColor)
|
public static AnsiConsole GetError()
|
||||||
{
|
{
|
||||||
return new AnsiConsole(Console.Error, useConsoleColor);
|
return new AnsiConsole(Console.Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextWriter Writer { get; }
|
public TextWriter Writer { get; }
|
||||||
|
|
||||||
public ConsoleColor OriginalForegroundColor { get; }
|
public ConsoleColor OriginalForegroundColor { get; }
|
||||||
|
|
||||||
private void SetColor(ConsoleColor color)
|
private void SetColor(ConsoleColor color)
|
||||||
{
|
{
|
||||||
Console.ForegroundColor = (ConsoleColor)(((int)Console.ForegroundColor & 0x08) | ((int)color & 0x07));
|
const int Light = 0x08;
|
||||||
}
|
int c = (int)color;
|
||||||
|
|
||||||
|
Console.ForegroundColor =
|
||||||
|
c < 0 ? color : // unknown, just use it
|
||||||
|
_boldRecursion > 0 ? (ConsoleColor)(c & ~Light) : // ensure color is dark
|
||||||
|
(ConsoleColor)(c | Light); // ensure color is light
|
||||||
|
}
|
||||||
|
|
||||||
private void SetBold(bool bold)
|
private void SetBold(bool bold)
|
||||||
{
|
{
|
||||||
_boldRecursion += bold ? 1 : -1;
|
_boldRecursion += bold ? 1 : -1;
|
||||||
|
@ -48,18 +49,20 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.ForegroundColor = (ConsoleColor)((int)Console.ForegroundColor ^ 0x08);
|
// switches on _boldRecursion to handle boldness
|
||||||
|
SetColor(Console.ForegroundColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WriteLine(string message)
|
public void WriteLine(string message)
|
||||||
{
|
{
|
||||||
if (!_useConsoleColor)
|
Write(message);
|
||||||
{
|
Writer.WriteLine();
|
||||||
Writer.WriteLine(message);
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
public void Write(string message)
|
||||||
|
{
|
||||||
var escapeScan = 0;
|
var escapeScan = 0;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
@ -80,14 +83,14 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
{
|
{
|
||||||
endIndex += 1;
|
endIndex += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
var text = message.Substring(escapeScan, escapeIndex - escapeScan);
|
var text = message.Substring(escapeScan, escapeIndex - escapeScan);
|
||||||
Writer.Write(text);
|
Writer.Write(text);
|
||||||
if (endIndex == message.Length)
|
if (endIndex == message.Length)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (message[endIndex])
|
switch (message[endIndex])
|
||||||
{
|
{
|
||||||
case 'm':
|
case 'm':
|
||||||
|
@ -133,11 +136,10 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
escapeScan = endIndex + 1;
|
escapeScan = endIndex + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Writer.WriteLine();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,13 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
BuildTarget target;
|
BuildTarget target;
|
||||||
if (!Targets.TryGetValue(name, out target))
|
if (!Targets.TryGetValue(name, out target))
|
||||||
{
|
{
|
||||||
Reporter.Verbose.WriteLine($"Skipping undefined target: {name}");
|
throw new UndefinedTargetException($"Undefined target: {name}");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!EvaluateTargetConditions(target))
|
||||||
|
{
|
||||||
|
Reporter.Verbose.WriteLine($"Skipping, Target Conditions not met: {target.Name}");
|
||||||
|
return new BuildTargetResult(target, success: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if it's been completed
|
// Check if it's been completed
|
||||||
|
@ -53,7 +59,6 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// It hasn't, or we're forcing, so run it
|
// It hasn't, or we're forcing, so run it
|
||||||
result = ExecTarget(target);
|
result = ExecTarget(target);
|
||||||
_completedTargets[target.Name] = result;
|
_completedTargets[target.Name] = result;
|
||||||
|
@ -80,8 +85,36 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
Reporter.Error.WriteLine("error".Red().Bold() + $": {message}");
|
Reporter.Error.WriteLine("error".Red().Bold() + $": {message}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool EvaluateTargetConditions(BuildTarget target)
|
||||||
|
{
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("target");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (target.Conditions == null)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var condition in target.Conditions)
|
||||||
|
{
|
||||||
|
if (!condition())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private BuildTargetResult ExecTarget(BuildTarget target)
|
private BuildTargetResult ExecTarget(BuildTarget target)
|
||||||
{
|
{
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("target");
|
||||||
|
}
|
||||||
|
|
||||||
var sectionName = $"{target.Name.PadRight(_maxTargetLen + 2).Yellow()} ({target.Source.White()})";
|
var sectionName = $"{target.Name.PadRight(_maxTargetLen + 2).Yellow()} ({target.Source.White()})";
|
||||||
BuildReporter.BeginSection("TARGET", sectionName);
|
BuildReporter.BeginSection("TARGET", sectionName);
|
||||||
|
|
||||||
|
|
|
@ -52,8 +52,6 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
|
|
||||||
public int Run(string[] args)
|
public int Run(string[] args)
|
||||||
{
|
{
|
||||||
DebugHelper.HandleDebugSwitch(ref args);
|
|
||||||
|
|
||||||
var targets = new[] { BuildContext.DefaultTarget };
|
var targets = new[] { BuildContext.DefaultTarget };
|
||||||
if(args.Length > 0)
|
if(args.Length > 0)
|
||||||
{
|
{
|
||||||
|
@ -104,18 +102,40 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
private static IEnumerable<BuildTarget> CollectTargets(Type typ)
|
private static IEnumerable<BuildTarget> CollectTargets(Type typ)
|
||||||
{
|
{
|
||||||
return from m in typ.GetMethods()
|
return from m in typ.GetMethods()
|
||||||
let attr = m.GetCustomAttribute<TargetAttribute>()
|
let targetAttribute = m.GetCustomAttribute<TargetAttribute>()
|
||||||
where attr != null
|
let conditionalAttributes = m.GetCustomAttributes<TargetConditionAttribute>(false)
|
||||||
select CreateTarget(m, attr);
|
where targetAttribute != null
|
||||||
|
select CreateTarget(m, targetAttribute, conditionalAttributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BuildTarget CreateTarget(MethodInfo m, TargetAttribute attr)
|
private static BuildTarget CreateTarget(
|
||||||
|
MethodInfo methodInfo,
|
||||||
|
TargetAttribute targetAttribute,
|
||||||
|
IEnumerable<TargetConditionAttribute> targetConditionAttributes)
|
||||||
{
|
{
|
||||||
|
var name = targetAttribute.Name ?? methodInfo.Name;
|
||||||
|
|
||||||
|
var conditions = ExtractTargetConditionsFromAttributes(targetConditionAttributes);
|
||||||
|
|
||||||
return new BuildTarget(
|
return new BuildTarget(
|
||||||
attr.Name ?? m.Name,
|
name,
|
||||||
$"{m.DeclaringType.FullName}.{m.Name}",
|
$"{methodInfo.DeclaringType.FullName}.{methodInfo.Name}",
|
||||||
attr.Dependencies,
|
targetAttribute.Dependencies,
|
||||||
(Func<BuildTargetContext, BuildTargetResult>)m.CreateDelegate(typeof(Func<BuildTargetContext, BuildTargetResult>)));
|
conditions,
|
||||||
|
(Func<BuildTargetContext, BuildTargetResult>)methodInfo.CreateDelegate(typeof(Func<BuildTargetContext, BuildTargetResult>)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IEnumerable<Func<bool>> ExtractTargetConditionsFromAttributes(
|
||||||
|
IEnumerable<TargetConditionAttribute> targetConditionAttributes)
|
||||||
|
{
|
||||||
|
if (targetConditionAttributes == null || targetConditionAttributes.Count() == 0)
|
||||||
|
{
|
||||||
|
return Enumerable.Empty<Func<bool>>();
|
||||||
|
}
|
||||||
|
|
||||||
|
return targetConditionAttributes
|
||||||
|
.Select<TargetConditionAttribute, Func<bool>>(c => c.EvaluateCondition)
|
||||||
|
.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GenerateSourceString(string file, int? line, string member)
|
private string GenerateSourceString(string file, int? line, string member)
|
||||||
|
|
|
@ -4,21 +4,28 @@ using System.Linq;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
{
|
{
|
||||||
public class BuildTarget
|
public class BuildTarget
|
||||||
{
|
{
|
||||||
public string Name { get; }
|
public string Name { get; }
|
||||||
public string Source { get; }
|
public string Source { get; }
|
||||||
public IEnumerable<string> Dependencies { get; }
|
public IEnumerable<string> Dependencies { get; }
|
||||||
public Func<BuildTargetContext, BuildTargetResult> Body { get; }
|
public IEnumerable<Func<bool>> Conditions { get; }
|
||||||
|
public Func<BuildTargetContext, BuildTargetResult> Body { get; }
|
||||||
|
|
||||||
public BuildTarget(string name, string source) : this(name, source, Enumerable.Empty<string>(), null) { }
|
public BuildTarget(string name, string source) : this(name, source, Enumerable.Empty<string>(), Enumerable.Empty<Func<bool>>(), null) { }
|
||||||
public BuildTarget(string name, string source, IEnumerable<string> dependencies) : this(name, source, dependencies, null) { }
|
public BuildTarget(string name, string source, IEnumerable<string> dependencies) : this(name, source, dependencies, Enumerable.Empty<Func<bool>>(), null) { }
|
||||||
public BuildTarget(string name, string source, IEnumerable<string> dependencies, Func<BuildTargetContext, BuildTargetResult> body)
|
public BuildTarget(
|
||||||
{
|
string name,
|
||||||
Name = name;
|
string source,
|
||||||
|
IEnumerable<string> dependencies,
|
||||||
|
IEnumerable<Func<bool>> conditions,
|
||||||
|
Func<BuildTargetContext, BuildTargetResult> body)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
Source = source;
|
Source = source;
|
||||||
Dependencies = dependencies;
|
Dependencies = dependencies;
|
||||||
Body = body;
|
Conditions = conditions;
|
||||||
}
|
Body = body;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -25,6 +25,7 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
private Action<string> _stdErrHandler;
|
private Action<string> _stdErrHandler;
|
||||||
|
|
||||||
private bool _running = false;
|
private bool _running = false;
|
||||||
|
private bool _quietBuildReporter = false;
|
||||||
|
|
||||||
private Command(string executable, string args)
|
private Command(string executable, string args)
|
||||||
{
|
{
|
||||||
|
@ -148,6 +149,12 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Command QuietBuildReporter()
|
||||||
|
{
|
||||||
|
_quietBuildReporter = true;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public CommandResult Execute()
|
public CommandResult Execute()
|
||||||
{
|
{
|
||||||
ThrowIfRunning();
|
ThrowIfRunning();
|
||||||
|
@ -172,7 +179,7 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
_process.EnableRaisingEvents = true;
|
_process.EnableRaisingEvents = true;
|
||||||
|
|
||||||
var sw = Stopwatch.StartNew();
|
var sw = Stopwatch.StartNew();
|
||||||
BuildReporter.BeginSection("EXEC", FormatProcessInfo(_process.StartInfo));
|
ReportExecBegin();
|
||||||
|
|
||||||
_process.Start();
|
_process.Start();
|
||||||
|
|
||||||
|
@ -190,15 +197,7 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
|
|
||||||
var exitCode = _process.ExitCode;
|
var exitCode = _process.ExitCode;
|
||||||
|
|
||||||
var message = $"{FormatProcessInfo(_process.StartInfo)} exited with {exitCode}";
|
ReportExecEnd(exitCode);
|
||||||
if (exitCode == 0)
|
|
||||||
{
|
|
||||||
BuildReporter.EndSection("EXEC", message.Green(), success: true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BuildReporter.EndSection("EXEC", message.Red().Bold(), success: false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new CommandResult(
|
return new CommandResult(
|
||||||
_process.StartInfo,
|
_process.StartInfo,
|
||||||
|
@ -299,6 +298,30 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
return info.FileName + " " + info.Arguments;
|
return info.FileName + " " + info.Arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ReportExecBegin()
|
||||||
|
{
|
||||||
|
if (!_quietBuildReporter)
|
||||||
|
{
|
||||||
|
BuildReporter.BeginSection("EXEC", FormatProcessInfo(_process.StartInfo));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ReportExecEnd(int exitCode)
|
||||||
|
{
|
||||||
|
if (!_quietBuildReporter)
|
||||||
|
{
|
||||||
|
var message = $"{FormatProcessInfo(_process.StartInfo)} exited with {exitCode}";
|
||||||
|
if (exitCode == 0)
|
||||||
|
{
|
||||||
|
BuildReporter.EndSection("EXEC", message.Green(), success: true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BuildReporter.EndSection("EXEC", message.Red().Bold(), success: false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ThrowIfRunning([CallerMemberName] string memberName = null)
|
private void ThrowIfRunning([CallerMemberName] string memberName = null)
|
||||||
{
|
{
|
||||||
if (_running)
|
if (_running)
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
|
{
|
||||||
|
public static class CurrentArchitecture
|
||||||
|
{
|
||||||
|
public static BuildArchitecture Current
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return DetermineCurrentArchitecture();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool Isx86
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var archName = PlatformServices.Default.Runtime.RuntimeArchitecture;
|
||||||
|
return string.Equals(archName, "x86", StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool Isx64
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var archName = PlatformServices.Default.Runtime.RuntimeArchitecture;
|
||||||
|
return string.Equals(archName, "x64", StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static BuildArchitecture DetermineCurrentArchitecture()
|
||||||
|
{
|
||||||
|
if (Isx86)
|
||||||
|
{
|
||||||
|
return BuildArchitecture.x86;
|
||||||
|
}
|
||||||
|
else if (Isx64)
|
||||||
|
{
|
||||||
|
return BuildArchitecture.x64;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return default(BuildArchitecture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
|
{
|
||||||
|
public static class CurrentPlatform
|
||||||
|
{
|
||||||
|
public static BuildPlatform Current
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return DetermineCurrentPlatform();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsWindows
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsOSX
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsUbuntu
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var osname = PlatformServices.Default.Runtime.OperatingSystem;
|
||||||
|
return string.Equals(osname, "ubuntu", StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsCentOS
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var osname = PlatformServices.Default.Runtime.OperatingSystem;
|
||||||
|
return string.Equals(osname, "centos", StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static BuildPlatform DetermineCurrentPlatform()
|
||||||
|
{
|
||||||
|
if (IsWindows)
|
||||||
|
{
|
||||||
|
return BuildPlatform.Windows;
|
||||||
|
}
|
||||||
|
else if (IsOSX)
|
||||||
|
{
|
||||||
|
return BuildPlatform.OSX;
|
||||||
|
}
|
||||||
|
else if (IsUbuntu)
|
||||||
|
{
|
||||||
|
return BuildPlatform.Ubuntu;
|
||||||
|
}
|
||||||
|
else if (IsCentOS)
|
||||||
|
{
|
||||||
|
return BuildPlatform.CentOS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return default(BuildPlatform);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
|
{
|
||||||
|
public enum BuildArchitecture
|
||||||
|
{
|
||||||
|
x86 = 1,
|
||||||
|
x64 = 2
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
|
{
|
||||||
|
public enum BuildPlatform
|
||||||
|
{
|
||||||
|
Windows = 1,
|
||||||
|
OSX = 2,
|
||||||
|
Ubuntu = 3,
|
||||||
|
CentOS = 4
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,16 +19,9 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
_console = console;
|
_console = console;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Reporter Output { get; } = Create(AnsiConsole.GetOutput);
|
public static Reporter Output { get; } = new Reporter(AnsiConsole.GetOutput());
|
||||||
public static Reporter Error { get; } = Create(AnsiConsole.GetOutput);
|
public static Reporter Error { get; } = new Reporter(AnsiConsole.GetOutput());
|
||||||
public static Reporter Verbose { get; } = Create(AnsiConsole.GetOutput);
|
public static Reporter Verbose { get; } = new Reporter(AnsiConsole.GetOutput());
|
||||||
|
|
||||||
public static Reporter Create(Func<bool, AnsiConsole> getter)
|
|
||||||
{
|
|
||||||
var stripColors = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ||
|
|
||||||
string.Equals(Environment.GetEnvironmentVariable("NO_COLOR"), "1");
|
|
||||||
return new Reporter(getter(stripColors));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void WriteLine(string message)
|
public void WriteLine(string message)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,8 +5,8 @@ using System.Linq;
|
||||||
namespace Microsoft.DotNet.Cli.Build.Framework
|
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
{
|
{
|
||||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
|
||||||
public class TargetAttribute : Attribute
|
public class TargetAttribute : Attribute
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public IEnumerable<string> Dependencies { get; }
|
public IEnumerable<string> Dependencies { get; }
|
||||||
|
|
||||||
|
@ -20,5 +20,5 @@ namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
{
|
{
|
||||||
Dependencies = dependencies;
|
Dependencies = dependencies;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
|
{
|
||||||
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
|
||||||
|
public class BuildArchitecturesAttribute : TargetConditionAttribute
|
||||||
|
{
|
||||||
|
private IEnumerable<BuildArchitecture> _buildArchitectures;
|
||||||
|
|
||||||
|
public BuildArchitecturesAttribute(params BuildArchitecture[] architectures)
|
||||||
|
{
|
||||||
|
if (architectures == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("architectures");
|
||||||
|
}
|
||||||
|
|
||||||
|
_buildArchitectures = architectures;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool EvaluateCondition()
|
||||||
|
{
|
||||||
|
var currentArchitecture = CurrentArchitecture.Current;
|
||||||
|
|
||||||
|
if (currentArchitecture == default(BuildArchitecture))
|
||||||
|
{
|
||||||
|
throw new Exception("Unrecognized Architecture");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var architecture in _buildArchitectures)
|
||||||
|
{
|
||||||
|
if (architecture == currentArchitecture)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
|
{
|
||||||
|
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
|
||||||
|
public class BuildPlatformsAttribute : TargetConditionAttribute
|
||||||
|
{
|
||||||
|
private IEnumerable<BuildPlatform> _buildPlatforms;
|
||||||
|
|
||||||
|
public BuildPlatformsAttribute(params BuildPlatform[] platforms)
|
||||||
|
{
|
||||||
|
if (platforms == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("platforms");
|
||||||
|
}
|
||||||
|
|
||||||
|
_buildPlatforms = platforms;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool EvaluateCondition()
|
||||||
|
{
|
||||||
|
var currentPlatform = CurrentPlatform.Current;
|
||||||
|
|
||||||
|
if (currentPlatform == default(BuildPlatform))
|
||||||
|
{
|
||||||
|
throw new Exception("Unrecognized Platform.");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var platform in _buildPlatforms)
|
||||||
|
{
|
||||||
|
if (platform == currentPlatform)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
|
{
|
||||||
|
public abstract class TargetConditionAttribute : Attribute
|
||||||
|
{
|
||||||
|
public abstract bool EvaluateCondition();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Cli.Build.Framework
|
||||||
|
{
|
||||||
|
public class UndefinedTargetException : Exception
|
||||||
|
{
|
||||||
|
public UndefinedTargetException(string message) : base(message) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||||
"System.Diagnostics.Process": "4.1.0-rc2-23811"
|
"System.Diagnostics.Process": "4.1.0-rc2-23811",
|
||||||
|
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16537"
|
||||||
},
|
},
|
||||||
|
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
|
|
|
@ -6,39 +6,80 @@
|
||||||
# Dockerfile that creates a container suitable to build dotnet-cli
|
# Dockerfile that creates a container suitable to build dotnet-cli
|
||||||
FROM ubuntu:14.04
|
FROM ubuntu:14.04
|
||||||
|
|
||||||
|
# Misc Dependencies for build
|
||||||
|
RUN apt-get update && apt-get -qqy install curl unzip gettext sudo
|
||||||
|
|
||||||
# This could become a "microsoft/coreclr" image, since it just installs the dependencies for CoreCLR (and stdlib)
|
# This could become a "microsoft/coreclr" image, since it just installs the dependencies for CoreCLR (and stdlib)
|
||||||
# Install CoreCLR and CoreFx dependencies
|
RUN echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.6 main" | tee /etc/apt/sources.list.d/llvm.list && \
|
||||||
RUN apt-get update && \
|
curl http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add - && \
|
||||||
apt-get -qqy install unzip curl libicu-dev libunwind8 gettext libssl-dev libcurl3-gnutls zlib1g liblttng-ust-dev lldb-3.6-dev lldb-3.6
|
apt-get update && apt-get -qqy install\
|
||||||
|
libc6 \
|
||||||
|
libedit2 \
|
||||||
|
libffi6 \
|
||||||
|
libgcc1 \
|
||||||
|
libicu52 \
|
||||||
|
liblldb-3.6 \
|
||||||
|
libllvm3.6 \
|
||||||
|
liblttng-ust0 \
|
||||||
|
liblzma5 \
|
||||||
|
libncurses5 \
|
||||||
|
libpython2.7 \
|
||||||
|
libstdc++6 \
|
||||||
|
libtinfo5 \
|
||||||
|
libunwind8 \
|
||||||
|
liburcu1 \
|
||||||
|
libuuid1 \
|
||||||
|
zlib1g \
|
||||||
|
libasn1-8-heimdal \
|
||||||
|
libcomerr2 \
|
||||||
|
libcurl3 \
|
||||||
|
libgcrypt11 \
|
||||||
|
libgnutls26 \
|
||||||
|
libgpg-error0 \
|
||||||
|
libgssapi3-heimdal \
|
||||||
|
libgssapi-krb5-2 \
|
||||||
|
libhcrypto4-heimdal \
|
||||||
|
libheimbase1-heimdal \
|
||||||
|
libheimntlm0-heimdal \
|
||||||
|
libhx509-5-heimdal \
|
||||||
|
libidn11 \
|
||||||
|
libk5crypto3 \
|
||||||
|
libkeyutils1 \
|
||||||
|
libkrb5-26-heimdal \
|
||||||
|
libkrb5-3 \
|
||||||
|
libkrb5support0 \
|
||||||
|
libldap-2.4-2 \
|
||||||
|
libp11-kit0 \
|
||||||
|
libroken18-heimdal \
|
||||||
|
librtmp0 \
|
||||||
|
libsasl2-2 \
|
||||||
|
libsqlite3-0 \
|
||||||
|
libssl1.0.0 \
|
||||||
|
libtasn1-6 \
|
||||||
|
libwind0-heimdal
|
||||||
|
|
||||||
# Install Dotnet CLI dependencies.
|
# Install Dotnet CLI dependencies.
|
||||||
# clang is required for dotnet-compile-native
|
# clang is required for dotnet-compile-native
|
||||||
RUN apt-get -qqy install clang-3.5
|
RUN apt-get -qqy install clang-3.5
|
||||||
|
|
||||||
# Install Build Prereqs
|
# Install Build Prereqs
|
||||||
RUN echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.6 main" | tee /etc/apt/sources.list.d/llvm.list && \
|
RUN apt-get -qq install -y debhelper build-essential devscripts git cmake
|
||||||
curl http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add - && \
|
|
||||||
apt-get update && \
|
|
||||||
apt-get install -y debhelper build-essential devscripts git cmake
|
|
||||||
|
|
||||||
# Use clang as c++ compiler
|
# Use clang as c++ compiler
|
||||||
RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-3.5 100
|
RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-3.5 100
|
||||||
RUN update-alternatives --set c++ /usr/bin/clang++-3.5
|
RUN update-alternatives --set c++ /usr/bin/clang++-3.5
|
||||||
|
|
||||||
# Install azure cli. We need this to publish artifacts.
|
# Install azure cli. We need this to publish artifacts.
|
||||||
RUN apt-get -y install nodejs-legacy && \
|
RUN apt-get -qqy install nodejs-legacy && \
|
||||||
apt-get -y install npm && \
|
apt-get -qqy install npm && \
|
||||||
npm install -g azure-cli
|
npm install -g azure-cli
|
||||||
|
|
||||||
|
|
||||||
RUN apt-get install -qqy sudo
|
|
||||||
|
|
||||||
# Setup User to match Host User, and give superuser permissions
|
# Setup User to match Host User, and give superuser permissions
|
||||||
ARG USER_ID=0
|
ARG USER_ID=0
|
||||||
RUN useradd -m code_executor -u ${USER_ID} -g sudo
|
RUN useradd -m code_executor -u ${USER_ID} -g sudo
|
||||||
RUN echo 'code_executor ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
RUN echo 'code_executor ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
||||||
|
|
||||||
# With the User Change, we need to change permssions on these directories
|
# With the User Change, we need to change permissions on these directories
|
||||||
RUN chmod -R a+rwx /usr/local
|
RUN chmod -R a+rwx /usr/local
|
||||||
RUN chmod -R a+rwx /home
|
RUN chmod -R a+rwx /home
|
||||||
RUN chmod -R 755 /usr/lib/sudo
|
RUN chmod -R 755 /usr/lib/sudo
|
||||||
|
|
96
scripts/dotnet-cli-build/PackageDependencies.cs
Normal file
96
scripts/dotnet-cli-build/PackageDependencies.cs
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Cli.Build
|
||||||
|
{
|
||||||
|
public class PackageDependencies
|
||||||
|
{
|
||||||
|
internal static string[] DebianPackageBuildDependencies
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new string[]
|
||||||
|
{
|
||||||
|
"devscripts",
|
||||||
|
"debhelper",
|
||||||
|
"build-essential"
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static string[] UbuntuCoreclrAndCoreFxDependencies
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new string[]
|
||||||
|
{
|
||||||
|
"libc6",
|
||||||
|
"libedit2",
|
||||||
|
"libffi6",
|
||||||
|
"libgcc1",
|
||||||
|
"libicu52",
|
||||||
|
"liblldb-3.6",
|
||||||
|
"libllvm3.6",
|
||||||
|
"liblttng-ust0",
|
||||||
|
"liblzma5",
|
||||||
|
"libncurses5",
|
||||||
|
"libpython2.7",
|
||||||
|
"libstdc++6",
|
||||||
|
"libtinfo5",
|
||||||
|
"libunwind8",
|
||||||
|
"liburcu1",
|
||||||
|
"libuuid1",
|
||||||
|
"zlib1g",
|
||||||
|
"libasn1-8-heimdal",
|
||||||
|
"libcomerr2",
|
||||||
|
"libcurl3",
|
||||||
|
"libgcrypt11",
|
||||||
|
"libgnutls26",
|
||||||
|
"libgpg-error0",
|
||||||
|
"libgssapi3-heimdal",
|
||||||
|
"libgssapi-krb5-2",
|
||||||
|
"libhcrypto4-heimdal",
|
||||||
|
"libheimbase1-heimdal",
|
||||||
|
"libheimntlm0-heimdal",
|
||||||
|
"libhx509-5-heimdal",
|
||||||
|
"libidn11",
|
||||||
|
"libk5crypto3",
|
||||||
|
"libkeyutils1",
|
||||||
|
"libkrb5-26-heimdal",
|
||||||
|
"libkrb5-3",
|
||||||
|
"libkrb5support0",
|
||||||
|
"libldap-2.4-2",
|
||||||
|
"libp11-kit0",
|
||||||
|
"libroken18-heimdal",
|
||||||
|
"librtmp0",
|
||||||
|
"libsasl2-2",
|
||||||
|
"libsqlite3-0",
|
||||||
|
"libssl1.0.0",
|
||||||
|
"libtasn1-6",
|
||||||
|
"libwind0-heimdal"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static string[] CentosCoreclrAndCoreFxDependencies
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new string[]
|
||||||
|
{
|
||||||
|
"unzip",
|
||||||
|
"libunwind",
|
||||||
|
"gettext",
|
||||||
|
"libcurl-devel",
|
||||||
|
"openssl-devel",
|
||||||
|
"zlib",
|
||||||
|
"libicu-devel"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
using static Microsoft.DotNet.Cli.Build.FS;
|
using static Microsoft.DotNet.Cli.Build.FS;
|
||||||
using static Microsoft.DotNet.Cli.Build.Utils;
|
using static Microsoft.DotNet.Cli.Build.Utils;
|
||||||
|
@ -17,6 +18,18 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
[Target(nameof(Init), nameof(RestorePackages))]
|
[Target(nameof(Init), nameof(RestorePackages))]
|
||||||
public static BuildTargetResult Prepare(BuildTargetContext c) => c.Success();
|
public static BuildTargetResult Prepare(BuildTargetContext c) => c.Success();
|
||||||
|
|
||||||
|
[Target(nameof(CheckPrereqCmakePresent), nameof(CheckPlatformDependencies))]
|
||||||
|
public static BuildTargetResult CheckPrereqs(BuildTargetContext c) => c.Success();
|
||||||
|
|
||||||
|
[Target(nameof(CheckCoreclrPlatformDependencies), nameof(CheckInstallerBuildPlatformDependencies))]
|
||||||
|
public static BuildTargetResult CheckPlatformDependencies(BuildTargetContext c) => c.Success();
|
||||||
|
|
||||||
|
[Target(nameof(CheckUbuntuCoreclrAndCoreFxDependencies), nameof(CheckCentOSCoreclrAndCoreFxDependencies))]
|
||||||
|
public static BuildTargetResult CheckCoreclrPlatformDependencies(BuildTargetContext c) => c.Success();
|
||||||
|
|
||||||
|
[Target(nameof(CheckUbuntuDebianPackageBuildDependencies))]
|
||||||
|
public static BuildTargetResult CheckInstallerBuildPlatformDependencies(BuildTargetContext c) => c.Success();
|
||||||
|
|
||||||
// All major targets will depend on this in order to ensure variables are set up right if they are run independently
|
// All major targets will depend on this in order to ensure variables are set up right if they are run independently
|
||||||
[Target(nameof(GenerateVersions), nameof(CheckPrereqs), nameof(LocateStage0))]
|
[Target(nameof(GenerateVersions), nameof(CheckPrereqs), nameof(LocateStage0))]
|
||||||
public static BuildTargetResult Init(BuildTargetContext c)
|
public static BuildTargetResult Init(BuildTargetContext c)
|
||||||
|
@ -91,38 +104,6 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
return c.Success();
|
return c.Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Target]
|
|
||||||
public static BuildTargetResult CheckPrereqs(BuildTargetContext c)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Command.Create("cmake", "--version")
|
|
||||||
.CaptureStdOut()
|
|
||||||
.CaptureStdErr()
|
|
||||||
.Execute();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
string message = $@"Error running cmake: {ex.Message}
|
|
||||||
cmake is required to build the native host 'corehost'";
|
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
||||||
{
|
|
||||||
message += Environment.NewLine + "Download it from https://www.cmake.org";
|
|
||||||
}
|
|
||||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|
||||||
{
|
|
||||||
message += Environment.NewLine + "Ubuntu: 'sudo apt-get install cmake'";
|
|
||||||
}
|
|
||||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
|
||||||
{
|
|
||||||
message += Environment.NewLine + "OS X w/Homebrew: 'brew install cmake'";
|
|
||||||
}
|
|
||||||
return c.Failed(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return c.Success();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Target]
|
[Target]
|
||||||
public static BuildTargetResult CheckPackageCache(BuildTargetContext c)
|
public static BuildTargetResult CheckPackageCache(BuildTargetContext c)
|
||||||
{
|
{
|
||||||
|
@ -200,6 +181,134 @@ cmake is required to build the native host 'corehost'";
|
||||||
return c.Success();
|
return c.Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Target]
|
||||||
|
[BuildPlatforms(BuildPlatform.Ubuntu)]
|
||||||
|
public static BuildTargetResult CheckUbuntuDebianPackageBuildDependencies(BuildTargetContext c)
|
||||||
|
{
|
||||||
|
|
||||||
|
var messageBuilder = new StringBuilder();
|
||||||
|
var aptDependencyUtility = new AptDependencyUtility();
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var package in PackageDependencies.DebianPackageBuildDependencies)
|
||||||
|
{
|
||||||
|
if (!AptDependencyUtility.PackageIsInstalled(package))
|
||||||
|
{
|
||||||
|
messageBuilder.Append($"Error: Debian package build dependency {package} missing.");
|
||||||
|
messageBuilder.Append(Environment.NewLine);
|
||||||
|
messageBuilder.Append($"-> install with apt-get install {package}");
|
||||||
|
messageBuilder.Append(Environment.NewLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (messageBuilder.Length == 0)
|
||||||
|
{
|
||||||
|
return c.Success();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return c.Failed(messageBuilder.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Target]
|
||||||
|
[BuildPlatforms(BuildPlatform.Ubuntu)]
|
||||||
|
public static BuildTargetResult CheckUbuntuCoreclrAndCoreFxDependencies(BuildTargetContext c)
|
||||||
|
{
|
||||||
|
var errorMessageBuilder = new StringBuilder();
|
||||||
|
var stage0 = DotNetCli.Stage0.BinPath;
|
||||||
|
|
||||||
|
foreach (var package in PackageDependencies.UbuntuCoreclrAndCoreFxDependencies)
|
||||||
|
{
|
||||||
|
if (!AptDependencyUtility.PackageIsInstalled(package))
|
||||||
|
{
|
||||||
|
errorMessageBuilder.Append($"Error: Coreclr package dependency {package} missing.");
|
||||||
|
errorMessageBuilder.Append(Environment.NewLine);
|
||||||
|
errorMessageBuilder.Append($"-> install with apt-get install {package}");
|
||||||
|
errorMessageBuilder.Append(Environment.NewLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (errorMessageBuilder.Length == 0)
|
||||||
|
{
|
||||||
|
return c.Success();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return c.Failed(errorMessageBuilder.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Target]
|
||||||
|
[BuildPlatforms(BuildPlatform.CentOS)]
|
||||||
|
public static BuildTargetResult CheckCentOSCoreclrAndCoreFxDependencies(BuildTargetContext c)
|
||||||
|
{
|
||||||
|
var errorMessageBuilder = new StringBuilder();
|
||||||
|
|
||||||
|
foreach (var package in PackageDependencies.CentosCoreclrAndCoreFxDependencies)
|
||||||
|
{
|
||||||
|
if (!YumDependencyUtility.PackageIsInstalled(package))
|
||||||
|
{
|
||||||
|
errorMessageBuilder.Append($"Error: Coreclr package dependency {package} missing.");
|
||||||
|
errorMessageBuilder.Append(Environment.NewLine);
|
||||||
|
errorMessageBuilder.Append($"-> install with yum install {package}");
|
||||||
|
errorMessageBuilder.Append(Environment.NewLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (errorMessageBuilder.Length == 0)
|
||||||
|
{
|
||||||
|
return c.Success();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return c.Failed(errorMessageBuilder.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Target]
|
||||||
|
public static BuildTargetResult CheckPrereqCmakePresent(BuildTargetContext c)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Command.Create("cmake", "--version")
|
||||||
|
.CaptureStdOut()
|
||||||
|
.CaptureStdErr()
|
||||||
|
.Execute();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
string message = $@"Error running cmake: {ex.Message}
|
||||||
|
cmake is required to build the native host 'corehost'";
|
||||||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
|
{
|
||||||
|
message += Environment.NewLine + "Download it from https://www.cmake.org";
|
||||||
|
}
|
||||||
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||||
|
{
|
||||||
|
message += Environment.NewLine + "Ubuntu: 'sudo apt-get install cmake'";
|
||||||
|
}
|
||||||
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||||
|
{
|
||||||
|
message += Environment.NewLine + "OS X w/Homebrew: 'brew install cmake'";
|
||||||
|
}
|
||||||
|
return c.Failed(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool AptPackageIsInstalled(string packageName)
|
||||||
|
{
|
||||||
|
var result = Command.Create("dpkg", "-s", packageName)
|
||||||
|
.CaptureStdOut()
|
||||||
|
.CaptureStdErr()
|
||||||
|
.QuietBuildReporter()
|
||||||
|
.Execute();
|
||||||
|
|
||||||
|
return result.ExitCode == 0;
|
||||||
|
}
|
||||||
|
|
||||||
private static IDictionary<string, string> ReadBranchInfo(BuildTargetContext c, string path)
|
private static IDictionary<string, string> ReadBranchInfo(BuildTargetContext c, string path)
|
||||||
{
|
{
|
||||||
var lines = File.ReadAllLines(path);
|
var lines = File.ReadAllLines(path);
|
||||||
|
|
|
@ -4,9 +4,14 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
{
|
{
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
public static int Main(string[] args) => BuildSetup.Create(".NET Core CLI")
|
public static int Main(string[] args)
|
||||||
.UseStandardGoals()
|
{
|
||||||
.UseAllTargetsFromAssembly<Program>()
|
DebugHelper.HandleDebugSwitch(ref args);
|
||||||
.Run(args);
|
|
||||||
|
return BuildSetup.Create(".NET Core CLI")
|
||||||
|
.UseStandardGoals()
|
||||||
|
.UseAllTargetsFromAssembly<Program>()
|
||||||
|
.Run(args);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ namespace Microsoft.DotNet.Cli.Build
|
||||||
"dotnet-build.Tests",
|
"dotnet-build.Tests",
|
||||||
"dotnet-pack.Tests",
|
"dotnet-pack.Tests",
|
||||||
"dotnet-resgen.Tests",
|
"dotnet-resgen.Tests",
|
||||||
|
"dotnet-run.Tests",
|
||||||
"Microsoft.DotNet.Cli.Utils.Tests",
|
"Microsoft.DotNet.Cli.Utils.Tests",
|
||||||
"Microsoft.DotNet.Compiler.Common.Tests",
|
"Microsoft.DotNet.Compiler.Common.Tests",
|
||||||
"Microsoft.DotNet.ProjectModel.Tests",
|
"Microsoft.DotNet.ProjectModel.Tests",
|
||||||
|
|
24
scripts/dotnet-cli-build/Utils/AptDependencyUtility.cs
Normal file
24
scripts/dotnet-cli-build/Utils/AptDependencyUtility.cs
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.DotNet.Cli.Build.Framework;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Cli.Build
|
||||||
|
{
|
||||||
|
public class AptDependencyUtility
|
||||||
|
{
|
||||||
|
internal static bool PackageIsInstalled(string packageName)
|
||||||
|
{
|
||||||
|
var result = Command.Create("dpkg", "-s", packageName)
|
||||||
|
.CaptureStdOut()
|
||||||
|
.CaptureStdErr()
|
||||||
|
.QuietBuildReporter()
|
||||||
|
.Execute();
|
||||||
|
|
||||||
|
return result.ExitCode == 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
22
scripts/dotnet-cli-build/Utils/YumDependencyUtility.cs
Normal file
22
scripts/dotnet-cli-build/Utils/YumDependencyUtility.cs
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.DotNet.Cli.Build.Framework;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Cli.Build
|
||||||
|
{
|
||||||
|
public class YumDependencyUtility
|
||||||
|
{
|
||||||
|
internal static bool PackageIsInstalled(string packageName)
|
||||||
|
{
|
||||||
|
var result = Command.Create("yum", "list", "installed", packageName)
|
||||||
|
.CaptureStdOut()
|
||||||
|
.CaptureStdErr()
|
||||||
|
.QuietBuildReporter()
|
||||||
|
.Execute();
|
||||||
|
|
||||||
|
return result.ExitCode == 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,6 +7,7 @@ param(
|
||||||
[string]$Configuration="Debug",
|
[string]$Configuration="Debug",
|
||||||
[string]$Architecture="x64",
|
[string]$Architecture="x64",
|
||||||
[switch]$NoPackage,
|
[switch]$NoPackage,
|
||||||
|
[switch]$RunInstallerTestsInDocker,
|
||||||
[switch]$Help)
|
[switch]$Help)
|
||||||
|
|
||||||
if($Help)
|
if($Help)
|
||||||
|
@ -17,6 +18,7 @@ if($Help)
|
||||||
Write-Host " -Configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)"
|
Write-Host " -Configuration <CONFIGURATION> Build the specified Configuration (Debug or Release, default: Debug)"
|
||||||
Write-Host " -Architecture <ARCHITECTURE> Build the specified architecture (x64 or x86 (supported only on Windows), default: x64)"
|
Write-Host " -Architecture <ARCHITECTURE> Build the specified architecture (x64 or x86 (supported only on Windows), default: x64)"
|
||||||
Write-Host " -NoPackage Skip packaging targets"
|
Write-Host " -NoPackage Skip packaging targets"
|
||||||
|
Write-Host " -RunInstallerTestsInDocker Runs the .msi installer tests in a Docker container. Requires Windows 2016 TP4 or higher"
|
||||||
Write-Host " -Help Display this help message"
|
Write-Host " -Help Display this help message"
|
||||||
Write-Host " <TARGETS...> The build targets to run (Init, Compile, Publish, etc.; Default is a full build and publish)"
|
Write-Host " <TARGETS...> The build targets to run (Init, Compile, Publish, etc.; Default is a full build and publish)"
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -33,6 +35,11 @@ else
|
||||||
$env:DOTNET_BUILD_SKIP_PACKAGING=0
|
$env:DOTNET_BUILD_SKIP_PACKAGING=0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($RunInstallerTestsInDocker)
|
||||||
|
{
|
||||||
|
$env:RunInstallerTestsInDocker=1
|
||||||
|
}
|
||||||
|
|
||||||
# Load Branch Info
|
# Load Branch Info
|
||||||
cat "$PSScriptRoot\..\branchinfo.txt" | ForEach-Object {
|
cat "$PSScriptRoot\..\branchinfo.txt" | ForEach-Object {
|
||||||
if(!$_.StartsWith("#") -and ![String]::IsNullOrWhiteSpace($_)) {
|
if(!$_.StartsWith("#") -and ![String]::IsNullOrWhiteSpace($_)) {
|
||||||
|
|
|
@ -8,28 +8,23 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
{
|
{
|
||||||
public class AnsiConsole
|
public class AnsiConsole
|
||||||
{
|
{
|
||||||
private AnsiConsole(TextWriter writer, bool useConsoleColor)
|
private AnsiConsole(TextWriter writer)
|
||||||
{
|
{
|
||||||
Writer = writer;
|
Writer = writer;
|
||||||
|
|
||||||
_useConsoleColor = useConsoleColor;
|
OriginalForegroundColor = Console.ForegroundColor;
|
||||||
if (_useConsoleColor)
|
|
||||||
{
|
|
||||||
OriginalForegroundColor = Console.ForegroundColor;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int _boldRecursion;
|
private int _boldRecursion;
|
||||||
private bool _useConsoleColor;
|
|
||||||
|
|
||||||
public static AnsiConsole GetOutput(bool useConsoleColor)
|
public static AnsiConsole GetOutput()
|
||||||
{
|
{
|
||||||
return new AnsiConsole(Console.Out, useConsoleColor);
|
return new AnsiConsole(Console.Out);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AnsiConsole GetError(bool useConsoleColor)
|
public static AnsiConsole GetError()
|
||||||
{
|
{
|
||||||
return new AnsiConsole(Console.Error, useConsoleColor);
|
return new AnsiConsole(Console.Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextWriter Writer { get; }
|
public TextWriter Writer { get; }
|
||||||
|
@ -38,7 +33,13 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
|
|
||||||
private void SetColor(ConsoleColor color)
|
private void SetColor(ConsoleColor color)
|
||||||
{
|
{
|
||||||
Console.ForegroundColor = (ConsoleColor)(((int)Console.ForegroundColor & 0x08) | ((int)color & 0x07));
|
const int Light = 0x08;
|
||||||
|
int c = (int)color;
|
||||||
|
|
||||||
|
Console.ForegroundColor =
|
||||||
|
c < 0 ? color : // unknown, just use it
|
||||||
|
_boldRecursion > 0 ? (ConsoleColor)(c & ~Light) : // ensure color is dark
|
||||||
|
(ConsoleColor)(c | Light); // ensure color is light
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetBold(bool bold)
|
private void SetBold(bool bold)
|
||||||
|
@ -48,8 +49,9 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.ForegroundColor = (ConsoleColor)((int)Console.ForegroundColor ^ 0x08);
|
// switches on _boldRecursion to handle boldness
|
||||||
|
SetColor(Console.ForegroundColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WriteLine(string message)
|
public void WriteLine(string message)
|
||||||
|
@ -61,12 +63,6 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
|
|
||||||
public void Write(string message)
|
public void Write(string message)
|
||||||
{
|
{
|
||||||
if (!_useConsoleColor)
|
|
||||||
{
|
|
||||||
Writer.Write(message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var escapeScan = 0;
|
var escapeScan = 0;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,14 +19,11 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
_console = console;
|
_console = console;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Reporter Output { get; } = Create(AnsiConsole.GetOutput);
|
public static Reporter Output { get; } = new Reporter(AnsiConsole.GetOutput());
|
||||||
public static Reporter Error { get; } = Create(AnsiConsole.GetError);
|
public static Reporter Error { get; } = new Reporter(AnsiConsole.GetError());
|
||||||
public static Reporter Verbose { get; } = CommandContext.IsVerbose() ? Create(AnsiConsole.GetOutput) : NullReporter;
|
public static Reporter Verbose { get; } = CommandContext.IsVerbose() ?
|
||||||
|
new Reporter(AnsiConsole.GetOutput()) :
|
||||||
public static Reporter Create(Func<bool, AnsiConsole> getter)
|
NullReporter;
|
||||||
{
|
|
||||||
return new Reporter(getter(PlatformServices.Default.Runtime.OperatingSystemPlatform == Platform.Windows));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void WriteLine(string message)
|
public void WriteLine(string message)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,6 +10,7 @@ using Microsoft.CodeAnalysis.CSharp;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.Versioning;
|
using System.Runtime.Versioning;
|
||||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||||
|
using NuGet.Frameworks;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Cli.Compiler.Common
|
namespace Microsoft.DotNet.Cli.Compiler.Common
|
||||||
{
|
{
|
||||||
|
@ -59,7 +60,7 @@ namespace Microsoft.DotNet.Cli.Compiler.Common
|
||||||
|
|
||||||
private static Dictionary<Type, string> GetProjectAttributes(AssemblyInfoOptions metadata)
|
private static Dictionary<Type, string> GetProjectAttributes(AssemblyInfoOptions metadata)
|
||||||
{
|
{
|
||||||
return new Dictionary<Type, string>()
|
var attributes = new Dictionary<Type, string>()
|
||||||
{
|
{
|
||||||
[typeof(AssemblyTitleAttribute)] = EscapeCharacters(metadata.Title),
|
[typeof(AssemblyTitleAttribute)] = EscapeCharacters(metadata.Title),
|
||||||
[typeof(AssemblyDescriptionAttribute)] = EscapeCharacters(metadata.Description),
|
[typeof(AssemblyDescriptionAttribute)] = EscapeCharacters(metadata.Description),
|
||||||
|
@ -68,9 +69,34 @@ namespace Microsoft.DotNet.Cli.Compiler.Common
|
||||||
[typeof(AssemblyVersionAttribute)] = EscapeCharacters(metadata.AssemblyVersion?.ToString()),
|
[typeof(AssemblyVersionAttribute)] = EscapeCharacters(metadata.AssemblyVersion?.ToString()),
|
||||||
[typeof(AssemblyInformationalVersionAttribute)] = EscapeCharacters(metadata.InformationalVersion),
|
[typeof(AssemblyInformationalVersionAttribute)] = EscapeCharacters(metadata.InformationalVersion),
|
||||||
[typeof(AssemblyCultureAttribute)] = EscapeCharacters(metadata.Culture),
|
[typeof(AssemblyCultureAttribute)] = EscapeCharacters(metadata.Culture),
|
||||||
[typeof(NeutralResourcesLanguageAttribute)] = EscapeCharacters(metadata.NeutralLanguage),
|
[typeof(NeutralResourcesLanguageAttribute)] = EscapeCharacters(metadata.NeutralLanguage)
|
||||||
[typeof(TargetFrameworkAttribute)] = EscapeCharacters(metadata.TargetFramework)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (SupportsTargetFrameworkAttribute(metadata))
|
||||||
|
{
|
||||||
|
// TargetFrameworkAttribute only exists since .NET 4.0
|
||||||
|
attributes[typeof(TargetFrameworkAttribute)] = EscapeCharacters(metadata.TargetFramework);
|
||||||
|
};
|
||||||
|
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool SupportsTargetFrameworkAttribute(AssemblyInfoOptions metadata)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(metadata.TargetFramework))
|
||||||
|
{
|
||||||
|
// target framework is unknown. to be on the safe side, return false.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var targetFramework = NuGetFramework.Parse(metadata.TargetFramework);
|
||||||
|
if (!targetFramework.IsDesktop())
|
||||||
|
{
|
||||||
|
// assuming .NET Core, which should support .NET 4.0 attributes
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return targetFramework.Version >= new Version(4, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsSameAttribute(Type attributeType, AttributeSyntax attributeSyntax)
|
private static bool IsSameAttribute(Type attributeType, AttributeSyntax attributeSyntax)
|
||||||
|
|
|
@ -216,10 +216,14 @@ namespace Microsoft.DotNet.ProjectModel.Compilation
|
||||||
var compileAsset = new LibraryAsset(
|
var compileAsset = new LibraryAsset(
|
||||||
project.Project.Name,
|
project.Project.Name,
|
||||||
null,
|
null,
|
||||||
Path.GetFullPath(Path.Combine(project.Project.ProjectDirectory, assemblyPath)));
|
assemblyPath);
|
||||||
|
|
||||||
builder.AddCompilationAssembly(compileAsset);
|
builder.AddCompilationAssembly(compileAsset);
|
||||||
builder.AddRuntimeAsset(new LibraryAsset(Path.GetFileName(pdbPath), Path.GetFileName(pdbPath), pdbPath));
|
builder.AddRuntimeAssembly(compileAsset);
|
||||||
|
if (File.Exists(pdbPath))
|
||||||
|
{
|
||||||
|
builder.AddRuntimeAsset(new LibraryAsset(Path.GetFileName(pdbPath), Path.GetFileName(pdbPath), pdbPath));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (project.Project.Files.SourceFiles.Any())
|
else if (project.Project.Files.SourceFiles.Any())
|
||||||
{
|
{
|
||||||
|
@ -286,7 +290,7 @@ namespace Microsoft.DotNet.ProjectModel.Compilation
|
||||||
|
|
||||||
path = path.Replace("{configuration}", configuration);
|
path = path.Replace("{configuration}", configuration);
|
||||||
|
|
||||||
return path;
|
return Path.Combine(project.ProjectDirectory, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LibraryExport ExportFrameworkLibrary(LibraryDescription library)
|
private LibraryExport ExportFrameworkLibrary(LibraryDescription library)
|
||||||
|
|
|
@ -146,8 +146,12 @@ namespace Microsoft.DotNet.ProjectModel
|
||||||
var context = Create(ProjectFile.ProjectFilePath, TargetFramework, runtimeIdentifiers);
|
var context = Create(ProjectFile.ProjectFilePath, TargetFramework, runtimeIdentifiers);
|
||||||
if (context.RuntimeIdentifier == null)
|
if (context.RuntimeIdentifier == null)
|
||||||
{
|
{
|
||||||
var rids = string.Join(",", runtimeIdentifiers);
|
var rids = string.Join(", ", runtimeIdentifiers);
|
||||||
throw new InvalidOperationException($"Can not find runtime target for framework '{TargetFramework}' and RID's {rids}.");
|
throw new InvalidOperationException($"Can not find runtime target for framework '{TargetFramework}' and RID's '{rids}'. " +
|
||||||
|
"Possible causes:" + Environment.NewLine +
|
||||||
|
"1. Project is not restored or restore failed - run `dotnet restore`" + Environment.NewLine +
|
||||||
|
"2. Project is not targeting `runable` framework (`netstandardapp*` or `net*`)"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"description": "Types to model a .NET Project",
|
"description": "Types to model a .NET Project",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"System.Reflection.Metadata": "1.2.0-rc2-23811",
|
"System.Reflection.Metadata": "1.2.0-rc2-23811",
|
||||||
"NuGet.Packaging": "3.4.0-beta-625",
|
"NuGet.Packaging": "3.4.0-beta-632",
|
||||||
"Microsoft.Extensions.FileSystemGlobbing": "1.0.0-rc2-15996",
|
"Microsoft.Extensions.FileSystemGlobbing": "1.0.0-rc2-15996",
|
||||||
"Microsoft.Extensions.JsonParser.Sources": {
|
"Microsoft.Extensions.JsonParser.Sources": {
|
||||||
"type": "build",
|
"type": "build",
|
||||||
|
|
|
@ -11,6 +11,7 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
public class DependencyContext
|
public class DependencyContext
|
||||||
{
|
{
|
||||||
private const string DepsResourceSufix = ".deps.json";
|
private const string DepsResourceSufix = ".deps.json";
|
||||||
|
private const string DepsFileExtension = ".deps";
|
||||||
|
|
||||||
private static readonly Lazy<DependencyContext> _defaultContext = new Lazy<DependencyContext>(LoadDefault);
|
private static readonly Lazy<DependencyContext> _defaultContext = new Lazy<DependencyContext>(LoadDefault);
|
||||||
|
|
||||||
|
@ -43,22 +44,29 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
|
|
||||||
public static DependencyContext Load(Assembly assembly)
|
public static DependencyContext Load(Assembly assembly)
|
||||||
{
|
{
|
||||||
var stream = assembly.GetManifestResourceStream(assembly.GetName().Name + DepsResourceSufix);
|
if (assembly == null)
|
||||||
|
|
||||||
if (stream == null)
|
|
||||||
{
|
{
|
||||||
return null;
|
throw new ArgumentNullException(nameof(assembly));
|
||||||
}
|
}
|
||||||
|
|
||||||
using (stream)
|
using (var stream = assembly.GetManifestResourceStream(assembly.GetName().Name + DepsResourceSufix))
|
||||||
{
|
{
|
||||||
return Load(stream);
|
if (stream != null)
|
||||||
|
{
|
||||||
|
return new DependencyContextJsonReader().Read(stream);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static DependencyContext Load(Stream stream)
|
var depsFile = Path.ChangeExtension(assembly.Location, DepsFileExtension);
|
||||||
{
|
if (File.Exists(depsFile))
|
||||||
return new DependencyContextReader().Read(stream);
|
{
|
||||||
|
using (var stream = File.OpenRead(depsFile))
|
||||||
|
{
|
||||||
|
return new DependencyContextCsvReader().Read(stream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,130 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Microsoft.Extensions.DependencyModel
|
||||||
|
{
|
||||||
|
public class DependencyContextCsvReader
|
||||||
|
{
|
||||||
|
public DependencyContext Read(Stream stream)
|
||||||
|
{
|
||||||
|
var lines = new List<DepsFileLine>();
|
||||||
|
using (var reader = new StreamReader(stream))
|
||||||
|
{
|
||||||
|
while (!reader.EndOfStream)
|
||||||
|
{
|
||||||
|
var line = new DepsFileLine();
|
||||||
|
line.LibraryType = ReadValue(reader);
|
||||||
|
line.PackageName = ReadValue(reader);
|
||||||
|
line.PackageVersion = ReadValue(reader);
|
||||||
|
line.PackageHash = ReadValue(reader);
|
||||||
|
line.AssetType = ReadValue(reader);
|
||||||
|
line.AssetName = ReadValue(reader);
|
||||||
|
line.AssetPath = ReadValue(reader);
|
||||||
|
|
||||||
|
if (line.AssetType == "runtime" &&
|
||||||
|
!line.AssetPath.EndsWith(".ni.dll"))
|
||||||
|
{
|
||||||
|
lines.Add(line);
|
||||||
|
}
|
||||||
|
SkipWhitespace(reader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var runtimeLibraries = new List<RuntimeLibrary>();
|
||||||
|
var packageGroups = lines.GroupBy(PackageIdentity);
|
||||||
|
foreach (var packageGroup in packageGroups)
|
||||||
|
{
|
||||||
|
var identity = packageGroup.Key;
|
||||||
|
runtimeLibraries.Add(new RuntimeLibrary(
|
||||||
|
libraryType: identity.Item1,
|
||||||
|
packageName: identity.Item2,
|
||||||
|
version: identity.Item3,
|
||||||
|
hash: identity.Item4,
|
||||||
|
assemblies: packageGroup.Select(l => l.AssetPath).ToArray(),
|
||||||
|
dependencies: new Dependency[] { },
|
||||||
|
serviceable: false
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
return new DependencyContext(
|
||||||
|
target: string.Empty,
|
||||||
|
runtime: string.Empty,
|
||||||
|
compilationOptions: CompilationOptions.Default,
|
||||||
|
compileLibraries: new CompilationLibrary[] {},
|
||||||
|
runtimeLibraries: runtimeLibraries.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
private Tuple<string, string, string, string> PackageIdentity(DepsFileLine line)
|
||||||
|
{
|
||||||
|
return Tuple.Create(line.LibraryType, line.PackageName, line.PackageVersion, line.PackageHash);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SkipWhitespace(StreamReader reader)
|
||||||
|
{
|
||||||
|
// skip all whitespace
|
||||||
|
while (!reader.EndOfStream && char.IsWhiteSpace((char)reader.Peek()))
|
||||||
|
{
|
||||||
|
reader.Read();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string ReadValue(StreamReader reader)
|
||||||
|
{
|
||||||
|
SkipWhitespace(reader);
|
||||||
|
|
||||||
|
var c = ReadSucceed(reader.Read());
|
||||||
|
if (c != '"')
|
||||||
|
{
|
||||||
|
throw new FormatException("Deps file value should start with '\"'");
|
||||||
|
}
|
||||||
|
|
||||||
|
var value = new StringBuilder();
|
||||||
|
while (ReadSucceed(reader.Peek()) != '"')
|
||||||
|
{
|
||||||
|
c = ReadSucceed(reader.Read());
|
||||||
|
if (c == '\\')
|
||||||
|
{
|
||||||
|
value.Append(ReadSucceed(reader.Read()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
value.Append(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Read last "
|
||||||
|
ReadSucceed(reader.Read());
|
||||||
|
// Read comment
|
||||||
|
if (reader.Peek() == ',')
|
||||||
|
{
|
||||||
|
reader.Read();
|
||||||
|
}
|
||||||
|
return value.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private char ReadSucceed(int c)
|
||||||
|
{
|
||||||
|
if (c == -1)
|
||||||
|
{
|
||||||
|
throw new FormatException("Unexpected end of file");
|
||||||
|
}
|
||||||
|
return (char) c;
|
||||||
|
}
|
||||||
|
|
||||||
|
private struct DepsFileLine
|
||||||
|
{
|
||||||
|
public string LibraryType;
|
||||||
|
public string PackageName;
|
||||||
|
public string PackageVersion;
|
||||||
|
public string PackageHash;
|
||||||
|
public string AssetType;
|
||||||
|
public string AssetName;
|
||||||
|
public string AssetPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,7 +10,7 @@ using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
namespace Microsoft.Extensions.DependencyModel
|
namespace Microsoft.Extensions.DependencyModel
|
||||||
{
|
{
|
||||||
public class DependencyContextReader
|
public class DependencyContextJsonReader
|
||||||
{
|
{
|
||||||
public DependencyContext Read(Stream stream)
|
public DependencyContext Read(Stream stream)
|
||||||
{
|
{
|
|
@ -8,18 +8,20 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
{
|
{
|
||||||
public class RuntimeAssembly
|
public class RuntimeAssembly
|
||||||
{
|
{
|
||||||
|
private readonly string _assemblyName;
|
||||||
|
|
||||||
public RuntimeAssembly(string path)
|
public RuntimeAssembly(string path)
|
||||||
: this(new AssemblyName(System.IO.Path.GetFileNameWithoutExtension(path)), path)
|
: this(System.IO.Path.GetFileNameWithoutExtension(path), path)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public RuntimeAssembly(AssemblyName name, string path)
|
public RuntimeAssembly(string assemblyName, string path)
|
||||||
{
|
{
|
||||||
Name = name;
|
_assemblyName = assemblyName;
|
||||||
Path = path;
|
Path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AssemblyName Name { get; }
|
public AssemblyName Name => new AssemblyName(_assemblyName);
|
||||||
|
|
||||||
public string Path { get; }
|
public string Path { get; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,6 @@ namespace Microsoft.DotNet.Cli
|
||||||
var builtIns = new Dictionary<string, Func<string[], int>>
|
var builtIns = new Dictionary<string, Func<string[], int>>
|
||||||
{
|
{
|
||||||
["build"] = BuildCommand.Run,
|
["build"] = BuildCommand.Run,
|
||||||
["compile"] = CommpileCommand.Run,
|
|
||||||
["compile-csc"] = CompileCscCommand.Run,
|
["compile-csc"] = CompileCscCommand.Run,
|
||||||
["compile-fsc"] = CompileFscCommand.Run,
|
["compile-fsc"] = CompileFscCommand.Run,
|
||||||
["compile-native"] = CompileNativeCommand.Run,
|
["compile-native"] = CompileNativeCommand.Run,
|
||||||
|
|
|
@ -357,6 +357,12 @@ namespace Microsoft.DotNet.Tools.Build
|
||||||
args.Add("--cpp");
|
args.Add("--cpp");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(_args.CppCompilerFlagsValue))
|
||||||
|
{
|
||||||
|
args.Add("--cppcompilerflags");
|
||||||
|
args.Add(_args.CppCompilerFlagsValue);
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(_args.ArchValue))
|
if (!string.IsNullOrWhiteSpace(_args.ArchValue))
|
||||||
{
|
{
|
||||||
args.Add("--arch");
|
args.Add("--arch");
|
||||||
|
|
|
@ -12,24 +12,19 @@ namespace Microsoft.DotNet.Tools.Pack
|
||||||
internal class BuildProjectCommand
|
internal class BuildProjectCommand
|
||||||
{
|
{
|
||||||
private readonly Project _project;
|
private readonly Project _project;
|
||||||
private readonly ArtifactPathsCalculator _artifactPathsCalculator;
|
|
||||||
|
|
||||||
private readonly string _buildBasePath;
|
private readonly string _buildBasePath;
|
||||||
private readonly string _configuration;
|
private readonly string _configuration;
|
||||||
|
|
||||||
private readonly string _versionSuffix;
|
private readonly string _versionSuffix;
|
||||||
|
|
||||||
private bool SkipBuild => _artifactPathsCalculator.CompiledArtifactsPathSet;
|
|
||||||
|
|
||||||
public BuildProjectCommand(
|
public BuildProjectCommand(
|
||||||
Project project,
|
Project project,
|
||||||
ArtifactPathsCalculator artifactPathsCalculator,
|
|
||||||
string buildBasePath,
|
string buildBasePath,
|
||||||
string configuration,
|
string configuration,
|
||||||
string versionSuffix)
|
string versionSuffix)
|
||||||
{
|
{
|
||||||
_project = project;
|
_project = project;
|
||||||
_artifactPathsCalculator = artifactPathsCalculator;
|
|
||||||
_buildBasePath = buildBasePath;
|
_buildBasePath = buildBasePath;
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
_versionSuffix = versionSuffix;
|
_versionSuffix = versionSuffix;
|
||||||
|
@ -37,11 +32,6 @@ namespace Microsoft.DotNet.Tools.Pack
|
||||||
|
|
||||||
public int Execute()
|
public int Execute()
|
||||||
{
|
{
|
||||||
if (SkipBuild)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_project.Files.SourceFiles.Any())
|
if (_project.Files.SourceFiles.Any())
|
||||||
{
|
{
|
||||||
var argsBuilder = new List<string>();
|
var argsBuilder = new List<string>();
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace Microsoft.DotNet.Tools.Compiler
|
||||||
int buildResult = 0;
|
int buildResult = 0;
|
||||||
if (!noBuild.HasValue())
|
if (!noBuild.HasValue())
|
||||||
{
|
{
|
||||||
var buildProjectCommand = new BuildProjectCommand(project, artifactPathsCalculator, buildBasePathValue, configValue, versionSuffixValue);
|
var buildProjectCommand = new BuildProjectCommand(project, buildBasePathValue, configValue, versionSuffixValue);
|
||||||
buildResult = buildProjectCommand.Execute();
|
buildResult = buildProjectCommand.Execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,16 +47,21 @@ namespace Microsoft.DotNet.ProjectModel.Server
|
||||||
foreach (var export in allExports.Values)
|
foreach (var export in allExports.Values)
|
||||||
{
|
{
|
||||||
allSourceFiles.AddRange(export.SourceReferences.Select(f => f.ResolvedPath));
|
allSourceFiles.AddRange(export.SourceReferences.Select(f => f.ResolvedPath));
|
||||||
allFileReferences.AddRange(export.CompilationAssemblies.Select(asset => asset.ResolvedPath));
|
|
||||||
|
|
||||||
var diagnostics = diagnosticsLookup[export.Library].ToList();
|
var diagnostics = diagnosticsLookup[export.Library].ToList();
|
||||||
var description = DependencyDescription.Create(export.Library, diagnostics, allExports);
|
var description = DependencyDescription.Create(export.Library, diagnostics, allExports);
|
||||||
allDependencies[description.Name] = description;
|
allDependencies[description.Name] = description;
|
||||||
|
|
||||||
var projectDescription = export.Library as ProjectDescription;
|
var projectDescription = export.Library as ProjectDescription;
|
||||||
if (projectDescription != null && projectDescription.Identity.Name != context.ProjectFile.Name)
|
if (projectDescription != null)
|
||||||
{
|
{
|
||||||
allProjectReferences.Add(ProjectReferenceDescription.Create(projectDescription));
|
if (projectDescription.Identity.Name != context.ProjectFile.Name)
|
||||||
|
{
|
||||||
|
allProjectReferences.Add(ProjectReferenceDescription.Create(projectDescription));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
allFileReferences.AddRange(export.CompilationAssemblies.Select(asset => asset.ResolvedPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,9 @@ namespace Microsoft.DotNet.Tools.Run
|
||||||
context = contexts.FirstOrDefault(c => defaultFrameworks.Contains(c.TargetFramework.Framework));
|
context = contexts.FirstOrDefault(c => defaultFrameworks.Contains(c.TargetFramework.Framework));
|
||||||
if (context == null)
|
if (context == null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException($"Couldn't find target to run. Defaults: {string.Join(", ", defaultFrameworks)}");
|
throw new InvalidOperationException($"Couldn't find target to run. Possible causes:" + Environment.NewLine +
|
||||||
|
"1. No project.lock.json file or restore failed - run `dotnet restore`" + Environment.NewLine +
|
||||||
|
$"2. project.lock.json has multiple targets none of which is in default list ({string.Join(", " , defaultFrameworks)})");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using System.Diagnostics;
|
||||||
|
using Microsoft.DotNet.Cli.Utils;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public static class CommandTestRunnerExtensions
|
||||||
|
{
|
||||||
|
public static ProcessStartInfo ToProcessStartInfo(this ICommand command)
|
||||||
|
{
|
||||||
|
return new ProcessStartInfo(command.CommandName, command.CommandArgs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
106
src/dotnet/commands/dotnet-test/DotnetTest.cs
Normal file
106
src/dotnet/commands/dotnet-test/DotnetTest.cs
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.Extensions.Testing.Abstractions;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public class DotnetTest : IDotnetTest
|
||||||
|
{
|
||||||
|
private readonly IList<IReportingChannel> _channels;
|
||||||
|
private readonly IList<IDotnetTestMessageHandler> _messageHandlers;
|
||||||
|
private readonly ITestMessagesCollection _messages;
|
||||||
|
|
||||||
|
public IDotnetTestMessageHandler TestSessionTerminateMessageHandler { private get; set; }
|
||||||
|
public IDotnetTestMessageHandler UnknownMessageHandler { private get; set; }
|
||||||
|
|
||||||
|
public DotnetTestState State { get; private set; }
|
||||||
|
|
||||||
|
public string PathToAssemblyUnderTest { get; }
|
||||||
|
|
||||||
|
public DotnetTest(ITestMessagesCollection messages, string pathToAssemblyUnderTest)
|
||||||
|
{
|
||||||
|
PathToAssemblyUnderTest = pathToAssemblyUnderTest;
|
||||||
|
State = DotnetTestState.InitialState;
|
||||||
|
_channels = new List<IReportingChannel>();
|
||||||
|
_messageHandlers = new List<IDotnetTestMessageHandler>();
|
||||||
|
_messages = messages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DotnetTest AddMessageHandler(IDotnetTestMessageHandler messageHandler)
|
||||||
|
{
|
||||||
|
_messageHandlers.Add(messageHandler);
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartHandlingMessages()
|
||||||
|
{
|
||||||
|
Message message;
|
||||||
|
while (_messages.TryTake(out message))
|
||||||
|
{
|
||||||
|
HandleMessage(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartListeningTo(IReportingChannel reportingChannel)
|
||||||
|
{
|
||||||
|
ValidateSpecialMessageHandlersArePresent();
|
||||||
|
|
||||||
|
_channels.Add(reportingChannel);
|
||||||
|
reportingChannel.MessageReceived += OnMessageReceived;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
foreach (var reportingChannel in _channels)
|
||||||
|
{
|
||||||
|
reportingChannel.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ValidateSpecialMessageHandlersArePresent()
|
||||||
|
{
|
||||||
|
if (TestSessionTerminateMessageHandler == null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("The TestSession.Terminate message handler needs to be set.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (UnknownMessageHandler == null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("The unknown message handler needs to be set.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleMessage(Message message)
|
||||||
|
{
|
||||||
|
foreach (var messageHandler in _messageHandlers)
|
||||||
|
{
|
||||||
|
var nextState = messageHandler.HandleMessage(this, message);
|
||||||
|
|
||||||
|
if (nextState != DotnetTestState.NoOp)
|
||||||
|
{
|
||||||
|
State = nextState;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UnknownMessageHandler.HandleMessage(this, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnMessageReceived(object sender, Message message)
|
||||||
|
{
|
||||||
|
if (!TerminateTestSession(message))
|
||||||
|
{
|
||||||
|
_messages.Add(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TerminateTestSession(Message message)
|
||||||
|
{
|
||||||
|
return TestSessionTerminateMessageHandler.HandleMessage(this, message) == DotnetTestState.Terminated;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
61
src/dotnet/commands/dotnet-test/DotnetTestExtensions.cs
Normal file
61
src/dotnet/commands/dotnet-test/DotnetTestExtensions.cs
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using Microsoft.DotNet.Cli.Tools.Test;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public static class DotnetTestExtensions
|
||||||
|
{
|
||||||
|
public static IDotnetTest AddNonSpecificMessageHandlers(
|
||||||
|
this IDotnetTest dotnetTest,
|
||||||
|
ITestMessagesCollection messages,
|
||||||
|
IReportingChannel adapterChannel)
|
||||||
|
{
|
||||||
|
dotnetTest.TestSessionTerminateMessageHandler = new TestSessionTerminateMessageHandler(messages);
|
||||||
|
dotnetTest.UnknownMessageHandler = new UnknownMessageHandler(adapterChannel);
|
||||||
|
|
||||||
|
dotnetTest.AddMessageHandler(new VersionCheckMessageHandler(adapterChannel));
|
||||||
|
|
||||||
|
return dotnetTest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IDotnetTest AddTestDiscoveryMessageHandlers(
|
||||||
|
this IDotnetTest dotnetTest,
|
||||||
|
IReportingChannel adapterChannel,
|
||||||
|
IReportingChannelFactory reportingChannelFactory,
|
||||||
|
ITestRunnerFactory testRunnerFactory)
|
||||||
|
{
|
||||||
|
dotnetTest.AddMessageHandler(
|
||||||
|
new TestDiscoveryStartMessageHandler(testRunnerFactory, adapterChannel, reportingChannelFactory));
|
||||||
|
|
||||||
|
return dotnetTest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IDotnetTest AddTestRunMessageHandlers(
|
||||||
|
this IDotnetTest dotnetTest,
|
||||||
|
IReportingChannel adapterChannel,
|
||||||
|
IReportingChannelFactory reportingChannelFactory,
|
||||||
|
ITestRunnerFactory testRunnerFactory)
|
||||||
|
{
|
||||||
|
dotnetTest.AddMessageHandler(new GetTestRunnerProcessStartInfoMessageHandler(
|
||||||
|
testRunnerFactory,
|
||||||
|
adapterChannel,
|
||||||
|
reportingChannelFactory));
|
||||||
|
|
||||||
|
return dotnetTest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IDotnetTest AddTestRunnnersMessageHandlers(
|
||||||
|
this IDotnetTest dotnetTest,
|
||||||
|
IReportingChannel adapterChannel)
|
||||||
|
{
|
||||||
|
dotnetTest.AddMessageHandler(new TestRunnerTestStartedMessageHandler(adapterChannel));
|
||||||
|
dotnetTest.AddMessageHandler(new TestRunnerTestResultMessageHandler(adapterChannel));
|
||||||
|
dotnetTest.AddMessageHandler(new TestRunnerTestFoundMessageHandler(adapterChannel));
|
||||||
|
dotnetTest.AddMessageHandler(new TestRunnerTestCompletedMessageHandler(adapterChannel));
|
||||||
|
|
||||||
|
return dotnetTest;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
18
src/dotnet/commands/dotnet-test/DotnetTestState.cs
Normal file
18
src/dotnet/commands/dotnet-test/DotnetTestState.cs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public enum DotnetTestState
|
||||||
|
{
|
||||||
|
NoOp,
|
||||||
|
InitialState,
|
||||||
|
VersionCheckCompleted,
|
||||||
|
TestDiscoveryStarted,
|
||||||
|
TestDiscoveryCompleted,
|
||||||
|
TestExecutionSentTestRunnerProcessStartInfo,
|
||||||
|
TestExecutionStarted,
|
||||||
|
TestExecutionCompleted,
|
||||||
|
Terminated
|
||||||
|
}
|
||||||
|
}
|
24
src/dotnet/commands/dotnet-test/IDotnetTest.cs
Normal file
24
src/dotnet/commands/dotnet-test/IDotnetTest.cs
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public interface IDotnetTest : IDisposable
|
||||||
|
{
|
||||||
|
string PathToAssemblyUnderTest { get; }
|
||||||
|
|
||||||
|
DotnetTestState State { get; }
|
||||||
|
|
||||||
|
DotnetTest AddMessageHandler(IDotnetTestMessageHandler messageHandler);
|
||||||
|
|
||||||
|
IDotnetTestMessageHandler TestSessionTerminateMessageHandler { set; }
|
||||||
|
|
||||||
|
IDotnetTestMessageHandler UnknownMessageHandler { set; }
|
||||||
|
|
||||||
|
void StartHandlingMessages();
|
||||||
|
|
||||||
|
void StartListeningTo(IReportingChannel reportingChannel);
|
||||||
|
}
|
||||||
|
}
|
24
src/dotnet/commands/dotnet-test/IReportingChannel.cs
Normal file
24
src/dotnet/commands/dotnet-test/IReportingChannel.cs
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Extensions.Testing.Abstractions;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public interface IReportingChannel : IDisposable
|
||||||
|
{
|
||||||
|
event EventHandler<Message> MessageReceived;
|
||||||
|
|
||||||
|
int Port { get; }
|
||||||
|
|
||||||
|
void Accept();
|
||||||
|
|
||||||
|
void Send(Message message);
|
||||||
|
|
||||||
|
void SendError(string error);
|
||||||
|
|
||||||
|
void SendError(Exception ex);
|
||||||
|
}
|
||||||
|
}
|
12
src/dotnet/commands/dotnet-test/IReportingChannelFactory.cs
Normal file
12
src/dotnet/commands/dotnet-test/IReportingChannelFactory.cs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public interface IReportingChannelFactory
|
||||||
|
{
|
||||||
|
IReportingChannel CreateChannelWithAnyAvailablePort();
|
||||||
|
|
||||||
|
IReportingChannel CreateChannelWithPort(int port);
|
||||||
|
}
|
||||||
|
}
|
17
src/dotnet/commands/dotnet-test/ITestMessagesCollection.cs
Normal file
17
src/dotnet/commands/dotnet-test/ITestMessagesCollection.cs
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using Microsoft.Extensions.Testing.Abstractions;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public interface ITestMessagesCollection : IDisposable
|
||||||
|
{
|
||||||
|
void Drain();
|
||||||
|
|
||||||
|
void Add(Message message);
|
||||||
|
|
||||||
|
bool TryTake(out Message message);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using Microsoft.Extensions.Testing.Abstractions;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public class GetTestRunnerProcessStartInfoMessageHandler : IDotnetTestMessageHandler
|
||||||
|
{
|
||||||
|
private readonly ITestRunnerFactory _testRunnerFactory;
|
||||||
|
private readonly IReportingChannel _adapterChannel;
|
||||||
|
private readonly IReportingChannelFactory _reportingChannelFactory;
|
||||||
|
|
||||||
|
public GetTestRunnerProcessStartInfoMessageHandler(
|
||||||
|
ITestRunnerFactory testRunnerFactory,
|
||||||
|
IReportingChannel adapterChannel,
|
||||||
|
IReportingChannelFactory reportingChannelFactory)
|
||||||
|
{
|
||||||
|
_testRunnerFactory = testRunnerFactory;
|
||||||
|
_adapterChannel = adapterChannel;
|
||||||
|
_reportingChannelFactory = reportingChannelFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DotnetTestState HandleMessage(IDotnetTest dotnetTest, Message message)
|
||||||
|
{
|
||||||
|
var nextState = DotnetTestState.NoOp;
|
||||||
|
|
||||||
|
if (CanHandleMessage(dotnetTest, message))
|
||||||
|
{
|
||||||
|
DoHandleMessage(dotnetTest, message);
|
||||||
|
nextState = DotnetTestState.TestExecutionSentTestRunnerProcessStartInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nextState;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DoHandleMessage(IDotnetTest dotnetTest, Message message)
|
||||||
|
{
|
||||||
|
var testRunnerChannel = _reportingChannelFactory.CreateChannelWithAnyAvailablePort();
|
||||||
|
|
||||||
|
dotnetTest.StartListeningTo(testRunnerChannel);
|
||||||
|
|
||||||
|
testRunnerChannel.Accept();
|
||||||
|
|
||||||
|
var testRunner = _testRunnerFactory.CreateTestRunner(
|
||||||
|
new RunTestsArgumentsBuilder(dotnetTest.PathToAssemblyUnderTest, testRunnerChannel.Port, message));
|
||||||
|
|
||||||
|
var processStartInfo = testRunner.GetProcessStartInfo();
|
||||||
|
|
||||||
|
_adapterChannel.Send(new Message
|
||||||
|
{
|
||||||
|
MessageType = TestMessageTypes.TestExecutionTestRunnerProcessStartInfo,
|
||||||
|
Payload = JToken.FromObject(processStartInfo)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool CanHandleMessage(IDotnetTest dotnetTest, Message message)
|
||||||
|
{
|
||||||
|
return IsAtAnAcceptableState(dotnetTest) &&
|
||||||
|
message.MessageType == TestMessageTypes.TestExecutionGetTestRunnerProcessStartInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsAtAnAcceptableState(IDotnetTest dotnetTest)
|
||||||
|
{
|
||||||
|
return dotnetTest.State == DotnetTestState.VersionCheckCompleted ||
|
||||||
|
dotnetTest.State == DotnetTestState.InitialState;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using Microsoft.Extensions.Testing.Abstractions;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public interface IDotnetTestMessageHandler
|
||||||
|
{
|
||||||
|
DotnetTestState HandleMessage(IDotnetTest dotnetTest, Message message);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,82 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.DotNet.Tools.Test;
|
||||||
|
using Microsoft.Extensions.Testing.Abstractions;
|
||||||
|
using NuGet.Protocol.Core.v3;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Cli.Tools.Test
|
||||||
|
{
|
||||||
|
public class TestDiscoveryStartMessageHandler : IDotnetTestMessageHandler
|
||||||
|
{
|
||||||
|
private readonly ITestRunnerFactory _testRunnerFactory;
|
||||||
|
private readonly IReportingChannel _adapterChannel;
|
||||||
|
private readonly IReportingChannelFactory _reportingChannelFactory;
|
||||||
|
|
||||||
|
public TestDiscoveryStartMessageHandler(
|
||||||
|
ITestRunnerFactory testRunnerFactory,
|
||||||
|
IReportingChannel adapterChannel,
|
||||||
|
IReportingChannelFactory reportingChannelFactory)
|
||||||
|
{
|
||||||
|
_testRunnerFactory = testRunnerFactory;
|
||||||
|
_adapterChannel = adapterChannel;
|
||||||
|
_reportingChannelFactory = reportingChannelFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DotnetTestState HandleMessage(IDotnetTest dotnetTest, Message message)
|
||||||
|
{
|
||||||
|
var nextState = DotnetTestState.NoOp;
|
||||||
|
if (CanHandleMessage(dotnetTest, message))
|
||||||
|
{
|
||||||
|
HandleMessage(dotnetTest);
|
||||||
|
nextState = DotnetTestState.TestDiscoveryStarted;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nextState;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleMessage(IDotnetTest dotnetTest)
|
||||||
|
{
|
||||||
|
TestHostTracing.Source.TraceInformation("Starting Discovery");
|
||||||
|
|
||||||
|
DiscoverTests(dotnetTest);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DiscoverTests(IDotnetTest dotnetTest)
|
||||||
|
{
|
||||||
|
var testRunnerResults = Enumerable.Empty<Message>();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var testRunnerChannel = _reportingChannelFactory.CreateChannelWithAnyAvailablePort();
|
||||||
|
|
||||||
|
dotnetTest.StartListeningTo(testRunnerChannel);
|
||||||
|
|
||||||
|
testRunnerChannel.Accept();
|
||||||
|
|
||||||
|
var testRunner = _testRunnerFactory.CreateTestRunner(
|
||||||
|
new DiscoverTestsArgumentsBuilder(dotnetTest.PathToAssemblyUnderTest, testRunnerChannel.Port));
|
||||||
|
|
||||||
|
testRunner.RunTestCommand();
|
||||||
|
}
|
||||||
|
catch (TestRunnerOperationFailedException e)
|
||||||
|
{
|
||||||
|
_adapterChannel.SendError(e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool CanHandleMessage(IDotnetTest dotnetTest, Message message)
|
||||||
|
{
|
||||||
|
return IsAtAnAcceptableState(dotnetTest) && message.MessageType == TestMessageTypes.TestDiscoveryStart;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsAtAnAcceptableState(IDotnetTest dotnetTest)
|
||||||
|
{
|
||||||
|
return (dotnetTest.State == DotnetTestState.VersionCheckCompleted ||
|
||||||
|
dotnetTest.State == DotnetTestState.InitialState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public static class TestMessageTypes
|
||||||
|
{
|
||||||
|
public const string TestRunnerTestResult = "TestExecution.TestResult";
|
||||||
|
public const string TestRunnerTestStarted = "TestExecution.TestStarted";
|
||||||
|
public const string TestRunnerTestCompleted = "TestRunner.TestCompleted";
|
||||||
|
public const string TestRunnerTestFound = "TestDiscovery.TestFound";
|
||||||
|
public const string TestSessionTerminate = "TestSession.Terminate";
|
||||||
|
public const string VersionCheck = "ProtocolVersion";
|
||||||
|
public const string TestDiscoveryStart = "TestDiscovery.Start";
|
||||||
|
public const string TestDiscoveryCompleted = "TestDiscovery.Completed";
|
||||||
|
public const string TestDiscoveryTestFound = "TestDiscovery.TestFound";
|
||||||
|
public const string TestExecutionGetTestRunnerProcessStartInfo = "TestExecution.GetTestRunnerProcessStartInfo";
|
||||||
|
public const string TestExecutionTestRunnerProcessStartInfo = "TestExecution.TestRunnerProcessStartInfo";
|
||||||
|
public const string TestExecutionStarted = "TestExecution.TestStarted";
|
||||||
|
public const string TestExecutionTestResult = "TestExecution.TestResult";
|
||||||
|
public const string TestExecutionCompleted = "TestExecution.Completed";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using Microsoft.Extensions.Testing.Abstractions;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public abstract class TestRunnerResultMessageHandler : IDotnetTestMessageHandler
|
||||||
|
{
|
||||||
|
private readonly IReportingChannel _adapterChannel;
|
||||||
|
private readonly DotnetTestState _nextStateIfHandled;
|
||||||
|
private readonly string _messageIfHandled;
|
||||||
|
|
||||||
|
protected TestRunnerResultMessageHandler(
|
||||||
|
IReportingChannel adapterChannel,
|
||||||
|
DotnetTestState nextStateIfHandled,
|
||||||
|
string messageIfHandled)
|
||||||
|
{
|
||||||
|
_adapterChannel = adapterChannel;
|
||||||
|
_nextStateIfHandled = nextStateIfHandled;
|
||||||
|
_messageIfHandled = messageIfHandled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DotnetTestState HandleMessage(IDotnetTest dotnetTest, Message message)
|
||||||
|
{
|
||||||
|
var nextState = DotnetTestState.NoOp;
|
||||||
|
if (CanHandleMessage(dotnetTest, message))
|
||||||
|
{
|
||||||
|
HandleMessage(message);
|
||||||
|
nextState = _nextStateIfHandled;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nextState;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleMessage(Message message)
|
||||||
|
{
|
||||||
|
_adapterChannel.Send(new Message
|
||||||
|
{
|
||||||
|
MessageType = _messageIfHandled,
|
||||||
|
Payload = message.Payload
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract bool CanHandleMessage(IDotnetTest dotnetTest, Message message);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using Microsoft.Extensions.Testing.Abstractions;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public class TestRunnerTestCompletedMessageHandler : IDotnetTestMessageHandler
|
||||||
|
{
|
||||||
|
private readonly IReportingChannel _adapterChannel;
|
||||||
|
|
||||||
|
public TestRunnerTestCompletedMessageHandler(IReportingChannel adapterChannel)
|
||||||
|
{
|
||||||
|
_adapterChannel = adapterChannel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DotnetTestState HandleMessage(IDotnetTest dotnetTest, Message message)
|
||||||
|
{
|
||||||
|
var nextState = DotnetTestState.NoOp;
|
||||||
|
if (CanHandleMessage(dotnetTest, message))
|
||||||
|
{
|
||||||
|
DoHandleMessage(dotnetTest, message);
|
||||||
|
nextState = NextState(dotnetTest);
|
||||||
|
}
|
||||||
|
|
||||||
|
return nextState;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DoHandleMessage(IDotnetTest dotnetTest, Message message)
|
||||||
|
{
|
||||||
|
_adapterChannel.Send(new Message
|
||||||
|
{
|
||||||
|
MessageType = MessageType(dotnetTest)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private string MessageType(IDotnetTest dotnetTest)
|
||||||
|
{
|
||||||
|
return dotnetTest.State == DotnetTestState.TestDiscoveryStarted
|
||||||
|
? TestMessageTypes.TestDiscoveryCompleted
|
||||||
|
: TestMessageTypes.TestExecutionCompleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
private DotnetTestState NextState(IDotnetTest dotnetTest)
|
||||||
|
{
|
||||||
|
return dotnetTest.State == DotnetTestState.TestDiscoveryStarted
|
||||||
|
? DotnetTestState.TestDiscoveryCompleted
|
||||||
|
: DotnetTestState.TestExecutionCompleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CanHandleMessage(IDotnetTest dotnetTest, Message message)
|
||||||
|
{
|
||||||
|
return IsAtAnAcceptableState(dotnetTest) && CanAcceptMessage(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool CanAcceptMessage(Message message)
|
||||||
|
{
|
||||||
|
return message.MessageType == TestMessageTypes.TestRunnerTestCompleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsAtAnAcceptableState(IDotnetTest dotnetTest)
|
||||||
|
{
|
||||||
|
return (dotnetTest.State == DotnetTestState.TestDiscoveryStarted ||
|
||||||
|
dotnetTest.State == DotnetTestState.TestExecutionStarted);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using Microsoft.Extensions.Testing.Abstractions;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public class TestRunnerTestFoundMessageHandler : TestRunnerResultMessageHandler
|
||||||
|
{
|
||||||
|
public TestRunnerTestFoundMessageHandler(IReportingChannel adapterChannel)
|
||||||
|
: base(adapterChannel, DotnetTestState.TestDiscoveryStarted, TestMessageTypes.TestDiscoveryTestFound)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool CanHandleMessage(IDotnetTest dotnetTest, Message message)
|
||||||
|
{
|
||||||
|
return dotnetTest.State == DotnetTestState.TestDiscoveryStarted &&
|
||||||
|
message.MessageType == TestMessageTypes.TestRunnerTestFound;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using Microsoft.Extensions.Testing.Abstractions;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public class TestRunnerTestResultMessageHandler : TestRunnerResultMessageHandler
|
||||||
|
{
|
||||||
|
public TestRunnerTestResultMessageHandler(IReportingChannel adapterChannel)
|
||||||
|
: base(adapterChannel, DotnetTestState.TestExecutionStarted, TestMessageTypes.TestExecutionTestResult)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool CanHandleMessage(IDotnetTest dotnetTest, Message message)
|
||||||
|
{
|
||||||
|
return dotnetTest.State == DotnetTestState.TestExecutionStarted &&
|
||||||
|
message.MessageType == TestMessageTypes.TestRunnerTestResult;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using Microsoft.Extensions.Testing.Abstractions;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public class TestRunnerTestStartedMessageHandler : TestRunnerResultMessageHandler
|
||||||
|
{
|
||||||
|
public TestRunnerTestStartedMessageHandler(IReportingChannel adapterChannel)
|
||||||
|
: base(adapterChannel, DotnetTestState.TestExecutionStarted, TestMessageTypes.TestExecutionStarted)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool CanHandleMessage(IDotnetTest dotnetTest, Message message)
|
||||||
|
{
|
||||||
|
return IsAtAnAcceptableState(dotnetTest) &&
|
||||||
|
message.MessageType == TestMessageTypes.TestRunnerTestStarted;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsAtAnAcceptableState(IDotnetTest dotnetTest)
|
||||||
|
{
|
||||||
|
return dotnetTest.State == DotnetTestState.TestExecutionSentTestRunnerProcessStartInfo ||
|
||||||
|
dotnetTest.State == DotnetTestState.TestExecutionStarted;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using Microsoft.Extensions.Testing.Abstractions;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public class TestSessionTerminateMessageHandler : IDotnetTestMessageHandler
|
||||||
|
{
|
||||||
|
private readonly ITestMessagesCollection _messages;
|
||||||
|
|
||||||
|
public TestSessionTerminateMessageHandler(ITestMessagesCollection messages)
|
||||||
|
{
|
||||||
|
_messages = messages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DotnetTestState HandleMessage(IDotnetTest dotnetTest, Message message)
|
||||||
|
{
|
||||||
|
var nextState = DotnetTestState.NoOp;
|
||||||
|
|
||||||
|
if (TestMessageTypes.TestSessionTerminate.Equals(message.MessageType))
|
||||||
|
{
|
||||||
|
nextState = DotnetTestState.Terminated;
|
||||||
|
_messages.Drain();
|
||||||
|
}
|
||||||
|
|
||||||
|
return nextState;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using Microsoft.Extensions.Testing.Abstractions;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public class UnknownMessageHandler : IDotnetTestMessageHandler
|
||||||
|
{
|
||||||
|
private readonly IReportingChannel _adapterChannel;
|
||||||
|
|
||||||
|
public UnknownMessageHandler(IReportingChannel adapterChannel)
|
||||||
|
{
|
||||||
|
_adapterChannel = adapterChannel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DotnetTestState HandleMessage(IDotnetTest dotnetTest, Message message)
|
||||||
|
{
|
||||||
|
var error = $"No handler for message '{message.MessageType}' when at state '{dotnetTest.State}'";
|
||||||
|
|
||||||
|
TestHostTracing.Source.TraceEvent(TraceEventType.Error, 0, error);
|
||||||
|
|
||||||
|
_adapterChannel.SendError(error);
|
||||||
|
|
||||||
|
throw new InvalidOperationException(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using Microsoft.Extensions.Testing.Abstractions;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public class VersionCheckMessageHandler : IDotnetTestMessageHandler
|
||||||
|
{
|
||||||
|
private const int SupportedVersion = 1;
|
||||||
|
|
||||||
|
private readonly IReportingChannel _adapterChannel;
|
||||||
|
|
||||||
|
public VersionCheckMessageHandler(IReportingChannel adapterChannel)
|
||||||
|
{
|
||||||
|
_adapterChannel = adapterChannel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DotnetTestState HandleMessage(IDotnetTest dotnetTest, Message message)
|
||||||
|
{
|
||||||
|
var nextState = DotnetTestState.NoOp;
|
||||||
|
if (CanHandleMessage(dotnetTest, message))
|
||||||
|
{
|
||||||
|
HandleMessage(message);
|
||||||
|
nextState = DotnetTestState.VersionCheckCompleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nextState;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleMessage(Message message)
|
||||||
|
{
|
||||||
|
var version = message.Payload?.ToObject<ProtocolVersionMessage>().Version;
|
||||||
|
TestHostTracing.Source.TraceInformation(
|
||||||
|
"[ReportingChannel]: Requested Version: {0} - Using Version: {1}",
|
||||||
|
version,
|
||||||
|
SupportedVersion);
|
||||||
|
|
||||||
|
_adapterChannel.Send(new Message
|
||||||
|
{
|
||||||
|
MessageType = TestMessageTypes.VersionCheck,
|
||||||
|
Payload = JToken.FromObject(new ProtocolVersionMessage
|
||||||
|
{
|
||||||
|
Version = SupportedVersion,
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool CanHandleMessage(IDotnetTest dotnetTest, Message message)
|
||||||
|
{
|
||||||
|
return dotnetTest.State == DotnetTestState.InitialState &&
|
||||||
|
TestMessageTypes.VersionCheck.Equals(message.MessageType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,10 +9,6 @@ using System.Linq;
|
||||||
using Microsoft.DotNet.Cli.Utils;
|
using Microsoft.DotNet.Cli.Utils;
|
||||||
using Microsoft.Dnx.Runtime.Common.CommandLine;
|
using Microsoft.Dnx.Runtime.Common.CommandLine;
|
||||||
using Microsoft.DotNet.ProjectModel;
|
using Microsoft.DotNet.ProjectModel;
|
||||||
using Microsoft.Extensions.Testing.Abstractions;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using NuGet.Frameworks;
|
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Tools.Test
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
{
|
{
|
||||||
|
@ -58,7 +54,7 @@ namespace Microsoft.DotNet.Tools.Test
|
||||||
var projectContext = projectContexts.First();
|
var projectContext = projectContexts.First();
|
||||||
|
|
||||||
var testRunner = projectContext.ProjectFile.TestRunner;
|
var testRunner = projectContext.ProjectFile.TestRunner;
|
||||||
|
|
||||||
var configuration = configurationOption.Value() ?? Constants.DefaultConfiguration;
|
var configuration = configurationOption.Value() ?? Constants.DefaultConfiguration;
|
||||||
|
|
||||||
if (portOption.HasValue())
|
if (portOption.HasValue())
|
||||||
|
@ -105,154 +101,54 @@ namespace Microsoft.DotNet.Tools.Test
|
||||||
.ExitCode;
|
.ExitCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int RunDesignTime(int port, ProjectContext projectContext, string testRunner, string configuration)
|
private static int RunDesignTime(
|
||||||
|
int port,
|
||||||
|
ProjectContext
|
||||||
|
projectContext,
|
||||||
|
string testRunner,
|
||||||
|
string configuration)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Listening on port {0}", port);
|
Console.WriteLine("Listening on port {0}", port);
|
||||||
using (var channel = ReportingChannel.ListenOn(port))
|
|
||||||
{
|
|
||||||
Console.WriteLine("Client accepted {0}", channel.Socket.LocalEndPoint);
|
|
||||||
|
|
||||||
HandleDesignTimeMessages(projectContext, testRunner, channel, configuration);
|
HandleDesignTimeMessages(projectContext, testRunner, port, configuration);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void HandleDesignTimeMessages(ProjectContext projectContext, string testRunner, ReportingChannel channel, string configuration)
|
private static void HandleDesignTimeMessages(
|
||||||
|
ProjectContext projectContext,
|
||||||
|
string testRunner,
|
||||||
|
int port,
|
||||||
|
string configuration)
|
||||||
{
|
{
|
||||||
|
var reportingChannelFactory = new ReportingChannelFactory();
|
||||||
|
var adapterChannel = reportingChannelFactory.CreateChannelWithPort(port);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var message = channel.ReadQueue.Take();
|
var assemblyUnderTest = projectContext.GetOutputPaths(configuration).CompilationFiles.Assembly;
|
||||||
|
var messages = new TestMessagesCollection();
|
||||||
|
using (var dotnetTest = new DotnetTest(messages, assemblyUnderTest))
|
||||||
|
{
|
||||||
|
var commandFactory = new DotNetCommandFactory();
|
||||||
|
var testRunnerFactory = new TestRunnerFactory(GetCommandName(testRunner), commandFactory);
|
||||||
|
|
||||||
if (message.MessageType == "ProtocolVersion")
|
dotnetTest
|
||||||
{
|
.AddNonSpecificMessageHandlers(messages, adapterChannel)
|
||||||
HandleProtocolVersionMessage(message, channel);
|
.AddTestDiscoveryMessageHandlers(adapterChannel, reportingChannelFactory, testRunnerFactory)
|
||||||
|
.AddTestRunMessageHandlers(adapterChannel, reportingChannelFactory, testRunnerFactory)
|
||||||
|
.AddTestRunnnersMessageHandlers(adapterChannel);
|
||||||
|
|
||||||
// Take the next message, which should be the command to execute.
|
dotnetTest.StartListeningTo(adapterChannel);
|
||||||
message = channel.ReadQueue.Take();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (message.MessageType == "TestDiscovery.Start")
|
adapterChannel.Accept();
|
||||||
{
|
|
||||||
HandleTestDiscoveryStartMessage(testRunner, channel, projectContext, configuration);
|
dotnetTest.StartHandlingMessages();
|
||||||
}
|
|
||||||
else if (message.MessageType == "TestExecution.Start")
|
|
||||||
{
|
|
||||||
HandleTestExecutionStartMessage(testRunner, message, channel, projectContext, configuration);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
HandleUnknownMessage(message, channel);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
channel.SendError(ex);
|
adapterChannel.SendError(ex);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void HandleProtocolVersionMessage(Message message, ReportingChannel channel)
|
|
||||||
{
|
|
||||||
var version = message.Payload?.ToObject<ProtocolVersionMessage>().Version;
|
|
||||||
var supportedVersion = 1;
|
|
||||||
TestHostTracing.Source.TraceInformation(
|
|
||||||
"[ReportingChannel]: Requested Version: {0} - Using Version: {1}",
|
|
||||||
version,
|
|
||||||
supportedVersion);
|
|
||||||
|
|
||||||
channel.Send(new Message()
|
|
||||||
{
|
|
||||||
MessageType = "ProtocolVersion",
|
|
||||||
Payload = JToken.FromObject(new ProtocolVersionMessage()
|
|
||||||
{
|
|
||||||
Version = supportedVersion,
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void HandleTestDiscoveryStartMessage(string testRunner, ReportingChannel channel, ProjectContext projectContext, string configuration)
|
|
||||||
{
|
|
||||||
TestHostTracing.Source.TraceInformation("Starting Discovery");
|
|
||||||
|
|
||||||
var commandArgs = new List<string> { projectContext.GetOutputPaths(configuration).CompilationFiles.Assembly };
|
|
||||||
|
|
||||||
commandArgs.AddRange(new[]
|
|
||||||
{
|
|
||||||
"--list",
|
|
||||||
"--designtime"
|
|
||||||
});
|
|
||||||
|
|
||||||
ExecuteRunnerCommand(testRunner, channel, commandArgs);
|
|
||||||
|
|
||||||
channel.Send(new Message()
|
|
||||||
{
|
|
||||||
MessageType = "TestDiscovery.Response",
|
|
||||||
});
|
|
||||||
|
|
||||||
TestHostTracing.Source.TraceInformation("Completed Discovery");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void HandleTestExecutionStartMessage(string testRunner, Message message, ReportingChannel channel, ProjectContext projectContext, string configuration)
|
|
||||||
{
|
|
||||||
TestHostTracing.Source.TraceInformation("Starting Execution");
|
|
||||||
|
|
||||||
var commandArgs = new List<string> { projectContext.GetOutputPaths(configuration).CompilationFiles.Assembly };
|
|
||||||
|
|
||||||
commandArgs.AddRange(new[]
|
|
||||||
{
|
|
||||||
"--designtime"
|
|
||||||
});
|
|
||||||
|
|
||||||
var tests = message.Payload?.ToObject<RunTestsMessage>().Tests;
|
|
||||||
if (tests != null)
|
|
||||||
{
|
|
||||||
foreach (var test in tests)
|
|
||||||
{
|
|
||||||
commandArgs.Add("--test");
|
|
||||||
commandArgs.Add(test);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ExecuteRunnerCommand(testRunner, channel, commandArgs);
|
|
||||||
|
|
||||||
channel.Send(new Message()
|
|
||||||
{
|
|
||||||
MessageType = "TestExecution.Response",
|
|
||||||
});
|
|
||||||
|
|
||||||
TestHostTracing.Source.TraceInformation("Completed Execution");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void HandleUnknownMessage(Message message, ReportingChannel channel)
|
|
||||||
{
|
|
||||||
var error = string.Format("Unexpected message type: '{0}'.", message.MessageType);
|
|
||||||
|
|
||||||
TestHostTracing.Source.TraceEvent(TraceEventType.Error, 0, error);
|
|
||||||
|
|
||||||
channel.SendError(error);
|
|
||||||
|
|
||||||
throw new InvalidOperationException(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void ExecuteRunnerCommand(string testRunner, ReportingChannel channel, List<string> commandArgs)
|
|
||||||
{
|
|
||||||
var result = Command.CreateDotNet(GetCommandName(testRunner), commandArgs, new NuGetFramework("DNXCore", Version.Parse("5.0")))
|
|
||||||
.OnOutputLine(line =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
channel.Send(JsonConvert.DeserializeObject<Message>(line));
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
TestHostTracing.Source.TraceInformation(line);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.Execute();
|
|
||||||
|
|
||||||
if (result.ExitCode != 0)
|
|
||||||
{
|
|
||||||
channel.SendError($"{GetCommandName(testRunner)} returned '{result.ExitCode}'.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,57 +2,65 @@
|
||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Extensions.Testing.Abstractions;
|
using Microsoft.Extensions.Testing.Abstractions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Tools.Test
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
{
|
{
|
||||||
public class ReportingChannel : IDisposable
|
public class ReportingChannel : IReportingChannel
|
||||||
{
|
{
|
||||||
public static ReportingChannel ListenOn(int port)
|
public static ReportingChannel ListenOn(int port)
|
||||||
{
|
{
|
||||||
// This fixes the mono incompatibility but ties it to ipv4 connections
|
// This fixes the mono incompatibility but ties it to ipv4 connections
|
||||||
using (var listenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
|
var listenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||||
{
|
|
||||||
listenSocket.Bind(new IPEndPoint(IPAddress.Loopback, port));
|
|
||||||
listenSocket.Listen(10);
|
|
||||||
|
|
||||||
var socket = listenSocket.Accept();
|
listenSocket.Bind(new IPEndPoint(IPAddress.Loopback, port));
|
||||||
|
listenSocket.Listen(10);
|
||||||
|
|
||||||
return new ReportingChannel(socket);
|
return new ReportingChannel(listenSocket);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly BinaryWriter _writer;
|
private BinaryWriter _writer;
|
||||||
private readonly BinaryReader _reader;
|
private BinaryReader _reader;
|
||||||
private readonly ManualResetEventSlim _ackWaitHandle;
|
private Socket _listenSocket;
|
||||||
|
|
||||||
private ReportingChannel(Socket socket)
|
private ReportingChannel(Socket listenSocket)
|
||||||
{
|
{
|
||||||
Socket = socket;
|
_listenSocket = listenSocket;
|
||||||
|
Port = ((IPEndPoint)listenSocket.LocalEndPoint).Port;
|
||||||
var stream = new NetworkStream(Socket);
|
|
||||||
_writer = new BinaryWriter(stream);
|
|
||||||
_reader = new BinaryReader(stream);
|
|
||||||
_ackWaitHandle = new ManualResetEventSlim();
|
|
||||||
|
|
||||||
ReadQueue = new BlockingCollection<Message>(boundedCapacity: 1);
|
|
||||||
|
|
||||||
// Read incoming messages on the background thread
|
|
||||||
new Thread(ReadMessages) { IsBackground = true }.Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockingCollection<Message> ReadQueue { get; }
|
public event EventHandler<Message> MessageReceived;
|
||||||
|
|
||||||
public Socket Socket { get; private set; }
|
public Socket Socket { get; private set; }
|
||||||
|
|
||||||
|
public int Port { get; }
|
||||||
|
|
||||||
|
public void Accept()
|
||||||
|
{
|
||||||
|
new Thread(() =>
|
||||||
|
{
|
||||||
|
using (_listenSocket)
|
||||||
|
{
|
||||||
|
Socket = _listenSocket.Accept();
|
||||||
|
|
||||||
|
var stream = new NetworkStream(Socket);
|
||||||
|
_writer = new BinaryWriter(stream);
|
||||||
|
_reader = new BinaryReader(stream);
|
||||||
|
|
||||||
|
// Read incoming messages on the background thread
|
||||||
|
new Thread(ReadMessages) { IsBackground = true }.Start();
|
||||||
|
}
|
||||||
|
}) { IsBackground = true }.Start();
|
||||||
|
}
|
||||||
|
|
||||||
public void Send(Message message)
|
public void Send(Message message)
|
||||||
{
|
{
|
||||||
lock (_writer)
|
lock (_writer)
|
||||||
|
@ -62,7 +70,7 @@ namespace Microsoft.DotNet.Tools.Test
|
||||||
TestHostTracing.Source.TraceEvent(
|
TestHostTracing.Source.TraceEvent(
|
||||||
TraceEventType.Verbose,
|
TraceEventType.Verbose,
|
||||||
0,
|
0,
|
||||||
"[ReportingChannel]: Send({0})",
|
"[ReportingChannel]: Send({0})",
|
||||||
message);
|
message);
|
||||||
|
|
||||||
_writer.Write(JsonConvert.SerializeObject(message));
|
_writer.Write(JsonConvert.SerializeObject(message));
|
||||||
|
@ -102,13 +110,13 @@ namespace Microsoft.DotNet.Tools.Test
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var message = JsonConvert.DeserializeObject<Message>(_reader.ReadString());
|
var rawMessage = _reader.ReadString();
|
||||||
ReadQueue.Add(message);
|
var message = JsonConvert.DeserializeObject<Message>(rawMessage);
|
||||||
|
|
||||||
if (string.Equals(message.MessageType, "TestHost.Acknowledge"))
|
MessageReceived?.Invoke(this, message);
|
||||||
|
|
||||||
|
if (ShouldStopListening(message))
|
||||||
{
|
{
|
||||||
_ackWaitHandle.Set();
|
|
||||||
ReadQueue.CompleteAdding();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,26 +132,14 @@ namespace Microsoft.DotNet.Tools.Test
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool ShouldStopListening(Message message)
|
||||||
|
{
|
||||||
|
return message.MessageType == TestMessageTypes.TestRunnerTestCompleted ||
|
||||||
|
message.MessageType == TestMessageTypes.TestSessionTerminate;
|
||||||
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
// Wait for a graceful disconnect - drain the queue until we get an 'ACK'
|
|
||||||
Message message;
|
|
||||||
while (ReadQueue.TryTake(out message, millisecondsTimeout: 1))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_ackWaitHandle.Wait(TimeSpan.FromSeconds(10)))
|
|
||||||
{
|
|
||||||
TestHostTracing.Source.TraceInformation("[ReportingChannel]: Received for ack from test host");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TestHostTracing.Source.TraceEvent(
|
|
||||||
TraceEventType.Error,
|
|
||||||
0,
|
|
||||||
"[ReportingChannel]: Timed out waiting for ack from test host");
|
|
||||||
}
|
|
||||||
|
|
||||||
Socket.Dispose();
|
Socket.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
18
src/dotnet/commands/dotnet-test/ReportingChannelFactory.cs
Normal file
18
src/dotnet/commands/dotnet-test/ReportingChannelFactory.cs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public class ReportingChannelFactory : IReportingChannelFactory
|
||||||
|
{
|
||||||
|
public IReportingChannel CreateChannelWithAnyAvailablePort()
|
||||||
|
{
|
||||||
|
return ReportingChannel.ListenOn(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IReportingChannel CreateChannelWithPort(int port)
|
||||||
|
{
|
||||||
|
return ReportingChannel.ListenOn(port);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
73
src/dotnet/commands/dotnet-test/TestMessagesCollection.cs
Normal file
73
src/dotnet/commands/dotnet-test/TestMessagesCollection.cs
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Threading;
|
||||||
|
using Microsoft.Extensions.Testing.Abstractions;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public class TestMessagesCollection : ITestMessagesCollection
|
||||||
|
{
|
||||||
|
private readonly ManualResetEventSlim _terminateWaitHandle;
|
||||||
|
private readonly BlockingCollection<Message> _readQueue;
|
||||||
|
|
||||||
|
public TestMessagesCollection()
|
||||||
|
{
|
||||||
|
_readQueue = new BlockingCollection<Message>(boundedCapacity: 1);
|
||||||
|
_terminateWaitHandle = new ManualResetEventSlim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Drain()
|
||||||
|
{
|
||||||
|
_terminateWaitHandle.Set();
|
||||||
|
_readQueue.CompleteAdding();
|
||||||
|
DrainQueue();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Add(Message message)
|
||||||
|
{
|
||||||
|
_readQueue.Add(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TryTake(out Message message)
|
||||||
|
{
|
||||||
|
message = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
message = _readQueue.Take();
|
||||||
|
}
|
||||||
|
catch (InvalidOperationException)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (_terminateWaitHandle.Wait(TimeSpan.FromSeconds(10)))
|
||||||
|
{
|
||||||
|
TestHostTracing.Source.TraceInformation("[ReportingChannel]: Received TestSession:Terminate from test host");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TestHostTracing.Source.TraceEvent(
|
||||||
|
TraceEventType.Error,
|
||||||
|
0,
|
||||||
|
"[ReportingChannel]: Timed out waiting for aTestSession:Terminate from test host");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrainQueue()
|
||||||
|
{
|
||||||
|
Message message;
|
||||||
|
while (_readQueue.TryTake(out message, millisecondsTimeout: 1))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using Microsoft.Extensions.Testing.Abstractions;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public class DiscoverTestsArgumentsBuilder : ITestRunnerArgumentsBuilder
|
||||||
|
{
|
||||||
|
private readonly string _assemblyUnderTest;
|
||||||
|
private readonly int _port;
|
||||||
|
|
||||||
|
public DiscoverTestsArgumentsBuilder(string assemblyUnderTest, int port)
|
||||||
|
{
|
||||||
|
_assemblyUnderTest = assemblyUnderTest;
|
||||||
|
_port = port;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<string> BuildArguments()
|
||||||
|
{
|
||||||
|
var commandArgs = new List<string>
|
||||||
|
{
|
||||||
|
_assemblyUnderTest,
|
||||||
|
"--list",
|
||||||
|
"--designtime",
|
||||||
|
"--port",
|
||||||
|
$"{_port}"
|
||||||
|
};
|
||||||
|
|
||||||
|
return commandArgs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
16
src/dotnet/commands/dotnet-test/TestRunners/ITestRunner.cs
Normal file
16
src/dotnet/commands/dotnet-test/TestRunners/ITestRunner.cs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using Microsoft.Extensions.Testing.Abstractions;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public interface ITestRunner
|
||||||
|
{
|
||||||
|
void RunTestCommand();
|
||||||
|
|
||||||
|
ProcessStartInfo GetProcessStartInfo();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public interface ITestRunnerArgumentsBuilder
|
||||||
|
{
|
||||||
|
IEnumerable<string> BuildArguments();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using Microsoft.Extensions.Testing.Abstractions;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public interface ITestRunnerFactory
|
||||||
|
{
|
||||||
|
ITestRunner CreateTestRunner(ITestRunnerArgumentsBuilder argumentsBuilder);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.Extensions.Testing.Abstractions;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public class RunTestsArgumentsBuilder : ITestRunnerArgumentsBuilder
|
||||||
|
{
|
||||||
|
private readonly string _assemblyUnderTest;
|
||||||
|
private readonly int _port;
|
||||||
|
private readonly Message _message;
|
||||||
|
|
||||||
|
public RunTestsArgumentsBuilder(string assemblyUnderTest, int port, Message message)
|
||||||
|
{
|
||||||
|
_assemblyUnderTest = assemblyUnderTest;
|
||||||
|
_port = port;
|
||||||
|
_message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<string> BuildArguments()
|
||||||
|
{
|
||||||
|
var commandArgs = new List<string>
|
||||||
|
{
|
||||||
|
_assemblyUnderTest,
|
||||||
|
"--designtime",
|
||||||
|
"--port",
|
||||||
|
$"{_port}"
|
||||||
|
};
|
||||||
|
|
||||||
|
var tests = _message.Payload?.ToObject<RunTestsMessage>().Tests;
|
||||||
|
if (tests != null)
|
||||||
|
{
|
||||||
|
foreach (var test in tests)
|
||||||
|
{
|
||||||
|
commandArgs.Add("--test");
|
||||||
|
commandArgs.Add(test);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return commandArgs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
59
src/dotnet/commands/dotnet-test/TestRunners/TestRunner.cs
Normal file
59
src/dotnet/commands/dotnet-test/TestRunners/TestRunner.cs
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||||
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using Microsoft.DotNet.Cli.Utils;
|
||||||
|
using NuGet.Frameworks;
|
||||||
|
|
||||||
|
namespace Microsoft.DotNet.Tools.Test
|
||||||
|
{
|
||||||
|
public class TestRunner : ITestRunner
|
||||||
|
{
|
||||||
|
private readonly string _testRunner;
|
||||||
|
private readonly ICommandFactory _commandFactory;
|
||||||
|
private readonly ITestRunnerArgumentsBuilder _argumentsBuilder;
|
||||||
|
|
||||||
|
public TestRunner(
|
||||||
|
string testRunner,
|
||||||
|
ICommandFactory commandFactory,
|
||||||
|
ITestRunnerArgumentsBuilder argumentsBuilder)
|
||||||
|
{
|
||||||
|
_testRunner = testRunner;
|
||||||
|
_commandFactory = commandFactory;
|
||||||
|
_argumentsBuilder = argumentsBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RunTestCommand()
|
||||||
|
{
|
||||||
|
ExecuteRunnerCommand();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProcessStartInfo GetProcessStartInfo()
|
||||||
|
{
|
||||||
|
var command = CreateTestRunnerCommand();
|
||||||
|
|
||||||
|
return command.ToProcessStartInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ExecuteRunnerCommand()
|
||||||
|
{
|
||||||
|
var result = CreateTestRunnerCommand().Execute();
|
||||||
|
|
||||||
|
if (result.ExitCode != 0)
|
||||||
|
{
|
||||||
|
throw new TestRunnerOperationFailedException(_testRunner, result.ExitCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICommand CreateTestRunnerCommand()
|
||||||
|
{
|
||||||
|
var commandArgs = _argumentsBuilder.BuildArguments();
|
||||||
|
|
||||||
|
return _commandFactory.Create(
|
||||||
|
_testRunner,
|
||||||
|
commandArgs,
|
||||||
|
new NuGetFramework("DNXCore", Version.Parse("5.0")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue