Merge branch 'rel/1.0.0' of https://github.com/dotnet/cli into test-fx
This commit is contained in:
commit
f86952cf1d
72 changed files with 569 additions and 270 deletions
|
@ -20,8 +20,8 @@ Installers
|
|||
|
||||
| |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-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) |
|
||||
|**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) |
|
||||
|
||||
Interested in .NET Core + ASP.NET 5 RC bits?
|
||||
----------------------------------------
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"dependencies": {
|
||||
"TestLibrary": "1.0.0-*",
|
||||
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"additionalArguments": [ "-highentropyva+" ]
|
||||
},
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"content": "testcontentfile.txt",
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"compilationOptions": {
|
||||
"emitEntryPoint": true
|
||||
"emitEntryPoint": true,
|
||||
"preserveCompilationContext": true
|
||||
},
|
||||
|
||||
"dependencies": {
|
||||
"TestLibrary": { "target":"project"},
|
||||
"TestLibrary": { "target":"project", "version":"1.0.0-*" },
|
||||
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -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 0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"compilationOptions": {
|
||||
"emitEntryPoint": true
|
||||
},
|
||||
|
||||
"dependencies": {
|
||||
"TestLibraryWithAppDependency": { "target":"project", "version":"1.0.0-*" },
|
||||
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"dnxcore50": { }
|
||||
},
|
||||
}
|
|
@ -10,7 +10,7 @@
|
|||
"dnxcore50": {
|
||||
"imports" : "portable-net45+wp80+win8",
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"dnxcore50": {
|
||||
"imports" : "portable-net45+wp80+win8",
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||
"System.Runtime.Analyzers": { "version": "1.1.0", "type": "build" }
|
||||
},
|
||||
|
||||
|
|
|
@ -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 TestLibrary2
|
||||
{
|
||||
public static class Helper
|
||||
{
|
||||
/// <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>
|
||||
public static string GetMessage()
|
||||
{
|
||||
return "This string came from the test library!";
|
||||
}
|
||||
|
||||
public static void SayHi()
|
||||
{
|
||||
Console.WriteLine("Hello there!");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"dependencies": {
|
||||
"TestApp": { "target":"project", "version":"1.0.0-*" },
|
||||
|
||||
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"dnxcore50": { }
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
"L11": "1.0.0-*",
|
||||
"L12": "1.0.0-*",
|
||||
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"L12": "1.0.0-*",
|
||||
"L21": "1.0.0-*",
|
||||
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"dependencies": {
|
||||
"L22": "1.0.0-*",
|
||||
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"version": "1.0.0-*",
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"version": "1.0.0-*",
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -246,6 +246,6 @@ Write-Host -ForegroundColor Green "Successfully created dotnet bundle - $DotnetB
|
|||
_ $RepoRoot\test\Installer\testmsi.ps1 @("$DotnetMSIOutput")
|
||||
|
||||
$PublishScript = Join-Path $PSScriptRoot "..\..\scripts\publish\publish.ps1"
|
||||
& $PublishScript -file $DotnetMSIOutput
|
||||
& $PublishScript -file $DotnetBundleOutput
|
||||
|
||||
exit $LastExitCode
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
@echo off
|
||||
REM Turn echo off off so we can echo with echo and the echoing
|
||||
REM (But seriously, this script has weird hangs and crashes sometimes so we want to know exactly which commands are failing)
|
||||
REM @echo off
|
||||
|
||||
REM Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
REM Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
@ -13,7 +15,7 @@ set BIN_DIR=%CD%\bin
|
|||
popd
|
||||
|
||||
REM Replace with a robust method for finding the right crossgen.exe
|
||||
set CROSSGEN_UTIL=%NUGET_PACKAGES%\runtime.win7-x64.Microsoft.NETCore.Runtime.CoreCLR\1.0.1-rc2-23808\tools\crossgen.exe
|
||||
set CROSSGEN_UTIL=%NUGET_PACKAGES%\runtime.win7-x64.Microsoft.NETCore.Runtime.CoreCLR\1.0.1-rc2-23811\tools\crossgen.exe
|
||||
|
||||
REM Crossgen currently requires itself to be next to mscorlib
|
||||
copy %CROSSGEN_UTIL% /Y %BIN_DIR% > nul
|
||||
|
|
|
@ -44,7 +44,7 @@ fi
|
|||
READYTORUN=""
|
||||
|
||||
# Replace with a robust method for finding the right crossgen.exe
|
||||
CROSSGEN_UTIL=$NUGET_PACKAGES/runtime.$RID.Microsoft.NETCore.Runtime.CoreCLR/1.0.1-rc2-23808/tools/crossgen
|
||||
CROSSGEN_UTIL=$NUGET_PACKAGES/runtime.$RID.Microsoft.NETCore.Runtime.CoreCLR/1.0.1-rc2-23811/tools/crossgen
|
||||
|
||||
cd $BIN_DIR
|
||||
|
||||
|
@ -70,4 +70,4 @@ chmod +x crossgen
|
|||
./crossgen -nologo $READYTORUN -platform_assemblies_paths $BIN_DIR vbc.dll
|
||||
[ -e vbc.ni.exe ] && [ ! -e vbc.ni.dll ] && mv vbc.ni.exe vbc.ni.dll
|
||||
|
||||
info "CrossGen Roslyn Finished"
|
||||
info "CrossGen Roslyn Finished"
|
||||
|
|
|
@ -22,3 +22,13 @@ source "$DIR/../common/_common.sh"
|
|||
# Ensure the latest stage0 is installed
|
||||
header "Installing dotnet stage 0"
|
||||
$REPOROOT/scripts/obtain/install.sh
|
||||
|
||||
# Now patch the runtime in stage 0
|
||||
# HACK(anurse): BIG HACK. This is just to dodge the current broken Linux stage0. We'll remove it as soon as we've got a new stage 0
|
||||
(
|
||||
export PATH="$DOTNET_INSTALL_DIR/bin:$PATH"
|
||||
cd $REPOROOT/src/Microsoft.DotNet.Runtime
|
||||
dotnet restore
|
||||
dotnet publish -o "$DOTNET_INSTALL_DIR/share/dotnet/cli/runtime/coreclr"
|
||||
cp $DOTNET_INSTALL_DIR/share/dotnet/cli/runtime/coreclr/* $DOTNET_INSTALL_DIR/share/dotnet/cli/bin
|
||||
)
|
||||
|
|
|
@ -3,15 +3,21 @@
|
|||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#
|
||||
|
||||
param([string]$Channel="dev")
|
||||
|
||||
param(
|
||||
[string]$Channel="dev",
|
||||
[string]$version="Latest"
|
||||
)
|
||||
|
||||
$ErrorActionPreference="Stop"
|
||||
$ProgressPreference="SilentlyContinue"
|
||||
|
||||
$fileVersion = $Version
|
||||
if ($fileVersion -eq "Latest") {
|
||||
$fileVersion = "latest"
|
||||
}
|
||||
$Feed="https://dotnetcli.blob.core.windows.net/dotnet"
|
||||
$DotNetFileName="dotnet-win-x64.latest.zip"
|
||||
$DotNetUrl="$Feed/$Channel/Binaries/Latest"
|
||||
$DotNetFileName="dotnet-win-x64.$fileVersion.zip"
|
||||
$DotNetUrl="$Feed/$Channel/Binaries/$Version"
|
||||
|
||||
function say($str)
|
||||
{
|
||||
|
@ -34,21 +40,29 @@ if (Test-Path $LocalFile)
|
|||
$LocalVersion = $LocalData[1].Trim()
|
||||
if ($LocalVersion -and $LocalHash)
|
||||
{
|
||||
$RemoteResponse = Invoke-WebRequest -UseBasicParsing "$Feed/$Channel/dnvm/latest.win.version"
|
||||
$RemoteData = @([Text.Encoding]::UTF8.GetString($RemoteResponse.Content).Split([char[]]@(), [StringSplitOptions]::RemoveEmptyEntries));
|
||||
$RemoteHash = $RemoteData[0].Trim()
|
||||
$RemoteVersion = $RemoteData[1].Trim()
|
||||
|
||||
if (!$RemoteVersion -or !$RemoteHash) {
|
||||
throw "Invalid response from feed"
|
||||
}
|
||||
|
||||
say "Latest version: $RemoteVersion"
|
||||
say "Local Version: $LocalVersion"
|
||||
|
||||
if($LocalHash -eq $RemoteHash)
|
||||
if ($Version -eq "Latest")
|
||||
{
|
||||
say "You already have the latest version"
|
||||
$RemoteResponse = Invoke-WebRequest -UseBasicParsing "$Feed/$Channel/dnvm/latest.win.version"
|
||||
$RemoteData = @([Text.Encoding]::UTF8.GetString($RemoteResponse.Content).Split([char[]]@(), [StringSplitOptions]::RemoveEmptyEntries));
|
||||
$RemoteHash = $RemoteData[0].Trim()
|
||||
$RemoteVersion = $RemoteData[1].Trim()
|
||||
|
||||
if (!$RemoteVersion -or !$RemoteHash) {
|
||||
throw "Invalid response from feed"
|
||||
}
|
||||
|
||||
say "Latest version: $RemoteVersion"
|
||||
say "Local Version: $LocalVersion"
|
||||
|
||||
if($LocalHash -eq $RemoteHash)
|
||||
{
|
||||
say "You already have the latest version"
|
||||
exit 0
|
||||
}
|
||||
}
|
||||
elseif ($LocalVersion -eq $Version)
|
||||
{
|
||||
say "$Version is already installed."
|
||||
exit 0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env sh
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
@ -162,10 +160,17 @@ install_dotnet()
|
|||
say_err "Ending install due to missing pre-reqs"
|
||||
return 1;
|
||||
fi
|
||||
|
||||
if [ "$VERSION" == "Latest" ]; then
|
||||
local fileVersion=latest
|
||||
else
|
||||
local fileVersion=$VERSION
|
||||
fi
|
||||
|
||||
local os=$(current_os)
|
||||
local installLocation="$PREFIX/share/dotnet"
|
||||
local dotnet_url="https://dotnetcli.blob.core.windows.net/dotnet/$CHANNEL/Binaries/Latest"
|
||||
local dotnet_filename="dotnet-$os-x64.latest.tar.gz"
|
||||
local dotnet_url="https://dotnetcli.blob.core.windows.net/dotnet/$CHANNEL/Binaries/$VERSION"
|
||||
local dotnet_filename="dotnet-$os-x64.$fileVersion.tar.gz"
|
||||
|
||||
if [ "$RELINK" = "0" ]; then
|
||||
if [ "$FORCE" = "0" ]; then
|
||||
|
@ -246,6 +251,10 @@ do
|
|||
shift
|
||||
CHANNEL=$1
|
||||
;;
|
||||
-v|--version)
|
||||
shift
|
||||
VERSION=$1
|
||||
;;
|
||||
-d|--destination)
|
||||
shift
|
||||
DOTNET_INSTALL_DIR=$1
|
||||
|
@ -288,5 +297,6 @@ elif [ -z "$PREFIX" ]; then
|
|||
fi
|
||||
|
||||
[ -z "$CHANNEL" ] && CHANNEL="dev"
|
||||
[ -z "$VERSION" ] && VERSION="Latest"
|
||||
|
||||
install_dotnet
|
||||
|
|
|
@ -114,20 +114,20 @@ function UploadBinaries($zipFile)
|
|||
return 0
|
||||
}
|
||||
|
||||
function UploadInstallers($msiFile)
|
||||
function UploadInstallers($installerFile)
|
||||
{
|
||||
$fileName = [System.IO.Path]::GetFileName($msiFile)
|
||||
$msiBlob = "$env:CHANNEL/Installers/$env:DOTNET_CLI_VERSION/$fileName"
|
||||
$fileName = [System.IO.Path]::GetFileName($installerFile)
|
||||
$installerBlob = "$env:CHANNEL/Installers/$env:DOTNET_CLI_VERSION/$fileName"
|
||||
|
||||
if(-Not (UploadFile $msiBlob $msiFile))
|
||||
if(-Not (UploadFile $installerBlob $installerFile))
|
||||
{
|
||||
return -1
|
||||
}
|
||||
|
||||
Write-Host "Updating the latest dotnet installer for windows.."
|
||||
$msiBlobLatest = "$env:CHANNEL/Installers/Latest/dotnet-win-x64.latest.msi"
|
||||
$installerBlobLatest = "$env:CHANNEL/Installers/Latest/dotnet-win-x64.latest.exe"
|
||||
|
||||
if(-Not (UploadFile $msiBlobLatest $msiFile))
|
||||
if(-Not (UploadFile $installerBlobLatest $installerFile))
|
||||
{
|
||||
return -1
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ if([System.IO.Path]::GetExtension($file).ToLower() -eq ".zip")
|
|||
{
|
||||
$result = UploadBinaries $file
|
||||
}
|
||||
elseif([System.IO.Path]::GetExtension($file).ToLower() -eq ".msi")
|
||||
elseif([System.IO.Path]::GetExtension($file).ToLower() -eq ".exe")
|
||||
{
|
||||
$result = UploadInstallers $file
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||
"Microsoft.DotNet.ProjectModel": "1.0.0-*",
|
||||
"System.Reflection.Metadata": "1.2.0-rc2-23808",
|
||||
"System.Reflection.Metadata": "1.2.0-rc2-23811",
|
||||
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc2-16537"
|
||||
},
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace Microsoft.Dotnet.Cli.Compiler.Common
|
|||
private void MakeCompilationOutputRunnableForFullFramework(
|
||||
string outputPath)
|
||||
{
|
||||
CopyAllDependencies(outputPath, _exporter);
|
||||
CopyAllDependencies(outputPath, _exporter.GetAllExports());
|
||||
GenerateBindingRedirects(_exporter);
|
||||
}
|
||||
|
||||
|
@ -78,17 +78,14 @@ namespace Microsoft.Dotnet.Cli.Compiler.Common
|
|||
contentFiles.StructuredCopyTo(outputPath);
|
||||
}
|
||||
|
||||
private static void CopyAllDependencies(string outputPath, LibraryExporter exporter)
|
||||
private static void CopyAllDependencies(string outputPath, IEnumerable<LibraryExport> libraryExports)
|
||||
{
|
||||
var libraryExports = exporter.GetAllExports();
|
||||
|
||||
libraryExports
|
||||
.SelectMany(e => e.RuntimeAssemblies)
|
||||
.CopyTo(outputPath);
|
||||
|
||||
libraryExports
|
||||
.SelectMany(RuntimeAssets)
|
||||
.StructuredCopyTo(outputPath);
|
||||
foreach (var libraryExport in libraryExports)
|
||||
{
|
||||
libraryExport.RuntimeAssemblies.CopyTo(outputPath);
|
||||
libraryExport.NativeLibraries.CopyTo(outputPath);
|
||||
libraryExport.RuntimeAssets.StructuredCopyTo(outputPath);
|
||||
}
|
||||
}
|
||||
|
||||
private static void WriteDepsFileAndCopyProjectDependencies(
|
||||
|
@ -104,20 +101,7 @@ namespace Microsoft.Dotnet.Cli.Compiler.Common
|
|||
.Where(e => e.Library.Identity.Type == LibraryType.Project)
|
||||
.ToArray();
|
||||
|
||||
projectExports
|
||||
.SelectMany(e => e.RuntimeAssemblies)
|
||||
.CopyTo(outputPath);
|
||||
|
||||
projectExports
|
||||
.SelectMany(RuntimeAssets)
|
||||
.StructuredCopyTo(outputPath);
|
||||
}
|
||||
|
||||
|
||||
private static IEnumerable<LibraryAsset> RuntimeAssets(LibraryExport export)
|
||||
{
|
||||
return export.NativeLibraries
|
||||
.Union(export.RuntimeAssets);
|
||||
CopyAllDependencies(outputPath, projectExports);
|
||||
}
|
||||
|
||||
public void GenerateBindingRedirects(LibraryExporter exporter)
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||
"System.CommandLine": "0.1.0-e160119-1",
|
||||
"Microsoft.CodeAnalysis.CSharp": "1.2.0-beta1-20160108-01",
|
||||
"Microsoft.DotNet.ProjectModel": "1.0.0-*",
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
},
|
||||
"description": "Abstraction to interact with the file system and file paths.",
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||
"System.Linq.Expressions": "4.0.11-rc2-23808",
|
||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||
"System.Linq.Expressions": "4.0.11-rc2-23811",
|
||||
|
||||
"Microsoft.Extensions.FileSystemGlobbing": "1.0.0-rc2-15996",
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
"keyFile": "../../tools/Key.snk"
|
||||
},
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||
"Microsoft.DotNet.ProjectModel": "1.0.0-*",
|
||||
"System.Runtime.Loader": "4.0.0-rc2-23808"
|
||||
"System.Runtime.Loader": "4.0.0-rc2-23811"
|
||||
},
|
||||
"frameworks": {
|
||||
"dnxcore50": {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"keyFile": "../../tools/Key.snk"
|
||||
},
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||
"Microsoft.DotNet.ProjectModel": "1.0.0-*",
|
||||
"Microsoft.DotNet.Compiler.Common": "1.0.0-*",
|
||||
"Microsoft.CodeAnalysis.CSharp.Workspaces": "1.2.0-beta1-20160108-01"
|
||||
|
|
|
@ -2,10 +2,13 @@
|
|||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.DotNet.ProjectModel;
|
||||
using Microsoft.DotNet.ProjectModel.Compilation;
|
||||
using Microsoft.DotNet.ProjectModel.Graph;
|
||||
using Microsoft.DotNet.ProjectModel.Resolution;
|
||||
using Microsoft.DotNet.ProjectModel.Utilities;
|
||||
using NuGet.Frameworks;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
|
@ -61,7 +64,7 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
bool runtime,
|
||||
IDictionary<string, Dependency> dependencyLookup)
|
||||
{
|
||||
var type = export.Library.Identity.Type.Value.ToLowerInvariant();
|
||||
var type = export.Library.Identity.Type;
|
||||
|
||||
var serviceable = (export.Library as PackageDescription)?.Library.IsServiceable ?? false;
|
||||
var libraryDependencies = new List<Dependency>();
|
||||
|
@ -82,7 +85,7 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
}
|
||||
|
||||
string[] assemblies;
|
||||
if (type == "project")
|
||||
if (type == LibraryType.Project)
|
||||
{
|
||||
var isExe = ((ProjectDescription)export.Library)
|
||||
.Project
|
||||
|
@ -94,6 +97,10 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
|
||||
assemblies = new[] { export.Library.Identity.Name + (isExe ? ".exe" : ".dll") };
|
||||
}
|
||||
else if (type == LibraryType.ReferenceAssembly)
|
||||
{
|
||||
assemblies = ResolveReferenceAssembliesPath(libraryAssets);
|
||||
}
|
||||
else
|
||||
{
|
||||
assemblies = libraryAssets.Select(libraryAsset => libraryAsset.RelativePath).ToArray();
|
||||
|
@ -102,7 +109,7 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
if (runtime)
|
||||
{
|
||||
return new RuntimeLibrary(
|
||||
type,
|
||||
type.ToString().ToLowerInvariant(),
|
||||
export.Library.Identity.Name,
|
||||
export.Library.Identity.Version.ToString(),
|
||||
export.Library.Hash,
|
||||
|
@ -114,7 +121,7 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
else
|
||||
{
|
||||
return new CompilationLibrary(
|
||||
type,
|
||||
type.ToString().ToLowerInvariant(),
|
||||
export.Library.Identity.Name,
|
||||
export.Library.Identity.Version.ToString(),
|
||||
export.Library.Hash,
|
||||
|
@ -124,5 +131,26 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
private static string[] ResolveReferenceAssembliesPath(IEnumerable<LibraryAsset> libraryAssets)
|
||||
{
|
||||
var resolvedPaths = new List<string>();
|
||||
var referenceAssembliesPath =
|
||||
PathUtility.EnsureTrailingSlash(FrameworkReferenceResolver.Default.ReferenceAssembliesPath);
|
||||
foreach (var libraryAsset in libraryAssets)
|
||||
{
|
||||
// If resolved path is under ReferenceAssembliesPath store it as a relative to it
|
||||
// if not, save only assembly name and try to find it somehow later
|
||||
if (libraryAsset.ResolvedPath.StartsWith(referenceAssembliesPath))
|
||||
{
|
||||
resolvedPaths.Add(libraryAsset.ResolvedPath.Substring(referenceAssembliesPath.Length));
|
||||
}
|
||||
else
|
||||
{
|
||||
resolvedPaths.Add(Path.GetFileName(libraryAsset.ResolvedPath));
|
||||
}
|
||||
}
|
||||
return resolvedPaths.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
},
|
||||
"description": "Types to model a .NET Project",
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||
"System.Reflection.Metadata": "1.2.0-rc2-23808",
|
||||
"System.Runtime.Loader": "4.0.0-rc2-23808",
|
||||
"System.Dynamic.Runtime": "4.0.11-rc2-23808",
|
||||
"System.Security.Cryptography.Algorithms": "4.0.0-rc2-23808",
|
||||
"Microsoft.CSharp": "4.0.1-rc2-23808",
|
||||
"System.Xml.XDocument": "4.0.11-rc2-23808",
|
||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||
"System.Reflection.Metadata": "1.2.0-rc2-23811",
|
||||
"System.Runtime.Loader": "4.0.0-rc2-23811",
|
||||
"System.Dynamic.Runtime": "4.0.11-rc2-23811",
|
||||
"System.Security.Cryptography.Algorithms": "4.0.0-rc2-23811",
|
||||
"Microsoft.CSharp": "4.0.1-rc2-23811",
|
||||
"System.Xml.XDocument": "4.0.11-rc2-23811",
|
||||
"NuGet.Packaging": "3.4.0-beta-583",
|
||||
|
||||
"Microsoft.Extensions.FileSystemGlobbing": "1.0.0-rc2-15996",
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library" : "1.0.0-rc2-23808"
|
||||
"NETStandard.Library" : "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -11,12 +11,6 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
{
|
||||
public class CompilationLibrary : Library
|
||||
{
|
||||
private static Lazy<Assembly> _entryAssembly = new Lazy<Assembly>(GetEntryAssembly);
|
||||
|
||||
private static string _nugetPackages = Environment.GetEnvironmentVariable("NUGET_PACKAGES") ?? GetDefaultPackageDirectory();
|
||||
|
||||
private static string _packageCache = Environment.GetEnvironmentVariable("DOTNET_PACKAGES_CACHE");
|
||||
|
||||
public CompilationLibrary(string libraryType, string packageName, string version, string hash, string[] assemblies, Dependency[] dependencies, bool serviceable)
|
||||
: base(libraryType, packageName, version, hash, dependencies, serviceable)
|
||||
{
|
||||
|
@ -27,56 +21,90 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
|
||||
public IEnumerable<string> ResolveReferencePaths()
|
||||
{
|
||||
var entryAssembly = _entryAssembly.Value;
|
||||
var entryAssembly = Assembly.GetEntryAssembly();
|
||||
|
||||
string basePath;
|
||||
string fullName;
|
||||
|
||||
var appBase = Path.GetDirectoryName(entryAssembly.Location);
|
||||
var refsDir = Path.Combine(appBase, "refs");
|
||||
var hasRefs = Directory.Exists(refsDir);
|
||||
var isProject = string.Equals(LibraryType, "project", StringComparison.OrdinalIgnoreCase);
|
||||
var isReferenceAssembly = string.Equals(LibraryType, "referenceassembly", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
if (!isProject && PackagePathResolver.TryResolvePackageCachePath(this, out basePath))
|
||||
{
|
||||
return ResolveFromPackagePath(basePath);
|
||||
}
|
||||
if (hasRefs || isProject)
|
||||
{
|
||||
foreach (var assembly in Assemblies)
|
||||
var directories = new List<string>()
|
||||
{
|
||||
var assemblyFile = Path.GetFileName(assembly);
|
||||
if (hasRefs && TryResolveAssemblyFile(refsDir, assemblyFile, out fullName))
|
||||
{
|
||||
yield return fullName;
|
||||
}
|
||||
else if (TryResolveAssemblyFile(appBase, assemblyFile, out fullName))
|
||||
{
|
||||
yield return fullName;
|
||||
}
|
||||
else
|
||||
{
|
||||
var errorMessage = $"Can not find assembly file {assemblyFile} at '{appBase}'";
|
||||
if (hasRefs)
|
||||
{
|
||||
errorMessage += $", '{refsDir}'";
|
||||
}
|
||||
throw new InvalidOperationException(errorMessage);
|
||||
}
|
||||
appBase
|
||||
};
|
||||
|
||||
if (hasRefs)
|
||||
{
|
||||
directories.Add(refsDir);
|
||||
}
|
||||
yield break;
|
||||
return ResolveFromDirectories(directories.ToArray());
|
||||
}
|
||||
else if (TryResolvePackagePath(out basePath))
|
||||
if (isReferenceAssembly)
|
||||
{
|
||||
foreach (var assembly in Assemblies)
|
||||
{
|
||||
if (!TryResolveAssemblyFile(basePath, assembly, out fullName))
|
||||
{
|
||||
throw new InvalidOperationException($"Can not find assembly file at '{fullName}'");
|
||||
}
|
||||
yield return fullName;
|
||||
}
|
||||
yield break;
|
||||
return ResolveFromReferenceAssemblies();
|
||||
}
|
||||
if (PackagePathResolver.TryResolvePackagePath(this, out basePath))
|
||||
{
|
||||
return ResolveFromPackagePath(basePath);
|
||||
}
|
||||
throw new InvalidOperationException($"Can not find compilation library location for package '{PackageName}'");
|
||||
}
|
||||
|
||||
private IEnumerable<string> ResolveFromPackagePath(string basePath)
|
||||
{
|
||||
foreach (var assembly in Assemblies)
|
||||
{
|
||||
string fullName;
|
||||
if (!TryResolveAssemblyFile(basePath, assembly, out fullName))
|
||||
{
|
||||
throw new InvalidOperationException($"Can not find assembly file for package {PackageName} at '{fullName}'");
|
||||
}
|
||||
yield return fullName;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<string> ResolveFromReferenceAssemblies()
|
||||
{
|
||||
foreach (var assembly in Assemblies)
|
||||
{
|
||||
string fullName;
|
||||
if (!ReferenceAssemblyPathResolver.TryResolveReferenceAssembly(assembly, out fullName))
|
||||
{
|
||||
throw new InvalidOperationException($"Can not find refernce assembly file for package {PackageName}: '{assembly}'");
|
||||
}
|
||||
yield return fullName;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<string> ResolveFromDirectories(string[] directories)
|
||||
{
|
||||
foreach (var assembly in Assemblies)
|
||||
{
|
||||
var assemblyFile = Path.GetFileName(assembly);
|
||||
foreach (var directory in directories)
|
||||
{
|
||||
string fullName;
|
||||
if (TryResolveAssemblyFile(directory, assemblyFile, out fullName))
|
||||
{
|
||||
yield return fullName;
|
||||
break;
|
||||
}
|
||||
|
||||
var errorMessage = $"Can not find assembly file {assemblyFile} at '{string.Join(",", directories)}'";
|
||||
throw new InvalidOperationException(errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryResolveAssemblyFile(string basePath, string assemblyPath, out string fullName)
|
||||
{
|
||||
fullName = Path.Combine(basePath, assemblyPath);
|
||||
|
@ -86,76 +114,5 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool TryResolvePackagePath(out string packagePath)
|
||||
{
|
||||
packagePath = null;
|
||||
|
||||
if (!string.IsNullOrEmpty(_packageCache))
|
||||
{
|
||||
var hashSplitterPos = Hash.IndexOf('-');
|
||||
if (hashSplitterPos <= 0 || hashSplitterPos == Hash.Length - 1)
|
||||
{
|
||||
throw new InvalidOperationException($"Invalid hash entry '{Hash}' for package '{PackageName}'");
|
||||
}
|
||||
|
||||
var hashAlgorithm = Hash.Substring(0, hashSplitterPos);
|
||||
|
||||
var cacheHashPath = Path.Combine(_packageCache, $"{PackageName}.{Version}.nupkg.{hashAlgorithm}");
|
||||
|
||||
if (File.Exists(cacheHashPath) &&
|
||||
File.ReadAllText(cacheHashPath) == Hash.Substring(hashSplitterPos + 1))
|
||||
{
|
||||
if (TryResolvePackagePath(_nugetPackages, out packagePath))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(_nugetPackages) &&
|
||||
TryResolvePackagePath(_nugetPackages, out packagePath))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool TryResolvePackagePath(string basePath, out string packagePath)
|
||||
{
|
||||
packagePath = Path.Combine(basePath, PackageName, Version);
|
||||
if (Directory.Exists(packagePath))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static string GetDefaultPackageDirectory()
|
||||
{
|
||||
string basePath;
|
||||
if (PlatformServices.Default.Runtime.OperatingSystemPlatform == Platform.Windows)
|
||||
{
|
||||
basePath = Environment.GetEnvironmentVariable("USERPROFILE");
|
||||
}
|
||||
else
|
||||
{
|
||||
basePath = Environment.GetEnvironmentVariable("HOME");
|
||||
}
|
||||
if (string.IsNullOrEmpty(basePath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Path.Combine(basePath, ".nuget", "packages");
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
{
|
||||
using (var writer = new StreamWriter(stream))
|
||||
{
|
||||
using (var jsonWriter = new JsonTextWriter(writer))
|
||||
using (var jsonWriter = new JsonTextWriter(writer) { Formatting = Formatting.Indented })
|
||||
{
|
||||
Write(context).WriteTo(jsonWriter);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
// 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 Microsoft.Extensions.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
{
|
||||
public class PackagePathResolver
|
||||
{
|
||||
private static string _nugetPackages = Environment.GetEnvironmentVariable("NUGET_PACKAGES") ?? GetDefaultPackageDirectory();
|
||||
private static string _packageCache = Environment.GetEnvironmentVariable("DOTNET_PACKAGES_CACHE");
|
||||
|
||||
internal static bool TryResolvePackageCachePath(CompilationLibrary library, out string packagePath)
|
||||
{
|
||||
packagePath = null;
|
||||
|
||||
if (!string.IsNullOrEmpty(_packageCache))
|
||||
{
|
||||
var hashSplitterPos = library.Hash.IndexOf('-');
|
||||
if (hashSplitterPos <= 0 || hashSplitterPos == library.Hash.Length - 1)
|
||||
{
|
||||
throw new InvalidOperationException($"Invalid hash entry '{library.Hash}' for package '{library.PackageName}'");
|
||||
}
|
||||
|
||||
var hashAlgorithm = library.Hash.Substring(0, hashSplitterPos);
|
||||
|
||||
var cacheHashPath = Path.Combine(_packageCache, $"{library.PackageName}.{library.Version}.nupkg.{hashAlgorithm}");
|
||||
|
||||
if (File.Exists(cacheHashPath) &&
|
||||
File.ReadAllText(cacheHashPath) == library.Hash.Substring(hashSplitterPos + 1))
|
||||
{
|
||||
if (TryResolvePackagePath(library, _nugetPackages, out packagePath))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
internal static bool TryResolvePackagePath(CompilationLibrary library, out string packagePath)
|
||||
{
|
||||
packagePath = null;
|
||||
|
||||
if (!string.IsNullOrEmpty(_nugetPackages) &&
|
||||
TryResolvePackagePath(library, _nugetPackages, out packagePath))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static string GetDefaultPackageDirectory()
|
||||
{
|
||||
string basePath;
|
||||
if (PlatformServices.Default.Runtime.OperatingSystemPlatform == Platform.Windows)
|
||||
{
|
||||
basePath = Environment.GetEnvironmentVariable("USERPROFILE");
|
||||
}
|
||||
else
|
||||
{
|
||||
basePath = Environment.GetEnvironmentVariable("HOME");
|
||||
}
|
||||
if (string.IsNullOrEmpty(basePath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return Path.Combine(basePath, ".nuget", "packages");
|
||||
}
|
||||
|
||||
private static bool TryResolvePackagePath(CompilationLibrary library, string basePath, out string packagePath)
|
||||
{
|
||||
packagePath = Path.Combine(basePath, library.PackageName, library.Version);
|
||||
if (Directory.Exists(packagePath))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
// 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 Microsoft.Extensions.PlatformAbstractions;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyModel
|
||||
{
|
||||
public class ReferenceAssemblyPathResolver
|
||||
{
|
||||
private static readonly Lazy<string> _defaultReferenceAssembliesPath = new Lazy<string>(GetDefaultReferenceAssembliesPath);
|
||||
private static readonly Lazy<string[]> _fallbackSearchPaths = new Lazy<string[]>(GetFallbackSearchPaths);
|
||||
|
||||
private static string[] GetFallbackSearchPaths()
|
||||
{
|
||||
if (PlatformServices.Default.Runtime.OperatingSystemPlatform != Platform.Windows)
|
||||
{
|
||||
return new string[0];
|
||||
}
|
||||
|
||||
var net20Dir = Path.Combine(Environment.GetEnvironmentVariable("WINDIR"), "Microsoft.NET", "Framework", "v2.0.50727");
|
||||
|
||||
if (!Directory.Exists(net20Dir))
|
||||
{
|
||||
return new string[0];
|
||||
}
|
||||
return new[] { net20Dir };
|
||||
}
|
||||
|
||||
public static string GetDefaultReferenceAssembliesPath()
|
||||
{
|
||||
// Allow setting the reference assemblies path via an environment variable
|
||||
var referenceAssembliesPath = Environment.GetEnvironmentVariable("DOTNET_REFERENCE_ASSEMBLIES_PATH");
|
||||
|
||||
if (!string.IsNullOrEmpty(referenceAssembliesPath))
|
||||
{
|
||||
return referenceAssembliesPath;
|
||||
}
|
||||
|
||||
if (PlatformServices.Default.Runtime.OperatingSystemPlatform != Platform.Windows)
|
||||
{
|
||||
// There is no reference assemblies path outside of windows
|
||||
// The environment variable can be used to specify one
|
||||
return null;
|
||||
}
|
||||
|
||||
// References assemblies are in %ProgramFiles(x86)% on
|
||||
// 64 bit machines
|
||||
var programFiles = Environment.GetEnvironmentVariable("ProgramFiles(x86)");
|
||||
|
||||
if (string.IsNullOrEmpty(programFiles))
|
||||
{
|
||||
// On 32 bit machines they are in %ProgramFiles%
|
||||
programFiles = Environment.GetEnvironmentVariable("ProgramFiles");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(programFiles))
|
||||
{
|
||||
// Reference assemblies aren't installed
|
||||
return null;
|
||||
}
|
||||
|
||||
return Path.Combine(
|
||||
programFiles,
|
||||
"Reference Assemblies", "Microsoft", "Framework");
|
||||
}
|
||||
|
||||
public static bool TryResolveReferenceAssembly(string path, out string fullPath)
|
||||
{
|
||||
fullPath = null;
|
||||
|
||||
var refereneAssembliesPath = _defaultReferenceAssembliesPath.Value;
|
||||
if (refereneAssembliesPath == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var relativeToReferenceAssemblies = Path.Combine(refereneAssembliesPath, path);
|
||||
if (File.Exists(relativeToReferenceAssemblies))
|
||||
{
|
||||
fullPath = relativeToReferenceAssemblies;
|
||||
return true;
|
||||
}
|
||||
|
||||
var name = Path.GetFileName(path);
|
||||
foreach (var fallbackPath in _fallbackSearchPaths.Value)
|
||||
{
|
||||
var fallbackFile = Path.Combine(fallbackPath, name);
|
||||
if (File.Exists(fallbackFile))
|
||||
{
|
||||
fullPath = fallbackFile;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,22 +18,22 @@
|
|||
"dotnet5.4": {
|
||||
"imports": "portable-net451+win8",
|
||||
"dependencies": {
|
||||
"System.IO.FileSystem": "4.0.1-rc2-23808",
|
||||
"System.Linq": "4.0.1-rc2-23808",
|
||||
"System.Runtime": "4.0.21-rc2-23808",
|
||||
"System.Reflection": "4.1.0-rc2-23808",
|
||||
"System.Dynamic.Runtime": "4.0.11-rc2-23808"
|
||||
"System.IO.FileSystem": "4.0.1-rc2-23811",
|
||||
"System.Linq": "4.0.1-rc2-23811",
|
||||
"System.Runtime": "4.0.21-rc2-23811",
|
||||
"System.Reflection": "4.1.0-rc2-23811",
|
||||
"System.Dynamic.Runtime": "4.0.11-rc2-23811"
|
||||
}
|
||||
},
|
||||
"dnxcore50": {
|
||||
"imports": "portable-net45+win8",
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.Platforms": "1.0.1-rc2-23808",
|
||||
"System.IO.FileSystem": "4.0.1-rc2-23808",
|
||||
"System.Linq": "4.0.1-rc2-23808",
|
||||
"System.Runtime": "4.0.21-rc2-23808",
|
||||
"System.Reflection": "4.1.0-rc2-23808",
|
||||
"System.Dynamic.Runtime": "4.0.11-rc2-23808"
|
||||
"Microsoft.NETCore.Platforms": "1.0.1-rc2-23811",
|
||||
"System.IO.FileSystem": "4.0.1-rc2-23811",
|
||||
"System.Linq": "4.0.1-rc2-23811",
|
||||
"System.Runtime": "4.0.21-rc2-23811",
|
||||
"System.Reflection": "4.1.0-rc2-23811",
|
||||
"System.Dynamic.Runtime": "4.0.11-rc2-23811"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
"Newtonsoft.Json": "7.0.1",
|
||||
"Microsoft.DotNet.ProjectModel": "1.0.0-*",
|
||||
"Microsoft.Extensions.Logging.Abstractions": "1.0.0-rc2-16040",
|
||||
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||
"System.Resources.ResourceManager": "4.0.1-rc2-23808",
|
||||
"System.Runtime.Serialization.Primitives": "4.1.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||
"System.Resources.ResourceManager": "4.0.1-rc2-23811",
|
||||
"System.Runtime.Serialization.Primitives": "4.1.0-rc2-23811"
|
||||
},
|
||||
"frameworks": {
|
||||
"dnxcore50": {
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace Microsoft.DotNet.Tools.Build
|
|||
|
||||
private bool NeedsRebuilding(ProjectContext project, ProjectDependenciesFacade dependencies, string baseBuildPath)
|
||||
{
|
||||
var compilerIO = GetCompileIO(project, _args.ConfigValue, baseBuildPath, _args.OutputValue, dependencies);
|
||||
var compilerIO = GetCompileIO(project, _args.ConfigValue, baseBuildPath, _args.OutputValue, dependencies, project == _rootProject);
|
||||
|
||||
// rebuild if empty inputs / outputs
|
||||
if (!(compilerIO.Outputs.Any() && compilerIO.Inputs.Any()))
|
||||
|
@ -437,12 +437,7 @@ namespace Microsoft.DotNet.Tools.Build
|
|||
// computes all the inputs and outputs that would be used in the compilation of a project
|
||||
// ensures that all paths are files
|
||||
// ensures no missing inputs
|
||||
public static CompilerIO GetCompileIO(
|
||||
ProjectContext project,
|
||||
string buildConfiguration,
|
||||
string buildBasePath,
|
||||
string outputPath,
|
||||
ProjectDependenciesFacade dependencies)
|
||||
public static CompilerIO GetCompileIO(ProjectContext project, string buildConfiguration, string buildBasePath, string outputPath, ProjectDependenciesFacade dependencies, bool isRootProject)
|
||||
{
|
||||
var compilerIO = new CompilerIO(new List<string>(), new List<string>());
|
||||
var calculator = project.GetOutputPaths(buildConfiguration, buildBasePath, outputPath);
|
||||
|
@ -462,7 +457,7 @@ namespace Microsoft.DotNet.Tools.Build
|
|||
AddDependencies(dependencies, compilerIO);
|
||||
|
||||
var allOutputPath = new List<string>(calculator.CompilationFiles.All());
|
||||
if (project.ProjectFile.HasRuntimeOutput(buildConfiguration))
|
||||
if (isRootProject && project.ProjectFile.HasRuntimeOutput(buildConfiguration))
|
||||
{
|
||||
allOutputPath.AddRange(calculator.RuntimeFiles.All());
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"emitEntryPoint": true
|
||||
},
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||
"Microsoft.DotNet.AppDep":"1.0.5-prerelease-00001"
|
||||
},
|
||||
"frameworks": {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
"dependencies": {
|
||||
"Microsoft.FSharp.Core.netcore": "1.0.0-alpha-151221",
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -49,18 +49,18 @@
|
|||
"version": "1.0.0-*",
|
||||
"type": "build"
|
||||
},
|
||||
"Microsoft.NETCore.ConsoleHost": "1.0.0-rc2-23808",
|
||||
"Microsoft.NETCore.TestHost": "1.0.0-rc2-23808",
|
||||
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||
"System.Diagnostics.TextWriterTraceListener": "4.0.0-rc2-23808",
|
||||
"System.Diagnostics.TraceSource": "4.0.0-rc2-23808",
|
||||
"System.Linq.Expressions": "4.0.11-rc2-23808",
|
||||
"System.Xml.XDocument": "4.0.11-rc2-23808",
|
||||
"System.Resources.ReaderWriter": "4.0.0-rc2-23808",
|
||||
"System.Net.Sockets": "4.1.0-rc2-23808",
|
||||
"System.IO.Compression.ZipFile": "4.0.1-rc2-23808",
|
||||
"System.Threading.ThreadPool": "4.0.10-rc2-23808",
|
||||
"System.Runtime.Serialization.Primitives": "4.1.0-rc2-23808"
|
||||
"Microsoft.NETCore.ConsoleHost": "1.0.0-rc2-23811",
|
||||
"Microsoft.NETCore.TestHost": "1.0.0-rc2-23811",
|
||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||
"System.Diagnostics.TextWriterTraceListener": "4.0.0-rc2-23811",
|
||||
"System.Diagnostics.TraceSource": "4.0.0-rc2-23811",
|
||||
"System.Linq.Expressions": "4.0.11-rc2-23811",
|
||||
"System.Xml.XDocument": "4.0.11-rc2-23811",
|
||||
"System.Resources.ReaderWriter": "4.0.0-rc2-23811",
|
||||
"System.Net.Sockets": "4.1.0-rc2-23811",
|
||||
"System.IO.Compression.ZipFile": "4.0.1-rc2-23811",
|
||||
"System.Threading.ThreadPool": "4.0.10-rc2-23811",
|
||||
"System.Runtime.Serialization.Primitives": "4.1.0-rc2-23811"
|
||||
},
|
||||
"frameworks": {
|
||||
"dnxcore50": {
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library" : "1.0.0-rc2-23808",
|
||||
"Microsoft.NETCore.TestHost": "1.0.0-rc2-23808",
|
||||
"NETStandard.Library" : "1.0.0-rc2-23811",
|
||||
"Microsoft.NETCore.TestHost": "1.0.0-rc2-23811",
|
||||
|
||||
"xunit": "2.1.0",
|
||||
"xunit.console.netcore": "1.0.2-prerelease-00101",
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library" : "1.0.0-rc2-23808",
|
||||
"Microsoft.NETCore.TestHost": "1.0.0-rc2-23808",
|
||||
"NETStandard.Library" : "1.0.0-rc2-23811",
|
||||
"Microsoft.NETCore.TestHost": "1.0.0-rc2-23811",
|
||||
|
||||
"xunit": "2.1.0",
|
||||
"xunit.console.netcore": "1.0.2-prerelease-00101",
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||
|
||||
"Microsoft.DotNet.ProjectModel": { "target": "project" },
|
||||
"Microsoft.DotNet.Cli.Utils": { "target": "project" },
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
],
|
||||
"dependencies": {
|
||||
"Microsoft.FSharp.Core.netcore": "1.0.0-alpha-151221",
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
],
|
||||
"dependencies": {
|
||||
"TestLibrary": "1.0.0-*",
|
||||
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||
"Microsoft.FSharp.Core.netcore": "1.0.0-alpha-151221",
|
||||
},
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
],
|
||||
"dependencies": {
|
||||
"Microsoft.FSharp.Core.netcore": "1.0.0-alpha-151221",
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"version": "1.0.0-*",
|
||||
"dependencies": {
|
||||
"Microsoft.FSharp.Core.netcore": "1.0.0-alpha-151221",
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
"compilerName": "fsc",
|
||||
"compileFiles": [
|
||||
|
|
|
@ -14,4 +14,4 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library" : "1.0.0-rc2-23808",
|
||||
"NETStandard.Library" : "1.0.0-rc2-23811",
|
||||
|
||||
"Microsoft.DotNet.ProjectModel": { "target": "project" },
|
||||
"Microsoft.DotNet.Cli.Utils": { "target": "project" },
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"version": "1.0.0-*",
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||
|
||||
"Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" },
|
||||
"Microsoft.DotNet.ProjectModel": { "target": "project" },
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||
"dotnet-hello": { "version": "1.0.0", "target": "package" }
|
||||
},
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"testRunner": "must-be-specified-to-generate-deps",
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||
"dotnet-hello": {"version": "1.0.0", "target": "package"}
|
||||
},
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
|
|||
|
||||
}
|
||||
|
||||
|
||||
public IncrementalTestBase(string testProjectsRoot, string mainProject, string expectedOutput)
|
||||
{
|
||||
MainProject = mainProject;
|
||||
|
|
44
test/dotnet-build.Tests/IncrementalTestsTransitiveRuntime.cs
Normal file
44
test/dotnet-build.Tests/IncrementalTestsTransitiveRuntime.cs
Normal file
|
@ -0,0 +1,44 @@
|
|||
// 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 Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Builder.Tests
|
||||
{
|
||||
public class IncrementalTestsTransitiveRuntime : IncrementalTestBase
|
||||
{
|
||||
private const string TestLibraryWithAppDependency = "TestLibraryWithAppDependency";
|
||||
private const string LibraryProject = "TestLibrary";
|
||||
private const string AppProject = "TestApp";
|
||||
|
||||
public IncrementalTestsTransitiveRuntime() : base(
|
||||
Path.Combine(AppContext.BaseDirectory, "TestAssets", "TestProjects", "TestAppWithTransitiveAppDependency"),
|
||||
"TestAppWithTransitiveAppDependency",
|
||||
"This string came from the test library!" + Environment.NewLine)
|
||||
{
|
||||
Root.CopyDirectory(Path.Combine(AppContext.BaseDirectory, "TestAssets", "TestProjects", LibraryProject));
|
||||
Root.CopyDirectory(Path.Combine(AppContext.BaseDirectory, "TestAssets", "TestProjects", AppProject));
|
||||
Root.CopyDirectory(Path.Combine(AppContext.BaseDirectory, "TestAssets", "TestProjects", TestLibraryWithAppDependency));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TestSkipsRebuildWithTransitiveExeDependency()
|
||||
{
|
||||
var buildResult = BuildProject();
|
||||
buildResult.Should().HaveCompiledProject(MainProject);
|
||||
buildResult.Should().HaveCompiledProject(TestLibraryWithAppDependency);
|
||||
buildResult.Should().HaveCompiledProject(AppProject);
|
||||
buildResult.Should().HaveCompiledProject(LibraryProject);
|
||||
|
||||
buildResult = BuildProject();
|
||||
|
||||
buildResult.Should().HaveSkippedProjectCompilation(MainProject);
|
||||
buildResult.Should().HaveSkippedProjectCompilation(TestLibraryWithAppDependency);
|
||||
buildResult.Should().HaveSkippedProjectCompilation(AppProject);
|
||||
buildResult.Should().HaveSkippedProjectCompilation(LibraryProject);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
"version": "1.0.0-*",
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||
|
||||
"Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" },
|
||||
"Microsoft.DotNet.Cli.Utils": {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"version": "1.0.0-*",
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||
|
||||
"Microsoft.DotNet.TestFramework": "1.0.0-*",
|
||||
"Microsoft.DotNet.Tools.Tests.Utilities": { "target": "project" },
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||
"EmptyLibrary": ""
|
||||
},
|
||||
"frameworks": {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"frameworks": {
|
||||
"dnxcore50": {
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808"
|
||||
"NETStandard.Library": "1.0.0-rc2-23811"
|
||||
}
|
||||
},
|
||||
"dnx451": { }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||
"Microsoft.Web.Administration": "7.0.0"
|
||||
},
|
||||
"frameworks": {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
},
|
||||
|
||||
"dependencies": {
|
||||
"NETStandard.Library": "1.0.0-rc2-23808",
|
||||
"NETStandard.Library": "1.0.0-rc2-23811",
|
||||
"Microsoft.DotNet.ProjectModel": "1.0.0-*",
|
||||
"Microsoft.DotNet.Cli.Utils": "1.0.0-*"
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue