Merge branch 'master' of https://github.com/dotnet/cli into centos-docker
Conflicts: scripts/build/build.sh
This commit is contained in:
commit
7fe96d56c3
41 changed files with 497 additions and 243 deletions
|
@ -70,6 +70,7 @@ EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Extensions.DependencyModel", "src\Microsoft.Extensions.DependencyModel\Microsoft.Extensions.DependencyModel.xproj", "{688870C8-9843-4F9E-8576-D39290AD0F25}"
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Extensions.DependencyModel", "src\Microsoft.Extensions.DependencyModel\Microsoft.Extensions.DependencyModel.xproj", "{688870C8-9843-4F9E-8576-D39290AD0F25}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Tools.Compiler.Fsc", "src\Microsoft.DotNet.Tools.Compiler.Fsc\Microsoft.DotNet.Tools.Compiler.Fsc.xproj", "{74F25188-BF63-4BF3-879B-B6CDB11ED608}"
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.DotNet.Tools.Compiler.Fsc", "src\Microsoft.DotNet.Tools.Compiler.Fsc\Microsoft.DotNet.Tools.Compiler.Fsc.xproj", "{74F25188-BF63-4BF3-879B-B6CDB11ED608}"
|
||||||
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "E2E", "test\E2E\E2E.xproj", "{65741CB1-8AEE-4C66-8198-10A7EA0E4258}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -547,6 +548,22 @@ Global
|
||||||
{11C77123-E4DA-499F-8900-80C88C2C69F2}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
{11C77123-E4DA-499F-8900-80C88C2C69F2}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||||
{11C77123-E4DA-499F-8900-80C88C2C69F2}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
{11C77123-E4DA-499F-8900-80C88C2C69F2}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||||
{11C77123-E4DA-499F-8900-80C88C2C69F2}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
{11C77123-E4DA-499F-8900-80C88C2C69F2}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||||
|
{65741CB1-8AEE-4C66-8198-10A7EA0E4258}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{65741CB1-8AEE-4C66-8198-10A7EA0E4258}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{65741CB1-8AEE-4C66-8198-10A7EA0E4258}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{65741CB1-8AEE-4C66-8198-10A7EA0E4258}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{65741CB1-8AEE-4C66-8198-10A7EA0E4258}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{65741CB1-8AEE-4C66-8198-10A7EA0E4258}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{65741CB1-8AEE-4C66-8198-10A7EA0E4258}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{65741CB1-8AEE-4C66-8198-10A7EA0E4258}.MinSizeRel|x64.Build.0 = Debug|Any CPU
|
||||||
|
{65741CB1-8AEE-4C66-8198-10A7EA0E4258}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{65741CB1-8AEE-4C66-8198-10A7EA0E4258}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{65741CB1-8AEE-4C66-8198-10A7EA0E4258}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{65741CB1-8AEE-4C66-8198-10A7EA0E4258}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{65741CB1-8AEE-4C66-8198-10A7EA0E4258}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{65741CB1-8AEE-4C66-8198-10A7EA0E4258}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{65741CB1-8AEE-4C66-8198-10A7EA0E4258}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{65741CB1-8AEE-4C66-8198-10A7EA0E4258}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -581,5 +598,6 @@ Global
|
||||||
{79620410-4EC7-4A38-A8C3-EE81243F818E} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
{79620410-4EC7-4A38-A8C3-EE81243F818E} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||||
{1EA9AF94-5494-40DD-A05B-9D564572CCFC} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
{1EA9AF94-5494-40DD-A05B-9D564572CCFC} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||||
{11C77123-E4DA-499F-8900-80C88C2C69F2} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
{11C77123-E4DA-499F-8900-80C88C2C69F2} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||||
|
{65741CB1-8AEE-4C66-8198-10A7EA0E4258} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
@ -21,7 +21,7 @@ Installers
|
||||||
|
|
||||||
| |Ubuntu 14.04 |Windows |Mac OS X |CentOS 7.1 |
|
| |Ubuntu 14.04 |Windows |Mac OS X |CentOS 7.1 |
|
||||||
|---------|:------:|:------:|:------:|:------:|
|
|---------|:------:|:------:|:------:|:------:|
|
||||||
|**Installers**|[Download Debian Package](https://dotnetcli.blob.core.windows.net/dotnet/dev/Installers/Latest/dotnet-linux-x64.latest.deb)|[Download Msi](https://dotnetcli.blob.core.windows.net/dotnet/dev/Installers/Latest/dotnet-win-x64.latest.msi)|[Download Pkg](https://dotnetcli.blob.core.windows.net/dotnet/dev/Installers/Latest/dotnet-osx-x64.latest.pkg) |N/A |
|
|**Installers**|[Download Debian Package](https://dotnetcli.blob.core.windows.net/dotnet/dev/Installers/Latest/dotnet-ubuntu-x64.latest.deb)|[Download Msi](https://dotnetcli.blob.core.windows.net/dotnet/dev/Installers/Latest/dotnet-win-x64.latest.msi)|[Download Pkg](https://dotnetcli.blob.core.windows.net/dotnet/dev/Installers/Latest/dotnet-osx-x64.latest.pkg) |N/A |
|
||||||
|**Binaries**|[Download tar file](https://dotnetcli.blob.core.windows.net/dotnet/dev/Binaries/Latest/dotnet-ubuntu-x64.latest.tar.gz)|[Download zip file](https://dotnetcli.blob.core.windows.net/dotnet/dev/Binaries/Latest/dotnet-win-x64.latest.zip)|[Download tar file](https://dotnetcli.blob.core.windows.net/dotnet/dev/Binaries/Latest/dotnet-osx-x64.latest.tar.gz) |[Download tar file](https://dotnetcli.blob.core.windows.net/dotnet/dev/Binaries/Latest/dotnet-centos-x64.latest.tar.gz) |
|
|**Binaries**|[Download tar file](https://dotnetcli.blob.core.windows.net/dotnet/dev/Binaries/Latest/dotnet-ubuntu-x64.latest.tar.gz)|[Download zip file](https://dotnetcli.blob.core.windows.net/dotnet/dev/Binaries/Latest/dotnet-win-x64.latest.zip)|[Download tar file](https://dotnetcli.blob.core.windows.net/dotnet/dev/Binaries/Latest/dotnet-osx-x64.latest.tar.gz) |[Download tar file](https://dotnetcli.blob.core.windows.net/dotnet/dev/Binaries/Latest/dotnet-centos-x64.latest.tar.gz) |
|
||||||
|
|
||||||
Interested in .NET Core + ASP.NET 5 RC bits?
|
Interested in .NET Core + ASP.NET 5 RC bits?
|
||||||
|
|
|
@ -142,7 +142,7 @@ package_absolute_placement(){
|
||||||
abs_files=( $(_get_files_in_dir_tree $ABSOLUTE_PLACEMENT_DIR) )
|
abs_files=( $(_get_files_in_dir_tree $ABSOLUTE_PLACEMENT_DIR) )
|
||||||
|
|
||||||
# For each file add a a system placement
|
# For each file add a a system placement
|
||||||
for abs_file in $abs_files
|
for abs_file in ${abs_files[@]}
|
||||||
do
|
do
|
||||||
parent_dir=$(dirname $abs_file)
|
parent_dir=$(dirname $abs_file)
|
||||||
filename=$(basename $abs_file)
|
filename=$(basename $abs_file)
|
||||||
|
@ -189,7 +189,7 @@ generate_manpage_manifest(){
|
||||||
# Remove any existing manifest
|
# Remove any existing manifest
|
||||||
rm -f ${DEBIAN_DIR}/${PACKAGE_NAME}.manpages
|
rm -f ${DEBIAN_DIR}/${PACKAGE_NAME}.manpages
|
||||||
|
|
||||||
for manpage in $generated_manpages
|
for manpage in ${generated_manpages[@]}
|
||||||
do
|
do
|
||||||
echo "${docs_rel_path}/${manpage}" >> "${DEBIAN_DIR}/${PACKAGE_NAME}.manpages"
|
echo "${docs_rel_path}/${manpage}" >> "${DEBIAN_DIR}/${PACKAGE_NAME}.manpages"
|
||||||
done
|
done
|
||||||
|
@ -200,7 +200,7 @@ generate_sample_manifest(){
|
||||||
generated_manpages=( $(_get_files_in_dir_tree $INPUT_SAMPLES_DIR) )
|
generated_manpages=( $(_get_files_in_dir_tree $INPUT_SAMPLES_DIR) )
|
||||||
|
|
||||||
rm -f sample_manifest
|
rm -f sample_manifest
|
||||||
for sample in $samples
|
for sample in ${samples[@]}
|
||||||
do
|
do
|
||||||
echo "$sample" >> "${DEBIAN_DIR}/${PACKAGE_NAME}.examples"
|
echo "$sample" >> "${DEBIAN_DIR}/${PACKAGE_NAME}.examples"
|
||||||
done
|
done
|
||||||
|
|
|
@ -33,6 +33,10 @@ else {
|
||||||
header "Compiling"
|
header "Compiling"
|
||||||
_ "$RepoRoot\scripts\compile\compile.ps1" @("$Configuration")
|
_ "$RepoRoot\scripts\compile\compile.ps1" @("$Configuration")
|
||||||
|
|
||||||
|
# Put stage2 on the PATH now that we have a build
|
||||||
|
$env:PATH = "$Stage2Dir\bin;$env:PATH"
|
||||||
|
$env:DOTNET_HOME = "$Stage2Dir"
|
||||||
|
|
||||||
header "Running Tests"
|
header "Running Tests"
|
||||||
_ "$RepoRoot\scripts\test\runtests.ps1"
|
_ "$RepoRoot\scripts\test\runtests.ps1"
|
||||||
|
|
||||||
|
@ -46,4 +50,4 @@ header "Generating dotnet MSI"
|
||||||
_ "$RepoRoot\packaging\windows\generatemsi.ps1" @("$Stage2Dir")
|
_ "$RepoRoot\packaging\windows\generatemsi.ps1" @("$Stage2Dir")
|
||||||
|
|
||||||
header "Generating NuGet packages"
|
header "Generating NuGet packages"
|
||||||
_ "$RepoRoot\packaging\nuget\package.ps1" @("$Stage2Dir\bin", "$VersionSuffix")
|
_ "$RepoRoot\packaging\nuget\package.ps1" @("$Stage2Dir\bin", "$VersionSuffix")
|
||||||
|
|
|
@ -37,7 +37,10 @@ fi
|
||||||
header "Compiling"
|
header "Compiling"
|
||||||
$REPOROOT/scripts/compile/compile.sh
|
$REPOROOT/scripts/compile/compile.sh
|
||||||
|
|
||||||
# Run tests on the stage2 output
|
# Put stage2 on the PATH now that we have a build
|
||||||
|
export DOTNET_TOOLS=$STAGE1_DIR
|
||||||
|
export PATH=$STAGE2_DIR/bin:$PATH
|
||||||
|
|
||||||
header "Testing stage2..."
|
header "Testing stage2..."
|
||||||
DOTNET_HOME=$STAGE2_DIR DOTNET_TOOLS=$STAGE2_DIR $REPOROOT/scripts/test/runtests.sh
|
DOTNET_HOME=$STAGE2_DIR DOTNET_TOOLS=$STAGE2_DIR $REPOROOT/scripts/test/runtests.sh
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,11 @@ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||||
source "$DIR/../common/_common.sh"
|
source "$DIR/../common/_common.sh"
|
||||||
|
|
||||||
header "Restoring packages"
|
header "Restoring packages"
|
||||||
$DNX_ROOT/dnu restore "$REPOROOT/src" --quiet --runtime "$RID" "$NOCACHE" --parallel
|
|
||||||
$DNX_ROOT/dnu restore "$REPOROOT/test" --quiet --runtime "$RID" "$NOCACHE" --parallel
|
#Temporarily restore for ALL THE RIDS! This solves a bootstrapping problem in this fix
|
||||||
$DNX_ROOT/dnu restore "$REPOROOT/tools" --quiet --runtime "$RID" "$NOCACHE" --parallel
|
$DNX_ROOT/dnu restore "$REPOROOT/src" --quiet --runtime win7-x64 --runtime ubuntu.14.04-x64 --runtime osx.10.10-x64 --runtime osx.10.11-x64 --runtime centos.7.1-x64 "$NOCACHE" --parallel
|
||||||
|
$DNX_ROOT/dnu restore "$REPOROOT/test" --quiet --runtime win7-x64 --runtime ubuntu.14.04-x64 --runtime osx.10.10-x64 --runtime osx.10.11-x64 --runtime centos.7.1-x64 "$NOCACHE" --parallel
|
||||||
|
$DNX_ROOT/dnu restore "$REPOROOT/tools" --quiet --runtime win7-x64 --runtime ubuntu.14.04-x64 --runtime osx.10.10-x64 --runtime osx.10.11-x64 --runtime centos.7.1-x64 "$NOCACHE" --parallel
|
||||||
set +e
|
set +e
|
||||||
$DNX_ROOT/dnu restore "$REPOROOT/testapp" --quiet --runtime "$RID" "$NOCACHE" --parallel >/dev/null 2>&1
|
$DNX_ROOT/dnu restore "$REPOROOT/testapp" --quiet --runtime win7-x64 --runtime ubuntu.14.04-x64 --runtime osx.10.10-x64 --runtime osx.10.11-x64 --runtime centos.7.1-x64 "$NOCACHE" --parallel >/dev/null 2>&1
|
||||||
set -e
|
set -e
|
||||||
|
|
|
@ -12,7 +12,7 @@ if [ -z "$RID" ]; then
|
||||||
if [ -n "$(sw_vers -productVersion | grep 10.10)" ]; then
|
if [ -n "$(sw_vers -productVersion | grep 10.10)" ]; then
|
||||||
export RID=osx.10.10-x64
|
export RID=osx.10.10-x64
|
||||||
elif [ -n "$(sw_vers -productVersion | grep 10.11)" ]; then
|
elif [ -n "$(sw_vers -productVersion | grep 10.11)" ]; then
|
||||||
export RID=osx.10.10-x64
|
export RID=osx.10.11-x64
|
||||||
else
|
else
|
||||||
error "unknown OS X: $(sw_vers -productVersion)" 1>&2
|
error "unknown OS X: $(sw_vers -productVersion)" 1>&2
|
||||||
fi
|
fi
|
||||||
|
@ -34,4 +34,4 @@ fi
|
||||||
|
|
||||||
if [ -z "$RID" ]; then
|
if [ -z "$RID" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -10,15 +10,14 @@ BIN_DIR="$( cd $1 && pwd )"
|
||||||
|
|
||||||
UNAME=`uname`
|
UNAME=`uname`
|
||||||
|
|
||||||
if [ -z "$RID" ]; then
|
# Always recalculate the RID because the package always uses a specific RID, regardless of OS X version or Linux distro.
|
||||||
if [ "$UNAME" == "Darwin" ]; then
|
if [ "$UNAME" == "Darwin" ]; then
|
||||||
RID=osx.10.10-x64
|
RID=osx.10.10-x64
|
||||||
elif [ "$UNAME" == "Linux" ]; then
|
elif [ "$UNAME" == "Linux" ]; then
|
||||||
RID=ubuntu.14.04-x64
|
RID=ubuntu.14.04-x64
|
||||||
else
|
else
|
||||||
echo "Unknown OS: $UNAME" 1>&2
|
echo "Unknown OS: $UNAME" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Replace with a robust method for finding the right crossgen.exe
|
# Replace with a robust method for finding the right crossgen.exe
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
. "$PSScriptRoot\..\common\_common.ps1"
|
. "$PSScriptRoot\..\common\_common.ps1"
|
||||||
|
|
||||||
|
$failCount = 0
|
||||||
|
|
||||||
$TestBinRoot = "$RepoRoot\artifacts\tests"
|
$TestBinRoot = "$RepoRoot\artifacts\tests"
|
||||||
|
|
||||||
$TestProjects = @(
|
$TestProjects = @(
|
||||||
|
@ -45,7 +47,7 @@ pushd "$TestBinRoot"
|
||||||
|
|
||||||
# Run each test project
|
# Run each test project
|
||||||
$TestProjects | ForEach-Object {
|
$TestProjects | ForEach-Object {
|
||||||
& "corerun.exe" "xunit.console.netcore.exe" "$_.dll" -xml "$_-testResults.xml" -notrait category=failing
|
& ".\corerun" "xunit.console.netcore.exe" "$_.dll" -xml "$_-testResults.xml" -notrait category=failing
|
||||||
$exitCode = $LastExitCode
|
$exitCode = $LastExitCode
|
||||||
if ($exitCode -ne 0) {
|
if ($exitCode -ne 0) {
|
||||||
$failingTests += "$_"
|
$failingTests += "$_"
|
||||||
|
@ -61,8 +63,7 @@ if ($failCount -ne 0) {
|
||||||
$failingTests | ForEach-Object {
|
$failingTests | ForEach-Object {
|
||||||
Write-Host -ForegroundColor Red "$_.dll failed. Logs in '$TestBinRoot\$_-testResults.xml'"
|
Write-Host -ForegroundColor Red "$_.dll failed. Logs in '$TestBinRoot\$_-testResults.xml'"
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Host -ForegroundColor Green "All the tests passed!"
|
Write-Host -ForegroundColor Green "All the tests passed!"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ TestProjects=( \
|
||||||
Microsoft.DotNet.Tools.Publish.Tests \
|
Microsoft.DotNet.Tools.Publish.Tests \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
for project in ${TestProjects[@]}
|
for project in ${TestProjects[@]}
|
||||||
do
|
do
|
||||||
dotnet publish --framework "dnxcore50" --runtime "$RID" --output "$TestBinRoot" --configuration "$CONFIGURATION" "$REPOROOT/test/$project"
|
dotnet publish --framework "dnxcore50" --runtime "$RID" --output "$TestBinRoot" --configuration "$CONFIGURATION" "$REPOROOT/test/$project"
|
||||||
|
@ -43,7 +42,7 @@ failCount=0
|
||||||
|
|
||||||
for project in ${TestProjects[@]}
|
for project in ${TestProjects[@]}
|
||||||
do
|
do
|
||||||
./corerun "xunit.console.netcore.exe" "$project.dll" -xml "${project}-testResults.xml" -notrait category=failing
|
./corerun "xunit.console.netcore.exe" "$project.dll" -xml "${project}-testResults.xml" -notrait category=failing
|
||||||
exitCode=$?
|
exitCode=$?
|
||||||
failCount+=$exitCode
|
failCount+=$exitCode
|
||||||
if [ $exitCode -ne 0 ]; then
|
if [ $exitCode -ne 0 ]; then
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Microsoft.Extensions.PlatformAbstractions
|
||||||
|
{
|
||||||
|
// This is to support some legacy stuff.
|
||||||
|
// dnu restore (and thus dotnet restore) always uses win7-x64 as the Windows restore target,
|
||||||
|
// so, when picking targets out of the lock file, we need to do version fallback since the
|
||||||
|
// active RID might be higher than the RID in the lock file.
|
||||||
|
//
|
||||||
|
// We should clean this up. Filed #619 to track.
|
||||||
|
public static class RuntimeEnvironmentRidExtensions
|
||||||
|
{
|
||||||
|
// Gets the identfier that is used for restore by default (this is different from the actual RID, but only on Windows)
|
||||||
|
public static string GetLegacyRestoreRuntimeIdentifier(this IRuntimeEnvironment env)
|
||||||
|
{
|
||||||
|
if (env.OperatingSystemPlatform != Platform.Windows)
|
||||||
|
{
|
||||||
|
return env.GetRuntimeIdentifier();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var arch = env.RuntimeArchitecture.ToLowerInvariant();
|
||||||
|
return "win7-" + arch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<string> GetAllCandidateRuntimeIdentifiers(this IRuntimeEnvironment env)
|
||||||
|
{
|
||||||
|
if (env.OperatingSystemPlatform != Platform.Windows)
|
||||||
|
{
|
||||||
|
yield return env.GetRuntimeIdentifier();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var arch = env.RuntimeArchitecture.ToLowerInvariant();
|
||||||
|
if (env.OperatingSystemVersion.StartsWith("6.1", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
yield return "win7-" + arch;
|
||||||
|
}
|
||||||
|
else if (env.OperatingSystemVersion.StartsWith("6.2", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
yield return "win8-" + arch;
|
||||||
|
yield return "win7-" + arch;
|
||||||
|
}
|
||||||
|
else if (env.OperatingSystemVersion.StartsWith("6.3", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
yield return "win81-" + arch;
|
||||||
|
yield return "win8-" + arch;
|
||||||
|
yield return "win7-" + arch;
|
||||||
|
}
|
||||||
|
else if (env.OperatingSystemVersion.StartsWith("10.0", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
yield return "win10-" + arch;
|
||||||
|
yield return "win81-" + arch;
|
||||||
|
yield return "win8-" + arch;
|
||||||
|
yield return "win7-" + arch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,13 +1,14 @@
|
||||||
{
|
{
|
||||||
"version": "1.0.0-*",
|
"version": "1.0.0-*",
|
||||||
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"NETStandard.Library": "1.0.0-rc2-23704",
|
"NETStandard.Library": "1.0.0-rc2-23704",
|
||||||
"Microsoft.DotNet.ProjectModel": "1.0.0",
|
"Microsoft.DotNet.ProjectModel": "1.0.0",
|
||||||
"System.Reflection.Metadata": "1.1.0"
|
"System.Reflection.Metadata": "1.1.0",
|
||||||
},
|
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16530"
|
||||||
|
},
|
||||||
"frameworks": {
|
|
||||||
"dnxcore50": { }
|
"frameworks": {
|
||||||
}
|
"dnxcore50": { }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,15 +4,17 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using Microsoft.DotNet.Cli.Utils;
|
using Microsoft.DotNet.Cli.Utils;
|
||||||
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
using NuGet.Frameworks;
|
using NuGet.Frameworks;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Cli
|
namespace Microsoft.DotNet.Cli
|
||||||
{
|
{
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
private const string HelpText = @".NET Command Line Interface
|
private const string ProductLongName = ".NET Command Line Tools";
|
||||||
Usage: dotnet [common-options] [command] [arguments]
|
private const string UsageText = @"Usage: dotnet [common-options] [command] [arguments]
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
[command] The command to execute
|
[command] The command to execute
|
||||||
|
@ -20,6 +22,7 @@ Arguments:
|
||||||
|
|
||||||
Common Options (passed before the command):
|
Common Options (passed before the command):
|
||||||
-v|--verbose Enable verbose output
|
-v|--verbose Enable verbose output
|
||||||
|
--version Display .NET CLI Version Info
|
||||||
|
|
||||||
Common Commands:
|
Common Commands:
|
||||||
new Initialize a basic .NET project
|
new Initialize a basic .NET project
|
||||||
|
@ -29,6 +32,13 @@ Common Commands:
|
||||||
run Compiles and immediately executes a .NET project
|
run Compiles and immediately executes a .NET project
|
||||||
repl Launch an interactive session (read, eval, print, loop)
|
repl Launch an interactive session (read, eval, print, loop)
|
||||||
pack Creates a NuGet package";
|
pack Creates a NuGet package";
|
||||||
|
private static readonly string ProductVersion = GetProductVersion();
|
||||||
|
|
||||||
|
private static string GetProductVersion()
|
||||||
|
{
|
||||||
|
var attr = typeof(Program).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
|
||||||
|
return attr?.InformationalVersion;
|
||||||
|
}
|
||||||
|
|
||||||
public static int Main(string[] args)
|
public static int Main(string[] args)
|
||||||
{
|
{
|
||||||
|
@ -45,6 +55,11 @@ Common Commands:
|
||||||
{
|
{
|
||||||
verbose = true;
|
verbose = true;
|
||||||
}
|
}
|
||||||
|
else if(IsArg(args[lastArg], "version"))
|
||||||
|
{
|
||||||
|
PrintVersionInfo();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
else if (IsArg(args[lastArg], "h", "help"))
|
else if (IsArg(args[lastArg], "h", "help"))
|
||||||
{
|
{
|
||||||
PrintHelp();
|
PrintHelp();
|
||||||
|
@ -102,12 +117,38 @@ Common Commands:
|
||||||
|
|
||||||
private static void PrintHelp()
|
private static void PrintHelp()
|
||||||
{
|
{
|
||||||
Reporter.Output.WriteLine(HelpText);
|
PrintVersionHeader();
|
||||||
|
Reporter.Output.WriteLine(UsageText);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void PrintVersionHeader()
|
||||||
|
{
|
||||||
|
var versionString = string.IsNullOrEmpty(ProductVersion) ?
|
||||||
|
string.Empty :
|
||||||
|
$" ({ProductVersion})";
|
||||||
|
Reporter.Output.WriteLine(ProductLongName + versionString);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void PrintVersionInfo()
|
||||||
|
{
|
||||||
|
PrintVersionHeader();
|
||||||
|
|
||||||
|
var runtimeEnvironment = PlatformServices.Default.Runtime;
|
||||||
|
Reporter.Output.WriteLine("Runtime Environment:");
|
||||||
|
Reporter.Output.WriteLine($" OS Name: {runtimeEnvironment.OperatingSystem}");
|
||||||
|
Reporter.Output.WriteLine($" OS Version: {runtimeEnvironment.OperatingSystemVersion}");
|
||||||
|
Reporter.Output.WriteLine($" OS Platform: {runtimeEnvironment.OperatingSystemPlatform}");
|
||||||
|
Reporter.Output.WriteLine($" Runtime Id: {runtimeEnvironment.GetRuntimeIdentifier()}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool IsArg(string candidate, string longName)
|
||||||
|
{
|
||||||
|
return IsArg(candidate, shortName: null, longName: longName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsArg(string candidate, string shortName, string longName)
|
private static bool IsArg(string candidate, string shortName, string longName)
|
||||||
{
|
{
|
||||||
return candidate.Equals("-" + shortName) || candidate.Equals("--" + longName);
|
return (shortName != null && candidate.Equals("-" + shortName)) || (longName != null && candidate.Equals("--" + longName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
using System;
|
// 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.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.DotNet.ProjectModel;
|
using Microsoft.DotNet.ProjectModel;
|
||||||
using Microsoft.DotNet.ProjectModel.Compilation;
|
using Microsoft.DotNet.ProjectModel.Compilation;
|
||||||
using Microsoft.DotNet.ProjectModel.Graph;
|
using Microsoft.DotNet.ProjectModel.Graph;
|
||||||
|
@ -26,8 +27,8 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
|
|
||||||
return new DependencyContext(target.DotNetFrameworkName, runtime,
|
return new DependencyContext(target.DotNetFrameworkName, runtime,
|
||||||
GetCompilationOptions(compilerOptions),
|
GetCompilationOptions(compilerOptions),
|
||||||
GetLibraries(dependencies, dependencyLookup, target, configuration, export => export.CompilationAssemblies),
|
GetLibraries(dependencies, dependencyLookup, target, configuration, runtime: false).Cast<CompilationLibrary>().ToArray(),
|
||||||
GetLibraries(dependencies, dependencyLookup, target, configuration, export => export.RuntimeAssemblies));
|
GetLibraries(dependencies, dependencyLookup, target, configuration, runtime: true).Cast<RuntimeLibrary>().ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CompilationOptions GetCompilationOptions(CommonCompilerOptions compilerOptions)
|
private static CompilationOptions GetCompilationOptions(CommonCompilerOptions compilerOptions)
|
||||||
|
@ -44,19 +45,19 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
compilerOptions.EmitEntryPoint);
|
compilerOptions.EmitEntryPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Library[] GetLibraries(IEnumerable<LibraryExport> dependencies,
|
private static IEnumerable<Library> GetLibraries(IEnumerable<LibraryExport> dependencies,
|
||||||
IDictionary<string, Dependency> dependencyLookup,
|
IDictionary<string, Dependency> dependencyLookup,
|
||||||
NuGetFramework target,
|
NuGetFramework target,
|
||||||
string configuration,
|
string configuration,
|
||||||
Func<LibraryExport, IEnumerable<LibraryAsset>> assemblySelector)
|
bool runtime)
|
||||||
{
|
{
|
||||||
return dependencies.Select(export => GetLibrary(export, target, configuration, assemblySelector(export), dependencyLookup)).ToArray();
|
return dependencies.Select(export => GetLibrary(export, target, configuration, runtime, dependencyLookup));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Library GetLibrary(LibraryExport export,
|
private static Library GetLibrary(LibraryExport export,
|
||||||
NuGetFramework target,
|
NuGetFramework target,
|
||||||
string configuration,
|
string configuration,
|
||||||
IEnumerable<LibraryAsset> libraryAssets,
|
bool runtime,
|
||||||
IDictionary<string, Dependency> dependencyLookup)
|
IDictionary<string, Dependency> dependencyLookup)
|
||||||
{
|
{
|
||||||
var type = export.Library.Identity.Type.Value.ToLowerInvariant();
|
var type = export.Library.Identity.Type.Value.ToLowerInvariant();
|
||||||
|
@ -64,6 +65,8 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
var serviceable = (export.Library as PackageDescription)?.Library.IsServiceable ?? false;
|
var serviceable = (export.Library as PackageDescription)?.Library.IsServiceable ?? false;
|
||||||
var libraryDependencies = new List<Dependency>();
|
var libraryDependencies = new List<Dependency>();
|
||||||
|
|
||||||
|
var libraryAssets = runtime ? export.RuntimeAssemblies : export.CompilationAssemblies;
|
||||||
|
|
||||||
foreach (var libraryDependency in export.Library.Dependencies)
|
foreach (var libraryDependency in export.Library.Dependencies)
|
||||||
{
|
{
|
||||||
Dependency dependency;
|
Dependency dependency;
|
||||||
|
@ -82,6 +85,8 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
.EmitEntryPoint
|
.EmitEntryPoint
|
||||||
.GetValueOrDefault(false);
|
.GetValueOrDefault(false);
|
||||||
|
|
||||||
|
isExe &= target.IsDesktop();
|
||||||
|
|
||||||
assemblies = new[] { export.Library.Identity.Name + (isExe ? ".exe": ".dll") };
|
assemblies = new[] { export.Library.Identity.Name + (isExe ? ".exe": ".dll") };
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -89,15 +94,30 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
assemblies = libraryAssets.Select(libraryAsset => libraryAsset.RelativePath).ToArray();
|
assemblies = libraryAssets.Select(libraryAsset => libraryAsset.RelativePath).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Library(
|
if (runtime)
|
||||||
type,
|
{
|
||||||
export.Library.Identity.Name,
|
return new RuntimeLibrary(
|
||||||
export.Library.Identity.Version.ToString(),
|
type,
|
||||||
export.Library.Hash,
|
export.Library.Identity.Name,
|
||||||
assemblies,
|
export.Library.Identity.Version.ToString(),
|
||||||
libraryDependencies.ToArray(),
|
export.Library.Hash,
|
||||||
serviceable
|
assemblies,
|
||||||
);
|
libraryDependencies.ToArray(),
|
||||||
|
serviceable
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new CompilationLibrary(
|
||||||
|
type,
|
||||||
|
export.Library.Identity.Name,
|
||||||
|
export.Library.Identity.Version.ToString(),
|
||||||
|
export.Library.Hash,
|
||||||
|
assemblies,
|
||||||
|
libraryDependencies.ToArray(),
|
||||||
|
serviceable
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,19 +38,14 @@ namespace Microsoft.DotNet.ProjectModel.Resolution
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version == null || version.Version == assemblyVersion)
|
return new LibraryDescription(
|
||||||
{
|
new LibraryIdentity(libraryRange.Name, new NuGetVersion(assemblyVersion), LibraryType.ReferenceAssembly),
|
||||||
return new LibraryDescription(
|
string.Empty, // Framework assemblies don't have hashes
|
||||||
new LibraryIdentity(libraryRange.Name, new NuGetVersion(assemblyVersion), LibraryType.ReferenceAssembly),
|
path,
|
||||||
string.Empty, // Framework assemblies don't have hashes
|
Enumerable.Empty<LibraryRange>(),
|
||||||
path,
|
targetFramework,
|
||||||
Enumerable.Empty<LibraryRange>(),
|
resolved: true,
|
||||||
targetFramework,
|
compatible: true);
|
||||||
resolved: true,
|
|
||||||
compatible: true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
// 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.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace Microsoft.DotNet.ProjectModel
|
|
||||||
{
|
|
||||||
public static class RuntimeIdentifier
|
|
||||||
{
|
|
||||||
public static string Current { get; } = DetermineRID();
|
|
||||||
|
|
||||||
private static string DetermineRID()
|
|
||||||
{
|
|
||||||
// TODO: Not this, obviously. Do proper RID detection
|
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
||||||
{
|
|
||||||
return "win7-x64";
|
|
||||||
}
|
|
||||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|
||||||
{
|
|
||||||
if(IsCentOS())
|
|
||||||
{
|
|
||||||
return "centos.7-x64";
|
|
||||||
}
|
|
||||||
else if(IsUbuntu())
|
|
||||||
{
|
|
||||||
return "ubuntu.14.04-x64";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// unknown distro. Lets fail fast
|
|
||||||
throw new InvalidOperationException("Current linux distro is not supported.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
|
||||||
{
|
|
||||||
return "osx.10.10-x64";
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new InvalidOperationException("Current operating system is not supported.");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool IsCentOS()
|
|
||||||
{
|
|
||||||
return IsLinuxDistro("centos");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool IsUbuntu()
|
|
||||||
{
|
|
||||||
return IsLinuxDistro("ubuntu");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static bool IsLinuxDistro(string distro)
|
|
||||||
{
|
|
||||||
// HACK - A file which can be found in most linux distros
|
|
||||||
// Did not test in non-en distros
|
|
||||||
const string OSIDFILE = "/etc/os-release";
|
|
||||||
|
|
||||||
if(!File.Exists(OSIDFILE))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return File.ReadAllText(OSIDFILE).ToLower().Contains(distro);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -5,7 +5,7 @@
|
||||||
"emitEntryPoint": true
|
"emitEntryPoint": true
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.DotNet.AppDep":"1.0.3-*"
|
"Microsoft.DotNet.AppDep":"1.0.4-*"
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"dnxcore50": { }
|
"dnxcore50": { }
|
||||||
|
|
|
@ -13,6 +13,7 @@ using Microsoft.DotNet.ProjectModel.Compilation;
|
||||||
using Microsoft.DotNet.ProjectModel.Utilities;
|
using Microsoft.DotNet.ProjectModel.Utilities;
|
||||||
using NuGet.Frameworks;
|
using NuGet.Frameworks;
|
||||||
using Microsoft.Extensions.DependencyModel;
|
using Microsoft.Extensions.DependencyModel;
|
||||||
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Tools.Compiler
|
namespace Microsoft.DotNet.Tools.Compiler
|
||||||
{
|
{
|
||||||
|
@ -250,13 +251,10 @@ namespace Microsoft.DotNet.Tools.Compiler
|
||||||
|
|
||||||
compilerArgs.AddRange(references.Select(r => $"--reference:{r}"));
|
compilerArgs.AddRange(references.Select(r => $"--reference:{r}"));
|
||||||
|
|
||||||
var runtimeContext = ProjectContext.Create(context.ProjectDirectory, context.TargetFramework, new[] { RuntimeIdentifier.Current });
|
|
||||||
var libraryExporter = runtimeContext.CreateExporter(args.ConfigValue);
|
|
||||||
|
|
||||||
if (compilationOptions.PreserveCompilationContext == true)
|
if (compilationOptions.PreserveCompilationContext == true)
|
||||||
{
|
{
|
||||||
var dependencyContext = DependencyContextBuilder.Build(compilationOptions,
|
var dependencyContext = DependencyContextBuilder.Build(compilationOptions,
|
||||||
libraryExporter,
|
exporter,
|
||||||
args.ConfigValue,
|
args.ConfigValue,
|
||||||
context.TargetFramework,
|
context.TargetFramework,
|
||||||
context.RuntimeIdentifier);
|
context.RuntimeIdentifier);
|
||||||
|
@ -347,8 +345,9 @@ namespace Microsoft.DotNet.Tools.Compiler
|
||||||
|
|
||||||
if (success && !args.NoHostValue && compilationOptions.EmitEntryPoint.GetValueOrDefault())
|
if (success && !args.NoHostValue && compilationOptions.EmitEntryPoint.GetValueOrDefault())
|
||||||
{
|
{
|
||||||
var projectContext = ProjectContext.Create(context.ProjectDirectory, context.TargetFramework, new[] { RuntimeIdentifier.Current });
|
var rids = PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers();
|
||||||
projectContext
|
var runtimeContext = ProjectContext.Create(context.ProjectDirectory, context.TargetFramework, rids);
|
||||||
|
runtimeContext
|
||||||
.MakeCompilationOutputRunnable(outputPath, args.ConfigValue);
|
.MakeCompilationOutputRunnable(outputPath, args.ConfigValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,31 +1,33 @@
|
||||||
{
|
{
|
||||||
"name": "dotnet-compile",
|
"name": "dotnet-compile",
|
||||||
"version": "1.0.0-*",
|
"version": "1.0.0-*",
|
||||||
"compilationOptions": {
|
"compilationOptions": {
|
||||||
"emitEntryPoint": true
|
"emitEntryPoint": true
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"NETStandard.Library": "1.0.0-rc2-23704",
|
|
||||||
"System.Reflection.Metadata": "1.1.0",
|
|
||||||
"Microsoft.DotNet.ProjectModel": "1.0.0-*",
|
|
||||||
"Microsoft.DotNet.Compiler.Common": "1.0.0-*",
|
|
||||||
"Microsoft.DotNet.Cli.Utils": "1.0.0-*",
|
|
||||||
"Microsoft.Extensions.CommandLineUtils.Sources": {
|
|
||||||
"type": "build",
|
|
||||||
"version": "1.0.0-*"
|
|
||||||
},
|
},
|
||||||
"Microsoft.Extensions.DependencyModel": {
|
"dependencies": {
|
||||||
"type": "build",
|
"NETStandard.Library": "1.0.0-rc2-23704",
|
||||||
"version": "1.0.0-*"
|
"System.Reflection.Metadata": "1.1.0",
|
||||||
|
"Microsoft.DotNet.ProjectModel": "1.0.0-*",
|
||||||
|
"Microsoft.DotNet.Compiler.Common": "1.0.0-*",
|
||||||
|
"Microsoft.DotNet.Cli.Utils": "1.0.0-*",
|
||||||
|
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-*",
|
||||||
|
|
||||||
|
"Microsoft.Extensions.CommandLineUtils.Sources": {
|
||||||
|
"type": "build",
|
||||||
|
"version": "1.0.0-*"
|
||||||
|
},
|
||||||
|
"Microsoft.Extensions.DependencyModel": {
|
||||||
|
"type": "build",
|
||||||
|
"version": "1.0.0-*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"dnxcore50": { }
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"postcompile": [
|
||||||
|
"../../scripts/build/place-binary \"%compile:OutputDir%/%project:Name%.dll\"",
|
||||||
|
"../../scripts/build/place-binary \"%compile:OutputDir%/%project:Name%.pdb\""
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"dnxcore50": { }
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"postcompile": [
|
|
||||||
"../../scripts/build/place-binary \"%compile:OutputDir%/%project:Name%.dll\"",
|
|
||||||
"../../scripts/build/place-binary \"%compile:OutputDir%/%project:Name%.pdb\""
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ using Microsoft.DotNet.Cli.Utils;
|
||||||
using Microsoft.DotNet.ProjectModel;
|
using Microsoft.DotNet.ProjectModel;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Tools.Publish
|
namespace Microsoft.DotNet.Tools.Publish
|
||||||
{
|
{
|
||||||
|
@ -33,8 +34,7 @@ namespace Microsoft.DotNet.Tools.Publish
|
||||||
var publish = new PublishCommand();
|
var publish = new PublishCommand();
|
||||||
|
|
||||||
publish.Framework = framework.Value();
|
publish.Framework = framework.Value();
|
||||||
// TODO: Remove default once xplat publish is enabled.
|
publish.Runtime = runtime.Value();
|
||||||
publish.Runtime = runtime.Value() ?? RuntimeIdentifier.Current;
|
|
||||||
publish.OutputPath = output.Value();
|
publish.OutputPath = output.Value();
|
||||||
publish.Configuration = configuration.Value() ?? Constants.DefaultConfiguration;
|
publish.Configuration = configuration.Value() ?? Constants.DefaultConfiguration;
|
||||||
publish.NativeSubdirectories = nativeSubdirectories.HasValue();
|
publish.NativeSubdirectories = nativeSubdirectories.HasValue();
|
||||||
|
|
|
@ -9,6 +9,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Tools.Publish
|
namespace Microsoft.DotNet.Tools.Publish
|
||||||
{
|
{
|
||||||
|
@ -39,10 +40,8 @@ namespace Microsoft.DotNet.Tools.Publish
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectContexts = ProjectContext.CreateContextForEachTarget(ProjectPath);
|
ProjectContexts = SelectContexts(ProjectPath, NugetFramework, Runtime);
|
||||||
ProjectContexts = GetMatchingProjectContexts(ProjectContexts, NugetFramework, Runtime);
|
if (!ProjectContexts.Any())
|
||||||
|
|
||||||
if (ProjectContexts.Count() == 0)
|
|
||||||
{
|
{
|
||||||
string errMsg = $"'{ProjectPath}' cannot be published for '{Framework ?? "<no framework provided>"}' '{Runtime ?? "<no runtime provided>"}'";
|
string errMsg = $"'{ProjectPath}' cannot be published for '{Framework ?? "<no framework provided>"}' '{Runtime ?? "<no runtime provided>"}'";
|
||||||
Reporter.Output.WriteLine(errMsg.Red());
|
Reporter.Output.WriteLine(errMsg.Red());
|
||||||
|
@ -67,29 +66,6 @@ namespace Microsoft.DotNet.Tools.Publish
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Return the matching framework/runtime ProjectContext.
|
|
||||||
/// If 'nugetframework' or 'runtime' is null or empty then it matches with any.
|
|
||||||
/// </summary>
|
|
||||||
private static IEnumerable<ProjectContext> GetMatchingProjectContexts(IEnumerable<ProjectContext> contexts, NuGetFramework framework, string runtimeIdentifier)
|
|
||||||
{
|
|
||||||
foreach (var context in contexts)
|
|
||||||
{
|
|
||||||
if (context.TargetFramework == null || string.IsNullOrEmpty(context.RuntimeIdentifier))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(runtimeIdentifier) || runtimeIdentifier.Equals(context.RuntimeIdentifier))
|
|
||||||
{
|
|
||||||
if (framework == null || framework.Equals(context.TargetFramework))
|
|
||||||
{
|
|
||||||
yield return context;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Publish the project for given 'framework (ex - dnxcore50)' and 'runtimeID (ex - win7-x64)'
|
/// Publish the project for given 'framework (ex - dnxcore50)' and 'runtimeID (ex - win7-x64)'
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -228,5 +204,51 @@ namespace Microsoft.DotNet.Tools.Publish
|
||||||
|
|
||||||
return candidate;
|
return candidate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static IEnumerable<ProjectContext> SelectContexts(string projectPath, NuGetFramework framework, string runtime)
|
||||||
|
{
|
||||||
|
var allContexts = ProjectContext.CreateContextForEachTarget(projectPath);
|
||||||
|
if (string.IsNullOrEmpty(runtime))
|
||||||
|
{
|
||||||
|
// Nothing was specified, so figure out what the candidate runtime identifiers are and try each of them
|
||||||
|
// Temporary until #619 is resolved
|
||||||
|
foreach (var candidate in PlatformServices.Default.Runtime.GetAllCandidateRuntimeIdentifiers())
|
||||||
|
{
|
||||||
|
var contexts = GetMatchingProjectContexts(allContexts, framework, candidate);
|
||||||
|
if (contexts.Any())
|
||||||
|
{
|
||||||
|
return contexts;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Enumerable.Empty<ProjectContext>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return GetMatchingProjectContexts(allContexts, framework, runtime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return the matching framework/runtime ProjectContext.
|
||||||
|
/// If 'framework' or 'runtimeIdentifier' is null or empty then it matches with any.
|
||||||
|
/// </summary>
|
||||||
|
private static IEnumerable<ProjectContext> GetMatchingProjectContexts(IEnumerable<ProjectContext> contexts, NuGetFramework framework, string runtimeIdentifier)
|
||||||
|
{
|
||||||
|
foreach (var context in contexts)
|
||||||
|
{
|
||||||
|
if (context.TargetFramework == null || string.IsNullOrEmpty(context.RuntimeIdentifier))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(runtimeIdentifier) || string.Equals(runtimeIdentifier, context.RuntimeIdentifier, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
if (framework == null || framework.Equals(context.TargetFramework))
|
||||||
|
{
|
||||||
|
yield return context;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ namespace Microsoft.DotNet.Tools.Repl.Csi
|
||||||
private static int Run(string script, string targetFramework, string buildConfiguration, bool preserveTemporaryOutput, string projectPath, IEnumerable<string> remainingArguments)
|
private static int Run(string script, string targetFramework, string buildConfiguration, bool preserveTemporaryOutput, string projectPath, IEnumerable<string> remainingArguments)
|
||||||
{
|
{
|
||||||
var corerun = Path.Combine(AppContext.BaseDirectory, Constants.HostExecutableName);
|
var corerun = Path.Combine(AppContext.BaseDirectory, Constants.HostExecutableName);
|
||||||
var csiExe = Path.Combine(AppContext.BaseDirectory, "csi.exe");
|
var csiExe = Path.Combine(AppContext.BaseDirectory, $"csi{Constants.ExeSuffix}");
|
||||||
var csiArgs = new StringBuilder();
|
var csiArgs = new StringBuilder();
|
||||||
|
|
||||||
if (buildConfiguration == null)
|
if (buildConfiguration == null)
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
// 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.Reflection;
|
||||||
|
|
||||||
|
namespace Microsoft.Extensions.DependencyModel
|
||||||
|
{
|
||||||
|
public class CompilationLibrary : Library
|
||||||
|
{
|
||||||
|
private static Lazy<Assembly> _entryAssembly = new Lazy<Assembly>(GetEntryAssembly);
|
||||||
|
|
||||||
|
public CompilationLibrary(string libraryType, string packageName, string version, string hash, string[] assemblies, Dependency[] dependencies, bool serviceable)
|
||||||
|
: base(libraryType, packageName, version, hash, dependencies, serviceable)
|
||||||
|
{
|
||||||
|
Assemblies = assemblies;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IReadOnlyList<string> Assemblies { get; }
|
||||||
|
|
||||||
|
public IEnumerable<string> ResolveReferencePaths()
|
||||||
|
{
|
||||||
|
var entryAssembly = _entryAssembly.Value;
|
||||||
|
var entryAssemblyName = entryAssembly.GetName().Name;
|
||||||
|
var basePath = GetRefsLocation();
|
||||||
|
|
||||||
|
foreach (var assembly in Assemblies)
|
||||||
|
{
|
||||||
|
if (Path.GetFileNameWithoutExtension(assembly) == entryAssemblyName)
|
||||||
|
{
|
||||||
|
yield return entryAssembly.Location;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var fullName = Path.Combine(basePath, Path.GetFileName(assembly));
|
||||||
|
if (!File.Exists(fullName))
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException($"Can not resolve assembly {assembly} location");
|
||||||
|
}
|
||||||
|
yield return fullName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static Assembly GetEntryAssembly()
|
||||||
|
{
|
||||||
|
var entryAssembly = (Assembly)typeof(Assembly).GetTypeInfo().GetDeclaredMethod("GetEntryAssembly").Invoke(null, null);
|
||||||
|
if (entryAssembly == null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Could not determine entry assembly");
|
||||||
|
}
|
||||||
|
return entryAssembly;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetRefsLocation()
|
||||||
|
{
|
||||||
|
return Path.Combine(Path.GetDirectoryName(_entryAssembly.Value.Location), "refs");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,7 @@
|
||||||
using System.Collections.Generic;
|
// 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.Extensions.DependencyModel
|
namespace Microsoft.Extensions.DependencyModel
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
|
|
||||||
private static Lazy<DependencyContext> _defaultContext = new Lazy<DependencyContext>(LoadDefault);
|
private static Lazy<DependencyContext> _defaultContext = new Lazy<DependencyContext>(LoadDefault);
|
||||||
|
|
||||||
public DependencyContext(string target, string runtime, CompilationOptions compilationOptions, Library[] compileLibraries, Library[] runtimeLibraries)
|
public DependencyContext(string target, string runtime, CompilationOptions compilationOptions, CompilationLibrary[] compileLibraries, RuntimeLibrary[] runtimeLibraries)
|
||||||
{
|
{
|
||||||
Target = target;
|
Target = target;
|
||||||
Runtime = runtime;
|
Runtime = runtime;
|
||||||
|
@ -31,9 +31,9 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
|
|
||||||
public CompilationOptions CompilationOptions { get; }
|
public CompilationOptions CompilationOptions { get; }
|
||||||
|
|
||||||
public IReadOnlyList<Library> CompileLibraries { get; }
|
public IReadOnlyList<CompilationLibrary> CompileLibraries { get; }
|
||||||
|
|
||||||
public IReadOnlyList<Library> RuntimeLibraries { get; }
|
public IReadOnlyList<RuntimeLibrary> RuntimeLibraries { get; }
|
||||||
|
|
||||||
private static DependencyContext LoadDefault()
|
private static DependencyContext LoadDefault()
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,8 +38,8 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
compileTargetProperty.Key,
|
compileTargetProperty.Key,
|
||||||
runtimeTargetProperty.Key.Substring(compileTargetProperty.Key.Length + 1),
|
runtimeTargetProperty.Key.Substring(compileTargetProperty.Key.Length + 1),
|
||||||
ReadCompilationOptions((JObject)root[DependencyContextStrings.CompilationOptionsPropertName]),
|
ReadCompilationOptions((JObject)root[DependencyContextStrings.CompilationOptionsPropertName]),
|
||||||
ReadLibraries((JObject)runtimeTargetProperty.Value, true, libraryStubs),
|
ReadLibraries((JObject)compileTargetProperty.Value, false, libraryStubs).Cast<CompilationLibrary>().ToArray(),
|
||||||
ReadLibraries((JObject)compileTargetProperty.Value, false, libraryStubs)
|
ReadLibraries((JObject)runtimeTargetProperty.Value, true, libraryStubs).Cast<RuntimeLibrary>().ToArray()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,12 +59,12 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Library[] ReadLibraries(JObject librariesObject, bool runtime, Dictionary<string, DependencyContextReader.LibraryStub> libraryStubs)
|
private IEnumerable<Library> ReadLibraries(JObject librariesObject, bool runtime, Dictionary<string, LibraryStub> libraryStubs)
|
||||||
{
|
{
|
||||||
return librariesObject.Properties().Select(property => ReadLibrary(property, runtime, libraryStubs)).ToArray();
|
return librariesObject.Properties().Select(property => ReadLibrary(property, runtime, libraryStubs));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Library ReadLibrary(JProperty property, bool runtime, Dictionary<string, DependencyContextReader.LibraryStub> libraryStubs)
|
private Library ReadLibrary(JProperty property, bool runtime, Dictionary<string, LibraryStub> libraryStubs)
|
||||||
{
|
{
|
||||||
var nameWithVersion = property.Name;
|
var nameWithVersion = property.Name;
|
||||||
LibraryStub stub;
|
LibraryStub stub;
|
||||||
|
@ -84,7 +84,14 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
var dependencies = ReadDependencies(libraryObject);
|
var dependencies = ReadDependencies(libraryObject);
|
||||||
var assemblies = ReadAssemblies(libraryObject, runtime);
|
var assemblies = ReadAssemblies(libraryObject, runtime);
|
||||||
|
|
||||||
return new Library(stub.Type, name, version, stub.Hash, assemblies, dependencies, stub.Serviceable);
|
if (runtime)
|
||||||
|
{
|
||||||
|
return new RuntimeLibrary(stub.Type, name, version, stub.Hash, assemblies, dependencies, stub.Serviceable);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new CompilationLibrary(stub.Type, name, version, stub.Hash, assemblies, dependencies, stub.Serviceable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string[] ReadAssemblies(JObject libraryObject, bool runtime)
|
private static string[] ReadAssemblies(JObject libraryObject, bool runtime)
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
// 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.Extensions.DependencyModel
|
namespace Microsoft.Extensions.DependencyModel
|
||||||
{
|
{
|
||||||
internal class DependencyContextStrings
|
internal class DependencyContextStrings
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
// 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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -78,25 +81,49 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
private JObject WriteTargets(DependencyContext context)
|
private JObject WriteTargets(DependencyContext context)
|
||||||
{
|
{
|
||||||
return new JObject(
|
return new JObject(
|
||||||
new JProperty(context.Target, WriteTarget(context.CompileLibraries, false)),
|
new JProperty(context.Target, WriteTarget(context.CompileLibraries)),
|
||||||
new JProperty(context.Target + DependencyContextStrings.VersionSeperator + context.Runtime,
|
new JProperty(context.Target + DependencyContextStrings.VersionSeperator + context.Runtime,
|
||||||
WriteTarget(context.RuntimeLibraries, true))
|
WriteTarget(context.RuntimeLibraries))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private JObject WriteTarget(IReadOnlyList<Library> libraries, bool runtime)
|
private JObject WriteTarget(IReadOnlyList<Library> libraries)
|
||||||
{
|
{
|
||||||
return new JObject(
|
return new JObject(
|
||||||
libraries.Select(library =>
|
libraries.Select(library =>
|
||||||
new JProperty(library.PackageName + DependencyContextStrings.VersionSeperator + library.Version, WriteTargetLibrary(library, runtime))));
|
new JProperty(library.PackageName + DependencyContextStrings.VersionSeperator + library.Version, WriteTargetLibrary(library))));
|
||||||
}
|
}
|
||||||
|
|
||||||
private JObject WriteTargetLibrary(Library library, bool runtime)
|
private JObject WriteTargetLibrary(Library library)
|
||||||
{
|
{
|
||||||
|
string propertyName;
|
||||||
|
string[] assemblies;
|
||||||
|
|
||||||
|
var runtimeLibrary = library as RuntimeLibrary;
|
||||||
|
if (runtimeLibrary != null)
|
||||||
|
{
|
||||||
|
propertyName = DependencyContextStrings.RunTimeAssembliesKey;
|
||||||
|
assemblies = runtimeLibrary.Assemblies.Select(assembly => assembly.Path).ToArray();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var compilationLibrary = library as CompilationLibrary;
|
||||||
|
if (compilationLibrary != null)
|
||||||
|
{
|
||||||
|
propertyName = DependencyContextStrings.CompileTimeAssembliesKey;
|
||||||
|
assemblies = compilationLibrary.Assemblies.ToArray();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new NotSupportedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return new JObject(
|
return new JObject(
|
||||||
new JProperty(DependencyContextStrings.DependenciesPropertyName, WriteDependencies(library.Dependencies)),
|
new JProperty(DependencyContextStrings.DependenciesPropertyName, WriteDependencies(library.Dependencies)),
|
||||||
new JProperty(runtime ? DependencyContextStrings.RunTimeAssembliesKey : DependencyContextStrings.CompileTimeAssembliesKey,
|
new JProperty(propertyName,
|
||||||
WriteAssemblies(library.Assemblies))
|
WriteAssemblies(assemblies))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +142,7 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
private JObject WriteLibraries(DependencyContext context)
|
private JObject WriteLibraries(DependencyContext context)
|
||||||
{
|
{
|
||||||
var allLibraries =
|
var allLibraries =
|
||||||
context.RuntimeLibraries.Concat(context.CompileLibraries)
|
context.RuntimeLibraries.Cast<Library>().Concat(context.CompileLibraries)
|
||||||
.GroupBy(library => library.PackageName + DependencyContextStrings.VersionSeperator + library.Version);
|
.GroupBy(library => library.PackageName + DependencyContextStrings.VersionSeperator + library.Version);
|
||||||
|
|
||||||
return new JObject(allLibraries.Select(libraries=> new JProperty(libraries.Key, WriteLibrary(libraries.First()))));
|
return new JObject(allLibraries.Select(libraries=> new JProperty(libraries.Key, WriteLibrary(libraries.First()))));
|
||||||
|
|
|
@ -1,20 +1,18 @@
|
||||||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
// 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.
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Microsoft.Extensions.DependencyModel
|
namespace Microsoft.Extensions.DependencyModel
|
||||||
{
|
{
|
||||||
public struct Library
|
public class Library
|
||||||
{
|
{
|
||||||
public Library(string libraryType, string packageName, string version, string hash, string[] assemblies, Dependency[] dependencies, bool serviceable)
|
public Library(string libraryType, string packageName, string version, string hash, Dependency[] dependencies, bool serviceable)
|
||||||
{
|
{
|
||||||
LibraryType = libraryType;
|
LibraryType = libraryType;
|
||||||
PackageName = packageName;
|
PackageName = packageName;
|
||||||
Version = version;
|
Version = version;
|
||||||
Hash = hash;
|
Hash = hash;
|
||||||
Assemblies = assemblies;
|
|
||||||
Dependencies = dependencies;
|
Dependencies = dependencies;
|
||||||
Serviceable = serviceable;
|
Serviceable = serviceable;
|
||||||
}
|
}
|
||||||
|
@ -27,8 +25,6 @@ namespace Microsoft.Extensions.DependencyModel
|
||||||
|
|
||||||
public string Hash { get; }
|
public string Hash { get; }
|
||||||
|
|
||||||
public IReadOnlyList<string> Assemblies { get; }
|
|
||||||
|
|
||||||
public IReadOnlyList<Dependency> Dependencies { get; }
|
public IReadOnlyList<Dependency> Dependencies { get; }
|
||||||
|
|
||||||
public bool Serviceable { get; }
|
public bool Serviceable { get; }
|
||||||
|
|
26
src/Microsoft.Extensions.DependencyModel/RuntimeAssembly.cs
Normal file
26
src/Microsoft.Extensions.DependencyModel/RuntimeAssembly.cs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// 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.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace Microsoft.Extensions.DependencyModel
|
||||||
|
{
|
||||||
|
public class RuntimeAssembly
|
||||||
|
{
|
||||||
|
public RuntimeAssembly(string path)
|
||||||
|
: this(new AssemblyName(System.IO.Path.GetFileNameWithoutExtension(path)), path)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public RuntimeAssembly(AssemblyName name, string path)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
Path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AssemblyName Name { get; }
|
||||||
|
|
||||||
|
public string Path { get; }
|
||||||
|
}
|
||||||
|
}
|
19
src/Microsoft.Extensions.DependencyModel/RuntimeLibrary.cs
Normal file
19
src/Microsoft.Extensions.DependencyModel/RuntimeLibrary.cs
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
// 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.Linq;
|
||||||
|
|
||||||
|
namespace Microsoft.Extensions.DependencyModel
|
||||||
|
{
|
||||||
|
public class RuntimeLibrary : Library
|
||||||
|
{
|
||||||
|
public RuntimeLibrary(string libraryType, string packageName, string version, string hash, string[] assemblies, Dependency[] dependencies, bool serviceable)
|
||||||
|
: base(libraryType, packageName, version, hash, dependencies, serviceable)
|
||||||
|
{
|
||||||
|
Assemblies = assemblies.Select(path => new RuntimeAssembly(path)).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IReadOnlyList<RuntimeAssembly> Assemblies { get; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,8 +16,10 @@
|
||||||
"net451": { },
|
"net451": { },
|
||||||
"dotnet5.4": {
|
"dotnet5.4": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"System.IO.FileSystem": "4.0.1-rc2-23616",
|
||||||
"System.Linq": "4.0.1-rc2-23616",
|
"System.Linq": "4.0.1-rc2-23616",
|
||||||
"System.Runtime": "4.0.21-rc2-23616",
|
"System.Runtime": "4.0.21-rc2-23616",
|
||||||
|
"System.Reflection": "4.1.0-rc2-23616",
|
||||||
"System.Dynamic.Runtime": "4.0.11-rc2-23616"
|
"System.Dynamic.Runtime": "4.0.11-rc2-23616"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,11 +12,14 @@ using Microsoft.Dnx.Runtime.Common.CommandLine;
|
||||||
using Microsoft.DotNet.ProjectModel;
|
using Microsoft.DotNet.ProjectModel;
|
||||||
using Microsoft.DotNet.ProjectModel.Graph;
|
using Microsoft.DotNet.ProjectModel.Graph;
|
||||||
using NuGet.Frameworks;
|
using NuGet.Frameworks;
|
||||||
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Tools.Restore
|
namespace Microsoft.DotNet.Tools.Restore
|
||||||
{
|
{
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
|
private static readonly string DefaultRid = PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier();
|
||||||
|
|
||||||
public static int Main(string[] args)
|
public static int Main(string[] args)
|
||||||
{
|
{
|
||||||
DebugHelper.HandleDebugSwitch(ref args);
|
DebugHelper.HandleDebugSwitch(ref args);
|
||||||
|
@ -130,7 +133,7 @@ namespace Microsoft.DotNet.Tools.Restore
|
||||||
private static void CreateDepsInPackageCache(LibraryRange toolLibrary, string projectPath)
|
private static void CreateDepsInPackageCache(LibraryRange toolLibrary, string projectPath)
|
||||||
{
|
{
|
||||||
var context = ProjectContext.Create(projectPath,
|
var context = ProjectContext.Create(projectPath,
|
||||||
FrameworkConstants.CommonFrameworks.DnxCore50, new[] { RuntimeIdentifier.Current });
|
FrameworkConstants.CommonFrameworks.DnxCore50, new[] { DefaultRid });
|
||||||
|
|
||||||
var toolDescription = context.LibraryManager.GetLibraries()
|
var toolDescription = context.LibraryManager.GetLibraries()
|
||||||
.Select(l => l as PackageDescription)
|
.Select(l => l as PackageDescription)
|
||||||
|
@ -155,7 +158,7 @@ namespace Microsoft.DotNet.Tools.Restore
|
||||||
var projectPath = Path.Combine(tempPath, Project.FileName);
|
var projectPath = Path.Combine(tempPath, Project.FileName);
|
||||||
File.WriteAllText(projectPath, GenerateProjectJsonContents(new[] {"dnxcore50"}));
|
File.WriteAllText(projectPath, GenerateProjectJsonContents(new[] {"dnxcore50"}));
|
||||||
Dnx.RunPackageInstall(tooldep, projectPath, args);
|
Dnx.RunPackageInstall(tooldep, projectPath, args);
|
||||||
Dnx.RunRestore(new [] { $"\"{projectPath}\"", "--runtime", $"{RuntimeIdentifier.Current}"}.Concat(args));
|
Dnx.RunRestore(new [] { $"\"{projectPath}\"", "--runtime", $"{DefaultRid}"}.Concat(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GenerateProjectJsonContents(IEnumerable<string> frameworks = null)
|
private static string GenerateProjectJsonContents(IEnumerable<string> frameworks = null)
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="14.0.24720" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.24720</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>386d412c-003c-47b1-8258-0e35865cb7c4</ProjectGuid>
|
<ProjectGuid>65741cb1-8aee-4c66-8198-10a7ea0e4258</ProjectGuid>
|
||||||
<RootNamespace>E2ETest</RootNamespace>
|
<RootNamespace>E2E</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>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'" />
|
|
||||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||||
</Project>
|
</Project>
|
|
@ -10,6 +10,7 @@ using Xunit;
|
||||||
using Microsoft.DotNet.Cli.Utils;
|
using Microsoft.DotNet.Cli.Utils;
|
||||||
using Microsoft.DotNet.ProjectModel;
|
using Microsoft.DotNet.ProjectModel;
|
||||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||||
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Tests.EndToEnd
|
namespace Microsoft.DotNet.Tests.EndToEnd
|
||||||
{
|
{
|
||||||
|
@ -33,7 +34,7 @@ namespace Microsoft.DotNet.Tests.EndToEnd
|
||||||
{
|
{
|
||||||
TestSetup();
|
TestSetup();
|
||||||
|
|
||||||
Rid = RuntimeIdentifier.Current;
|
Rid = PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
|
|
||||||
"Microsoft.DotNet.ProjectModel": { "target": "project" },
|
"Microsoft.DotNet.ProjectModel": { "target": "project" },
|
||||||
"Microsoft.DotNet.Cli.Utils": { "target": "project" },
|
"Microsoft.DotNet.Cli.Utils": { "target": "project" },
|
||||||
|
|
||||||
"Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" }
|
"Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" }
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Microsoft.DotNet.ProjectModel;
|
using Microsoft.DotNet.ProjectModel;
|
||||||
using Microsoft.DotNet.ProjectModel.Loader;
|
using Microsoft.DotNet.ProjectModel.Loader;
|
||||||
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
using NuGet.Frameworks;
|
using NuGet.Frameworks;
|
||||||
|
|
||||||
namespace LoadContextTest
|
namespace LoadContextTest
|
||||||
|
@ -23,7 +24,8 @@ namespace LoadContextTest
|
||||||
|
|
||||||
// Load the project load context
|
// Load the project load context
|
||||||
Console.WriteLine($"Creating load context for {project}");
|
Console.WriteLine($"Creating load context for {project}");
|
||||||
var context = ProjectContext.Create(project, FrameworkConstants.CommonFrameworks.DnxCore50, new[] { RuntimeIdentifier.Current });
|
var rid = PlatformServices.Default.Runtime.GetRuntimeIdentifier();
|
||||||
|
var context = ProjectContext.Create(project, FrameworkConstants.CommonFrameworks.DnxCore50, new[] { rid });
|
||||||
var loadContext = context.CreateLoadContext();
|
var loadContext = context.CreateLoadContext();
|
||||||
|
|
||||||
// Load the project assembly
|
// Load the project assembly
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
"System.Linq": "4.0.1-beta-23516",
|
"System.Linq": "4.0.1-beta-23516",
|
||||||
"System.Threading": "4.0.11-beta-23516",
|
"System.Threading": "4.0.11-beta-23516",
|
||||||
|
|
||||||
|
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-*",
|
||||||
|
|
||||||
"Microsoft.DotNet.ProjectModel.Loader": { "target": "project" }
|
"Microsoft.DotNet.ProjectModel.Loader": { "target": "project" }
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ using Xunit;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.DotNet.ProjectModel;
|
using Microsoft.DotNet.ProjectModel;
|
||||||
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Tools.Publish.Tests
|
namespace Microsoft.DotNet.Tools.Publish.Tests
|
||||||
{
|
{
|
||||||
|
@ -24,11 +25,11 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
|
||||||
{
|
{
|
||||||
new object[] { "", "", "", "" },
|
new object[] { "", "", "", "" },
|
||||||
new object[] { "dnxcore50", "", "", "" },
|
new object[] { "dnxcore50", "", "", "" },
|
||||||
new object[] { "", RuntimeIdentifier.Current, "", "" },
|
new object[] { "", PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier(), "", "" },
|
||||||
new object[] { "", "", "Release", "" },
|
new object[] { "", "", "Release", "" },
|
||||||
new object[] { "", "", "", "some/dir"},
|
new object[] { "", "", "", "some/dir"},
|
||||||
//new object[] { "", "", "", "\"some/dir/with spaces\"" }, // issue - https://github.com/dotnet/cli/issues/525
|
//new object[] { "", "", "", "\"some/dir/with spaces\"" }, // issue - https://github.com/dotnet/cli/issues/525
|
||||||
new object[] { "dnxcore50", RuntimeIdentifier.Current, "Debug", "some/dir" },
|
new object[] { "dnxcore50", PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier(), "Debug", "some/dir" },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,11 @@
|
||||||
"xunit.netcore.extensions": "1.0.0-prerelease-*",
|
"xunit.netcore.extensions": "1.0.0-prerelease-*",
|
||||||
"xunit.runner.utility": "2.1.0",
|
"xunit.runner.utility": "2.1.0",
|
||||||
|
|
||||||
"Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" }
|
"Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" },
|
||||||
|
"Microsoft.DotNet.Cli.Utils": {
|
||||||
|
"target": "project",
|
||||||
|
"type": "build"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
|
|
|
@ -10,6 +10,7 @@ using System.Threading.Tasks;
|
||||||
using Microsoft.DotNet.Cli.Utils;
|
using Microsoft.DotNet.Cli.Utils;
|
||||||
using Microsoft.DotNet.ProjectModel;
|
using Microsoft.DotNet.ProjectModel;
|
||||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||||
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
|
||||||
namespace Microsoft.DotNet.Tools.Test.Utilities
|
namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
{
|
{
|
||||||
|
@ -55,7 +56,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||||
string config = string.IsNullOrEmpty(_config) ? "Debug" : _config;
|
string config = string.IsNullOrEmpty(_config) ? "Debug" : _config;
|
||||||
string framework = string.IsNullOrEmpty(_framework) ?
|
string framework = string.IsNullOrEmpty(_framework) ?
|
||||||
_project.GetTargetFrameworks().First().FrameworkName.GetShortFolderName() : _framework;
|
_project.GetTargetFrameworks().First().FrameworkName.GetShortFolderName() : _framework;
|
||||||
string runtime = string.IsNullOrEmpty(_runtime) ? RuntimeIdentifier.Current : _runtime;
|
string runtime = string.IsNullOrEmpty(_runtime) ? PlatformServices.Default.Runtime.GetLegacyRestoreRuntimeIdentifier() : _runtime;
|
||||||
string output = Path.Combine("bin", config, framework, runtime);
|
string output = Path.Combine("bin", config, framework, runtime);
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue