提交 346acaf0 编写于 作者: C Cyrus Najmabadi

Merge branch 'master' into noMorePreOrder

......@@ -22,6 +22,10 @@ x64/
[Bb]uild[Ll]og.*
UnitTestResults.html
# NuGet V3 artifacts
*lock.json
*-packages.config
*_i.c
*_p.c
*.ilk
......
......@@ -8,4 +8,13 @@
<config>
<add key="repositoryPath" value="../packages" />
</config>
<packageSources>
<add key="myget.org dotnet-coreclr" value="https://www.myget.org/F/dotnet-coreclr/" />
<add key="myget.org dotnet-corefx" value="https://www.myget.org/F/dotnet-corefx/" />
<add key="myget.org dotnet-core" value="https://www.myget.org/F/dotnet-core/" />
<add key="myget.org dotnet-corefxtestdata" value="https://www.myget.org/F/dotnet-corefxtestdata/" />
<add key="myget.org dotnet-buildtools" value="https://www.myget.org/F/dotnet-buildtools/" />
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
</packageSources>
</configuration>
无法预览此类型文件
$NuGetExe = "$PSScriptRoot\NuGet.exe"
& $NuGetExe restore "$PSScriptRoot\packages.config" -PackagesDirectory "$PSScriptRoot\..\packages"
& $NuGetExe restore "$PSScriptRoot\..\Roslyn.sln"
& $NuGetExe restore "$PSScriptRoot\..\src\Samples\Samples.sln"
& $NuGetExe restore "$PSScriptRoot\..\src\Dependencies\Dependencies.sln"
& $NuGetExe restore "$PSScriptRoot\packages.config" -PackagesDirectory "$PSScriptRoot\..\packages" -ConfigFile "$PSScriptRoot\NuGet.config"
& $NuGetExe restore "$PSScriptRoot\..\Roslyn.sln" -ConfigFile "$PSScriptRoot\NuGet.config"
& $NuGetExe restore "$PSScriptRoot\..\src\Samples\Samples.sln" -ConfigFile "$PSScriptRoot\NuGet.config"
& $NuGetExe restore "$PSScriptRoot\..\src\Dependencies\Dependencies.sln" -ConfigFile "$PSScriptRoot\NuGet.config"
......@@ -5,5 +5,8 @@
<package id="Microsoft.Net.RoslynDiagnostics" version="1.0.0-rc3-20150616-02" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.1.36" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.0.21" targetFramework="net45" />
<package id="Microsoft.DotNet.BuildTools" version="1.0.25-prerelease-00056" />
<package id="FakeSign" version="0.9.2" targetFramework="net45" />
<package id="dnx-coreclr-win-x86" version="1.0.0-beta5-12101" />
<package id="dnx-mono" version="1.0.0-beta5-12101" />
</packages>
......@@ -12,6 +12,8 @@
<PropertyGroup>
<RoslynSolution>$(MSBuildThisFileDirectory)Roslyn.sln</RoslynSolution>
<RoslynSolution Condition="'$(PublicBuild)' == 'true'">$(MSBuildThisFileDirectory)RoslynLight.sln</RoslynSolution>
<CscCoreProj>$(MSBuildThisFileDirectory)\src\Compilers\CSharp\CscCore\CscCore.csproj</CscCoreProj>
<VbcCoreProj>$(MSBuildThisFileDirectory)\src\Compilers\VisualBasic\VbcCore\VbcCore.csproj</VbcCoreProj>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<RunTestArgs></RunTestArgs>
<RunTestArgs Condition="'$(Test64)' == 'true'">-test64</RunTestArgs>
......@@ -31,6 +33,12 @@
Projects="$(RoslynSolution)"
Properties="RestorePackages=false;TreatWarningsAsErrors=true"
Targets="Build"/>
<MSBuild BuildInParallel="true"
Projects="$(CscCoreProj)"
Targets="Build" />
<MSBuild BuildInParallel="true"
Projects="$(VbcCoreProj)"
Targets="Build" />
</Target>
<Target Name="Clean">
......@@ -38,6 +46,12 @@
Projects="$(RoslynSolution)"
Properties="RestorePackages=false"
Targets="Clean"/>
<MSBuild BuildInParallel="true"
Projects="$(CscCoreProj)"
Targets="Clean" />
<MSBuild BuildInParallel="true"
Projects="$(VbcCoreProj)"
Targets="Clean" />
</Target>
<Target Name="Rebuild">
......@@ -45,19 +59,25 @@
Projects="$(RoslynSolution)"
Properties="RestorePackages=false;TreatWarningsAsErrors=true"
Targets="Rebuild"/>
<MSBuild BuildInParallel="true"
Projects="$(CscCoreProj)"
Targets="Rebuild" />
<MSBuild BuildInParallel="true"
Projects="$(VbcCoreProj)"
Targets="Rebuild" />
</Target>
<Target Name="Test">
<ItemGroup Condition="'$(PublicBuild)' == '' AND '$(CIBuild)' == ''">
<TestAssemblies
Include="Binaries\$(Configuration)\**\$(IncludePattern)"
<TestAssemblies
Include="Binaries\$(Configuration)\**\$(IncludePattern)"
Exclude="Binaries\$(Configuration)\Roslyn.Compilers.NativeClient.UnitTests.dll" />
</ItemGroup>
<ItemGroup Condition="'$(PublicBuild)' == '' AND '$(CIBuild)' == 'true'">
<TestAssemblies
Include="Binaries\$(Configuration)\**\$(IncludePattern)"
<TestAssemblies
Include="Binaries\$(Configuration)\**\$(IncludePattern)"
Exclude="
Binaries\$(Configuration)\Roslyn.Compilers.NativeClient.UnitTests.dll;
Binaries\$(Configuration)\Microsoft.CodeAnalysis.Scripting.UnitTests.dll;" />
......@@ -65,8 +85,8 @@
<!-- The Microsoft.CodeAnalysis.Scripting.UnitTests.dll is disabled due to https://github.com/dotnet/roslyn/issues/860 -->
<ItemGroup Condition="'$(PublicBuild)' == 'true' AND '$(CIBuild)' == ''">
<TestAssemblies
Include="Binaries\$(Configuration)\**\$(IncludePattern)"
<TestAssemblies
Include="Binaries\$(Configuration)\**\$(IncludePattern)"
Exclude="
Binaries\$(Configuration)\Roslyn.Compilers.NativeClient.UnitTests.dll;
Binaries\$(Configuration)\Microsoft.CodeAnalysis.Scripting.UnitTests.dll;
......
此差异已折叠。

Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23025.0
MinimumVisualStudioVersion = 10.0.40219.1
......@@ -285,6 +284,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpWinRTTest", "src\Comp
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSBuildTask", "src\Compilers\Core\MSBuildTask\MSBuildTask.csproj", "{D874349C-8BB3-4BDC-8535-2D52CCCA1198}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSBuildTaskTests", "src\Compilers\Core\MSBuildTaskTests\MSBuildTaskTests.csproj", "{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "BasicResultProvider", "src\ExpressionEvaluator\VisualBasic\Source\ResultProvider\BasicResultProvider.shproj", "{3140FE61-0856-4367-9AA3-8081B9A80E35}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "BasicResultProvider.NetFX20", "src\ExpressionEvaluator\VisualBasic\Source\ResultProvider\NetFX20\BasicResultProvider.NetFX20.vbproj", "{76242A2D-2600-49DD-8C15-FEA07ECB1842}"
......@@ -5576,6 +5577,22 @@ Global
{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F}.Release|x64.Build.0 = Release|Any CPU
{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F}.Release|x86.ActiveCfg = Release|Any CPU
{06ECCF53-B9B8-4CC2-83C0-E308BF645F7F}.Release|x86.Build.0 = Release|Any CPU
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|ARM.ActiveCfg = Debug|ARM
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|ARM.Build.0 = Debug|ARM
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|x64.ActiveCfg = Debug|x64
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|x64.Build.0 = Debug|x64
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|Any CPU.Build.0 = Release|Any CPU
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|ARM.ActiveCfg = Release|ARM
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|ARM.Build.0 = Release|ARM
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|x64.ActiveCfg = Release|x64
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -5734,5 +5751,6 @@ Global
{2491A9B9-C0A8-49EE-9077-A32DE76E1E94} = {999FBDA2-33DA-4F74-B957-03AC72CCE5EC}
{5CA5F70E-0FDB-467B-B22C-3CD5994F0087} = {999FBDA2-33DA-4F74-B957-03AC72CCE5EC}
{81F048A1-B30A-4E74-9BD3-2655DA1DBEA6} = {999FBDA2-33DA-4F74-B957-03AC72CCE5EC}
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9}
EndGlobalSection
EndGlobal
此差异已折叠。
......@@ -51,8 +51,8 @@
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.VisualBasic.targets" Condition="'$(ProjectLanguage)' == 'VB' And '$(TargetFrameworkIdentifier)' == '.NETPortable'"/>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" Condition="'$(ProjectLanguage)' == 'CSharp' And '$(TargetFrameworkIdentifier)' == '.NETPortable'"/>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" Condition="'$(ProjectLanguage)' == 'VB' And '$(TargetFrameworkIdentifier)' != '.NETPortable'" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" Condition="'$(ProjectLanguage)' == 'CSharp' And '$(TargetFrameworkIdentifier)' != '.NETPortable'" />
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" Condition="'$(ProjectLanguage)' == 'VB' And '$(TargetFrameworkIdentifier)' != '.NETPortable' And '$(TestCoreClr)' != 'True'" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" Condition="'$(ProjectLanguage)' == 'CSharp' And '$(TargetFrameworkIdentifier)' != '.NETPortable' And '$(TestCoreClr)' != 'True'" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" Condition="'$(ProjectLanguage)' == 'C++'" />
<PropertyGroup>
......@@ -125,6 +125,48 @@
</ItemGroup>
</Target>
<PropertyGroup Condition="'$(TestCoreClr)' == 'true'">
<BuildToolsVersion>1.0.25-prerelease-00056</BuildToolsVersion>
<!-- fix this to be not hacky -->
<BuildToolsDir>$(NuGetPackagesPath)\Microsoft.DotNet.BuildTools.$(BuildToolsVersion)\lib\</BuildToolsDir>
<!-- Implicitly needed by packageresolve.targets. Should file a bug for a better error message here -->
<PackagesDir>$(NuGetPackagesPath)\</PackagesDir>
<DnxVersion>1.0.0-beta5-12101</DnxVersion>
<DnxPackageName Condition="'$(DnxPackageName)' == '' and '$(OsEnvironment)'!='Unix'">dnx-coreclr-win-x86.$(DnxVersion)</DnxPackageName>
<DnxPackageName Condition="'$(DnxPackageName)' == '' and '$(OsEnvironment)'=='Unix'">dnx-mono.$(DnxVersion)</DnxPackageName>
<NuGetToolPath Condition="'$(NuGetToolPath)' == ''">$(NuGetPackagesPath)\..\.nuget\</NuGetToolPath>
<NuGetConfigCommandLine>-ConfigFile "$(NuGetConfigFile)"</NuGetConfigCommandLine>
<NugetRestoreCommand>"$(NuGetToolPath)NuGet.exe"</NugetRestoreCommand>
<NugetRestoreCommand>$(NugetRestoreCommand) install</NugetRestoreCommand>
<NugetRestoreCommand>$(NugetRestoreCommand) -OutputDirectory "$(NuGetPackagesPath)"</NugetRestoreCommand>
<NugetRestoreCommand>$(NugetRestoreCommand) -Config "$(NuGetToolPath)NuGet.Config"</NugetRestoreCommand>
<DnxPackageDir Condition="'$(DnxPackageDir)'==''">$([System.IO.Path]::GetFullPath('$(NuGetPackagesPath)'))\$(DnxPackageName)\</DnxPackageDir>
<DnuToolPath Condition="'$(DnuToolPath)'=='' and '$(OS)' == 'Windows_NT'">$(DnxPackageDir)\bin\dnu.cmd</DnuToolPath>
<DnuToolPath Condition="'$(DnuToolPath)'=='' and '$(OS)' != 'Windows_NT'">$(DnxPackageDir)/bin/dnu</DnuToolPath>
<DnuRestoreCommand>"$(DnuToolPath)"</DnuRestoreCommand>
<DnuRestoreCommand>$(DnuRestoreCommand) restore</DnuRestoreCommand>
<DnuRestoreCommand>$(DnuRestoreCommand) --packages "$(PackagesDir.TrimEnd('/').TrimEnd('\\'))"</DnuRestoreCommand>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<!-- For now continue to sign things the way we've always signed them -->
<SkipSigning>True</SkipSigning>
<!-- Consider changing this in buildtools directly -->
<NoStdLib>True</NoStdLib>
</PropertyGroup>
<Import Condition="'$(TestCoreClr)' == 'True'" Project="$(BuildToolsDir)Build.Common.Targets" />
<!-- ====================================================================================
Generation of AssemblyVersion attributes from the BuildVersion property
......
......@@ -19,7 +19,8 @@
<SignAssembly Condition="'$(SignAssembly)' == ''">true</SignAssembly>
<NuGetPackagesPath Condition="'$(NuGetPackagesPath)' == ''">$(MSBuildThisFileDirectory)..\..\packages</NuGetPackagesPath>
<NuGetPackagesPath Condition="'$(NuGetPackagesPath)' == ''">$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\..\packages'))</NuGetPackagesPath>
<UseRoslynAnalyzers Condition="'$(UseRoslynAnalyzers)' == ''">true</UseRoslynAnalyzers>
<RoslynSemanticVersion Condition="'$(RoslynSemanticVersion)' == ''">1.1.0</RoslynSemanticVersion>
......

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.22725.0
VisualStudioVersion = 14.0.23025.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeAnalysisTest", "..\src\Compilers\Core\CodeAnalysisTest\CodeAnalysisTest.csproj", "{A4C99B85-765C-4C65-9C2A-BB609AAB09E6}"
EndProject
......@@ -11,11 +11,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VBCSCompiler", "..\src\Comp
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VBCSCompilerTests", "..\src\Compilers\Core\VBCSCompilerTests\VBCSCompilerTests.csproj", "{F5CE416E-B906-41D2-80B9-0078E887A3F6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "..\src\Core", "{A41D1B99-F489-4C43-BBDF-96D61B19A6B9}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{A41D1B99-F489-4C43-BBDF-96D61B19A6B9}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Compilers", "..\src\Compilers", "{3F40F71B-7DCF-44A1-B15C-38CA34824143}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Compilers", "Compilers", "{3F40F71B-7DCF-44A1-B15C-38CA34824143}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CSharp", "..\src\CSharp", "{32A48625-F0AD-419D-828B-A50BDABA38EA}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CSharp", "CSharp", "{32A48625-F0AD-419D-828B-A50BDABA38EA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csc", "..\src\Compilers\CSharp\csc\csc.csproj", "{4B45CA0C-03A0-400F-B454-3D4BCB16AF38}"
EndProject
......@@ -31,7 +31,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpCompilerSymbolTest",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpCompilerSyntaxTest", "..\src\Compilers\CSharp\Test\Syntax\CSharpCompilerSyntaxTest.csproj", "{50D26304-0961-4A51-ABF6-6CAD1A56D202}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VisualBasic", "..\src\VisualBasic", "{C65C6143-BED3-46E6-869E-9F0BE6E84C37}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "VisualBasic", "VisualBasic", "{C65C6143-BED3-46E6-869E-9F0BE6E84C37}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "CompilerTestResources", "..\src\Compilers\Test\Resources\Core\CompilerTestResources.vbproj", "{7FE6B002-89D8-4298-9B1B-0B5C247DD1FD}"
EndProject
......@@ -57,18 +57,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PdbUtilities", "..\src\Test
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestUtilities", "..\src\Test\Utilities\TestUtilities.csproj", "{76C6F005-C89D-4348-BB4A-391898DBEB52}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Workspaces", "..\src\Workspaces", "{55A62CFA-1155-46F1-ADF3-BEEE51B58AB5}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Workspaces", "Workspaces", "{55A62CFA-1155-46F1-ADF3-BEEE51B58AB5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Workspaces", "..\src\Workspaces\Core\Portable\Workspaces.csproj", "{5F8D2414-064A-4B3A-9B42-8E2A04246BE5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", "..\src\.nuget", "{C41FAB9A-D1D7-4253-B639-D72395B6BA37}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{C41FAB9A-D1D7-4253-B639-D72395B6BA37}"
ProjectSection(SolutionItems) = preProject
.nuget\NuGet.Config = .nuget\NuGet.Config
.nuget\NuGet.exe = .nuget\NuGet.exe
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "..\src\Tools", "{FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompilersBoundTreeGenerator", "..\src\Tools\Source\CompilerGeneratorTools\Source\BoundTreeGenerator\CompilersBoundTreeGenerator.csproj", "{02459936-CD2C-4F61-B671-5C518F2A3DDC}"
EndProject
......@@ -98,7 +98,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpFeatures", "..\src\Fe
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Features", "..\src\Features\Core\Features.csproj", "{EDC68A0E-C68D-4A74-91B7-BF38EC909888}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Features", "..\src\Features", "{3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Features", "Features", "{3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "AnalyzerDriver", "..\src\Compilers\Core\AnalyzerDriver\AnalyzerDriver.shproj", "{D0BC9BE7-24F6-40CA-8DC6-FCB93BD44B34}"
EndProject
......@@ -114,6 +114,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vbc2", "..\src\Compilers\Vi
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vbc", "..\src\Compilers\VisualBasic\vbc\vbc.csproj", "{E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSBuildTaskTests", "..\src\Compilers\Core\MSBuildTaskTests\MSBuildTaskTests.csproj", "{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
..\src\Compilers\Core\AnalyzerDriver\AnalyzerDriver.projitems*{edc68a0e-c68d-4a74-91b7-bf38ec909888}*SharedItemsImports = 4
......@@ -121,8 +123,8 @@ Global
..\src\Compilers\Core\AnalyzerDriver\AnalyzerDriver.projitems*{d0bc9be7-24f6-40ca-8dc6-fcb93bd44b34}*SharedItemsImports = 13
..\src\Compilers\VisualBasic\BasicAnalyzerDriver\BasicAnalyzerDriver.projitems*{a1bcd0ce-6c2f-4f8c-9a48-d9d93928e26d}*SharedItemsImports = 4
..\src\Compilers\Core\SharedCollections\SharedCollections.projitems*{afde6bea-5038-4a4a-a88e-dbd2e4088eed}*SharedItemsImports = 4
..\src\Compilers\Core\AnalyzerDriver\AnalyzerDriver.projitems*{1ee8cad3-55f9-4d91-96b2-084641da9a6c}*SharedItemsImports = 4
..\src\Compilers\Core\SharedCollections\SharedCollections.projitems*{1ee8cad3-55f9-4d91-96b2-084641da9a6c}*SharedItemsImports = 4
..\src\Compilers\Core\AnalyzerDriver\AnalyzerDriver.projitems*{1ee8cad3-55f9-4d91-96b2-084641da9a6c}*SharedItemsImports = 4
..\src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpAnalyzerDriver.projitems*{3973b09a-4fbf-44a5-8359-3d22ceb71f71}*SharedItemsImports = 4
..\src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpAnalyzerDriver.projitems*{b501a547-c911-4a05-ac6e-274a50dff30e}*SharedItemsImports = 4
..\src\Compilers\VisualBasic\BasicAnalyzerDriver\BasicAnalyzerDriver.projitems*{2523d0e6-df32-4a3e-8ae0-a19bffae2ef6}*SharedItemsImports = 4
......@@ -825,6 +827,22 @@ Global
{E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Release|x64.ActiveCfg = Release|x64
{E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}.Release|x64.Build.0 = Release|x64
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|ARM.ActiveCfg = Debug|ARM
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|ARM.Build.0 = Debug|ARM
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|x64.ActiveCfg = Debug|x64
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Debug|x64.Build.0 = Debug|x64
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|Any CPU.Build.0 = Release|Any CPU
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|ARM.ActiveCfg = Release|ARM
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|ARM.Build.0 = Release|ARM
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|x64.ActiveCfg = Release|x64
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -878,5 +896,6 @@ Global
{C545216D-8CBA-4460-810D-D3DC7EFF8373} = {32A48625-F0AD-419D-828B-A50BDABA38EA}
{21446697-E359-41D9-B39D-40ADA2B20823} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37}
{E58EE9D7-1239-4961-A0C1-F9EC3952C4C1} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37}
{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9}
EndGlobalSection
EndGlobal
......@@ -15,7 +15,7 @@ call :Usage && exit /b 1
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat"
REM Build the compiler so we can self host it for the full build
.nuget\NuGet.exe restore .nuget/packages.config -packagesdirectory packages
.nuget\NuGet.exe restore .nuget/packages.config -packagesdirectory packages -Config .nuget/NuGet.Config
.nuget\NuGet.exe restore %RoslynRoot%/build/Toolset.sln -packagesdirectory packages
msbuild /nologo /v:m /m %RoslynRoot%/build/Toolset.sln /p:Configuration=%BuildConfiguration%
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using Microsoft.VisualStudio.Shell.Interop;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.CSharp.CommandLine
{
internal sealed class Csc : CSharpCompiler
{
internal Csc(string responseFile, string clientDirectory, string baseDirectory, string sdkDirectory, string[] args, IAnalyzerAssemblyLoader analyzerLoader)
: base(CSharpCommandLineParser.Default, responseFile, args, clientDirectory, baseDirectory, sdkDirectory, Environment.GetEnvironmentVariable("LIB"), analyzerLoader)
{
}
internal static int Run(string clientDirectory, string sdkDirectory, string[] args, IAnalyzerAssemblyLoader analyzerLoader)
{
FatalError.Handler = FailFast.OnFatalException;
var responseFile = Path.Combine(clientDirectory, CSharpCompiler.ResponseFileName);
Csc compiler = new Csc(responseFile, clientDirectory, Directory.GetCurrentDirectory(), sdkDirectory, args, analyzerLoader);
return ConsoleUtil.RunWithOutput(compiler.Arguments.Utf8Output, (textWriterOut, _) => compiler.Run(textWriterOut));
}
protected override uint GetSqmAppID()
{
return SqmServiceProvider.CSHARP_APPID;
}
protected override void CompilerSpecificSqm(IVsSqmMulti sqm, uint sqmSession)
{
sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_COMPILERTYPE, (uint)SqmServiceProvider.CompilerType.Compiler);
sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_LANGUAGEVERSION, (uint)Arguments.ParseOptions.LanguageVersion);
sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_WARNINGLEVEL, (uint)Arguments.CompilationOptions.WarningLevel);
//Project complexity # of source files, # of references
sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_SOURCES, (uint)Arguments.SourceFiles.Count());
sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_REFERENCES, (uint)Arguments.ReferencePaths.Count());
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="Settings">
<Import Project="..\..\..\..\build\Targets\VSL.Settings.targets" />
</ImportGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E3CD2895-76A8-4D11-A316-EA67CB5EA42C}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.CSharp.CommandLine</RootNamespace>
<AssemblyName>csc</AssemblyName>
<Prefer32Bit>false</Prefer32Bit>
<LargeAddressAware>true</LargeAddressAware>
<StartupObject>Microsoft.CodeAnalysis.CSharp.CommandLine.Program</StartupObject>
<SolutionDir Condition="'$(SolutionDir)' == '' OR '$(SolutionDir)' == '*Undefined*'">..\..\..\..\</SolutionDir>
<OutDir>$(OutDir)core-clr\</OutDir>
<RestorePackages>true</RestorePackages>
<AutoGenerateBindingRedirects>True</AutoGenerateBindingRedirects>
<TestCoreClr>true</TestCoreClr>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\Core\Portable\CodeAnalysis.csproj">
<Project>{1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}</Project>
<Name>CodeAnalysis</Name>
</ProjectReference>
<ProjectReference Include="..\Portable\CSharpCodeAnalysis.csproj">
<Project>{B501A547-C911-4A05-AC6E-274A50DFF30E}</Project>
<Name>CSharpCodeAnalysis</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="System.Collections.Immutable">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\System.Collections.Immutable.$(SystemCollectionsImmutableVersion)\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
</Reference>
<Reference Include="System.Reflection.Metadata">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\System.Reflection.Metadata.$(SystemReflectionMetadataVersion)\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\Helpers\ConsoleUtil.cs">
<Link>ConsoleUtil.cs</Link>
</Compile>
<Compile Include="Csc.cs" />
<Compile Include="Program.cs" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleToTest Include="Roslyn.Compilers.CSharp.CommandLine.UnitTests" />
</ItemGroup>
<ItemGroup>
<None Include="csc.exe.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="csc.rsp">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="project.json" />
</ItemGroup>
<ImportGroup Label="Targets">
<Import Project="..\..\..\..\build\Targets\VSL.Imports.targets" />
</ImportGroup>
<Target Name="CopyExtraFiles" AfterTargets="Build">
<Copy SourceFiles="@(None)" DestinationFolder="$(OutDir)" Condition="'%(Extension)' == '.dll'" />
</Target>
</Project>
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace Microsoft.CodeAnalysis.CSharp.CommandLine
{
public class Program
{
public static int Main(string[] args)
=> Csc.Run(args: args,
clientDirectory: AppContext.BaseDirectory,
sdkDirectory: @"C:\Windows\Microsoft.NET\Framework\v4.0.30319",
analyzerLoader: null);
}
}
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
<configuration>
<runtime>
<gcServer enabled="true" />
<gcConcurrent enabled="false"/>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0-1.0.65535.65535" newVersion="1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0-1.0.65535.65535" newVersion="1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.VisualBasic" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0-1.0.65535.65535" newVersion="1.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
# Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
# This file contains command-line options that the C#
# command line compiler (CSC) will process as part
# of every compilation, unless the "/noconfig" option
# is specified.
# Reference the common Framework libraries
/r:Accessibility.dll
/r:Microsoft.CSharp.dll
/r:System.Configuration.dll
/r:System.Configuration.Install.dll
/r:System.Core.dll
/r:System.Data.dll
/r:System.Data.DataSetExtensions.dll
/r:System.Data.Linq.dll
/r:System.Data.OracleClient.dll
/r:System.Deployment.dll
/r:System.Design.dll
/r:System.DirectoryServices.dll
/r:System.dll
/r:System.Drawing.Design.dll
/r:System.Drawing.dll
/r:System.EnterpriseServices.dll
/r:System.Management.dll
/r:System.Messaging.dll
/r:System.Runtime.Remoting.dll
/r:System.Runtime.Serialization.dll
/r:System.Runtime.Serialization.Formatters.Soap.dll
/r:System.Security.dll
/r:System.ServiceModel.dll
/r:System.ServiceModel.Web.dll
/r:System.ServiceProcess.dll
/r:System.Transactions.dll
/r:System.Web.dll
/r:System.Web.Extensions.Design.dll
/r:System.Web.Extensions.dll
/r:System.Web.Mobile.dll
/r:System.Web.RegularExpressions.dll
/r:System.Web.Services.dll
/r:System.Windows.Forms.dll
/r:System.Workflow.Activities.dll
/r:System.Workflow.ComponentModel.dll
/r:System.Workflow.Runtime.dll
/r:System.Xml.dll
/r:System.Xml.Linq.dll
{
"dependencies": {
"System.AppContext": "4.0.0-beta-*",
"System.Console": "4.0.0-beta-*",
"System.Collections": "4.0.10-beta-*",
"System.Diagnostics.Debug": "4.0.10-beta-*",
"System.Diagnostics.FileVersionInfo": "4.0.0-beta-*",
"System.Diagnostics.Process": "4.0.0-beta-*",
"System.Diagnostics.Tools": "4.0.0-beta-*",
"System.Dynamic.Runtime": "4.0.10-beta-*",
"System.Globalization": "4.0.10-beta-*",
"System.IO": "4.0.10-beta-*",
"System.IO.FileSystem": "4.0.0-beta-*",
"System.IO.FileSystem.Primitives": "4.0.0-beta-*",
"System.IO.Pipes": "4.0.0-beta-*",
"System.Linq": "4.0.0-beta-*",
"System.Linq.Expressions": "4.0.10-beta-*",
"System.ObjectModel": "4.0.10-beta-*",
"System.Reflection": "4.0.10-beta-*",
"System.Reflection.Extensions": "4.0.0-beta-*",
"System.Reflection.Primitives": "4.0.0-beta-*",
"System.Reflection.TypeExtensions": "4.0.0-beta-*",
"System.Resources.ResourceManager": "4.0.0-beta-*",
"System.Runtime": "4.0.20-beta-*",
"System.Runtime.Extensions": "4.0.10-beta-*",
"System.Runtime.Handles": "4.0.0-beta-*",
"System.Runtime.InteropServices": "4.0.20-beta-*",
"System.Security.Cryptography.Hashing.Algorithms": "4.0.0-beta-*",
"System.Security.Principal": "4.0.0-beta-*",
"System.Text.Encoding": "4.0.10-beta-*",
"System.Text.Encoding.Extensions": "4.0.10-beta-*",
"System.Threading": "4.0.10-beta-*",
"System.Threading.Thread": "4.0.0-beta-*",
"System.Threading.Tasks": "4.0.10-beta-*",
"System.Threading.Tasks.Parallel": "4.0.0-beta-*",
"System.Xml.ReaderWriter": "4.0.10-beta-*",
"System.Xml.XDocument": "4.0.10-beta-*",
"System.Xml.XmlDocument": "4.0.0-beta-*",
},
"frameworks": {
"dnxcore50": {}
}
}
......@@ -7,6 +7,7 @@
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Reflection;
using Microsoft.CodeAnalysis.CodeGen;
using Microsoft.CodeAnalysis.Collections;
using Microsoft.CodeAnalysis.CSharp.Syntax;
......@@ -213,7 +214,7 @@ internal void DecodeSecurityAttribute<T>(Symbol targetSymbol, CSharpCompilation
Debug.Assert(!this.HasErrors);
bool hasErrors;
Cci.SecurityAction action = DecodeSecurityAttributeAction(targetSymbol, compilation, arguments.AttributeSyntaxOpt, out hasErrors, arguments.Diagnostics);
DeclarativeSecurityAction action = DecodeSecurityAttributeAction(targetSymbol, compilation, arguments.AttributeSyntaxOpt, out hasErrors, arguments.Diagnostics);
if (!hasErrors)
{
......@@ -232,7 +233,7 @@ internal void DecodeSecurityAttribute<T>(Symbol targetSymbol, CSharpCompilation
}
}
private Cci.SecurityAction DecodeSecurityAttributeAction(Symbol targetSymbol, CSharpCompilation compilation, AttributeSyntax nodeOpt, out bool hasErrors, DiagnosticBag diagnostics)
private DeclarativeSecurityAction DecodeSecurityAttributeAction(Symbol targetSymbol, CSharpCompilation compilation, AttributeSyntax nodeOpt, out bool hasErrors, DiagnosticBag diagnostics)
{
Debug.Assert((object)targetSymbol != null);
Debug.Assert(targetSymbol.Kind == SymbolKind.Assembly || targetSymbol.Kind == SymbolKind.NamedType || targetSymbol.Kind == SymbolKind.Method);
......@@ -256,7 +257,7 @@ private Cci.SecurityAction DecodeSecurityAttributeAction(Symbol targetSymbol, CS
if (this.IsTargetAttribute(targetSymbol, AttributeDescription.HostProtectionAttribute))
{
hasErrors = false;
return Cci.SecurityAction.LinkDemand;
return DeclarativeSecurityAction.LinkDemand;
}
}
else
......@@ -265,54 +266,55 @@ private Cci.SecurityAction DecodeSecurityAttributeAction(Symbol targetSymbol, CS
TypeSymbol firstArgType = (TypeSymbol)firstArg.Type;
if ((object)firstArgType != null && firstArgType.Equals(compilation.GetWellKnownType(WellKnownType.System_Security_Permissions_SecurityAction)))
{
var securityAction = (Cci.SecurityAction)firstArg.Value;
hasErrors = !ValidateSecurityAction(securityAction, targetSymbol, nodeOpt, diagnostics);
return securityAction;
return DecodeSecurityAction(firstArg, targetSymbol, nodeOpt, diagnostics, out hasErrors);
}
}
// CS7048: First argument to a security attribute must be a valid SecurityAction
diagnostics.Add(ErrorCode.ERR_SecurityAttributeMissingAction, nodeOpt != null ? nodeOpt.Name.Location : NoLocation.Singleton);
hasErrors = true;
return default(Cci.SecurityAction);
return DeclarativeSecurityAction.None;
}
private bool ValidateSecurityAction(Cci.SecurityAction securityAction, Symbol targetSymbol, AttributeSyntax nodeOpt, DiagnosticBag diagnostics)
private DeclarativeSecurityAction DecodeSecurityAction(TypedConstant typedValue, Symbol targetSymbol, AttributeSyntax nodeOpt, DiagnosticBag diagnostics, out bool hasErrors)
{
Debug.Assert((object)targetSymbol != null);
Debug.Assert(targetSymbol.Kind == SymbolKind.Assembly || targetSymbol.Kind == SymbolKind.NamedType || targetSymbol.Kind == SymbolKind.Method);
int securityAction = (int)typedValue.Value;
bool isPermissionRequestAction;
switch (securityAction)
{
case Cci.SecurityAction.InheritanceDemand:
case Cci.SecurityAction.LinkDemand:
case (int)DeclarativeSecurityAction.InheritanceDemand:
case (int)DeclarativeSecurityAction.LinkDemand:
if (this.IsTargetAttribute(targetSymbol, AttributeDescription.PrincipalPermissionAttribute))
{
// CS7052: SecurityAction value '{0}' is invalid for PrincipalPermission attribute
string displayString;
Location syntaxLocation = GetSecurityAttributeActionSyntaxLocation(nodeOpt, securityAction, out displayString);
Location syntaxLocation = GetSecurityAttributeActionSyntaxLocation(nodeOpt, typedValue, out displayString);
diagnostics.Add(ErrorCode.ERR_PrincipalPermissionInvalidAction, syntaxLocation, displayString);
return false;
hasErrors = true;
return DeclarativeSecurityAction.None;
}
isPermissionRequestAction = false;
break;
case Cci.SecurityAction.Undocumented:
case 1:
// Native compiler allows security action value 1 for security attributes on types/methods, even though there is no corresponding field in System.Security.Permissions.SecurityAction enum.
// We will maintain compatibility.
case Cci.SecurityAction.Assert:
case Cci.SecurityAction.Demand:
case Cci.SecurityAction.PermitOnly:
case Cci.SecurityAction.Deny:
case (int)DeclarativeSecurityAction.Assert:
case (int)DeclarativeSecurityAction.Demand:
case (int)DeclarativeSecurityAction.PermitOnly:
case (int)DeclarativeSecurityAction.Deny:
isPermissionRequestAction = false;
break;
case Cci.SecurityAction.RequestMinimum:
case Cci.SecurityAction.RequestOptional:
case Cci.SecurityAction.RequestRefuse:
case (int)DeclarativeSecurityAction.RequestMinimum:
case (int)DeclarativeSecurityAction.RequestOptional:
case (int)DeclarativeSecurityAction.RequestRefuse:
isPermissionRequestAction = true;
break;
......@@ -320,9 +322,10 @@ private bool ValidateSecurityAction(Cci.SecurityAction securityAction, Symbol ta
{
// CS7049: Security attribute '{0}' has an invalid SecurityAction value '{1}'
string displayString;
Location syntaxLocation = GetSecurityAttributeActionSyntaxLocation(nodeOpt, securityAction, out displayString);
Location syntaxLocation = GetSecurityAttributeActionSyntaxLocation(nodeOpt, typedValue, out displayString);
diagnostics.Add(ErrorCode.ERR_SecurityAttributeInvalidAction, syntaxLocation, nodeOpt != null ? nodeOpt.GetErrorDisplayName() : "", displayString);
return false;
hasErrors = true;
return DeclarativeSecurityAction.None;
}
}
......@@ -335,9 +338,10 @@ private bool ValidateSecurityAction(Cci.SecurityAction securityAction, Symbol ta
// CS7051: SecurityAction value '{0}' is invalid for security attributes applied to a type or a method
string displayString;
Location syntaxLocation = GetSecurityAttributeActionSyntaxLocation(nodeOpt, securityAction, out displayString);
Location syntaxLocation = GetSecurityAttributeActionSyntaxLocation(nodeOpt, typedValue, out displayString);
diagnostics.Add(ErrorCode.ERR_SecurityAttributeInvalidActionTypeOrMethod, syntaxLocation, displayString);
return false;
hasErrors = true;
return DeclarativeSecurityAction.None;
}
}
else
......@@ -348,16 +352,18 @@ private bool ValidateSecurityAction(Cci.SecurityAction securityAction, Symbol ta
// CS7050: SecurityAction value '{0}' is invalid for security attributes applied to an assembly
string displayString;
Location syntaxLocation = GetSecurityAttributeActionSyntaxLocation(nodeOpt, securityAction, out displayString);
Location syntaxLocation = GetSecurityAttributeActionSyntaxLocation(nodeOpt, typedValue, out displayString);
diagnostics.Add(ErrorCode.ERR_SecurityAttributeInvalidActionAssembly, syntaxLocation, displayString);
return false;
hasErrors = true;
return DeclarativeSecurityAction.None;
}
}
return true;
hasErrors = false;
return (DeclarativeSecurityAction)securityAction;
}
private static Location GetSecurityAttributeActionSyntaxLocation(AttributeSyntax nodeOpt, Cci.SecurityAction value, out string displayString)
private static Location GetSecurityAttributeActionSyntaxLocation(AttributeSyntax nodeOpt, TypedConstant typedValue, out string displayString)
{
if (nodeOpt == null)
{
......@@ -366,10 +372,10 @@ private static Location GetSecurityAttributeActionSyntaxLocation(AttributeSyntax
}
var argList = nodeOpt.ArgumentList;
if ((argList == null) || argList.Arguments.IsEmpty())
if (argList == null || argList.Arguments.IsEmpty())
{
// Optional SecurityAction parameter with default value.
displayString = value.ToString();
displayString = typedValue.Value.ToString();
return nodeOpt.Location;
}
......
......@@ -1545,7 +1545,7 @@ internal IEnumerable<Cci.SecurityAttribute> GetSecurityAttributes()
if (attribute != null)
{
yield return new Cci.SecurityAttribute((Cci.SecurityAction)constantValue, attribute);
yield return new Cci.SecurityAttribute((DeclarativeSecurityAction)(int)constantValue, attribute);
}
}
}
......
......@@ -52,7 +52,7 @@ public struct EventDescriptor
// Verify [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
var securityAttribute = typeSecurityAttributes.First();
Assert.Equal(Cci.SecurityAction.LinkDemand, securityAttribute.Action);
Assert.Equal(DeclarativeSecurityAction.LinkDemand, securityAttribute.Action);
var typeAttribute = (CSharpAttributeData)securityAttribute.Attribute;
Assert.Equal(hostProtectionAttr, typeAttribute.AttributeClass);
Assert.Equal(0, typeAttribute.CommonConstructorArguments.Length);
......@@ -1316,21 +1316,21 @@ public class C
// Verify [PrincipalPermission(SecurityAction.Demand, Role=@""User1"")]
securityAttribute = typeSecurityAttributes.First();
Assert.Equal(Cci.SecurityAction.Demand, securityAttribute.Action);
Assert.Equal(DeclarativeSecurityAction.Demand, securityAttribute.Action);
var typeAttribute = (CSharpAttributeData)securityAttribute.Attribute;
Assert.Equal(principalPermAttr, typeAttribute.AttributeClass);
Assert.Equal(1, typeAttribute.CommonConstructorArguments.Length);
typeAttribute.VerifyValue(0, TypedConstantKind.Enum, (int)Cci.SecurityAction.Demand);
typeAttribute.VerifyValue(0, TypedConstantKind.Enum, (int)DeclarativeSecurityAction.Demand);
Assert.Equal(1, typeAttribute.CommonNamedArguments.Length);
typeAttribute.VerifyNamedArgumentValue(0, "Role", TypedConstantKind.Primitive, "User1");
// Verify [PrincipalPermission(SecurityAction.Assert, Role=@""User2"")]
securityAttribute = typeSecurityAttributes.Last();
Assert.Equal(Cci.SecurityAction.Assert, securityAttribute.Action);
Assert.Equal(DeclarativeSecurityAction.Assert, securityAttribute.Action);
typeAttribute = (CSharpAttributeData)securityAttribute.Attribute;
Assert.Equal(principalPermAttr, typeAttribute.AttributeClass);
Assert.Equal(1, typeAttribute.CommonConstructorArguments.Length);
typeAttribute.VerifyValue(0, TypedConstantKind.Enum, (int)Cci.SecurityAction.Assert);
typeAttribute.VerifyValue(0, TypedConstantKind.Enum, (int)DeclarativeSecurityAction.Assert);
Assert.Equal(1, typeAttribute.CommonNamedArguments.Length);
typeAttribute.VerifyNamedArgumentValue(0, "Role", TypedConstantKind.Primitive, "User2");
......@@ -1341,21 +1341,21 @@ public class C
// Verify [PrincipalPermission(SecurityAction.Demand, Role=@""User1"")]
securityAttribute = methodSecurityAttributes.First();
Assert.Equal(Cci.SecurityAction.Demand, securityAttribute.Action);
Assert.Equal(DeclarativeSecurityAction.Demand, securityAttribute.Action);
var methodAttribute = (CSharpAttributeData)securityAttribute.Attribute;
Assert.Equal(principalPermAttr, methodAttribute.AttributeClass);
Assert.Equal(1, methodAttribute.CommonConstructorArguments.Length);
methodAttribute.VerifyValue(0, TypedConstantKind.Enum, (int)Cci.SecurityAction.Demand);
methodAttribute.VerifyValue(0, TypedConstantKind.Enum, (int)DeclarativeSecurityAction.Demand);
Assert.Equal(1, methodAttribute.CommonNamedArguments.Length);
methodAttribute.VerifyNamedArgumentValue(0, "Role", TypedConstantKind.Primitive, "User1");
// Verify [PrincipalPermission(SecurityAction.Demand, Role=@""User2"")]
securityAttribute = methodSecurityAttributes.Last();
Assert.Equal(Cci.SecurityAction.Demand, securityAttribute.Action);
Assert.Equal(DeclarativeSecurityAction.Demand, securityAttribute.Action);
methodAttribute = (CSharpAttributeData)securityAttribute.Attribute;
Assert.Equal(principalPermAttr, methodAttribute.AttributeClass);
Assert.Equal(1, methodAttribute.CommonConstructorArguments.Length);
methodAttribute.VerifyValue(0, TypedConstantKind.Enum, (int)Cci.SecurityAction.Demand);
methodAttribute.VerifyValue(0, TypedConstantKind.Enum, (int)DeclarativeSecurityAction.Demand);
Assert.Equal(1, methodAttribute.CommonNamedArguments.Length);
methodAttribute.VerifyNamedArgumentValue(0, "Role", TypedConstantKind.Primitive, "User2");
}
......
......@@ -6,6 +6,7 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
......@@ -1259,7 +1260,6 @@ public static void Main()
#region UnverifiableCode, SecurityPermission(SkipVerification)
// Verify via CCI
[Fact]
public void CheckUnsafeAttributes1()
{
......@@ -1282,7 +1282,6 @@ public static void Main()
VerifyUnverifiableCodeAttribute(moduleAttribute, compilation);
}
// Verify via CCI (module case)
[Fact]
public void CheckUnsafeAttributes2()
{
......@@ -1314,8 +1313,8 @@ internal static void VerifySkipVerificationSecurityAttribute(Cci.SecurityAttribu
var assemblyAttributeArgument = assemblyAttribute.CommonConstructorArguments.Single();
Assert.Equal(compilation.GetWellKnownType(WellKnownType.System_Security_Permissions_SecurityAction), assemblyAttributeArgument.Type);
Assert.Equal(Cci.SecurityAction.RequestMinimum, securityAttribute.Action);
Assert.Equal(Cci.SecurityAction.RequestMinimum, (Cci.SecurityAction)assemblyAttributeArgument.Value);
Assert.Equal(DeclarativeSecurityAction.RequestMinimum, securityAttribute.Action);
Assert.Equal(DeclarativeSecurityAction.RequestMinimum, (DeclarativeSecurityAction)(int)assemblyAttributeArgument.Value);
var assemblyAttributeNamedArgument = assemblyAttribute.CommonNamedArguments.Single();
Assert.Equal("SkipVerification", assemblyAttributeNamedArgument.Key);
......
......@@ -99,10 +99,9 @@
<None Include="csc.rsp">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
</ItemGroup>
<ImportGroup Label="Targets">
<Import Project="..\..\..\..\build\Targets\VSL.Imports.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
</ImportGroup>
</Project>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
</packages>
......@@ -479,6 +479,11 @@ private void LogErrorOutput(string output)
/// </remarks>
internal abstract void LogMessages(string output, MessageImportance messageImportance);
public string GenerateResponseFileContents()
{
return GenerateResponseFileCommands();
}
/// <summary>
/// Get the command line arguments to pass to the compiler.
/// </summary>
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Xunit;
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Linq;
using Microsoft.Build.Framework;
using Microsoft.CodeAnalysis.BuildTasks;
using Xunit;
using Moq;
namespace Microsoft.CodeAnalysis.BuildTasks.UnitTests
{
public sealed class CscTests
{
[Fact]
public void SingleSource()
{
var csc = new Csc();
csc.Sources = MSBuildUtil.CreateTaskItems("test.cs");
Assert.Equal("/out:test.exe test.cs", csc.GenerateResponseFileContents());
}
[Fact]
public void MultipleSourceFiles()
{
var csc = new Csc();
csc.Sources = MSBuildUtil.CreateTaskItems("test1.cs", "test2.cs");
Assert.Equal("/out:test1.exe test1.cs test2.cs", csc.GenerateResponseFileContents());
}
[Fact]
public void TargetTypeDll()
{
var csc = new Csc();
csc.TargetType = "library";
csc.Sources = MSBuildUtil.CreateTaskItems("test.cs");
Assert.Equal("/out:test.dll /target:library test.cs", csc.GenerateResponseFileContents());
}
[Fact]
public void TargetTypeBad()
{
var csc = new Csc();
csc.TargetType = "bad";
csc.Sources = MSBuildUtil.CreateTaskItems("test.cs");
Assert.Equal("/out:test.exe /target:bad test.cs", csc.GenerateResponseFileContents());
}
[Fact]
public void OutputAssembly()
{
var csc = new Csc();
csc.Sources = MSBuildUtil.CreateTaskItems("test.cs");
csc.OutputAssembly = MSBuildUtil.CreateTaskItem("x.exe");
Assert.Equal("/out:x.exe test.cs", csc.GenerateResponseFileContents());
}
[Fact]
public void DefineConstantsSimple()
{
Action<string> test = (s) =>
{
var csc = new Csc();
csc.DefineConstants = s;
csc.Sources = MSBuildUtil.CreateTaskItems("test.cs");
Assert.Equal("/define:D1;D2 /out:test.exe test.cs", csc.GenerateResponseFileContents());
};
test("D1;D2");
test("D1,D2");
test("D1 D2");
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="Settings">
<Import Project="..\..\..\..\build\Targets\VSL.Settings.targets" />
</ImportGroup>
<PropertyGroup>
<Nonshipping>true</Nonshipping>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
<ProjectGuid>{1DFEA9C5-973C-4179-9B1B-0F32288E1EF2}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.BuildTasks.UnitTests</RootNamespace>
<AssemblyName>Microsoft.Build.Tasks.CodeAnalysis.UnitTests</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<SolutionDir Condition="'$(SolutionDir)' == '' OR '$(SolutionDir)' == '*Undefined*'">..\..\..\..\</SolutionDir>
<RestorePackages>true</RestorePackages>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\..\Test\PdbUtilities\PdbUtilities.csproj">
<Project>{AFDE6BEA-5038-4A4A-A88E-DBD2E4088EED}</Project>
<Name>PdbUtilities</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Test\Utilities\TestUtilities.csproj">
<Project>{76C6F005-C89D-4348-BB4A-391898DBEB52}</Project>
<Name>TestUtilities</Name>
</ProjectReference>
<ProjectReference Include="..\..\Test\Resources\Core\CompilerTestResources.vbproj">
<Project>{7FE6B002-89D8-4298-9B1B-0B5C247DD1FD}</Project>
<Name>CompilerTestResources</Name>
</ProjectReference>
<ProjectReference Include="..\..\Test\Utilities\Core2\CompilerTestUtilities2.csproj">
<Project>{F7712928-1175-47B3-8819-EE086753DEE2}</Project>
<Name>CompilerTestUtilities2</Name>
</ProjectReference>
<ProjectReference Include="..\MSBuildTask\MSBuildTask.csproj">
<Project>{d874349c-8bb3-4bdc-8535-2d52ccca1198}</Project>
<Name>MSBuildTask</Name>
</ProjectReference>
<ProjectReference Include="..\Portable\CodeAnalysis.csproj">
<Project>{1ee8cad3-55f9-4d91-96b2-084641da9a6c}</Project>
<Name>CodeAnalysis</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup Label="File References">
<Reference Include="..\..\..\..\packages\System.Reflection.Metadata.$(SystemReflectionMetadataVersion)\lib\portable-net45+win8\System.Reflection.Metadata.dll" />
<Reference Include="..\..\..\..\packages\System.Collections.Immutable.$(SystemCollectionsImmutableVersion)\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll" />
<Reference Include="..\..\..\..\packages\Microsoft.DiaSymReader.1.0.5\lib\net45\Microsoft.DiaSymReader.dll" />
<Reference Include="..\..\..\..\packages\Moq.4.2.1402.2112\lib\net40\Moq.dll" />
<Reference Include="Microsoft.Build.Framework">
<HintPath>$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\MSBuild\v14.0\Microsoft.Build.Framework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\MSBuild\v14.0\Microsoft.Build.Utilities.Core.dll</HintPath>
</Reference>
<Reference Include="xunit">
<HintPath>..\..\..\..\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
</Reference>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|ARM' ">
<PlatformTarget>ARM</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|ARM' ">
<PlatformTarget>ARM</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutDir>..\..\..\..\Binaries\Debug\amd64</OutDir>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<NoWarn>1591</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutDir>..\..\..\..\Binaries\Release\amd64</OutDir>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<NoWarn>1591</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CodeAnalysis.Test.Resources.Proprietary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\Microsoft.CodeAnalysis.Test.Resources.Proprietary.1.0.0-rc3-20150528-03\lib\net45\Microsoft.CodeAnalysis.Test.Resources.Proprietary.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Collections" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CscTests.cs" />
<Compile Include="MSBuildUtil.cs" />
<Compile Include="VbcTests.cs" />
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ImportGroup Label="Targets">
<Import Project="..\..\..\..\build\Targets\VSL.Imports.targets" />
</ImportGroup>
</Project>
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.Build.Framework;
using Moq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Microsoft.CodeAnalysis.BuildTasks.UnitTests
{
internal static class MSBuildUtil
{
public static ITaskItem[] CreateTaskItems(params string[] fileNames)
{
return fileNames.Select(CreateTaskItem).ToArray();
}
public static ITaskItem CreateTaskItem(string fileName)
{
var taskItem = new Mock<ITaskItem>(MockBehavior.Strict);
taskItem.Setup(x => x.ItemSpec).Returns(fileName);
return taskItem.Object;
}
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.CodeAnalysis.BuildTasks;
using Xunit;
namespace Microsoft.CodeAnalysis.BuildTasks.UnitTests
{
public sealed class VbcTests
{
[Fact]
public void SingleSource()
{
var vbc = new Vbc();
vbc.Sources = MSBuildUtil.CreateTaskItems("test.vb");
Assert.Equal("/optionstrict:custom /out:test.exe test.vb", vbc.GenerateResponseFileContents());
}
[Fact]
public void MultipleSourceFiles()
{
var vbc = new Vbc();
vbc.Sources = MSBuildUtil.CreateTaskItems("test1.vb", "test2.vb");
Assert.Equal("/optionstrict:custom /out:test1.exe test1.vb test2.vb", vbc.GenerateResponseFileContents());
}
[Fact]
public void TargetTypeDll()
{
var vbc = new Vbc();
vbc.Sources = MSBuildUtil.CreateTaskItems("test.vb");
vbc.TargetType = "library";
Assert.Equal("/optionstrict:custom /out:test.dll /target:library test.vb", vbc.GenerateResponseFileContents());
}
[Fact]
public void TargetTypeBad()
{
var vbc = new Vbc();
vbc.Sources = MSBuildUtil.CreateTaskItems("test.vb");
vbc.TargetType = "bad";
Assert.Equal("/optionstrict:custom /out:test.exe /target:bad test.vb", vbc.GenerateResponseFileContents());
}
[Fact]
public void OutputAssembly()
{
var vbc = new Vbc();
vbc.OutputAssembly = MSBuildUtil.CreateTaskItem("x.exe");
vbc.Sources = MSBuildUtil.CreateTaskItems("test.vb");
Assert.Equal("/optionstrict:custom /out:x.exe test.vb", vbc.GenerateResponseFileContents());
}
[Fact]
public void DefineConstantsSimple()
{
Action<string> test = (s) =>
{
var vbc = new Vbc();
vbc.DefineConstants = s;
vbc.Sources = MSBuildUtil.CreateTaskItems("test.vb");
Assert.Equal($@"/optionstrict:custom /define:""{s}"" /out:test.exe test.vb", vbc.GenerateResponseFileContents());
};
test("D1;D2");
test("D1,D2");
test("D1 D2");
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.CodeAnalysis.Test.Resources.Proprietary" version="1.0.0-rc3-20150528-03" targetFramework="net45" />
<package id="Microsoft.DiaSymReader" version="1.0.5" targetFramework="net45" />
<package id="Moq" version="4.2.1402.2112" targetFramework="net45" />
<package id="xunit" version="1.9.2" targetFramework="net45" />
</packages>
......@@ -426,7 +426,6 @@
<Compile Include="PEWriter\ReturnValueParameter.cs" />
<Compile Include="PEWriter\RootModuleType.cs" />
<Compile Include="PEWriter\SectionHeader.cs" />
<Compile Include="PEWriter\SecurityAction.cs" />
<Compile Include="PEWriter\SequencePoint.cs" />
<Compile Include="PEWriter\TypeLibTypeFlags.cs" />
<Compile Include="PEWriter\Types.cs" />
......
......@@ -2795,11 +2795,11 @@ private void PopulateDeclSecurityTableRows()
private void PopulateDeclSecurityTableRowsFor(uint parent, IEnumerable<SecurityAttribute> attributes)
{
OrderPreservingMultiDictionary<SecurityAction, ICustomAttribute> groupedSecurityAttributes = null;
OrderPreservingMultiDictionary<DeclarativeSecurityAction, ICustomAttribute> groupedSecurityAttributes = null;
foreach (SecurityAttribute securityAttribute in attributes)
{
groupedSecurityAttributes = groupedSecurityAttributes ?? OrderPreservingMultiDictionary<SecurityAction, ICustomAttribute>.GetInstance();
groupedSecurityAttributes = groupedSecurityAttributes ?? OrderPreservingMultiDictionary<DeclarativeSecurityAction, ICustomAttribute>.GetInstance();
groupedSecurityAttributes.Add(securityAttribute.Action, securityAttribute.Attribute);
}
......@@ -2811,7 +2811,7 @@ private void PopulateDeclSecurityTableRowsFor(uint parent, IEnumerable<SecurityA
DeclSecurityRow r = new DeclSecurityRow();
r.Parent = parent;
foreach (SecurityAction securityAction in groupedSecurityAttributes.Keys)
foreach (DeclarativeSecurityAction securityAction in groupedSecurityAttributes.Keys)
{
r.Action = (ushort)securityAction;
r.PermissionSet = (uint)this.GetPermissionSetIndex(groupedSecurityAttributes[securityAction]);
......
......@@ -4,6 +4,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Reflection;
using System.Runtime.InteropServices;
using Roslyn.Utilities;
using EmitContext = Microsoft.CodeAnalysis.Emit.EmitContext;
......@@ -89,23 +90,13 @@ public static uint EnumerableCount<T>(IEnumerable<T>/*?*/ enumerable)
/// </summary>
internal struct SecurityAttribute
{
private readonly SecurityAction _action;
private readonly ICustomAttribute _attribute;
public DeclarativeSecurityAction Action { get; }
public ICustomAttribute Attribute { get; }
public SecurityAttribute(SecurityAction action, ICustomAttribute attribute)
public SecurityAttribute(DeclarativeSecurityAction action, ICustomAttribute attribute)
{
_attribute = attribute;
_action = action;
}
public SecurityAction Action
{
get { return _action; }
}
public ICustomAttribute Attribute
{
get { return _attribute; }
Action = action;
Attribute = attribute;
}
}
......
......@@ -30,6 +30,7 @@ internal sealed class PeWriter
/// True if we should attempt to generate a deterministic output (no timestamps or random data).
/// </summary>
private readonly bool _deterministic;
private readonly int _timeStamp;
private readonly string _pdbPathOpt;
private readonly bool _is32bit;
......@@ -54,6 +55,11 @@ internal sealed class PeWriter
_nativeResourcesOpt = nativeResourcesOpt;
_nativeResourceSectionOpt = nativeResourceSectionOpt;
_is32bit = !_properties.Requires64bits;
// In the PE File Header this is a "Time/Date Stamp" whose description is "Time and date
// the file was created in seconds since January 1st 1970 00:00:00 or 0"
// However, when we want to make it deterministic we fill it in (later) with bits from the hash of the full PE file.
_timeStamp = _deterministic ? 0 : (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
}
private bool EmitPdb => _pdbPathOpt != null;
......@@ -495,17 +501,12 @@ private CorHeader CreateCorHeader(MetadataSizes metadataSizes, int textSectionRv
out CoffHeader coffHeader,
out NtHeader ntHeader)
{
// In the PE File Header this is a "Time/Date Stamp" whose description is "Time and date
// the file was created in seconds since January 1st 1970 00:00:00 or 0"
// However, when we want to make it deterministic we fill it in (later) with bits from the hash of the full PE file.
int timeStamp = _deterministic ? 0 : (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
short sectionCount = (short)sectionHeaders.Count;
coffHeader = new CoffHeader(
machine: (_properties.Machine == 0) ? Machine.I386 : _properties.Machine,
numberOfSections: sectionCount,
timeDateStamp: timeStamp,
timeDateStamp: _timeStamp,
pointerToSymbolTable: 0,
numberOfSymbols: 0,
sizeOfOptionalHeader: (short)(_is32bit ? 224 : 240), // TODO: constants
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.Cci
{
internal enum SecurityAction
{
// this value is accepted by the compiler, but not part of the documented SecurityAction enum.
Undocumented = 1,
// Demand permission of all caller
Demand = 2,
// Assert permission so callers don't need
Assert = 3,
// Deny permissions so checks will fail
Deny = 4,
// Reduce permissions so check will fail
PermitOnly = 5,
// Demand permission of caller
LinkDemand = 6,
// Demand permission of a subclass
InheritanceDemand = 7,
// Request minimum permissions to run
RequestMinimum = 8,
// Request optional additional permissions
RequestOptional = 9,
// Refuse to be granted these permissions
RequestRefuse = 10,
}
}
......@@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Reflection;
using System.Threading;
using Microsoft.CodeAnalysis.CodeGen;
using Roslyn.Utilities;
......@@ -22,7 +23,7 @@ internal sealed class SecurityWellKnownAttributeData
// Fixup involves reading the file contents of the resolved file and emitting it in the permission set.
private string[] _lazyPathsForPermissionSetFixup;
public void SetSecurityAttribute(int attributeIndex, Cci.SecurityAction action, int totalSourceAttributes)
public void SetSecurityAttribute(int attributeIndex, DeclarativeSecurityAction action, int totalSourceAttributes)
{
Debug.Assert(attributeIndex >= 0 && attributeIndex < totalSourceAttributes);
Debug.Assert(action != 0);
......@@ -68,7 +69,7 @@ public IEnumerable<Cci.SecurityAttribute> GetSecurityAttributes<T>(ImmutableArra
{
if (_lazySecurityActions[i] != 0)
{
var action = (Cci.SecurityAction)_lazySecurityActions[i];
var action = (DeclarativeSecurityAction)_lazySecurityActions[i];
Cci.ICustomAttribute attribute = customAttributes[i];
if (_lazyPathsForPermissionSetFixup?[i] != null)
......
......@@ -3,6 +3,7 @@
Imports System
Imports System.Collections.Generic
Imports System.Collections.Immutable
Imports System.Reflection
Imports System.Runtime.InteropServices
Imports System.Text
Imports System.Threading
......@@ -186,7 +187,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Friend Sub DecodeSecurityAttribute(Of T As {WellKnownAttributeData, ISecurityAttributeTarget, New})(targetSymbol As Symbol, compilation As VisualBasicCompilation, ByRef arguments As DecodeWellKnownAttributeArguments(Of AttributeSyntax, VisualBasicAttributeData, AttributeLocation))
Dim hasErrors As Boolean = False
Dim action As Cci.SecurityAction = Me.DecodeSecurityAttributeAction(targetSymbol, compilation, arguments.AttributeSyntaxOpt, hasErrors, arguments.Diagnostics)
Dim action As DeclarativeSecurityAction = Me.DecodeSecurityAttributeAction(targetSymbol, compilation, arguments.AttributeSyntaxOpt, hasErrors, arguments.Diagnostics)
If Not hasErrors Then
Dim data As T = arguments.GetOrCreateData(Of T)()
Dim securityData As SecurityWellKnownAttributeData = data.GetOrCreateData()
......@@ -207,7 +208,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
nodeOpt As AttributeSyntax,
ByRef hasErrors As Boolean,
diagnostics As DiagnosticBag
) As Cci.SecurityAction
) As DeclarativeSecurityAction
Debug.Assert(Not hasErrors)
Debug.Assert(Me.IsSecurityAttribute(compilation))
Debug.Assert(targetSymbol.Kind = SymbolKind.Assembly OrElse targetSymbol.Kind = SymbolKind.NamedType OrElse targetSymbol.Kind = SymbolKind.Method)
......@@ -226,17 +227,14 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
' We currently allow this case only for the HostProtectionAttribute. In future if need arises, we can exactly match native compiler's behavior.
If Me.IsTargetAttribute(targetSymbol, AttributeDescription.HostProtectionAttribute) Then
Return Cci.SecurityAction.LinkDemand
Return DeclarativeSecurityAction.LinkDemand
End If
Else
Dim firstArg As TypedConstant = Me.CommonConstructorArguments.FirstOrDefault()
Dim firstArgType = DirectCast(firstArg.Type, TypeSymbol)
Dim useSiteDiagnostics As HashSet(Of DiagnosticInfo) = Nothing
If firstArgType IsNot Nothing AndAlso firstArgType.IsOrDerivedFromWellKnownClass(WellKnownType.System_Security_Permissions_SecurityAction, compilation, useSiteDiagnostics) Then
Dim securityAction = DirectCast(firstArg.Value, Cci.SecurityAction)
hasErrors = Not ValidateSecurityAction(targetSymbol, securityAction, nodeOpt, diagnostics)
Return securityAction
Return ValidateSecurityAction(firstArg, targetSymbol, nodeOpt, diagnostics, hasErrors)
End If
diagnostics.Add(If(nodeOpt IsNot Nothing, nodeOpt.Name.GetLocation, NoLocation.Singleton), useSiteDiagnostics)
......@@ -253,18 +251,21 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
End Function
Private Function ValidateSecurityAction(
typedValue As TypedConstant,
targetSymbol As Symbol,
action As Cci.SecurityAction,
nodeOpt As AttributeSyntax,
diagnostics As DiagnosticBag
) As Boolean
diagnostics As DiagnosticBag,
<Out> ByRef hasErrors As Boolean
) As DeclarativeSecurityAction
Debug.Assert(targetSymbol.Kind = SymbolKind.Assembly OrElse targetSymbol.Kind = SymbolKind.NamedType OrElse targetSymbol.Kind = SymbolKind.Method)
Dim securityAction As Integer = CInt(typedValue.Value)
hasErrors = False
Dim isPermissionRequestAction As Boolean
Select Case action
Case Cci.SecurityAction.InheritanceDemand,
Cci.SecurityAction.LinkDemand
Select Case securityAction
Case DeclarativeSecurityAction.InheritanceDemand,
DeclarativeSecurityAction.LinkDemand
If Me.IsTargetAttribute(targetSymbol, AttributeDescription.PrincipalPermissionAttribute) Then
' BC31209: SecurityAction value '{0}' is invalid for PrincipalPermission attribute
......@@ -272,26 +273,27 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
If(nodeOpt IsNot Nothing, nodeOpt.ArgumentList.Arguments(0).GetLocation(), NoLocation.Singleton),
If(nodeOpt IsNot Nothing, nodeOpt.ArgumentList.Arguments(0).ToString(), ""))
Return False
hasErrors = True
Return DeclarativeSecurityAction.None
End If
isPermissionRequestAction = False
Case Cci.SecurityAction.Undocumented
Case 1
' Native compiler allows security action value 1 even though there is no corresponding field in
' System.Security.Permissions.SecurityAction enum.
' We will maintain compatibility.
Case Cci.SecurityAction.Assert,
Cci.SecurityAction.Demand,
Cci.SecurityAction.PermitOnly,
Cci.SecurityAction.Deny
Case DeclarativeSecurityAction.Assert,
DeclarativeSecurityAction.Demand,
DeclarativeSecurityAction.PermitOnly,
DeclarativeSecurityAction.Deny
isPermissionRequestAction = False
Case Cci.SecurityAction.RequestMinimum,
Cci.SecurityAction.RequestOptional,
Cci.SecurityAction.RequestRefuse
Case DeclarativeSecurityAction.RequestMinimum,
DeclarativeSecurityAction.RequestOptional,
DeclarativeSecurityAction.RequestRefuse
isPermissionRequestAction = True
......@@ -302,7 +304,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
If(nodeOpt IsNot Nothing, nodeOpt.Name.ToString, ""),
If(nodeOpt IsNot Nothing, nodeOpt.ArgumentList.Arguments(0).ToString(), ""))
Return False
hasErrors = True
Return DeclarativeSecurityAction.None
End Select
If isPermissionRequestAction Then
......@@ -314,7 +317,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
If(nodeOpt IsNot Nothing, nodeOpt.ArgumentList.Arguments(0).GetLocation, NoLocation.Singleton),
If(nodeOpt IsNot Nothing, nodeOpt.ArgumentList.Arguments(0).ToString(), ""))
Return False
hasErrors = True
Return DeclarativeSecurityAction.None
End If
ElseIf targetSymbol.Kind = SymbolKind.Assembly Then
......@@ -325,10 +329,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
If(nodeOpt IsNot Nothing, nodeOpt.ArgumentList.Arguments(0).GetLocation, NoLocation.Singleton),
If(nodeOpt IsNot Nothing, nodeOpt.ArgumentList.Arguments(0).ToString(), ""))
Return False
hasErrors = True
Return DeclarativeSecurityAction.None
End If
Return True
Return CType(securityAction, DeclarativeSecurityAction)
End Function
''' <summary>
......
......@@ -2899,7 +2899,7 @@ end structure
' Verify <System.Security.Permissions.HostProtection(MayLeakOnAbort := true)>
Dim securityAttribute = typeSecurityAttributes.First()
Assert.Equal(Cci.SecurityAction.LinkDemand, securityAttribute.Action)
Assert.Equal(DeclarativeSecurityAction.LinkDemand, securityAttribute.Action)
Dim typeAttribute = DirectCast(securityAttribute.Attribute, VisualBasicAttributeData)
Assert.Equal(hostProtectionAttr, typeAttribute.AttributeClass)
Assert.Equal(0, typeAttribute.CommonConstructorArguments.Length)
......
......@@ -1756,22 +1756,22 @@ end namespace
Dim securityPermissionAttr As NamedTypeSymbol = sourceAssembly.CorLibrary.LookupTopLevelMetadataType(emittedName, True)
' Verify <assembly: SecurityPermission(SecurityAction.RequestOptional, RemotingConfiguration:=true)>
Dim securityAttribute As Microsoft.Cci.SecurityAttribute = assemblySecurityAttributes.First()
Assert.Equal(Cci.SecurityAction.RequestOptional, securityAttribute.Action)
Dim securityAttribute As Cci.SecurityAttribute = assemblySecurityAttributes.First()
Assert.Equal(DeclarativeSecurityAction.RequestOptional, securityAttribute.Action)
Dim typeAttribute = DirectCast(securityAttribute.Attribute, VisualBasicAttributeData)
Assert.Equal(securityPermissionAttr, typeAttribute.AttributeClass)
Assert.Equal(1, typeAttribute.CommonConstructorArguments.Length)
typeAttribute.VerifyValue(0, TypedConstantKind.Enum, CInt(Cci.SecurityAction.RequestOptional))
typeAttribute.VerifyValue(0, TypedConstantKind.Enum, CInt(DeclarativeSecurityAction.RequestOptional))
Assert.Equal(1, typeAttribute.CommonNamedArguments.Length)
typeAttribute.VerifyNamedArgumentValue(0, "RemotingConfiguration", TypedConstantKind.Primitive, True)
' Verify <assembly: SecurityPermission(SecurityAction.RequestMinimum, UnmanagedCode:=true)>
securityAttribute = assemblySecurityAttributes.Last()
Assert.Equal(Cci.SecurityAction.RequestMinimum, securityAttribute.Action)
Assert.Equal(DeclarativeSecurityAction.RequestMinimum, securityAttribute.Action)
typeAttribute = DirectCast(securityAttribute.Attribute, VisualBasicAttributeData)
Assert.Equal(securityPermissionAttr, typeAttribute.AttributeClass)
Assert.Equal(1, typeAttribute.CommonConstructorArguments.Length)
typeAttribute.VerifyValue(0, TypedConstantKind.Enum, CInt(Cci.SecurityAction.RequestMinimum))
typeAttribute.VerifyValue(0, TypedConstantKind.Enum, CInt(DeclarativeSecurityAction.RequestMinimum))
Assert.Equal(1, typeAttribute.CommonNamedArguments.Length)
typeAttribute.VerifyNamedArgumentValue(0, "UnmanagedCode", TypedConstantKind.Primitive, True)
......@@ -1787,21 +1787,21 @@ end namespace
' Verify <PrincipalPermission(SecurityAction.Demand, Role:="User1")>
securityAttribute = typeSecurityAttributes.First()
Assert.Equal(Cci.SecurityAction.Demand, securityAttribute.Action)
Assert.Equal(DeclarativeSecurityAction.Demand, securityAttribute.Action)
typeAttribute = DirectCast(securityAttribute.Attribute, VisualBasicAttributeData)
Assert.Equal(principalPermAttr, typeAttribute.AttributeClass)
Assert.Equal(1, typeAttribute.CommonConstructorArguments.Length)
typeAttribute.VerifyValue(0, TypedConstantKind.Enum, CInt(Cci.SecurityAction.Demand))
typeAttribute.VerifyValue(0, TypedConstantKind.Enum, CInt(DeclarativeSecurityAction.Demand))
Assert.Equal(1, typeAttribute.CommonNamedArguments.Length)
typeAttribute.VerifyNamedArgumentValue(0, "Role", TypedConstantKind.Primitive, "User1")
' Verify <PrincipalPermission(SecurityAction.RequestOptional, Role:="User2")>
securityAttribute = typeSecurityAttributes.Last()
Assert.Equal(Cci.SecurityAction.Assert, securityAttribute.Action)
Assert.Equal(DeclarativeSecurityAction.Assert, securityAttribute.Action)
typeAttribute = DirectCast(securityAttribute.Attribute, VisualBasicAttributeData)
Assert.Equal(principalPermAttr, typeAttribute.AttributeClass)
Assert.Equal(1, typeAttribute.CommonConstructorArguments.Length)
typeAttribute.VerifyValue(0, TypedConstantKind.Enum, CInt(Cci.SecurityAction.Assert))
typeAttribute.VerifyValue(0, TypedConstantKind.Enum, CInt(DeclarativeSecurityAction.Assert))
Assert.Equal(1, typeAttribute.CommonNamedArguments.Length)
typeAttribute.VerifyNamedArgumentValue(0, "Role", TypedConstantKind.Primitive, "User2")
......@@ -1812,21 +1812,21 @@ end namespace
' Verify <PrincipalPermission(SecurityAction.Demand, Role:="User3")>
securityAttribute = methodSecurityAttributes.First()
Assert.Equal(Cci.SecurityAction.Demand, securityAttribute.Action)
Assert.Equal(DeclarativeSecurityAction.Demand, securityAttribute.Action)
Dim methodAttribute = DirectCast(securityAttribute.Attribute, VisualBasicAttributeData)
Assert.Equal(principalPermAttr, methodAttribute.AttributeClass)
Assert.Equal(1, methodAttribute.CommonConstructorArguments.Length)
methodAttribute.VerifyValue(0, TypedConstantKind.Enum, CInt(Cci.SecurityAction.Demand))
methodAttribute.VerifyValue(0, TypedConstantKind.Enum, CInt(DeclarativeSecurityAction.Demand))
Assert.Equal(1, methodAttribute.CommonNamedArguments.Length)
methodAttribute.VerifyNamedArgumentValue(0, "Role", TypedConstantKind.Primitive, "User3")
' Verify PrincipalPermission(SecurityAction.RequestOptional, Role:="User4")
securityAttribute = methodSecurityAttributes.Last()
Assert.Equal(Cci.SecurityAction.Assert, securityAttribute.Action)
Assert.Equal(DeclarativeSecurityAction.Assert, securityAttribute.Action)
methodAttribute = DirectCast(securityAttribute.Attribute, VisualBasicAttributeData)
Assert.Equal(principalPermAttr, methodAttribute.AttributeClass)
Assert.Equal(1, methodAttribute.CommonConstructorArguments.Length)
methodAttribute.VerifyValue(0, TypedConstantKind.Enum, CInt(Cci.SecurityAction.Assert))
methodAttribute.VerifyValue(0, TypedConstantKind.Enum, CInt(DeclarativeSecurityAction.Assert))
Assert.Equal(1, methodAttribute.CommonNamedArguments.Length)
methodAttribute.VerifyNamedArgumentValue(0, "Role", TypedConstantKind.Primitive, "User4")
End Sub
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace Microsoft.CodeAnalysis.VisualBasic.CommandLine
{
public class Program
{
public static int Main(string[] args)
=> Vbc.Run(args: args,
clientDirectory: AppContext.BaseDirectory,
sdkDirectory: @"C:\Windows\Microsoft.NET\Framework\v4.0.30319",
analyzerLoader: null);
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
using System.Linq;
using System.Reflection;
using Microsoft.VisualStudio.Shell.Interop;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.VisualBasic.CommandLine
{
internal sealed class Vbc : VisualBasicCompiler
{
internal Vbc(string responseFile, string clientDirectory, string baseDirectory, string sdkDirectory, string[] args, IAnalyzerAssemblyLoader analyzerLoader)
: base(VisualBasicCommandLineParser.Default, responseFile, args, clientDirectory, baseDirectory, sdkDirectory, Environment.GetEnvironmentVariable("LIB"), analyzerLoader)
{
}
internal static int Run(string clientDirectory, string sdkDirectory, string[] args, IAnalyzerAssemblyLoader analyzerLoader)
{
FatalError.Handler = FailFast.OnFatalException;
var responseFile = Path.Combine(clientDirectory, VisualBasicCompiler.ResponseFileName);
Vbc compiler = new Vbc(responseFile, clientDirectory, Directory.GetCurrentDirectory(), sdkDirectory, args, analyzerLoader);
return ConsoleUtil.RunWithOutput(compiler.Arguments.Utf8Output, (textWriterOut, _) => compiler.Run(textWriterOut));
}
protected override uint GetSqmAppID()
{
return SqmServiceProvider.CSHARP_APPID;
}
protected override void CompilerSpecificSqm(IVsSqmMulti sqm, uint sqmSession)
{
sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_COMPILERTYPE, (uint)SqmServiceProvider.CompilerType.Compiler);
sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_LANGUAGEVERSION, (uint)Arguments.ParseOptions.LanguageVersion);
sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_WARNINGLEVEL, (uint)Arguments.CompilationOptions.WarningLevel);
//Project complexity # of source files, # of references
sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_SOURCES, (uint)Arguments.SourceFiles.Count());
sqm.SetDatapoint(sqmSession, SqmServiceProvider.DATAID_SQM_ROSLYN_REFERENCES, (uint)Arguments.ReferencePaths.Count());
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="Settings">
<Import Project="..\..\..\..\build\Targets\VSL.Settings.targets" />
</ImportGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{8CE3A581-2969-4864-A803-013E9D977C3A}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.VisualBasic.CommandLine</RootNamespace>
<AssemblyName>vbc</AssemblyName>
<Prefer32Bit>false</Prefer32Bit>
<LargeAddressAware>true</LargeAddressAware>
<StartupObject>Microsoft.CodeAnalysis.VisualBasic.CommandLine.Program</StartupObject>
<SolutionDir Condition="'$(SolutionDir)' == '' OR '$(SolutionDir)' == '*Undefined*'">..\..\..\..\</SolutionDir>
<OutDir>$(OutDir)core-clr\</OutDir>
<RestorePackages>true</RestorePackages>
<AutoGenerateBindingRedirects>True</AutoGenerateBindingRedirects>
<TestCoreClr>true</TestCoreClr>
</PropertyGroup>
<ItemGroup Label="Project References">
<ProjectReference Include="..\..\Core\Portable\CodeAnalysis.csproj">
<Project>{1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}</Project>
<Name>CodeAnalysis</Name>
</ProjectReference>
<ProjectReference Include="..\Portable\BasicCodeAnalysis.vbproj">
<Project>{2523d0e6-df32-4a3e-8ae0-a19bffae2ef6}</Project>
<Name>BasicCodeAnalysis</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="System.Collections.Immutable">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\System.Collections.Immutable.$(SystemCollectionsImmutableVersion)\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
</Reference>
<Reference Include="System.Reflection.Metadata">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\packages\System.Reflection.Metadata.$(SystemReflectionMetadataVersion)\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\Helpers\ConsoleUtil.cs">
<Link>ConsoleUtil.cs</Link>
</Compile>
<Compile Include="Vbc.cs" />
<Compile Include="Program.cs" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleToTest Include="Roslyn.Compilers.VisualBasic.CommandLine.UnitTests" />
</ItemGroup>
<ItemGroup>
<None Include="vbc.exe.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="vbc.rsp">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="project.json" />
</ItemGroup>
<ImportGroup Label="Targets">
<Import Project="..\..\..\..\build\Targets\VSL.Imports.targets" />
</ImportGroup>
<Target Name="CopyExtraFiles" AfterTargets="Build">
<Copy SourceFiles="@(None)" DestinationFolder="$(OutDir)" Condition="'%(Extension)' == '.dll'" />
</Target>
</Project>
{
"dependencies": {
"System.AppContext": "4.0.0-beta-22816",
"System.Console": "4.0.0-beta-22816",
"System.Collections": "4.0.10-beta-22816",
"System.Diagnostics.Debug": "4.0.10-beta-22816",
"System.Diagnostics.FileVersionInfo": "4.0.0-beta-22816",
"System.Diagnostics.Process": "4.0.0-beta-22816",
"System.Diagnostics.Tools": "4.0.0-beta-22816",
"System.Dynamic.Runtime": "4.0.0-beta-22816",
"System.Globalization": "4.0.10-beta-22816",
"System.IO": "4.0.10-beta-22816",
"System.IO.FileSystem": "4.0.0-beta-22816",
"System.IO.FileSystem.Primitives": "4.0.0-beta-22816",
"System.IO.Pipes": "4.0.0-beta-22816",
"System.Linq": "4.0.0-beta-22816",
"System.Linq.Expressions": "4.0.0-beta-22816",
"System.ObjectModel": "4.0.10-beta-22816",
"System.Reflection": "4.0.10-beta-22816",
"System.Reflection.Extensions": "4.0.0-beta-22816",
"System.Reflection.Primitives": "4.0.0-beta-22816",
"System.Reflection.TypeExtensions": "4.0.0-beta-22816",
"System.Resources.ResourceManager": "4.0.0-beta-22816",
"System.Runtime": "4.0.20-beta-22816",
"System.Runtime.Extensions": "4.0.10-beta-22816",
"System.Runtime.Handles": "4.0.0-beta-22816",
"System.Runtime.InteropServices": "4.0.20-beta-22816",
"System.Security.Cryptography.Hashing.Algorithms": "4.0.0-beta-22816",
"System.Security.Principal": "4.0.0-beta-22816",
"System.Text.Encoding": "4.0.10-beta-22816",
"System.Text.Encoding.Extensions": "3.0.10-beta-22816",
"System.Threading": "4.0.0-beta-22816",
"System.Threading.Thread": "4.0.0-beta-22816",
"System.Threading.Tasks": "4.0.10-beta-22816",
"System.Threading.Tasks.Parallel": "4.0.0-beta-22816",
"System.Xml.ReaderWriter": "4.0.10-beta-22816",
"System.Xml.XmlDocument": "4.0.0-beta-22816",
}
}
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
<configuration>
<runtime>
<gcServer enabled="true" />
<gcConcurrent enabled="false"/>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0-1.0.65535.65535" newVersion="1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0-1.0.65535.65535" newVersion="1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.CodeAnalysis.VisualBasic" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0-1.0.65535.65535" newVersion="1.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
# Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
# This file contains command-line options that the VB
# command line compiler (VBC) will process as part
# of every compilation, unless the "/noconfig" option
# is specified.
# Reference the common Framework libraries
/r:Accessibility.dll
/r:System.Configuration.dll
/r:System.Configuration.Install.dll
/r:System.Data.dll
/r:System.Data.OracleClient.dll
/r:System.Deployment.dll
/r:System.Design.dll
/r:System.DirectoryServices.dll
/r:System.dll
/r:System.Drawing.Design.dll
/r:System.Drawing.dll
/r:System.EnterpriseServices.dll
/r:System.Management.dll
/r:System.Messaging.dll
/r:System.Runtime.Remoting.dll
/r:System.Runtime.Serialization.Formatters.Soap.dll
/r:System.Security.dll
/r:System.ServiceProcess.dll
/r:System.Transactions.dll
/r:System.Web.dll
/r:System.Web.Mobile.dll
/r:System.Web.RegularExpressions.dll
/r:System.Web.Services.dll
/r:System.Windows.Forms.dll
/r:System.XML.dll
/r:System.Workflow.Activities.dll
/r:System.Workflow.ComponentModel.dll
/r:System.Workflow.Runtime.dll
/r:System.Runtime.Serialization.dll
/r:System.ServiceModel.dll
/r:System.Core.dll
/r:System.Xml.Linq.dll
/r:System.Data.Linq.dll
/r:System.Data.DataSetExtensions.dll
/r:System.Web.Extensions.dll
/r:System.Web.Extensions.Design.dll
/r:System.ServiceModel.Web.dll
# Import System and Microsoft.VisualBasic
/imports:System
/imports:Microsoft.VisualBasic
/imports:System.Linq
/imports:System.Xml.Linq
/optioninfer+
......@@ -576,7 +576,7 @@ private void VerifyWorker(string markup, bool isBuilder)
private void CheckResults(Document document, int position, bool isBuilder)
{
var triggerInfo = CompletionTriggerInfo.CreateTypeCharTriggerInfo('a', isAugment: true);
var triggerInfo = CompletionTriggerInfo.CreateTypeCharTriggerInfo('a');
var provider = CreateCompletionProvider();
if (isBuilder)
......
......@@ -297,7 +297,7 @@ Class C1
End Sub
End Class
</a>
VerifyBuilder(markup, CompletionTriggerInfo.CreateInvokeCompletionTriggerInfo(isAugment:=True).WithIsDebugger(True))
VerifyBuilder(markup, CompletionTriggerInfo.CreateInvokeCompletionTriggerInfo().WithIsDebugger(True))
End Sub
Private Sub VerifyNotBuilder(markup As XElement, Optional triggerInfo As CompletionTriggerInfo? = Nothing)
......@@ -326,7 +326,7 @@ End Class
End Sub
Private Sub CheckResults(document As Document, position As Integer, isBuilder As Boolean, triggerInfo As CompletionTriggerInfo?)
triggerInfo = If(triggerInfo, CompletionTriggerInfo.CreateTypeCharTriggerInfo("a"c, isAugment:=True))
triggerInfo = If(triggerInfo, CompletionTriggerInfo.CreateTypeCharTriggerInfo("a"c))
Dim provider = CreateCompletionProvider()
......
......@@ -149,45 +149,41 @@ private class ProviderGroup
{
return SpecializedCollections.SingletonEnumerable(firstExclusiveGroup.Group);
}
else
{
// If no exclusive providers provided anything, then go through the remaining
// triggered list and see if any provide items.
var nonExclusiveGroups = providersAndGroups.Where(t => !t.Group.IsExclusive).ToList();
// If we still don't have any items, then we're definitely done.
if (!nonExclusiveGroups.Any(g => g.Group.Items.Any()))
{
return null;
}
// If we do have items, then ask all the other (non exclusive providers) if they
// want to augment the items.
var augmentTriggerInfo = triggerInfo.WithIsAugment(true);
// If no exclusive providers provided anything, then go through the remaining
// triggered list and see if any provide items.
var nonExclusiveGroups = providersAndGroups.Where(t => !t.Group.IsExclusive).ToList();
var usedProviders = nonExclusiveGroups.Select(g => g.Provider);
var nonUsedProviders = completionProviders.Except(usedProviders);
var nonUsedNonExclusiveProviders = new List<ProviderGroup>();
foreach (var p in nonUsedProviders)
{
var g = await GetGroupAsync(p, documentOpt, text, position, augmentTriggerInfo, cancellationToken).ConfigureAwait(false);
if (g != null && !g.IsExclusive)
{
nonUsedNonExclusiveProviders.Add(new ProviderGroup { Provider = p, Group = g });
}
}
// If we still don't have any items, then we're definitely done.
if (!nonExclusiveGroups.Any(g => g.Group.Items.Any()))
{
return null;
}
var allGroups = nonExclusiveGroups.Concat(nonUsedNonExclusiveProviders).ToList();
if (allGroups.Count == 0)
// If we do have items, then ask all the other (non exclusive providers) if they
// want to augment the items.
var usedProviders = nonExclusiveGroups.Select(g => g.Provider);
var nonUsedProviders = completionProviders.Except(usedProviders);
var nonUsedNonExclusiveProviders = new List<ProviderGroup>();
foreach (var p in nonUsedProviders)
{
var g = await GetGroupAsync(p, documentOpt, text, position, triggerInfo, cancellationToken).ConfigureAwait(false);
if (g != null && !g.IsExclusive)
{
return null;
nonUsedNonExclusiveProviders.Add(new ProviderGroup { Provider = p, Group = g });
}
}
// Providers are ordered, but we processed them in our own order. Ensure that the
// groups are properly ordered based on the original providers.
allGroups.Sort((p1, p2) => completionProviderToIndex[p1.Provider] - completionProviderToIndex[p2.Provider]);
return allGroups.Select(g => g.Group);
var allGroups = nonExclusiveGroups.Concat(nonUsedNonExclusiveProviders).ToList();
if (allGroups.Count == 0)
{
return null;
}
// Providers are ordered, but we processed them in our own order. Ensure that the
// groups are properly ordered based on the original providers.
allGroups.Sort((p1, p2) => completionProviderToIndex[p1.Provider] - completionProviderToIndex[p2.Provider]);
return allGroups.Select(g => g.Group);
}
private Dictionary<ICompletionProvider, int> GetCompletionProviderToIndex(IEnumerable<ICompletionProvider> completionProviders)
......
......@@ -21,12 +21,6 @@ internal struct CompletionTriggerInfo
/// </summary>
public char? TriggerCharacter { get; }
/// <summary>
/// Returns true if the reason completion was triggered was to augment an existing list of
/// completion items.
/// </summary>
public bool IsAugment { get; }
/// <summary>
/// Returns true if completion was triggered by the debugger.
/// </summary>
......@@ -37,56 +31,48 @@ internal struct CompletionTriggerInfo
/// </summary>
internal bool IsImmediateWindow { get; }
private CompletionTriggerInfo(CompletionTriggerReason triggerReason, char? triggerCharacter, bool isAugment, bool isDebugger, bool isImmediateWindow)
private CompletionTriggerInfo(CompletionTriggerReason triggerReason, char? triggerCharacter, bool isDebugger, bool isImmediateWindow)
: this()
{
Contract.ThrowIfTrue(triggerReason == CompletionTriggerReason.TypeCharCommand && triggerCharacter == null);
this.TriggerReason = triggerReason;
this.TriggerCharacter = triggerCharacter;
this.IsAugment = isAugment;
this.IsDebugger = isDebugger;
this.IsImmediateWindow = isImmediateWindow;
}
public static CompletionTriggerInfo CreateTypeCharTriggerInfo(char triggerCharacter, bool isAugment = false)
public static CompletionTriggerInfo CreateTypeCharTriggerInfo(char triggerCharacter)
{
return new CompletionTriggerInfo(CompletionTriggerReason.TypeCharCommand, triggerCharacter, isAugment, isDebugger: false, isImmediateWindow: false);
return new CompletionTriggerInfo(CompletionTriggerReason.TypeCharCommand, triggerCharacter, isDebugger: false, isImmediateWindow: false);
}
public static CompletionTriggerInfo CreateInvokeCompletionTriggerInfo(bool isAugment = false)
public static CompletionTriggerInfo CreateInvokeCompletionTriggerInfo()
{
return new CompletionTriggerInfo(CompletionTriggerReason.InvokeCompletionCommand, null, isAugment, isDebugger: false, isImmediateWindow: false);
return new CompletionTriggerInfo(CompletionTriggerReason.InvokeCompletionCommand, null, isDebugger: false, isImmediateWindow: false);
}
public static CompletionTriggerInfo CreateBackspaceTriggerInfo(char? triggerCharacter, bool isAugment = false)
public static CompletionTriggerInfo CreateBackspaceTriggerInfo(char? triggerCharacter)
{
return new CompletionTriggerInfo(CompletionTriggerReason.BackspaceOrDeleteCommand, triggerCharacter, isAugment, isDebugger: false, isImmediateWindow: false);
return new CompletionTriggerInfo(CompletionTriggerReason.BackspaceOrDeleteCommand, triggerCharacter, isDebugger: false, isImmediateWindow: false);
}
public static CompletionTriggerInfo CreateSnippetTriggerInfo()
{
return new CompletionTriggerInfo(CompletionTriggerReason.Snippets, null, isAugment: false, isDebugger: false, isImmediateWindow: false);
}
internal CompletionTriggerInfo WithIsAugment(bool isAugment)
{
return this.IsAugment == isAugment
? this
: new CompletionTriggerInfo(this.TriggerReason, this.TriggerCharacter, isAugment, this.IsDebugger, this.IsImmediateWindow);
return new CompletionTriggerInfo(CompletionTriggerReason.Snippets, null, isDebugger: false, isImmediateWindow: false);
}
internal CompletionTriggerInfo WithIsDebugger(bool isDebugger)
{
return this.IsDebugger == isDebugger
? this
: new CompletionTriggerInfo(this.TriggerReason, this.TriggerCharacter, this.IsAugment, isDebugger, this.IsImmediateWindow);
: new CompletionTriggerInfo(this.TriggerReason, this.TriggerCharacter, isDebugger, this.IsImmediateWindow);
}
internal CompletionTriggerInfo WithIsImmediateWindow(bool isImmediateWIndow)
{
return this.IsImmediateWindow == isImmediateWIndow
? this
: new CompletionTriggerInfo(this.TriggerReason, this.TriggerCharacter, this.IsAugment, this.IsDebugger, isImmediateWIndow);
: new CompletionTriggerInfo(this.TriggerReason, this.TriggerCharacter, this.IsDebugger, isImmediateWIndow);
}
}
}
......@@ -16,11 +16,6 @@ internal abstract class SuggestionModeCompletionProvider : ICompletionProvider
public async Task<CompletionItemGroup> GetGroupAsync(Document document, int position, CompletionTriggerInfo triggerInfo, CancellationToken cancellationToken = default(CancellationToken))
{
if (!triggerInfo.IsAugment)
{
return null;
}
var builder = await this.GetBuilderAsync(document, position, triggerInfo, cancellationToken).ConfigureAwait(false);
if (builder == null)
{
......
......@@ -427,6 +427,15 @@ public string TokenList(IReadOnlyCollection<EntityHandle> handles, bool displayT
return string.Join(", ", handles.Select(h => Token(h, displayTable)));
}
public void VisualizeHeaders()
{
_reader = _readers[0];
_writer.WriteLine("MetadataVersion: {0}", _reader.MetadataVersion);
_writer.WriteLine();
}
private void WriteModule()
{
var def = _reader.GetModuleDefinition();
......@@ -860,30 +869,32 @@ private void WriteEnCMap()
private void WriteAssembly()
{
if (_reader.IsAssembly)
if (!_reader.IsAssembly)
{
AddHeader(
"Name",
"Version",
"Culture",
"PublicKey",
"Flags",
"HashAlgorithm"
);
return;
}
var entry = _reader.GetAssemblyDefinition();
AddHeader(
"Name",
"Version",
"Culture",
"PublicKey",
"Flags",
"HashAlgorithm"
);
AddRow(
Literal(entry.Name),
entry.Version.Major + "." + entry.Version.Minor + "." + entry.Version.Revision + "." + entry.Version.Build,
Literal(entry.Culture),
Literal(entry.PublicKey, BlobKind.Key),
EnumValue<int>(entry.Flags),
EnumValue<int>(entry.HashAlgorithm)
);
var entry = _reader.GetAssemblyDefinition();
WriteRows("Assembly (0x20):");
}
AddRow(
Literal(entry.Name),
entry.Version.Major + "." + entry.Version.Minor + "." + entry.Version.Revision + "." + entry.Version.Build,
Literal(entry.Culture),
Literal(entry.PublicKey, BlobKind.Key),
EnumValue<int>(entry.Flags),
EnumValue<int>(entry.HashAlgorithm)
);
WriteRows("Assembly (0x20):");
}
private void WriteAssemblyRef()
......
......@@ -164,6 +164,8 @@ private unsafe void VisualizeGenerations(List<GenerationData> generations)
var generation = generations[generationIndex];
var mdReader = generation.MetadataReader;
visualizer.VisualizeHeaders();
_writer.WriteLine(">>>");
_writer.WriteLine(string.Format(">>> Generation {0}:", generationIndex));
_writer.WriteLine(">>>");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册