Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@@ -0,0 +1,120 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="PrereleaseResolveNuGetPackageAssets" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
<UsingTask TaskName="LocatePreviousContract" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
<PropertyGroup>
<ApiCompatBaseline Condition="!Exists('$(ApiCompatBaseline)')">$(MSBuildProjectDirectory)\ApiCompatBaseline.$(TargetGroup).txt</ApiCompatBaseline>
<ApiCompatBaseline Condition="!Exists('$(ApiCompatBaseline)')">$(MSBuildProjectDirectory)\ApiCompatBaseline.txt</ApiCompatBaseline>
</PropertyGroup>
<PropertyGroup>
<RunApiCompatForSrc Condition="$(MSBuildProjectDirectory.EndsWith('src'))">true</RunApiCompatForSrc>
<!-- TODO: Disable the version over version ref compat checks for now because
we don't have a great way to get the previous version -->
<RunApiCompatForRef Condition="$(MSBuildProjectDirectory.EndsWith('ref'))">false</RunApiCompatForRef>
<RunApiCompat Condition="'$(RunApiCompat)'==''">false</RunApiCompat>
<ResolveMatchingContract Condition="'$(RunApiCompatForSrc)'=='true'">true</ResolveMatchingContract>
<TargetsTriggeredByCompilation Condition="'$(RunApiCompatForSrc)'=='true'">$(TargetsTriggeredByCompilation);ValidateApiCompatForSrc</TargetsTriggeredByCompilation>
<TargetsTriggeredByCompilation Condition="'$(RunApiCompatForRef)'=='true'">$(TargetsTriggeredByCompilation);ValidateApiCompatForRef</TargetsTriggeredByCompilation>
</PropertyGroup>
<!-- ApiCompat for Implementation Assemblies -->
<Target Name="ValidateApiCompatForSrc"
Condition="'$(RunApiCompatForSrc)' == 'true' AND '$(RunApiCompat)' == 'true' and '@(ResolvedMatchingContract)' != ''">
<PropertyGroup>
<ReferenceAssembly>@(ResolvedMatchingContract)</ReferenceAssembly>
</PropertyGroup>
<ItemGroup>
<_DependencyDirectoriesTemp Include="@(ReferencePath->'%(RootDir)%(Directory)')" />
<!-- Remove duplicate directories by batching over them -->
<_DependencyDirectories Include="%(_DependencyDirectoriesTemp.Identity)" />
<_ContractDependencyDirectories Include="@(ResolvedMatchingContract->'%(RootDir)%(Directory)')" />
</ItemGroup>
<PropertyGroup>
<ApiCompatArgs>$(ApiCompatArgs) "$(ReferenceAssembly)"</ApiCompatArgs>
<ApiCompatArgs>$(ApiCompatArgs) -contractDepends:"@(_ContractDependencyDirectories, ','),"</ApiCompatArgs>
<ApiCompatArgs>$(ApiCompatArgs) -implDirs:"$(IntermediateOutputPath),@(_DependencyDirectories, ','),"</ApiCompatArgs>
<ApiCompatArgs Condition="'$(BaselineAllAPICompatError)'!='true' and Exists('$(ApiCompatBaseline)')">$(ApiCompatArgs) -baseline:"$(ApiCompatBaseline)"</ApiCompatArgs>
<ApiCompatBaselineAll Condition="'$(BaselineAllAPICompatError)'=='true'">&gt; $(ApiCompatBaseline)</ApiCompatBaselineAll>
<ApiCompatExitCode>0</ApiCompatExitCode>
<ApiCompatResponseFile>$(IntermediateOutputPath)apicompat.rsp</ApiCompatResponseFile>
<ApiCompatCmd>$(ToolHostCmd) "$(ToolsDir)ApiCompat.exe"</ApiCompatCmd>
</PropertyGroup>
<MakeDir Directories="$(IntermediateOutputPath)" />
<WriteLinesToFile File="$(ApiCompatResponseFile)" Lines="$(ApiCompatArgs)" Overwrite="true" />
<Exec Condition="Exists('$(ReferenceAssembly)')"
Command="$(ApiCompatCmd) @&quot;$(ApiCompatResponseFile)&quot; $(ApiCompatBaselineAll)"
CustomErrorRegularExpression="^[a-zA-Z]+ :"
StandardOutputImportance="Low"
IgnoreExitCode="true"
>
<Output TaskParameter="ExitCode" PropertyName="ApiCompatExitCode" />
</Exec>
<!--
To force incremental builds to show failures again we are invalidating
one compile input by touching the assembly info file
-->
<Touch Condition="'$(ApiCompatExitCode)'!='0'" Files="$(AssemblyInfoFile)" />
<Error Condition="'$(ApiCompatExitCode)'!='0'" Text="ApiCompat failed for '$(TargetPath)'" />
</Target>
<!-- ApiCompat for Contract Assemblies -->
<Target Name="ValidateApiCompatForRef"
Condition="'$(RunApiCompatForRef)' == 'true' AND '$(RunApiCompat)' == 'true'" >
<!--
This target is opportunistic in the sense it only runs if the previous contract version
has been built. If it doesn't find and older version then it will not run. This is because
we don't have a great way to always force that the older contract exists and has been built.
-->
<LocatePreviousContract CurrentContractProjectPath="$(ReferenceAssemblyOutputPath)$(AssemblyName)" AssemblyVersion="$(AssemblyVersion)">
<Output TaskParameter="PreviousContractVersion" PropertyName="PreviousContractVersion" />
</LocatePreviousContract>
<PropertyGroup Condition="'$(PreviousContractVersion)'!=''">
<PreviousContractAssembly>$(ReferenceAssemblyOutputPath)$(AssemblyName)\$(PreviousContractVersion)\$(AssemblyName).dll</PreviousContractAssembly>
</PropertyGroup>
<ItemGroup>
<_CurrentContractDependencies Include="@(ReferencePath->'%(RootDir)%(Directory)')" />
<!--
Use the current contract dependencies for the previous contacts. While this isn't
100% correct it is the best way to ensure we have them all and it current version
should purely be a subset of the previous one.
-->
<_PreviousContractDependencyDirectories Include="@(_CurrentContractDependencies)" />
</ItemGroup>
<PropertyGroup>
<_ApiCompatCmd>$(ToolHostCmd) "$(ToolsDir)ApiCompat.exe" "$(PreviousContractAssembly)"</_ApiCompatCmd>
<_ApiCompatCmd>$(_ApiCompatCmd) -contractDepends:"@(_PreviousContractDependencyDirectories);"</_ApiCompatCmd>
<_ApiCompatCmd>$(_ApiCompatCmd) -implDirs:"$(IntermediateOutputPath);@(_CurrentContractDependencies);"</_ApiCompatCmd>
<_ApiCompatCmd Condition="Exists('$(ApiCompatBaseline)')">$(_ApiCompatCmd) -baseline:"$(ApiCompatBaseline)"</_ApiCompatCmd>
<ApiCompatExitCode>0</ApiCompatExitCode>
</PropertyGroup>
<Exec Condition="Exists('$(PreviousContractAssembly)')"
Command="$(_ApiCompatCmd)"
CustomErrorRegularExpression="^[a-zA-Z]+ :"
StandardOutputImportance="Low"
IgnoreExitCode="true"
>
<Output TaskParameter="ExitCode" PropertyName="ApiCompatExitCode" />
</Exec>
<!--
To force incremental builds to show failures again we are invaliding
one compile input by touching the assembly info file
-->
<Touch Condition="'$(ApiCompatExitCode)'!='0'" Files="$(AssemblyInfoFile)" />
<Error Condition="'$(ApiCompatExitCode)'!='0'" Text="ApiCompat failed for '$(TargetPath)'" />
</Target>
</Project>

View File

@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
This file will contain all of the common properties from most repos. The intention is to only have
repo specific properties inside the repos, and move to this file everything that is common.
-->
<!--
Import the reference assembly props
Sets Properties:
IsReferenceAssembly - Set if the project is in the ref assm path
-->
<Import Project="$(MSBuildThisFileDirectory)ReferenceAssemblies.props" Condition="'$(ExcludeReferenceAssembliesImport)'!='true'" />
<PropertyGroup>
<CompilerResponseFile Condition="'$(CheckSumSHA256)'!='false'">$(MSBuildThisFileDirectory)checksum.rsp</CompilerResponseFile>
</PropertyGroup>
<PropertyGroup>
<GetNuGetPackageVersionsDependsOn>CreateVersionFileDuringBuild</GetNuGetPackageVersionsDependsOn>
</PropertyGroup>
<!-- Platform detection -->
<PropertyGroup>
<OsEnvironment Condition="'$(OsEnvironment)'=='' AND '$(OS)'=='Unix' AND Exists('/Applications')">OSX</OsEnvironment>
<OsEnvironment Condition="'$(OsEnvironment)'=='' AND '$(OS)'=='Unix'">Linux</OsEnvironment>
<OsEnvironment Condition="'$(OsEnvironment)'==''">$(OS)</OsEnvironment>
<RunningOnUnix Condition="'$(OS)' != 'Windows_NT'">true</RunningOnUnix>
</PropertyGroup>
<!-- Common BuildTools properties -->
<PropertyGroup>
<ToolRuntimePath Condition="'$(ToolRuntimePath)'=='' and '$(ProjectDir)'==''">$(MSBuildThisFileDirectory)</ToolRuntimePath>
<ToolRuntimePath Condition="'$(ToolRuntimePath)'=='' and '$(ProjectDir)'!=''">$(ProjectDir)Tools/</ToolRuntimePath>
<ToolsDir Condition="'$(ToolsDir)'==''">$(MSBuildThisFileDirectory)</ToolsDir>
<DotnetCliPath Condition="'$(DotnetCliPath)'==''">$(ToolRuntimePath)dotnetcli/</DotnetCliPath>
<OverrideToolHost>$(DotnetCliPath)dotnet</OverrideToolHost>
<BuildToolsTaskDir Condition="'$(MSBuildRuntimeType)'!='core'">$(ToolsDir)net45/</BuildToolsTaskDir>
<BuildToolsTaskDir Condition="'$(MSBuildRuntimeType)'=='core'">$(ToolsDir)</BuildToolsTaskDir>
<UseRoslynCompilers Condition="'$(UseRoslynCompilers)'=='' and '$(RunningOnUnix)'=='true'">false</UseRoslynCompilers>
<UseSharedCompilation Condition="'$(UseSharedCompilation)' == '' and '$(RunningOnUnix)' != 'true' and '$(UseRoslynCompilers)' != 'false'">true</UseSharedCompilation>
</PropertyGroup>
<!-- Setting IsTestProject prior to Build.Common.targets -->
<PropertyGroup>
<IsTestProject Condition="'$(IsTestProject)'=='' And ($(MSBuildProjectFullPath.Contains('\tests\')) OR $(MSBuildProjectFullPath.Contains('/tests/')))">true</IsTestProject>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)Roslyn.Common.props" />
<!--
import the MicroBuild boot-strapper props (only relevant for shipping binaries)
-->
<Import Project="$(MSBuildThisFileDirectory)MicroBuild.Core.props" Condition="'$(IsTestProject)'!='true' AND Exists('$(MSBuildThisFileDirectory)MicroBuild.Core.props')" />
</Project>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="CloudBuild" Condition="'$(EnableCloudTest)' != 'true'" />
<!--
enables cloud-distributed testing. please see target VerifyInputs
in CloudTest.targets for the complete list of required properties.
-->
<Import Project="$(MSBuildThisFileDirectory)CloudTest.targets" Condition="'$(EnableCloudTest)' == 'true'" />
</Project>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
Code coverage package versions go here and in the test-runtime-packages.config
-->
<PropertyGroup>
<OpenCoverVersion>4.6.519</OpenCoverVersion>
<ReportGeneratorVersion>2.5.0</ReportGeneratorVersion>
<CoverallsUploaderVersion>1.4</CoverallsUploaderVersion>
</PropertyGroup>
<!-- Coverage options -->
<PropertyGroup>
<CodeCoverageEnabled>false</CodeCoverageEnabled>
<CodeCoverageEnabled Condition="'$(SkipTests)' != 'true' and '$(OS)' == 'Windows_NT' and '$(Coverage)' == 'true' and '$(Performance)' != 'true'">true</CodeCoverageEnabled>
<CoverageReportDir Condition="'$(CoverageReportDir)' == ''">$(TestWorkingDir)coverage\</CoverageReportDir>
<!-- This targets file has two modes one for individual projects and one for all -->
<GenerateCodeCoverageReportForAll Condition="'$(GenerateCodeCoverageReportForAll)'==''">false</GenerateCodeCoverageReportForAll>
<CoverageEnabledForProject Condition="'$(GenerateCodeCoverageReportForAll)'=='true'">false</CoverageEnabledForProject>
<CoverageEnabledForProject Condition="'$(CoverageEnabledForProject)'=='' and '$(IsTestProject)'=='true'">$(CodeCoverageEnabled)</CoverageEnabledForProject>
<GenerateIndividualCoverageReport Condition="'$(BuildAllProjects)'!='true' and '$(CoverageEnabledForProject)'=='true'">true</GenerateIndividualCoverageReport>
<GenerateFullCoverageReport Condition="'$(GenerateCodeCoverageReportForAll)'=='true' and '$(CodeCoverageEnabled)'=='true' and '$(SkipFullCoverageReport)' != 'true'">true</GenerateFullCoverageReport>
<GenerateVisitedMethodsReport Condition="'$(GenerateCodeCoverageReportForAll)'=='true' and '$(CodeCoverageEnabled)'=='true' and '$(GenerateVisitedReport)' == 'true'">true</GenerateVisitedMethodsReport>
<!-- We need to filter the data to only the assembly being tested. Otherwise we will gather tons of data about other assemblies. -->
<_ProjectDirectoryUnderSourceDir Condition="'$(IsTestProject)' == 'true'">$(MSBuildProjectDirectory.SubString($(SourceDir.Length)))</_ProjectDirectoryUnderSourceDir>
<AssemblyBeingTestedName Condition="'$(IsTestProject)' == 'true'">$(_ProjectDirectoryUnderSourceDir.SubString(0, $(_ProjectDirectoryUnderSourceDir.IndexOfAny("\\/"))))</AssemblyBeingTestedName>
<!--
When coverage is enabled, we disallow building projects in parallel.
There appear to be issues with the OpenCover tool in these scenarios.
-->
<SerializeProjects Condition="'$(CodeCoverageEnabled)'=='true'">true</SerializeProjects>
</PropertyGroup>
<Target Name="CreateCoverageFilter" BeforeTargets="GenerateTestExecutionScripts">
<!-- By default, code coverage data is only gathered for the assembly being tested.
CodeCoverageAssemblies can be passed in to the build to gather coverage on additional assemblies. -->
<ItemGroup>
<_CodeCoverageAssemblies Include="$(AssemblyBeingTestedName)" />
<_CodeCoverageAssemblies Include="@(AdditionalCodeCoverageAssemblies)" />
<_CodeCoverageAssemblies Include="$(CodeCoverageAssemblies)" Condition="'$(CodeCoverageAssemblies)' != ''" />
</ItemGroup>
<PropertyGroup>
<CoverageFilter>@(_CodeCoverageAssemblies->'+[%(Identity)]*', ' ')</CoverageFilter>
<CoverageFilter Condition="'$(CodeCoverageAssemblies)' == 'all'">[*]*</CoverageFilter>
</PropertyGroup>
</Target>
<!-- xUnit command line with coverage enabled -->
<PropertyGroup Condition="'$(CoverageEnabledForProject)'=='true'">
<CoverageHost>$(PackagesDir)OpenCover\$(OpenCoverVersion)\tools\OpenCover.Console.exe</CoverageHost>
<CoverageOutputFilePath>$(CoverageReportDir)$(MSBuildProjectName).coverage.xml</CoverageOutputFilePath>
<CoverageOptions>-oldStyle -filter:"{CoverageFilter}" -excludebyfile:"*\Common\src\System\SR.*" -nodefaultfilters -excludebyattribute:*.ExcludeFromCodeCoverage* -skipautoprops -hideskipped:All -threshold:1</CoverageOptions>
<CoverageCommandLine>$(CoverageOptions) -returntargetcode -register:user -target:$(TestProgram) -output:$(CoverageOutputFilePath)</CoverageCommandLine>
<TestHost>$(CoverageHost)</TestHost>
<XunitOptions>$(XunitOptions) -parallel none</XunitOptions>
<TestCommandLine>$(TestHost) $(CoverageCommandLine) -targetargs:"$(TestArguments) {XunitTraitOptions}"</TestCommandLine>
</PropertyGroup>
<!-- Report Generator Properties -->
<PropertyGroup>
<CoverageReportAssemblyFilters Condition="'$(CodeCoverageAssemblies)' != 'all'">"-assemblyfilters:@(_CodeCoverageAssemblies->'+%(Identity)', ';')"</CoverageReportAssemblyFilters>
<CoverageReportGeneratorOptions>-targetdir:$(CoverageReportDir) -reporttypes:Html;Badges $(CoverageReportAssemblyFilters)</CoverageReportGeneratorOptions>
<CoverageReportGeneratorCommandLine>$(PackagesDir)ReportGenerator\$(ReportGeneratorVersion)\tools\ReportGenerator.exe $(CoverageReportGeneratorOptions)</CoverageReportGeneratorCommandLine>
</PropertyGroup>
<PropertyGroup Condition="'$(GenerateIndividualCoverageReport)'=='true'">
<GenerateIndividualCoverageReportAfterTargets Condition="'$(GenerateIndividualCoverageReportAfterTargets)'==''">RunTestsForProject</GenerateIndividualCoverageReportAfterTargets>
</PropertyGroup>
<!-- Generate coverage reports for individual projects. -->
<Target Name="GenerateIndividualCoverageReport"
AfterTargets="$(GenerateIndividualCoverageReportAfterTargets)"
Inputs="$(CoverageOutputFilePath)"
Outputs="$(CoverageReportDir)index.htm"
Condition="'$(GenerateIndividualCoverageReport)'=='true'">
<Exec Command="$(CoverageReportGeneratorCommandLine) -reports:$(CoverageOutputFilePath)"
ContinueOnError="ErrorAndContinue" />
<Exec Command="start $(CoverageReportDir)index.htm"
Condition="'$(PopCoverageReport)' == 'true'" />
</Target>
<PropertyGroup Condition="'$(GenerateFullCoverageReport)'=='true'">
<GenerateFullCoverageReportAfterTargets Condition="'$(GenerateFullCoverageReportAfterTargets)'==''">TestAllProjects</GenerateFullCoverageReportAfterTargets>
</PropertyGroup>
<!-- Generate coverage report for all the projects. -->
<Target Name="GenerateFullCoverageReport"
AfterTargets="$(GenerateFullCoverageReportAfterTargets)"
Inputs="$(CoverageReportDir)\*.coverage.xml"
Outputs="$(CoverageReportDir)index.htm"
Condition="'$(GenerateFullCoverageReport)'=='true'">
<Exec Command="$(CoverageReportGeneratorCommandLine) -reports:$(CoverageReportDir)\*.coverage.xml"
ContinueOnError="ErrorAndContinue"
WorkingDirectory="$(ProjectDir)" />
<Exec Command="start $(CoverageReportDir)index.htm"
Condition="'$(PopCoverageReport)' == 'true'" />
<PropertyGroup>
<CoverallsUploaderCommandLine>$(PackagesDir)coveralls.io.$(CoverallsUploaderVersion)\tools\coveralls.net.exe</CoverallsUploaderCommandLine>
<CoverallsUploaderOptions>--opencover $(CoverageReportDir)\*.coverage.xml --repo-token $(CoverallsToken)</CoverallsUploaderOptions>
</PropertyGroup>
<Exec Command="$(CoverallsUploaderCommandLine) $(CoverallsUploaderOptions)"
ContinueOnError="ErrorAndContinue"
WorkingDirectory="$(ProjectDir)"
Condition="'$(UploadCoverallsData)'=='true'" />
</Target>
<UsingTask TaskName="ParseTestCoverageInfo" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
<!-- Generates VisitedMethodsReport.xml -->
<Target Name="GenerateVisitedReport"
AfterTargets="Test"
Condition="'$(GenerateVisitedMethodsReport)' == 'true'"
Inputs="$(CoverageReportDir)*.coverage.xml"
Outputs="$(CoverageReportDir)\VisitedMethodsReport.xml">
<ItemGroup>
<Reports Include="$(CoverageReportDir)*.coverage.xml"/>
</ItemGroup>
<ParseTestCoverageInfo CoverageReports="@(Reports)"
OutputReport="$(CoverageReportDir)\VisitedMethodsReport.xml"/>
</Target>
</Project>

View File

@@ -0,0 +1,64 @@
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="GenerateDepsJson" AssemblyFile="$(BuildToolsTaskDir)CoreFx.Tools.dll"/>
<PropertyGroup>
<NewSharedFxVersion>9.9.9</NewSharedFxVersion>
<OldSharedFxVersion>1.1.0</OldSharedFxVersion>
<TestSharedFxPath>$(TestSharedFxDir)\shared\Microsoft.NETCore.App\$(NewSharedFxVersion)</TestSharedFxPath>
<TestSharedFxPathHostFxr>$(TestSharedFxDir)\host\fxr\$(NewSharedFxVersion)</TestSharedFxPathHostFxr>
<ToolsDotNetCliSharedFxPath>$(ToolsDir)dotnetcli\shared\Microsoft.NETCore.App\$(OldSharedFxVersion)</ToolsDotNetCliSharedFxPath>
<ConstructSharedFxSem>$(ObjDir)constructsharedfxcomplete.sem</ConstructSharedFxSem>
</PropertyGroup>
<!-- This will generate a version of the dotnet cli that runs with the live
build of corefx using the other components gathered from the stable
version consumed from the Tools directory
To debug any issues set COREHOST_TRACE=1 and rerun dotnet
-->
<Target Name="ConstructTestingHost"
BeforeTargets="Build;BuildAllProjects"
Condition="!Exists('$(ConstructSharedFxSem)') OR '$(ReconstructSharedFx)' == 'true'" >
<ItemGroup>
<!-- This will only copy over the related file -->
<HostFxrFile Condition="'$(OS)'=='Windows_NT'" Include="$(RuntimePath)hostfxr.dll" />
<HostFxrFile Condition="'$(OS)'=='Unix'" Include="$(RuntimePath)libhostfxr.so" />
<HostFxrFile Condition="'$(OS)'=='Unix'" Include="$(RuntimePath)libhostfxr.dylib" />
<DotnetExe Condition="'$(OS)'=='Windows_NT'" Include="$(RuntimePath)dotnet.exe" />
<DotnetExe Condition="'$(OS)'!='Windows_NT'" Include="$(RuntimePath)dotnet" />
</ItemGroup>
<MakeDir Directories="$(TestSharedFxPathHostFxr)" />
<Copy SourceFiles="@(HostFxrFile)"
DestinationFolder="$(TestSharedFxPathHostFxr)"
Condition="Exists('%(RootDir)%(Directory)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(DotnetExe)"
DestinationFolder="$(TestSharedFxDir)"
Condition="Exists('%(RootDir)%(Directory)%(Filename)%(Extension)')" />
<ItemGroup>
<LiveDotNetCliComponents Include="$(RuntimePath)\*.*" Exclude="$(RuntimePath)\xunit.console.netcore.exe" />
</ItemGroup>
<Copy SourceFiles="@(LiveDotNetCliComponents)"
DestinationFiles="@(LiveDotNetCliComponents -> '$(TestSharedFxPath)\%(Filename)%(Extension)')"
UseHardlinksIfPossible="true" />
<PropertyGroup>
<OriginalDepsJsonPath>$(ToolsDotNetCliSharedFxPath)\Microsoft.NETCore.App.deps.json</OriginalDepsJsonPath>
</PropertyGroup>
<ItemGroup>
<!-- This is for HostPolicy, CoreCLR and Jit dependencies to continue to remain inside of the dep.json -->
<ExceptionForDepsJson Include="Microsoft.NETCore.DotNetHostPolicy" />
<ExceptionForDepsJson Include="Microsoft.NETCore.DotNetHostResolver" />
<ExceptionForDepsJson Include="Microsoft.NETCore.Runtime.CoreCLR" />
<ExceptionForDepsJson Include="Microsoft.NETCore.Jit" />
</ItemGroup>
<GenerateDepsJson DepsJsonPath="$(OriginalDepsJsonPath)"
RuntimeDirectory="$(RuntimePath)"
DepsExceptions="@(ExceptionForDepsJson)"
OutputPath="$(TestSharedFxPath)\Microsoft.NETCore.App.deps.json"/>
<WriteLinesToFile
File="$(ConstructSharedFxSem)"
Lines="$([System.DateTime]::Now.ToString(yyyyMMdd-mmss))"
Overwrite="true" />
</Target>
</Project>

View File

@@ -0,0 +1,180 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(IncludeDefaultReferences)' == ''">
<IncludeDefaultReferences Condition="'$(MSBuildProjectExtension)' == '.csproj'">true</IncludeDefaultReferences>
<IncludeDefaultReferences Condition="'$(MSBuildProjectExtension)' == '.vbproj'">true</IncludeDefaultReferences>
</PropertyGroup>
<ItemGroup>
<!-- netstandard is a default reference whenever building for NETStandard or building an implementation assembly -->
<DefaultReference Condition="$(NuGetTargetMoniker.StartsWith('.NETStandard')) OR '$(IsReferenceAssembly)' != 'true'"
Include="netstandard" />
</ItemGroup>
<ItemGroup>
<TargetingPackDirs Include="$(RefPath)" />
<AdditionalReferencePaths Include="@(TargetingPackDirs)" />
</ItemGroup>
<PropertyGroup>
<ContractOutputPath>$(RefPath)</ContractOutputPath>
<FrameworkPathOverride>$(ContractOutputPath)</FrameworkPathOverride>
<AssemblySearchPaths>$(AssemblySearchPaths);$(ContractOutputPath);{RawFileName}</AssemblySearchPaths>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFrameworkIdentifier)' == ''
and '$(TargetFrameworkVersion)' == ''
and '$(TargetFrameworkProfile)' == '' ">
<TargetingDefaultPlatform>true</TargetingDefaultPlatform>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == ''">
<TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
</PropertyGroup>
<!--
Limit the assembly resolution to just explicit locations.
Don't search anything machine-wide or build-order dependent.
<PropertyGroup>
<AssemblySearchPaths>{HintPathFromItem};{RawFileName}</AssemblySearchPaths>
</PropertyGroup>
-->
<!--
When targeting an explicit platform other than the default,
also allow the target framework directory.
-->
<PropertyGroup Condition="'$(TargetingDefaultPlatform)' != 'true'">
<AssemblySearchPaths>$(AssemblySearchPaths);{TargetFrameworkDirectory}</AssemblySearchPaths>
</PropertyGroup>
<!-- Setup the default target for projects not already explicitly targeting another platform -->
<PropertyGroup Condition="'$(TargetingDefaultPlatform)' == 'true'">
<!-- Setting a default portable profile, although nothing should resolve from there as we want to use the pacakge refs -->
<TargetPlatformIdentifier>Portable</TargetPlatformIdentifier>
<TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
<TargetFrameworkMonikerDisplayName>.NET Portable Subset</TargetFrameworkMonikerDisplayName>
<ImplicitlyExpandTargetFramework>false</ImplicitlyExpandTargetFramework>
<!-- Disable RAR complaining about us referencing higher .NET Portable libraries as we aren't a traditional portable library -->
<ResolveAssemblyReferenceIgnoreTargetFrameworkAttributeVersionMismatch>true</ResolveAssemblyReferenceIgnoreTargetFrameworkAttributeVersionMismatch>
<NuGetTargetMoniker Condition="'$(NuGetTargetMoniker)' == ''">.NETCoreApp,Version=v1.0</NuGetTargetMoniker>
</PropertyGroup>
<Target Name="AddDefaultReferences"
Condition="'$(IncludeDefaultReferences)' =='true'"
BeforeTargets="BeforeResolveReferences">
<ItemGroup>
<!-- Include default references when specified and they exist -->
<Reference Condition="Exists('$(RefPath)%(Identity).dll')" Include="@(DefaultReference)" />
</ItemGroup>
</Target>
<!-- Need to add references to the mscorlib design-time facade for some old-style portable dependencies like xunit -->
<Target Name="AddDesignTimeFacadeReferences"
Condition="'$(TargetingDefaultPlatform)' == 'true' AND '$(IsReferenceAssembly)' != 'true' AND '$(ExcludeMscorlibFacade)' != 'true'"
BeforeTargets="ResolveReferences"
DependsOnTargets="GetReferenceAssemblyPaths"
>
<PropertyGroup>
<_resolvedMscorlib Condition="'%(ReferencePath.FileName)' == 'mscorlib'">true</_resolvedMscorlib>
</PropertyGroup>
<ItemGroup>
<PossibleTargetFrameworks Include="$(_TargetFrameworkDirectories)" />
<ReferencePath Include="%(PossibleTargetFrameworks.Identity)mscorlib.dll"
Condition="'$(_resolvedMscorlib)' != 'true' and '%(PossibleTargetFrameworks.Identity)' != '' and Exists('%(PossibleTargetFrameworks.Identity)mscorlib.dll')" />
</ItemGroup>
</Target>
<Import Project="depProj.targets"
Condition="'$(MSBuildProjectExtension)' == '.depproj'" />
<Import Project="IL.targets"
Condition="'$(MSBuildProjectExtension)' == '.ilproj' AND '$(SkipImportILTargets)'!='true'" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets"
Condition="'$(TargetFrameworkIdentifier)' == '.NETPortable' and '$(MSBuildProjectExtension)' == '.csproj'" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"
Condition="'$(TargetFrameworkIdentifier)' != '.NETPortable' and '$(MSBuildProjectExtension)' == '.csproj'" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.VisualBasic.targets"
Condition="'$(TargetFrameworkIdentifier)' == '.NETPortable' and '$(MSBuildProjectExtension)' == '.vbproj'" />
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets"
Condition="'$(TargetFrameworkIdentifier)' != '.NETPortable' and '$(MSBuildProjectExtension)' == '.vbproj'" />
<PropertyGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework' and '$(OutputType)' == 'exe'">
<!-- RAR thinks all EXEs require binding redirects. That's not the case for CoreCLR -->
<AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences>
<GenerateBindingRedirectsOutputType>false</GenerateBindingRedirectsOutputType>
</PropertyGroup>
<!-- We need to point $(FrameworkPathOverride) to the directory that contains explicitly referenced System.Runtime.dll, if any.
Otherwise, if $(FrameworkPathOverride)\System.Runtime.dll is not the same file as the one referenced explicitly,
VS2013 VB compiler would load it and then it would complain about ambiguous type declarations.
-->
<PropertyGroup Condition="'$(MSBuildProjectExtension)' == '.vbproj'">
<CoreCompileDependsOn>$(CoreCompileDependsOn);OverrideFrameworkPathForVisualBasic</CoreCompileDependsOn>
</PropertyGroup>
<Target Name="OverrideFrameworkPathForVisualBasic" AfterTargets="ResolveAssemblyReferences" Condition="'$(MSBuildProjectExtension)' == '.vbproj'">
<ItemGroup>
<FrameworkPathOverrideCandidate Include="%(ReferencePath.RootDir)%(ReferencePath.Directory)"
Condition="'%(ReferencePath.Filename)%(ReferencePath.Extension)' == 'System.Runtime.dll'">
</FrameworkPathOverrideCandidate>
</ItemGroup>
<PropertyGroup Condition="'@(FrameworkPathOverrideCandidate->Count())' == '1'">
<FrameworkPathOverride>@(FrameworkPathOverrideCandidate)</FrameworkPathOverride>
</PropertyGroup>
</Target>
<!--
Cross Platform MSBuild has some logic to replace \ with / when invoking commands to fix up path differences between Windows and
*NIX. The define command line argument syntax for VB requires that we both surround some items with quotes and escape the quotes with
backslashes. However, due to the above MSBuild logic, this causes an invalid command line to be generated when running on *NIX.
Microsoft/msbuild#422 tracks an actual fix in MSBuild, but for now we work around the issue by using a custom task that
transforms the set of defines we are going to use into a response file we can pass along to the Vbc task along with an
empty set of defines.
-->
<UsingTask TaskName="WriteVisualBasicDefineResponseFile" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll" />
<Target Name="ConvertDefinesToResonseFile" BeforeTargets="CoreCompile" Condition="'$(MSBuildProjectExtension)' == '.vbproj'">
<WriteVisualBasicDefineResponseFile DefineConstants="$(FinalDefineConstants)"
File="$(IntermediateOutputPath)/defines.rsp" />
<PropertyGroup>
<CompilerResponseFile>$(IntermediateOutputPath)/defines.rsp;$(CompilerResponseFile)</CompilerResponseFile>
<FinalDefineConstants></FinalDefineConstants>
</PropertyGroup>
</Target>
<Target Name="ConvertCommonMetadataToAdditionalProperties" BeforeTargets="AssignProjectConfiguration">
<!-- list each append as a seperate item to force re-evaluation of AdditionalProperties metadata -->
<ItemGroup>
<!-- Configuration property shortcuts -->
<ProjectReference>
<AdditionalProperties Condition="'%(ProjectReference.Configuration)' != ''">Configuration=%(ProjectReference.Configuration);%(ProjectReference.AdditionalProperties)</AdditionalProperties>
</ProjectReference>
<!-- Packaging property shortcuts -->
<ProjectReference>
<AdditionalProperties Condition="'%(ProjectReference.PackageTargetFramework)' != ''">PackageTargetFramework=%(ProjectReference.PackageTargetFramework);%(ProjectReference.AdditionalProperties)</AdditionalProperties>
</ProjectReference>
<ProjectReference>
<AdditionalProperties Condition="'%(ProjectReference.PackageTargetPath)' != ''">PackageTargetPath=%(ProjectReference.PackageTargetPath);%(ProjectReference.AdditionalProperties)</AdditionalProperties>
</ProjectReference>
<ProjectReference>
<AdditionalProperties Condition="'%(ProjectReference.PackageTargetRuntime)' != ''">PackageTargetRuntime=%(ProjectReference.PackageTargetRuntime);%(ProjectReference.AdditionalProperties)</AdditionalProperties>
</ProjectReference>
<ProjectReference>
<AdditionalProperties Condition="'%(ProjectReference.Platform)' != ''">Platform=%(ProjectReference.Platform);%(ProjectReference.AdditionalProperties)</AdditionalProperties>
</ProjectReference>
</ItemGroup>
</Target>
</Project>

View File

@@ -0,0 +1,11 @@
{
"runtimeOptions": {
"framework": {
"name": "Microsoft.NETCore.App",
"version": "1.1.0"
},
"configProperties": {
"Microsoft.NETCore.DotNetHostPolicy.SetAppPaths": true
}
}
}

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RoslynVersion>2.0.0-beta3</RoslynVersion>
<RoslynPackageName>Microsoft.Net.Compilers</RoslynPackageName>
</PropertyGroup>
<PropertyGroup>
<RoslynPropsFile Condition="'$(RoslynPropsFile)' == '' and '$(RunningOnUnix)' != 'true'">$(ToolRuntimePath)/net45/roslyn/build/Microsoft.Net.Compilers.props</RoslynPropsFile>
</PropertyGroup>
<!--
On Unix we always use a version of Roslyn we restore from NuGet and we have to work around some known issues.
-->
<PropertyGroup Condition="'$(RoslynPropsFile)' == '' and '$(RunningOnUnix)' == 'true'">
<RoslynPackageDir>$(PackagesDir)/$(RoslynPackageName).$(RoslynVersion)/</RoslynPackageDir>
<RoslynPropsFile>$(RoslynPackageDir)build/$(RoslynPackageName).props</RoslynPropsFile>
<!--
Portable PDBs are now supported in Linux and OSX with .Net Core MSBuild.
-->
<DebugType>Portable</DebugType>
<!--
Full signing with Open key doesn't work with Portable Csc.
https://github.com/dotnet/roslyn/issues/8210
-->
<UseOpenKey>false</UseOpenKey>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,107 @@
#!/usr/bin/env bash
export RUNTIME_PATH=$1
export EXECUTION_DIR=$(dirname "$0")
function print_info_from_core_file {
local core_file_name=$1
local executable_name=$2
if ! [ -e $executable_name ]; then
echo "Unable to find executable $executable_name"
return
elif ! [ -e $core_file_name ]; then
echo "Unable to find core file $core_file_name"
return
fi
# Check for the existence of GDB on the path
hash gdb 2>/dev/null || { echo >&2 "GDB was not found. Unable to print core file."; return; }
echo "Printing info from core file $core_file_name"
# Open the dump in GDB and print the stack from each thread. We can add more
# commands here if desired.
gdb --batch -ex "thread apply all bt full" -ex "quit" $executable_name $core_file_name
}
function copy_core_file_to_temp_location {
local core_file_name=$1
local storage_location="/tmp/coredumps"
# Create the directory (this shouldn't fail even if it already exists).
mkdir -p $storage_location
# Only copy the file over if the directory is empty. Otherwise, do nothing.
if [ ! "$(ls -A $storage_location)" ]; then
echo "Copying core file $core_file_name to $storage_location"
cp $core_file_name $storage_location
fi
}
if [ "$RUNTIME_PATH" == "" ]
then
echo error: RUNTIME_PATH is not defined. Usage: $0 RUNTIME_PATH
exit -1
fi
echo Using $RUNTIME_DIR as the test runtime folder.
# ========================= BEGIN Core File Setup ============================
if [ "$(uname -s)" == "Darwin" ]; then
# On OS X, we will enable core dump generation only if there are no core
# files already in /cores/ at this point. This is being done to prevent
# inadvertently flooding the CI machines with dumps.
if [ ! "$(ls -A /cores)" ]; then
ulimit -c unlimited
fi
elif [ "$(uname -s)" == "Linux" ]; then
# On Linux, we'll enable core file generation unconditionally, and if a dump
# is generated, we will print some useful information from it and delete the
# dump immediately.
if [ -e /proc/self/coredump_filter ]; then
# Include memory in private and shared file-backed mappings in the dump.
# This ensures that we can see disassembly from our shared libraries when
# inspecting the contents of the dump. See 'man core' for details.
echo 0x3F > /proc/self/coredump_filter
fi
ulimit -c unlimited
fi
# ========================= END Core File Setup ==============================
# ========================= BEGIN Test Execution =============================
echo Running tests... Start time: $(date +"%T")
echo Commands:
[[TestRunCommandsEcho]]
pushd $EXECUTION_DIR
[[TestRunCommands]]
test_exitcode=$?
popd
echo Finished running tests. End time=$(date +"%T"). Return value was $test_exitcode
# ========================= END Test Execution ===============================
# ======================= BEGIN Core File Inspection =========================
if [ "$(uname -s)" == "Linux" ]; then
# Depending on distro/configuration, the core files may either be named "core"
# or "core.<PID>" by default. We read /proc/sys/kernel/core_uses_pid to
# determine which it is.
core_name_uses_pid=0
if [ -e /proc/sys/kernel/core_uses_pid ] && [ "1" == $(cat /proc/sys/kernel/core_uses_pid) ]; then
core_name_uses_pid=1
fi
if [ $core_name_uses_pid == "1" ]; then
# We don't know what the PID of the process was, so let's look at all core
# files whose name matches core.NUMBER
for f in core.*; do
[[ $f =~ core.[0-9]+ ]] && print_info_from_core_file "$f" "corerun" && copy_core_file_to_temp_location "$f" && rm "$f"
done
elif [ -f core ]; then
print_info_from_core_file "core" "corerun"
copy_core_file_to_temp_location "core"
rm "core"
fi
fi
# ======================== END Core File Inspection ==========================
exit $test_exitcode

View File

@@ -0,0 +1,32 @@
@ECHO OFF
SETLOCAL
SET RUNTIME_PATH=%1
set RUNTIME_PATH=%RUNTIME_PATH:/=\%
IF DEFINED RUNTIME_PATH ( echo Using %RUNTIME_PATH% as the test runtime folder.) ELSE (
echo Please specify a test runtime folder using the RUNTIME_PATH parameter
goto ShowUsage
)
set EXECUTION_DIR=%~dp0
echo Executing in %EXECUTION_DIR%
:: ========================= BEGIN Test Execution =============================
echo Running tests... Start time: %TIME%
echo Command(s):
[[TestRunCommandsEcho]]
pushd %EXECUTION_DIR%
[[TestRunCommands]]
popd
echo Finished running tests. End time=%TIME%, Exit code = %ERRORLEVEL%
EXIT /B %ERRORLEVEL%
:: ========================= END Test Execution =================================
:ShowUsage
echo.
echo Usage:
echo.
echo %0 {runtime path}
echo.
echo Parameters:
echo runtime path : (Mandatory) Root path containing the full test runtime necessary for test execution.
EXIT /B -1

View File

@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
We should be using $(BuildToolsTaskDir) for this, however we are currently forcing that property to
always be net45 (because we use Mono to run our tests and Mono needs to load the net45 version)
-->
<PropertyGroup>
<CodeAnalyzerDir Condition="'$(CodeAnalyzerDir)'=='' and '$(OSEnvironment)'=='Windows_NT'">$(ToolsDir)net45/analyzers/</CodeAnalyzerDir>
<CodeAnalyzerDir Condition="'$(CodeAnalyzerDir)'=='' and '$(OSEnvironment)'!='Windows_NT'">$(ToolsDir)analyzers/</CodeAnalyzerDir>
</PropertyGroup>
<!-- PInvokeChecker data files-->
<PropertyGroup Condition="'$(OSGroup)'=='Windows_NT' and '$(EnableDotnetAnalyzers)' == 'true'">
<!--
This file helps us choose the correct allowed pinvoke file.
1. In case we are building for windows and TargetGroup is Netcore50 or netcore50aot (Store profile) or SupportsUWP is set to true we use OneCoreUWPApis.txt
2. For all other windows configuration we use OneCoreAPIs.txt file.
-->
<UseWin32Apis Condition="'$(OSGroup)'=='Windows_NT'">true</UseWin32Apis>
<ValidPinvokeMappings>$(MSBuildThisFileDirectory)PinvokeAnalyzer_OneCoreApis.txt</ValidPinvokeMappings>
<ValidPinvokeMappings Condition="'$(UseWin32Apis)'=='true'">$(MSBuildThisFileDirectory)PinvokeAnalyzer_Win32Apis.txt</ValidPinvokeMappings>
<ValidPinvokeMappings Condition="'$(TargetGroup)'=='netcore50' or '$(TargetGroup)'=='netcore50aot' or '$(SupportsUWP)'=='true'">$(MSBuildThisFileDirectory)PinvokeAnalyzer_UWPApis.txt</ValidPinvokeMappings>
<ValidPinvokeMappings Condition="('$(TargetGroup)'=='netcore50' or '$(TargetGroup)'=='netcore50aot' or '$(SupportsUWP)'=='true') and '$(UseWin32Apis)'=='true'">$(MSBuildThisFileDirectory)PinvokeAnalyzer_Win32UWPApis.txt</ValidPinvokeMappings>
</PropertyGroup>
<PropertyGroup>
<!-- %24 = $ -->
<EnableFxCopAnalyzers Condition="$([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectDirectory), 'src%24'))">true</EnableFxCopAnalyzers>
<EnableFxCopAnalyzers Condition="'$(EnableFxCopAnalyzers)' != 'true'">false</EnableFxCopAnalyzers>
</PropertyGroup>
<ItemGroup Condition="$(EnableFxCopAnalyzers)">
<Analyzer Include="$(CodeAnalyzerDir)*.dll" Exclude="$(CodeAnalyzerDir)Microsoft.DotNet.CodeAnalysis.dll"/>
</ItemGroup>
<PropertyGroup Condition="$(EnableFxCopAnalyzers)">
<CodeAnalysisRuleSet Condition="'$(CodeAnalysisRuleSet)' == ''">$(MSBuildThisFileDirectory)Default.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup Condition="'$(EnableDotnetAnalyzers)' == 'true'">
<!-- Enable the Microsoft.Dotnet.CodeAnalysis.dll analyzer -->
<Analyzer Include="$(CodeAnalyzerDir)Microsoft.DotNet.CodeAnalysis.dll"/>
<AdditionalFiles Include="$(MSBuildProjectDirectory)/*.analyzerdata" />
<AdditionalFiles Include="$(MSBuildProjectDirectory)/*.analyzerdata.$(Platform)" />
<!-- Add the necessary valid Pinvoke mapping file -->
<AdditionalFiles Condition="'$(ValidPinvokeMappings)' != ''" Include="$(ValidPinvokeMappings)"/>
<!-- Disable any analyzers that should not run -->
<DisabledAnalyzers Condition="'$(IsTestProject)' == true or '$(TargetsUnix)' == 'true'" Include="PinvokeAnalyzer"/>
<DisabledAnalyzers Condition="'$(TargetsWindows)'=='true' and ($(TargetGroup.Contains('net46')) or $(TargetGroup.Contains('net45')))" Include="PinvokeAnalyzer" />
</ItemGroup>
<!-- If we have specified any analyzers that need to be disabled write them into the file -->
<Target Name="GenerateAnalyzerConfigFile" BeforeTargets="CoreCompile" Condition="'@(DisabledAnalyzers)'!='' and '$(EnableDotnetAnalyzers)' == 'true'" >
<WriteLinesToFile File="$(IntermediateOutputPath)/disabledAnalyzers.config" Lines="@(DisabledAnalyzers)" Overwrite="true" />
<ItemGroup>
<AdditionalFiles Include="$(IntermediateOutputPath)/disabledAnalyzers.config"/>
<FileWrites Include="$(IntermediateOutputPath)/disabledAnalyzers.config"/>
</ItemGroup>
</Target>
</Project>

85
external/corefx/Tools-Override/crossgen.sh vendored Executable file
View File

@@ -0,0 +1,85 @@
#!/usr/bin/env bash
# Restores crossgen and runs it on all tools components.
__CoreClrVersion=1.1.0
usage()
{
echo "crossgen.sh <directory>"
echo " Restores crossgen and runs it on all assemblies in <directory>."
exit 0
}
restore_crossgen()
{
__pjDir=$__toolsDir/crossgen
mkdir -p $__pjDir
echo "{\"frameworks\":{\"netcoreapp1.1\":{\"dependencies\":{\"Microsoft.NETCore.Runtime.CoreCLR\":\"$__CoreClrVersion\", \"Microsoft.NETCore.Platforms\": \"$__CoreClrVersion\"}}},\"runtimes\":{\"$__rid\":{}}}" > "$__pjDir/project.json"
$__dotnet restore $__pjDir/project.json --packages $__packagesDir
__crossgenInPackage=$__packagesDir/runtime.$__packageRid.Microsoft.NETCore.Runtime.CoreCLR/$__CoreClrVersion/tools/crossgen
if [ ! -e $__crossgenInPackage ]; then
echo "The crossgen executable could not be found at "$__crossgenInPackage". Aborting crossgen.sh."
exit 1
fi
cp $__crossgenInPackage $__sharedFxDir
__crossgen=$__sharedFxDir/crossgen
}
crossgen_everything()
{
echo "Running crossgen on all assemblies in $__targetDir."
for file in $__targetDir/*.{dll,exe}
do
if [ $(basename $file) != "Microsoft.Build.Framework.dll" ]; then
crossgen_single $file & pid=$!
__pids+=" $pid"
fi
done
trap "kill $__pids 2&> /dev/null" SIGINT
wait $__pids
echo "Crossgen finished."
}
crossgen_single()
{
__file=$1
$__crossgen /Platform_Assemblies_Paths $__toolsDir:$__sharedFxDir /nologo /MissingDependenciesOK $__file > /dev/null
if [ $? -eq 0 ]; then
__outname="${__file/.dll/.ni.dll}"
__outname="${__outname/.exe/.ni.exe}"
echo "$__file -> $__outname"
else
echo "Unable to successfully compile $__file"
fi
}
if [ ! -z $BUILDTOOLS_SKIP_CROSSGEN ]; then
echo "BUILDTOOLS_SKIP_CROSSGEN is set. Skipping crossgen step."
exit 0
fi
if [[ -z "$1" || "$1" == "-?" || "$1" == "--help" || "$1" == "-h" ]]; then
usage
fi
__targetDir=$1
__scriptpath=$(cd "$(dirname "$0")"; pwd -P)
__toolsDir=$__scriptpath/../Tools
__dotnet=$__toolsDir/dotnetcli/dotnet
__packagesDir=$__scriptpath/../packages
__sharedFxDir=$__toolsDir/dotnetcli/shared/Microsoft.NETCore.App/$__CoreClrVersion/
__rid=$($__dotnet --info | sed -n -e 's/^.*RID:[[:space:]]*//p')
if [[ $__rid == *"osx"* ]]; then
__packageRid="osx.10.10-x64"
elif [[ $__rid == *"rhel.7"* || $__rid == *"centos.7"* ]]; then
__packageRid="rhel.7-x64"
else
__packageRid=$__rid
fi
restore_crossgen
crossgen_everything
exit 0

View File

@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
***********************************************************************************************
depProj.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
This file defines the steps in the standard build process specific for NuGet deployment
projects. The remainder of the build process is defined in Microsoft.Common.targets,
which is imported by this file.
Licensed to the .NET Foundation under one or more agreements.
The .NET Foundation licenses this file to you under the MIT license.
See the LICENSE file in the project root for more information.
***********************************************************************************************
-->
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Deployment project
Restores NuGet dependencies and copies them to the output directory.
NuGetTargetMoniker - determined by the TargetFramework* and TargetPlatform*
properties of the project, can be overidden.
NuGetRuntimeIdentifier - defaults to <empty> (""), can be overidden.
NuGetDeploySourceItem - defaults to ReferenceCopyLocalPaths, can be overidden to
specify Reference (for compile assets) or Analyzer(for
analyzer assets)
For the appropriate behavior of P2P references the project should set the
TargetName and TargetExt to match one of the files that will be copied
from the packages.
-->
<PropertyGroup>
<NuGetDeploySourceItem Condition="'$(NuGetDeploySourceItem)' == ''">ReferenceCopyLocalPaths</NuGetDeploySourceItem>
<!-- suppress the attempt to copy build output. -->
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
<!-- Unless overridden, use no runtime identifier. This is transformed in packageresolve.targets.
We specify "None" here to avoid being assigned the default runtime for projects which set CopyNuGetImplementations=true. -->
<NuGetRuntimeIdentifier Condition="'$(NuGetRuntimeIdentifier)' == ''">None</NuGetRuntimeIdentifier>
<!-- make sure we tell nuget targets to copy, even if output type would not by default -->
<CopyNuGetImplementations>true</CopyNuGetImplementations>
<!-- by default there shouldn't be any assets in depproj files that require signing -->
<SkipSigning Condition="'$(SkipSigning)' == ''">true</SkipSigning>
</PropertyGroup>
<Target Name="CoreCompile">
<Error Condition="'$(NuGetDeploySourceItem)' != 'ReferenceCopyLocalPaths' AND
'$(NuGetDeploySourceItem)' != 'Reference' AND
'$(NuGetDeploySourceItem)' != 'Analyzer'"
Text="Unexpected value for NuGetDeploySourceItem:'$(NuGetDeploySourceItem)'. Expected ReferenceCopyLocalPaths, Reference, or Analyzer." />
<ItemGroup>
<!-- Don't set IntermediateAssembly since this is not produced -->
<IntermediateAssembly Remove="@(IntermediateAssembly)" />
<NuGetDeploy Include="@($(NuGetDeploySourceItem))"/>
<!-- filter to only items that came from packages -->
<!-- the following condition must be applied after the include because msbuild doesn't seem
to support property-defined-item-names in a metadata statement -->
<NuGetDeploy Remove="@(NuGetDeploy)" Condition="'%(NuGetDeploy.NuGetPackageId)' == ''" />
<!-- remove all existing items from NuGet packages we'll be defining these in our own item -->
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.NuGetPackageId)' != ''"/>
<Reference Remove="@(Reference)" Condition="'%(Reference.NuGetPackageId)' != ''"/>
<Analyzer Remove="@(Analyzer)" Condition="'%(Analyzer.NuGetPackageId)' != ''"/>
<!-- add items defined by NuGetDeployItem property to Content so that we get clean behavior -->
<ContentWithTargetPath Include="@(NuGetDeploy)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>%(FileName)%(Extension)</TargetPath>
</ContentWithTargetPath>
</ItemGroup>
<Error Condition="'@(NuGetDeploy)' == ''" Text="Error no assets were resolved from NuGet packages." />
<Message Importance="High" Text="%(FullPath) (%(NuGetPackageId).%(NuGetPackageVersion)) -&gt; @(NuGetDeploy->'$(TargetDir)%(FileName)%(Extension)')" />
<!-- Include marker files if an extension has been provided -->
<!-- internal builds use this to distinguish files which have already been signed -->
<Touch Condition="'$(DeployMarkerExtension)' != ''" Files="@(NuGetDeploy->'$(TargetDir)%(FileName)$(DeployMarkerExtension)')" AlwaysCreate="true">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites"/>
</Touch>
</Target>
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
<!-- Required by Common.Targets but not used for depproj -->
<Target Name="CreateManifestResourceNames" />
<!-- Support filtering to a subset of packages -->
<Target Name="FilterNugetPackages" AfterTargets="ResolveNuGetPackages">
<ItemGroup>
<_referenceCopyLocalByPackageId Include="@(ReferenceCopyLocalPaths->'%(NuGetPackageId)')">
<OriginalItemSpec>%(Identity)</OriginalItemSpec>
</_referenceCopyLocalByPackageId>
<_referenceCopyLocalByPackageIdToRemove Include="@(_referenceCopyLocalByPackageId)" Exclude="@(PackageToInclude)" Condition="'@(PackageToInclude)' != ''" />
<_filteredReferenceCopyLocalByPackageId Include="@(_referenceCopyLocalByPackageId)" Exclude="@(_referenceCopyLocalByPackageIdToRemove);@(PackageToExclude)" />
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)"/>
<ReferenceCopyLocalPaths Include="@(_filteredReferenceCopyLocalByPackageId->'%(OriginalItemSpec)')" />
</ItemGroup>
</Target>
</Project>

View File

@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="PrereleaseResolveNuGetPackageAssets" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
<UsingTask TaskName="RemoveDuplicatesWithLastOneWinsPolicy" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
<UsingTask TaskName="ZipFileCreateFromDirectory" Condition="'$(ArchiveTests)' == 'true'" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
<UsingTask TaskName="GenerateAssemblyList" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
<UsingTask TaskName="GetTargetMachineInfo" Condition="'$(TestWithLocalLibraries)'=='true'" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
<PropertyGroup>
<SerializeProjects Condition="'$(TestWithLocalLibraries)'=='true'">true</SerializeProjects>
</PropertyGroup>
<!--
Temporary until we have proper nuget support to deploy content files.
Copies supplemental test data to the build output and test directories.
-->
<Target Name="CopySupplementalTestData" DependsOnTargets="DiscoverTestInputs">
<!-- coalesce supplemental test data items with and without DestinationDir metadata -->
<ItemGroup>
<_SupplementalTestData Include="@(SupplementalTestData)" Condition="'%(DestinationDir)' != ''">
<DestinationDir>%(DestinationDir)</DestinationDir>
</_SupplementalTestData>
<_SupplementalTestData Include="@(SupplementalTestData)" Condition="'%(DestinationDir)' == ''">
<DestinationDir>%(RecursiveDir)</DestinationDir>
</_SupplementalTestData>
</ItemGroup>
<ItemGroup>
<SupplementalTestDataTestDir Include="@(_SupplementalTestData->'$(TestPath)/%(DestinationDir)%(Filename)%(Extension)')" />
<SupplementalTestDataOutDir Include="@(_SupplementalTestData->'$(OutDir)%(DestinationDir)%(Filename)%(Extension)')" />
</ItemGroup>
<Copy
SourceFiles="@(_SupplementalTestData)"
DestinationFiles="@(SupplementalTestDataTestDir)"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
<Copy
SourceFiles="@(_SupplementalTestData)"
DestinationFiles="@(SupplementalTestDataOutDir)"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
</Target>
<!-- Workaround for VS execution: This will form the same list and copy the same files as
copied via RunTests script so VS can work when the test dir is initially clean.
-->
<PropertyGroup Condition="'$(BuildingInsideVisualStudio)'=='true'">
<PrepareForRunDependsOn>$(PrepareForRunDependsOn);CopyDefaultTestAssetsForVS</PrepareForRunDependsOn>
</PropertyGroup>
<Target Name="CopyDefaultTestAssetsForVS" DependsOnTargets="DiscoverTestInputs;CopySupplementalTestData">
<!-- This was copied from RunTestsForProject in tests.targets
The RunTestsForProject target does not execute in VS context and would be confused by the script based runner.
_TestCopyLocalByFileNameWithoutDuplicates are the precise items that are fed to the runner script generation code.
-->
<ItemGroup>
<!-- Not all platforms can use the .ni.dlls that come from packages. If TestWithoutNativeImages is specified, we'll exclude them from copy generation.
If we end up needing this for any other sorts of filtering, we'll want to add a list of filtered extensions to be matched on EndsWith. -->
<_IncludedFileForTestsInVS Include="@(_TestCopyLocalByFileNameWithoutDuplicates)"
Condition="'$(TestWithoutNativeImages)' != 'true' Or !$([System.String]::Copy('%(_TestCopyLocalByFileNameWithoutDuplicates.SourcePath)').EndsWith('.ni.dll'))" >
<PackageRelativePath Condition="'%(_TestCopyLocalByFileNameWithoutDuplicates.NugetPackageId)' != ''">$([System.String]::Copy('%(_TestCopyLocalByFileNameWithoutDuplicates.SourcePath)').Replace('$(PackagesDir)',''))</PackageRelativePath>
<UseAbsolutePath Condition="'$(TestWithLocalLibraries)'=='true'">$([System.String]::Copy('%(_TestCopyLocalByFileNameWithoutDuplicates.SourcePath)').StartsWith('$(BinDir)'))</UseAbsolutePath>
<DestinationPath>$(TestPath)\%(Filename)%(Extension)</DestinationPath>
</_IncludedFileForTestsInVS>
<_IncludedFileForTestsInVs Remove="@(_IncludedFileForTestsInVS)" Condition="Exists('%(DestinationPath)')" />
</ItemGroup>
<Copy
SourceFiles="@(_IncludedFileForTestsInVS -> '%(SourcePath)')"
DestinationFiles="@(_IncludedFileForTestsInVS->'%(DestinationPath)')"
SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
UseHardlinksIfPossible="true">
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
</Copy>
</Target>
<!-- archive the test binaries along with some supporting files -->
<Target Name="ArchiveTestBuild"
Condition="'$(ArchiveTests)' == 'true'"
DependsOnTargets="GenerateTestExecutionScripts">
<PropertyGroup>
<TestArchiveDir>$(TestWorkingDir)$(OSPlatformConfig)/archive/tests/$(TargetOutputRelPath)</TestArchiveDir>
<TestArchiveDir Condition="'$(TestTFM)' != ''">$(TestArchiveDir)$(TestTFM)/</TestArchiveDir>
<ProjectJson Condition="!Exists('$(ProjectJson)')">$(OriginalProjectJson)</ProjectJson>
</PropertyGroup>
<PropertyGroup Condition="'$(TestProjectName)'==''">
<TestProjectName>$(MSBuildProjectName)</TestProjectName>
</PropertyGroup>
<!-- the project json and runner script files need to be included in the archive -->
<Copy SourceFiles="$(ProjectJson);$(ProjectLockJson)" DestinationFolder="$(TestPath)" />
<MakeDir Directories="$(TestArchiveDir)" />
<ZipFileCreateFromDirectory SourceDirectory="$(TestPath)" DestinationArchive="$(TestArchiveDir)$(TestProjectName).zip" OverwriteDestination="true" />
</Target>
</Project>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(ResolveMatchingContract)' == 'true'">
<ResolveReferencesDependsOn>
ResolveMatchingContract;
$(ResolveReferencesDependsOn)
</ResolveReferencesDependsOn>
<CleanDependsOn>
ResolveMatchingContract;
$(CleanDependsOn);
</CleanDependsOn>
</PropertyGroup>
<Target Name="ResolveMatchingContract">
<PropertyGroup>
<HasMatchingContract Condition="'$(HasMatchingContract)' == '' and Exists('$(SourceDir)/$(AssemblyName)/ref')">true</HasMatchingContract>
</PropertyGroup>
<ItemGroup Condition="'$(HasMatchingContract)' == 'true'">
<ResolvedMatchingContract Include="$(ContractOutputPath)/$(MSBuildProjectName).dll" />
</ItemGroup>
<Error Condition="'$(HasMatchingContract)' == 'true' and !Exists('%(ResolvedMatchingContract.Identity)')" Text="ResolveMatchingContract could not find a matching contract '%(ResolvedMatchingContract.Identity)' not found." />
</Target>
</Project>

View File

@@ -0,0 +1,280 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- This is the target that copies the test assets to the test output -->
<Import Project="$(MSBuildThisFileDirectory)publishtest.targets" />
<UsingTask TaskName="GenerateTestExecutionScripts" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
<UsingTask TaskName="GetTargetMachineInfo" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
<!-- Which categories of tests to run by default -->
<PropertyGroup>
<TestDisabled>false</TestDisabled>
<TestDisabled Condition="'$(IsTestProject)'!='true' Or '$(SkipTests)'=='true' Or '$(RunTestsForProject)'=='false'">true</TestDisabled>
<TestsSuccessfulSemaphore>tests.passed</TestsSuccessfulSemaphore>
<RunningOnNetFx Condition="'$(_bc_TargetGroup)' == 'netfx'">true</RunningOnNetFx>
</PropertyGroup>
<!-- In case that TestPath is not yet set, default it here -->
<PropertyGroup>
<TestPath Condition="'$(TestPath)'==''">$(OutDir)</TestPath>
</PropertyGroup>
<ItemGroup>
<!-- Split semicolon separated lists -->
<WithCategoriesItems Include="$(WithCategories)" />
<WithoutCategoriesItems Include="$(WithoutCategories)" />
<DefaultNoCategories Include="$(DefaultNoCategories)" />
<UnsupportedPlatformsItems Include="$(UnsupportedPlatforms)"/>
</ItemGroup>
<PropertyGroup Condition="'$(RunningOnNetFx)' != 'true'">
<XunitRuntimeConfig>$(ToolsDir)\xunit.console.netcore.runtimeconfig.json</XunitRuntimeConfig>
<TestRuntimeEnvVar Condition="'$(OS)' == 'Windows_NT'">%RUNTIME_PATH%\</TestRuntimeEnvVar>
<TestRuntimeEnvVar Condition="'$(OS)' != 'Windows_NT'">$RUNTIME_PATH/</TestRuntimeEnvVar>
<TestHostExecutablePath Condition="'$(OS)'=='Windows_NT' AND '$(TestHostExecutablePath)' == ''">$(TestRuntimeEnvVar)dotnet.exe</TestHostExecutablePath>
<TestHostExecutablePath Condition="'$(OS)'!='Windows_NT' AND '$(TestHostExecutablePath)' == ''">$(TestRuntimeEnvVar)dotnet</TestHostExecutablePath>
<XunitExecutable Condition="'$(XunitExecutable)' == ''">xunit.console.netcore.exe</XunitExecutable>
<DebugEngines>{2E36F1D4-B23C-435D-AB41-18E608940038}</DebugEngines>
</PropertyGroup>
<PropertyGroup Condition="'$(RunningOnNetFx)' == 'true'">
<XunitExecutable Condition="'$(XunitExecutable)' == ''">xunit.console.exe</XunitExecutable>
</PropertyGroup>
<!-- General xunit options -->
<PropertyGroup>
<XunitResultsFileName>testResults.xml</XunitResultsFileName>
<XunitOptions Condition="'$(RunningOnNetFx)' == 'true'">$(XunitOptions) -noshadow </XunitOptions>
<XunitOptions>$(XunitOptions) -xml $(XunitResultsFileName)</XunitOptions>
<XunitOptions Condition="'$(Performance)'!='true'">$(XunitOptions) -notrait Benchmark=true</XunitOptions>
<XunitOptions Condition="'$(UseDotNetNativeToolchain)'=='true'">$(XunitOptions) -redirectoutput</XunitOptions>
<!-- Temporary till we fix the whole filtering with TargetGroup -->
<XunitOptions Condition="'$(RunningOnNetFx)' != 'true'">$(XunitOptions) -notrait category=nonnetcoreapp1.1tests</XunitOptions>
<XunitOptions Condition="'$(XunitMaxThreads)'!=''">$(XunitOptions) -maxthreads $(XunitMaxThreads)</XunitOptions>
<XunitTestAssembly Condition="'$(XunitTestAssembly)' == ''">$(TargetFileName)</XunitTestAssembly>
<XunitArguments>$(XunitTestAssembly) $(XunitOptions)</XunitArguments>
<TestProgram Condition="'$(TestHostExecutablePath)'!=''">$(TestHostExecutablePath)</TestProgram>
<TestArguments Condition="'$(TestHostExecutablePath)'!=''">$(XunitExecutable) $(XunitArguments)</TestArguments>
<TestProgram Condition="'$(TestHostExecutablePath)'==''">$(XunitExecutable)</TestProgram>
<TestArguments Condition="'$(TestHostExecutablePath)'==''">$(XunitArguments)</TestArguments>
<TestCommandLine Condition="'$(Performance)'!='true'">$(TestProgram) $(TestArguments) {XunitTraitOptions}</TestCommandLine>
</PropertyGroup>
<!-- The Code Coverage targets will override TestHost and TestCommandLine if coverage is enabled -->
<Import Project="$(MSBuildThisFileDirectory)CodeCoverage.targets" />
<!-- In VS (2015 Preview or later currently required): Debug to run unit tests on CoreCLR. -->
<PropertyGroup Condition="'$(IsTestProject)'=='true'">
<StartWorkingDirectory Condition="'$(StartWorkingDirectory)'==''">$(TestPath)</StartWorkingDirectory>
<StartAction Condition="'$(StartAction)'==''">Program</StartAction>
<StartProgram Condition="'$(StartProgram)'==''">$(TestSharedFxDir)\dotnet.exe</StartProgram>
<StartArguments Condition="'$(StartArguments)'==''">$(TestArguments) -wait -parallel none</StartArguments>
</PropertyGroup>
<Target Name="DiscoverTestInputs" DependsOnTargets="ResolveReferences;GetCopyToOutputDirectoryItems">
<ItemGroup>
<RunTestsForProjectInputs Include="@(ReferenceCopyLocalPaths)" />
<RunTestsForProjectInputs Include="@(Content)" />
<RunTestsForProjectInputs Include="@(IntermediateAssembly)" />
<RunTestsForProjectInputs Include="@(_DebugSymbolsIntermediatePath)" />
<RunTestsForProjectInputs Include="@(AllItemsFullPathWithTargetPath)" />
</ItemGroup>
<ItemGroup Condition="'$(RunningOnNetFx)' != 'true'">
<SupplementalTestData Include="$(XunitRuntimeConfig)" />
<SupplementalTestData Include="$(RuntimePath)xunit.console.netcore.exe" />
</ItemGroup>
<ItemGroup Condition="'$(RunningOnNetFx)' == 'true'">
<SupplementalTestData Include="$(RuntimePath)xunit*.*" />
<SupplementalTestData Include="$(RuntimePath)*.xslt" />
</ItemGroup>
</Target>
<!-- Generate the script to run the tests. The script performs two high-level steps:
1. Copies the common test runtime dependencies calculated in DiscoverTestDependencies to the test
execution directory. Each copy command no-ops if the file already exists in the test execution
directory.
2. Runs the tests. -->
<Target Name="GenerateTestExecutionScripts"
DependsOnTargets="DiscoverTestInputs;SetupTestProperties">
<PropertyGroup>
<TargetOSTrait Condition="'$(TargetOS)'=='Windows_NT'">nonwindowstests</TargetOSTrait>
<TargetOSTrait Condition="'$(TargetOS)'=='Linux'">nonlinuxtests</TargetOSTrait>
<TargetOSTrait Condition="'$(TargetOS)'=='OSX'">nonosxtests</TargetOSTrait>
<TargetOSTrait Condition="'$(TargetOS)'=='FreeBSD'">nonfreebsdtests</TargetOSTrait>
<TargetOSTrait Condition="'$(TargetOS)'=='NetBSD'">nonnetbsdtests</TargetOSTrait>
</PropertyGroup>
<Error Condition="'$(TargetOSTrait)' == ''" Text="TargetOS [$(TargetOS)] is unknown so we don't know how to configure the test run for this project [$(MSBuildProjectName)]" />
<ItemGroup>
<RunWithoutTraits Condition="'$(TargetOSTrait)'!=''" Include="$(TargetOSTrait)" />
</ItemGroup>
<PropertyGroup>
<RunnerScriptName Condition="'$(TargetOS)'=='Windows_NT'" >RunTests.cmd</RunnerScriptName>
<RunnerTemplateName Condition="'$(TargetOS)'=='Windows_NT'" >RunnerTemplate.Windows.txt</RunnerTemplateName>
<RunnerScriptName Condition="'$(TargetOS)'!='Windows_NT'" >RunTests.sh</RunnerScriptName>
<RunnerTemplateName Condition="'$(TargetOS)'!='Windows_NT'" >RunnerTemplate.Unix.txt</RunnerTemplateName>
</PropertyGroup>
<PropertyGroup>
<XunitTraitOptions Condition="'@(RunWithTraits)'!=''">$(XunitTraitOptions) -trait category=@(RunWithTraits, ' -trait category=') </XunitTraitOptions>
<XunitTraitOptions Condition="'@(RunWithoutTraits)'!=''">$(XunitTraitOptions) -notrait category=@(RunWithoutTraits, ' -notrait category=') </XunitTraitOptions>
</PropertyGroup>
<!-- Replace the {XunitTraitOptions} place holder with the actual traits. We use the place holder
because code coverage needs to have a bit of the test command line after the traits (it adds ending quotes
to one of its options). Simply appending the traits would break code coverage.
Additionally, replace CoreRun.exe with ./corerun on Non-Windows OSes (this is the only difference in the command)
Future refactoring will allow us to construct this correctly initially, but we don't always know the TargetOS
when the properties are set currently. -->
<PropertyGroup>
<TestCommandLine>$(TestCommandLine.Replace('{XunitTraitOptions}', '$(XunitTraitOptions)'))</TestCommandLine>
<!-- We also need to replace {CoverageFilter} with its true value, which should be evaluated correctly at this point. -->
<TestCommandLine>$(TestCommandLine.Replace('{CoverageFilter}', '$(CoverageFilter)'))</TestCommandLine>
<OutputFolderForScriptGenerator>$(TestPath)</OutputFolderForScriptGenerator>
<OutputPathForScriptGenerator>$(OutputFolderForScriptGenerator)/$(RunnerScriptName)</OutputPathForScriptGenerator>
<OutputFolderForTestDependencies>$(BinDir)/TestDependencies</OutputFolderForTestDependencies>
</PropertyGroup>
<MakeDir Condition="'$(CoverageEnabledForProject)'=='true'" Directories="$(CoverageReportDir)" />
<MakeDir Directories="$(OutputFolderForTestDependencies)" />
<PropertyGroup>
<_TestDependencyListRoot>$(MSBuildProjectName)-$(TestConfiguration)</_TestDependencyListRoot>
<_TestDependencyListFileName>$(_TestDependencyListRoot).dependencylist.txt</_TestDependencyListFileName>
<TestDependencyListFilePath>$(OutputFolderForTestDependencies)/$(_TestDependencyListFileName)</TestDependencyListFilePath>
</PropertyGroup>
<Message Text="Generating $(TestDependencyListFilePath)" />
<WriteLinesToFile
File="$(TestDependencyListFilePath)"
Lines="@(IncludedFileForRunnerScript -> '%(PackageRelativePath)')"
Overwrite="true"
Encoding="Ascii" />
<!-- For .NET Native compilation, we first need to generate a native executable if possible. -->
<ItemGroup Condition="'$(UseDotNetNativeToolchain)' == 'true' AND '$(Performance)'!='true'" >
<TestCommandLines Include="copy /y $(TestILCFolder)\default.rd.xml %EXECUTION_DIR%" />
<TestCommandLines Include="$(TestILCFolder)\ilc.exe -usecustomframework -ExeName xunit.console.netcore.exe -in %EXECUTION_DIR% -out %EXECUTION_DIR%\native -usedefaultpinvoke -buildtype ret -v diag || exit /b %ERRORLEVEL%"/>
<TestCommandLines Include="copy /y $(TestILCFolder)\CRT\vcruntime140_app.dll %EXECUTION_DIR%\native" />
<TestCommandLines Include="echo > %EXECUTION_DIR%\native\$(XunitTestAssembly)"/>
<TestCommandLines Include="cd native"/>
</ItemGroup>
<ItemGroup Condition="'$(Performance)'!='true'">
<!-- On Windows, call prevents the test command from making execution end prematurely -->
<TestCommandLines Condition="'$(TargetOS)'=='Windows_NT'" Include="call $(TestCommandLine)"/>
<TestCommandLines Condition="'$(TargetOS)'!='Windows_NT'" Include="$(TestCommandLine)"/>
</ItemGroup>
<!-- Currently all netcore50 implementations of System.Console actually write to a noop stream -->
<!-- Workaround is to have the exe detect this and use Console.SetOut to write to a text file. -->
<ItemGroup Condition="'$(UseDotNetNativeToolchain)' == 'true' AND '$(Performance)'!='true'" >
<TestCommandLines Include="type Xunit.Console.Output.txt" />
<TestCommandLines Include="copy /y testResults.xml %EXECUTION_DIR%\" />
</ItemGroup>
<!-- Do not put anything between this Item Group and the GenerateTestExecutionScripts invocation -->
<ItemGroup>
<TestCommandLines Include="@(PostExecutionTestCommandLines)" />
</ItemGroup>
<GenerateTestExecutionScripts
TestCommands="@(TestCommandLines)"
TestDependencies="@(DontIncludeAnything)"
RunnerScriptTemplate="$(MSBuildThisFileDirectory)/$(RunnerTemplateName)"
ScriptOutputPath ="$(OutputPathForScriptGenerator)"
/>
</Target>
<Target Name="RunTestsForProject"
Condition="'$(TestDisabled)' != 'true'"
DependsOnTargets="DiscoverTestInputs;CheckTestCategories"
Inputs="@(RunTestsForProjectInputs)"
Outputs="$(TestsSuccessfulSemaphore);$(TestPath)/$(XunitResultsFileName);$(CoverageOutputFilePath)"
>
<MakeDir Condition="'$(CoverageEnabledForProject)'=='true'" Directories="$(CoverageReportDir)" />
<Exec Command="$(TestPath)/$(RunnerScriptName) $(TestSharedFxDir)"
CustomErrorRegularExpression="Failed: [^0]"
ContinueOnError="true"
IgnoreStandardErrorWarningFormat="true"
>
<Output PropertyName="TestRunExitCode" TaskParameter="ExitCode" />
</Exec>
<Error Condition="'$(TestDisabled)'!='true' And '$(TestRunExitCode)' != '0'" Text="One or more tests failed while running tests from '$(MSBuildProjectName)' please check $(TestPath)$(XunitResultsFileName) for details!" />
<Touch Condition="'$(TestRunExitCode)' == '0'" Files="$(TestsSuccessfulSemaphore)" AlwaysCreate="true" />
</Target>
<!-- Needs to run before RunTestsForProject target as it computes categories and set TestDisabled -->
<Target Name="CheckTestCategories">
<!-- Default behavior is to disable OuterLoop and failing tests if not specified in WithCategories. -->
<ItemGroup>
<DefaultNoCategories Condition="'$(Outerloop)'!='true'" Include="OuterLoop" />
<DefaultNoCategories Include="failing" />
<WithoutCategoriesItems Include="@(DefaultNoCategories)" Exclude="@(WithCategoriesItems)" />
<WithoutCategoriesItemsDistinct Include="@(WithoutCategoriesItems->Distinct())" />
</ItemGroup>
<ItemGroup>
<RunWithTraits Condition="'@(WithCategoriesItems)'!=''" Include="@(WithCategoriesItems)" />
<RunWithoutTraits Condition="'@(WithoutCategoriesItemsDistinct)'!=''" Include="@(WithoutCategoriesItemsDistinct)" />
</ItemGroup>
<PropertyGroup>
<TestsSuccessfulSemaphore Condition="'@(RunWithTraits)' != ''">$(TestsSuccessfulSemaphore).with.@(RunWithTraits, '.')</TestsSuccessfulSemaphore>
<TestsSuccessfulSemaphore Condition="'@(RunWithoutTraits)' != ''">$(TestsSuccessfulSemaphore).without.@(RunWithoutTraits, '.')</TestsSuccessfulSemaphore>
<TestsSuccessfulSemaphore>$(TestPath)/$(TestsSuccessfulSemaphore)</TestsSuccessfulSemaphore>
</PropertyGroup>
<Delete Condition="'$(ForceRunTests)'=='true' And Exists($(TestsSuccessfulSemaphore))"
Files="$(TestsSuccessfulSemaphore)" />
</Target>
<Target Name="CheckTestPlatforms">
<GetTargetMachineInfo Condition="'$(TargetOS)' == ''">
<Output TaskParameter="TargetOS" PropertyName="TargetOS" />
</GetTargetMachineInfo>
<PropertyGroup>
<TestDisabled Condition="'%(UnsupportedPlatformsItems.Identity)' == '$(TargetOS)' Or '$(ConfigurationErrorMsg)' != ''">true</TestDisabled>
</PropertyGroup>
<Message Text="CheckTestPlatforms found TargetOS of [$(TargetOS)]." Importance="Low" />
<Message Condition="'%(UnsupportedPlatformsItems.Identity)' == '$(TargetOS)'"
Text="Skipping tests in $(AssemblyName) because it is not supported on $(TargetOS)" />
<Message Condition="'$(ConfigurationErrorMsg)' != ''"
Text="Skipping tests in $(AssemblyName) because there is no configuration compatible with the current BuildConfiguration." />
</Target>
<Target Name="SetupTestProperties" DependsOnTargets="CheckTestPlatforms;CheckTestCategories" />
<PropertyGroup>
<TestDependsOn>
$(TestDependsOn);
CopySupplementalTestData;
GenerateTestExecutionScripts;
RunTestsForProject;
ArchiveTestBuild
</TestDependsOn>
</PropertyGroup>
<Target Name="Test" DependsOnTargets="$(TestDependsOn)" />
<Target Name="BuildAndTest" DependsOnTargets="Build;Test" />
<Target Name="RebuildAndTest" DependsOnTargets="Rebuild;Test" />
<!-- This helps collect crash dumps and requires python installed -->
<Import Project="$(MSBuildThisFileDirectory)Dumpling.targets" Condition="'$(EnableDumpling)' == 'true' OR '$(EnableCloudTest)' == 'true'" />
</Project>

View File

@@ -0,0 +1,387 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="GenerateCurrentVersion" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll" />
<!-- Setup the default file version information -->
<PropertyGroup>
<MajorVersion Condition="'$(MajorVersion)' == ''">1</MajorVersion>
<MinorVersion Condition="'$(MinorVersion)' == ''">0</MinorVersion>
<!-- These should be set by importing the targets below but initializing to 0 for consistency -->
<BuildNumberMajor Condition="'$(BuildNumberMajor)' == ''">0</BuildNumberMajor>
<BuildNumberMinor Condition="'$(BuildNumberMinor)' == ''">0</BuildNumberMinor>
</PropertyGroup>
<!-- Import a build target that includes the build numbers -->
<Import Project="$(BuildNumberTarget)" Condition="Exists('$(BuildNumberTarget)')" />
<!-- #################################### -->
<!-- Generate Assembly Info -->
<!-- #################################### -->
<PropertyGroup>
<AssemblyVersion Condition="'$(AssemblyVersion)'==''">1.0.0.0</AssemblyVersion>
<CLSCompliant Condition="'$(CLSCompliant)'==''">false</CLSCompliant>
<AssemblyFileVersion Condition="'$(AssemblyFileVersion)'==''">$(MajorVersion).$(MinorVersion).$(BuildNumberMajor).$(BuildNumberMinor)</AssemblyFileVersion>
</PropertyGroup>
<PropertyGroup>
<GenerateAssemblyInfo Condition="'$(GenerateAssemblyInfo)'==''">true</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup Condition="'$(GenerateAssemblyInfo)'=='true'">
<AssemblyInfoFile Condition="'$(MSBuildProjectExtension)' == '.csproj'">$(IntermediateOutputPath)_AssemblyInfo.cs</AssemblyInfoFile>
<AssemblyInfoFile Condition="'$(MSBuildProjectExtension)' == '.vbproj'">$(IntermediateOutputPath)_AssemblyInfo.vb</AssemblyInfoFile>
<AssemblyInfoPartialFile Condition="'$(MSBuildProjectExtension)' == '.csproj'">$(MSBuildThisFileDirectory)AssemblyInfoPartial.cs</AssemblyInfoPartialFile>
<AssemblyInfoPartialFile Condition="'$(MSBuildProjectExtension)' == '.vbproj'">$(MSBuildThisFileDirectory)AssemblyInfoPartial.vb</AssemblyInfoPartialFile>
<AssemblyInfoPartialFileLink Condition="'$(MSBuildProjectExtension)' == '.csproj'">Properties/_AssemblyInfo.cs</AssemblyInfoPartialFileLink>
<AssemblyInfoPartialFileLink Condition="'$(MSBuildProjectExtension)' == '.vbproj'">My Project/_AssemblyInfo.vb</AssemblyInfoPartialFileLink>
<CoreCompileDependsOn>$(CoreCompileDependsOn);GenerateAssemblyInfo</CoreCompileDependsOn>
</PropertyGroup>
<Target Name="GenerateAssemblyInfo"
Inputs="$(MSBuildProjectFile)"
Outputs="$(AssemblyInfoFile)"
Condition="'$(GenerateAssemblyInfo)'=='true'"
DependsOnTargets="CreateVersionFileDuringBuild">
<Error Condition="!Exists('$(IntermediateOutputPath)')" Text="GenerateAssemblyInfo failed because IntermediateOutputPath isn't set to a valid directory" />
<ItemGroup Condition="'$(MSBuildProjectExtension)' == '.csproj'">
<AssemblyInfoUsings Include="using System%3B" />
<AssemblyInfoUsings Include="using System.Reflection%3B" />
<AssemblyInfoLines Include="[assembly:AssemblyTitle(&quot;$(AssemblyName)&quot;)]" />
<AssemblyInfoLines Include="[assembly:AssemblyDescription(&quot;$(AssemblyName)&quot;)]" />
<AssemblyInfoLines Include="[assembly:AssemblyDefaultAlias(&quot;$(AssemblyName)&quot;)]" />
<AssemblyInfoLines Include="[assembly:AssemblyCompany(&quot;Microsoft Corporation&quot;)]" />
<AssemblyInfoLines Include="[assembly:AssemblyProduct(&quot;Microsoft\x00ae .NET Framework&quot;)]" />
<AssemblyInfoLines Include="[assembly:AssemblyCopyright(&quot;\x00a9 Microsoft Corporation. All rights reserved.&quot;)]" />
<AssemblyInfoLines Include="[assembly:AssemblyVersion(&quot;$(AssemblyVersion)&quot;)]" />
<AssemblyInfoLines Include="[assembly:AssemblyFileVersion(&quot;$(AssemblyFileVersion)&quot;)]" />
<AssemblyInfoLines Include="[assembly:AssemblyInformationalVersion(@&quot;$(AssemblyFileVersion)$(BuiltByString). Commit Hash%3A $(LatestCommit)&quot;)]" />
<AssemblyInfoLines Condition="'$(CLSCompliant)'=='true'" Include="[assembly:CLSCompliant(true)]" />
<AssemblyInfoLines Condition="'$(AssemblyComVisible)'!=''" Include="[assembly:System.Runtime.InteropServices.ComVisible($(AssemblyComVisible))]" />
<AssemblyInfoLines Condition="'$(SkipFrameworkAssemblyMetadata)' != 'true'"
Include="[assembly:System.Reflection.AssemblyMetadata(&quot;%(AssemblyMetadata.Identity)&quot;, &quot;%(AssemblyMetadata.Value)&quot;)]" />
</ItemGroup>
<ItemGroup Condition="'$(MSBuildProjectExtension)' == '.vbproj'">
<AssemblyInfoUsings Include="Imports System" />
<AssemblyInfoUsings Include="Imports System.Reflection" />
<AssemblyInfoLines Include="&lt;Assembly:AssemblyTitle(&quot;$(AssemblyName)&quot;)&gt;" />
<AssemblyInfoLines Include="&lt;Assembly:AssemblyDescription(&quot;$(AssemblyName)&quot;)&gt;" />
<AssemblyInfoLines Include="&lt;Assembly:AssemblyDefaultAlias(&quot;$(AssemblyName)&quot;)&gt;" />
<AssemblyInfoLines Include="&lt;Assembly:AssemblyCompany(&quot;Microsoft Corporation&quot;)&gt;" />
<AssemblyInfoLines Include="&lt;Assembly:AssemblyProduct(&quot;Microsoft\x00ae .NET Framework&quot;)&gt;" />
<AssemblyInfoLines Include="&lt;Assembly:AssemblyCopyright(&quot;\x00a9 Microsoft Corporation. All rights reserved.&quot;)&gt;" />
<AssemblyInfoLines Include="&lt;Assembly:AssemblyVersion(&quot;$(AssemblyVersion)&quot;)&gt;" />
<AssemblyInfoLines Include="&lt;Assembly:AssemblyFileVersion(&quot;$(AssemblyFileVersion)&quot;)&gt;" />
<AssemblyInfoLines Include="&lt;Assembly:AssemblyInformationalVersion(&quot;$(AssemblyFileVersion)$(BuiltByString). Commit Hash%3A $(LatestCommit)&quot;)&gt;" />
<AssemblyInfoLines Condition="'$(CLSCompliant)'=='true'" Include="&lt;Assembly:CLSCompliant(True)&gt;" />
<AssemblyInfoLines Condition="'$(AssemblyComVisible)'!=''" Include="&lt;Assembly:System.Runtime.InteropServices.ComVisible($(AssemblyComVisible))&gt;" />
<AssemblyInfoLines Condition="'$(SkipFrameworkAssemblyMetadata)' != 'true'"
Include="&lt;assembly:System.Reflection.AssemblyMetadata(&quot;%(AssemblyMetadata.Identity)&quot;, &quot;%(AssemblyMetadata.Value)&quot;)&gt;" />
</ItemGroup>
<ItemGroup Condition="'$(MSBuildProjectExtension)' == '.csproj' And '$(GenerateThisAssemblyClass)' == 'true'">
<AssemblyInfoLines Include="internal static class ThisAssembly" />
<AssemblyInfoLines Include="{" />
<AssemblyInfoLines Include="%20%20%20%20internal const string Title = &quot;$(AssemblyName)&quot;%3B" />
<AssemblyInfoLines Include="%20%20%20%20internal const string Copyright = &quot;\u00A9 Microsoft Corporation. All rights reserved.&quot;%3B" />
<AssemblyInfoLines Include="%20%20%20%20internal const string Version = &quot;$(AssemblyVersion)&quot;%3B" />
<AssemblyInfoLines Include="%20%20%20%20internal const string InformationalVersion = &quot;$(AssemblyFileVersion)&quot;%3B" />
<AssemblyInfoLines Include="}" />
</ItemGroup>
<WriteLinesToFile
File="$(AssemblyInfoFile)"
Lines="@(AssemblyInfoUsings);@(AssemblyInfoLines);@(AssemblyInfoSource)"
Overwrite="true" />
<ItemGroup>
<Compile Include="$(AssemblyInfoFile)" />
<FileWrites Include="$(AssemblyInfoFile)" />
</ItemGroup>
</Target>
<ItemGroup Condition="'$(GenerateAssemblyInfo)'=='true' AND '$(StringResourcesPath)' != '' AND '$(ExcludeAssemblyInfoPartialFile)' != 'true'">
<Compile Include="$(AssemblyInfoPartialFile)">
<Visible>true</Visible>
<Link>$(AssemblyInfoPartialFileLink)</Link>
</Compile>
</ItemGroup>
<PropertyGroup>
<GenerateNativeVersionInfo Condition="'$(GenerateNativeVersionInfo)'==''">false</GenerateNativeVersionInfo>
</PropertyGroup>
<PropertyGroup Condition="'$(GenerateNativeVersionInfo)'=='true'">
<NativeVersionFileDir>$(BaseIntermediateOutputPath)</NativeVersionFileDir>
<NativeVersionHeaderFile>$(NativeVersionFileDir)_version.h</NativeVersionHeaderFile>
<GenerateVersionHeader>true</GenerateVersionHeader>
</PropertyGroup>
<Target Name="GenerateVersionHeader"
Inputs="$(MSBuildProjectFile)"
Outputs="$(NativeVersionHeaderFile)"
DependsOnTargets="CreateVersionFileDuringBuild"
Condition="'$(NativeVersionHeaderFile)'!='' and '$(GenerateVersionHeader)'=='true' and !Exists($(NativeVersionHeaderFile))">
<ItemGroup>
<!-- Defining versioning variables -->
<NativeVersionLines Include="#ifndef VER_COMPANYNAME_STR" />
<NativeVersionLines Include="#define VER_COMPANYNAME_STR &quot;Microsoft Corporation&quot;" />
<NativeVersionLines Include="#endif" />
<NativeVersionLines Include="#ifndef VER_FILEDESCRIPTION_STR" />
<NativeVersionLines Include="#define VER_FILEDESCRIPTION_STR &quot;$(AssemblyName)&quot;" />
<NativeVersionLines Include="#endif" />
<NativeVersionLines Include="#ifndef VER_INTERNALNAME_STR" />
<NativeVersionLines Include="#define VER_INTERNALNAME_STR VER_FILEDESCRIPTION_STR" />
<NativeVersionLines Include="#endif" />
<NativeVersionLines Include="#ifndef VER_ORIGINALFILENAME_STR" />
<NativeVersionLines Include="#define VER_ORIGINALFILENAME_STR VER_FILEDESCRIPTION_STR" />
<NativeVersionLines Include="#endif" />
<NativeVersionLines Include="#ifndef VER_PRODUCTNAME_STR" />
<NativeVersionLines Include="#define VER_PRODUCTNAME_STR &quot;Microsoft\xae .NET Framework&quot;" />
<NativeVersionLines Include="#endif" />
<NativeVersionLines Include="#undef VER_PRODUCTVERSION" />
<NativeVersionLines Include="#define VER_PRODUCTVERSION $(MajorVersion),$(MinorVersion),$(BuildNumberMajor),$(BuildNumberMinor)" />
<NativeVersionLines Include="#undef VER_PRODUCTVERSION_STR" />
<NativeVersionLines Include="#define VER_PRODUCTVERSION_STR &quot;$(MajorVersion).$(MinorVersion).$(BuildNumberMajor).$(BuildNumberMinor)$(BuiltByString). Commit Hash%3A $(LatestCommit)&quot;" />
<NativeVersionLines Include="#undef VER_FILEVERSION" />
<NativeVersionLines Include="#define VER_FILEVERSION $(MajorVersion),$(MinorVersion),$(BuildNumberMajor),$(BuildNumberMinor)" />
<NativeVersionLines Include="#undef VER_FILEVERSION_STR" />
<NativeVersionLines Include="#define VER_FILEVERSION_STR &quot;$(MajorVersion).$(MinorVersion).$(BuildNumberMajor).$(BuildNumberMinor)$(BuiltByString). Commit Hash%3A $(LatestCommit)&quot;" />
<NativeVersionLines Include="#ifndef VER_LEGALCOPYRIGHT_STR" />
<NativeVersionLines Include="#define VER_LEGALCOPYRIGHT_STR &quot;\xa9 Microsoft Corporation. All rights reserved.&quot;" />
<NativeVersionLines Include="#endif" />
<NativeVersionLines Include="#ifndef VER_DEBUG" />
<NativeVersionLines Condition="'$(Configuration)'=='Debug'" Include="#define VER_DEBUG VS_FF_DEBUG" />
<NativeVersionLines Condition="'$(Configuration)'!='Debug'" Include="#define VER_DEBUG 0" />
<NativeVersionLines Include="#endif" />
</ItemGroup>
<MakeDir Condition="!Exists('$(NativeVersionFileDir)')" Directories="$(NativeVersionFileDir)" />
<WriteLinesToFile
File="$(NativeVersionHeaderFile)"
Lines="@(NativeVersionLines)"
Overwrite="true" />
<ItemGroup>
<FileWrites Include="$(NativeVersionHeaderFile)" />
</ItemGroup>
</Target>
<PropertyGroup Condition="'$(GenerateVersionSourceFile)'=='true'">
<NativeVersionSourceDir>$(BaseIntermediateOutputPath)</NativeVersionSourceDir>
<NativeVersionSourceFile>$(NativeVersionSourceDir)version.c</NativeVersionSourceFile>
</PropertyGroup>
<!-- Non Windows versioning requires to generate a source file and include it on the compilation. -->
<Target Name="GenerateVersionSourceFile"
Inputs="$(MSBuildProjectFile)"
Outputs="$(NativeVersionSourceFile)"
DependsOnTargets="CreateVersionFileDuringBuild"
Condition="'$(NativeVersionSourceFile)'!='' and '$(GenerateVersionSourceFile)'=='true'">
<ItemGroup>
<SourceFileLines />
<SourceFileLines Include="static char sccsid%5B%5D %5F%5Fattribute%5F%5F%28%28used%29%29 %3D %22%40%28%23%29Version $(MajorVersion).$(MinorVersion).$(BuildNumberMajor).$(BuildNumberMinor)$(BuiltByString). Commit Hash%3A $(LatestCommit)%22%3B" />
<!-- Since this is a source file, compiler will complain if there is no new line at end of file, so adding one bellow. -->
<SourceFileLines Include=" " />
</ItemGroup>
<MakeDir Condition="!Exists('$(NativeVersionSourceDir)')" Directories="$(NativeVersionSourceDir)" />
<WriteLinesToFile
File="$(NativeVersionSourceFile)"
Lines="@(SourceFileLines)"
Overwrite="true" />
<ItemGroup>
<FileWrites Include="$(NativeVersionSourceFile)" />
</ItemGroup>
</Target>
<PropertyGroup>
<GetNuGetPackageVersionsDependsOn>$(GetNuGetPackageVersionsDependsOn);CreateVersionInfoFile</GetNuGetPackageVersionsDependsOn>
</PropertyGroup>
<PropertyGroup>
<SyncInfoDirectory Condition="'$(SyncInfoDirectory)' == ''">$(ObjDir)</SyncInfoDirectory>
<SyncInfoFile Condition="'$(SyncInfoFile)' == ''">$(SyncInfoDirectory)version.txt</SyncInfoFile>
</PropertyGroup>
<Target Name="CreateVersionInfoFile"
DependsOnTargets="CreateVersionFileDuringBuild"
BeforeTargets="BuildAllProjects"
Inputs="$(LatestCommit)"
Outputs="$(SyncInfoFile)">
<MakeDir Condition="!Exists('$(SyncInfoDirectory)')"
Directories="$(SyncInfoDirectory)" />
<WriteLinesToFile
Condition="'$(LatestCommit)' != ''"
File="$(SyncInfoFile)"
Lines="$(LatestCommit)"
Overwrite="true" />
</Target>
<!--
Target: CreateOrUpdateCurrentVersionFile
Generates the version data and saves it to $(BuildVersionFile) if it hasn't been imported
Outputs:
$(LatestCommit)
$(BuiltByString)
$(BuildNumberMajor)
$(BuildNumberMinor)
$(AssemblyFileVersion)
-->
<Target Name="CreateOrUpdateCurrentVersionFile"
BeforeTargets="ResolveProjectReferences"
Condition="'$(SkipVersionGeneration)' != 'true' AND '$(VersionPropsImported)' != 'true'">
<!-- ############################### -->
<!-- Get the latest commit hash -->
<Exec Command="git rev-parse HEAD 2>&amp;1" StandardOutputImportance="Low" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="LatestCommit" />
<Output TaskParameter="ExitCode" PropertyName="LatestCommitExitCode" />
</Exec>
<!-- We shouldn't fail the build if we can't retreive the commit hash, so in this case just set it to N/A -->
<PropertyGroup Condition="'$(LatestCommitExitCode)'!='0'">
<LatestCommit>N/A</LatestCommit>
</PropertyGroup>
<PropertyGroup>
<LatestCommitExitCode/>
</PropertyGroup>
<!-- ############################### -->
<!-- Get the latest commit date -->
<ItemGroup>
<VersionTargetsFile Include="$(MSBuildThisFileFullPath)" />
</ItemGroup>
<!-- Windows Exec command requires DOS escaping for the percent sign since it secretly runs the process in a shell instead of calling createprocess. -->
<PropertyGroup>
<LatestDateCommand Condition="'$(OsEnvironment)'=='Windows_NT'">git show -s --format=^%25%25cd --date=short HEAD</LatestDateCommand>
<LatestDateCommand Condition="'$(OsEnvironment)'!='Windows_NT'">git show -s --format=%25cd --date=short HEAD</LatestDateCommand>
</PropertyGroup>
<Exec Command="$(LatestDateCommand)" StandardOutputImportance="Low" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="VersionSeedDate" />
<Output TaskParameter="ExitCode" PropertyName="LatestDateCommandExitCode" />
</Exec>
<PropertyGroup Condition="'$(LatestDateCommandExitCode)'!='0'">
<VersionSeedDate>%(VersionTargetsFile.ModifiedTime)</VersionSeedDate>
<VersionSeedSourceComment>VersionSeedDate was produced by getting the timestamp of versioning.targets.</VersionSeedSourceComment>
</PropertyGroup>
<PropertyGroup Condition="'$(LatestDateCommandExitCode)'=='0'">
<VersionSeedSourceComment>VersionSeedDate was produced by taking the timestamp of the last git commit.</VersionSeedSourceComment>
</PropertyGroup>
<ItemGroup>
<VersionTargetsFile Remove="@(VersionTargetsFile)" />
</ItemGroup>
<PropertyGroup>
<LatestDateCommand/>
<LatestDateCommandExitCode/>
</PropertyGroup>
<!-- ############################### -->
<!-- Get Username -->
<PropertyGroup>
<VersionUserName Condition="'$(VersionUserName)' == ''">$(USERNAME)</VersionUserName>
</PropertyGroup>
<Exec Command="whoami" Condition="'$(VersionUserName)' == ''" StandardOutputImportance="Low" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="VersionUserName" />
</Exec>
<!-- ############################### -->
<!-- Get Hostname -->
<PropertyGroup>
<VersionHostName Condition="'$(VersionHostName)' == ''">$(COMPUTERNAME)</VersionHostName>
</PropertyGroup>
<Exec Command="hostname" Condition="'$(OSEnvironment)'!='Windows_NT' AND '$(VersionHostName)'==''" StandardOutputImportance="Low" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="VersionHostName" />
</Exec>
<PropertyGroup>
<BuiltByString Condition="'$(BuiltByString)' == '' AND '$(VersionUserName)' != '' AND '$(VersionHostName)' != ''">%20built by: $(VersionUserName)-$(VersionHostName)</BuiltByString>
<VersionUserName/>
<VersionHostName/>
</PropertyGroup>
<!-- Setting default parameters in case that they are not set before. -->
<PropertyGroup>
<!-- Padding should be equal or greater to 5. Using 5 to align with internal build system. -->
<VersionPadding Condition="'$(VersionPadding)'==''">5</VersionPadding>
<!-- Using the following default comparison date will produce versions that align with our internal build system. -->
<VersionComparisonDate Condition="'$(VersionComparisonDate)'==''">1996-04-01</VersionComparisonDate>
</PropertyGroup>
<GenerateCurrentVersion SeedDate="$(VersionSeedDate)" OfficialBuildId="$(OfficialBuildId)" ComparisonDate="$(VersionComparisonDate)" Padding="$(VersionPadding)">
<Output PropertyName="BuildNumberMajor" TaskParameter="GeneratedVersion" />
<Output PropertyName="BuildNumberMinor" TaskParameter="GeneratedRevision" />
</GenerateCurrentVersion>
<PropertyGroup>
<VersionPadding/>
<VersionComparisonDate/>
</PropertyGroup>
<PropertyGroup>
<VersionFileContent>
<![CDATA[<?xml version="1.0" encoding="utf-8"?>
<!-- This is a generated file. $(VersionSourceComment) Seed Date is $(VersionSeedDate). -->
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VersionPropsImported>true</VersionPropsImported>
<BuildNumberMajor Condition="'%24(BuildNumberMajor)' == ''">$(BuildNumberMajor)</BuildNumberMajor>
<BuildNumberMinor Condition="'%24(BuildNumberMinor)' == ''">$(BuildNumberMinor)</BuildNumberMinor>
<LatestCommit Condition="'%24(LatestCommit)' == ''">$(LatestCommit)</LatestCommit>
<BuiltByString Condition="'%24(BuiltByString)' == ''">$(BuiltByString)</BuiltByString>
</PropertyGroup>
</Project>
]]>
</VersionFileContent>
</PropertyGroup>
<!-- Since by default the file will get dropped at the obj dir, make sure that the dir is created already or else WriteLinesToFile will error. -->
<MakeDir Directories="$(BuildVersionFilePath)" />
<WriteLinesToFile
ContinueOnError="WarnAndContinue"
Condition="!Exists('$(BuildVersionFile)')"
File="$(BuildVersionFile)"
Lines="$(VersionFileContent)"
Overwrite="true" />
<!-- Delete old BuildVersion.props files -->
<ItemGroup>
<OldBuildVersionFiles Include="$(BuildVersionFilePath)BuildVersions-*.props" Exclude="$(BuildVersionFile)" />
</ItemGroup>
<Delete Files="@(OldBuildVersionFiles)" TreatErrorsAsWarnings="true"/>
<ItemGroup>
<OldBuildVersionFiles Remove="@(OldBuildVersionFiles)"/>
</ItemGroup>
<PropertyGroup>
<!-- Redefine AssemblyFileVersion because we just computed it. -->
<AssemblyFileVersion>$(MajorVersion).$(MinorVersion).$(BuildNumberMajor).$(BuildNumberMinor)</AssemblyFileVersion>
</PropertyGroup>
</Target>
<!-- This target will only be executed if BuildVersion.props doesn't exist yet -->
<Target Name="CreateVersionFileDuringBuild" Condition="'$(SkipVersionGeneration)'!='true' AND '$(ShouldCreateVersionFileDuringBuild)'=='true'" DependsOnTargets="CreateOrUpdateCurrentVersionFile">
<PropertyGroup Condition="'$(SkipVersionGeneration)'!='true'">
<VersionSuffix Condition="'$(PreReleaseLabel)' != ''">-$(PreReleaseLabel)</VersionSuffix>
<VersionSuffix Condition="'$(IncludeBuildNumberInPackageVersion)' == 'true'">$(VersionSuffix)-$(BuildNumberMajor)-$(BuildNumberMinor)</VersionSuffix>
</PropertyGroup>
</Target>
<Target Name="NativeResourceCompile" DependsOnTargets="$(BeforeResourceCompileTargets)" Inputs="$(MsBuildThisFileDirectory)NativeVersion.rc" Outputs="$(Win32Resource)">
<Error Condition="!Exists('$(RCPATH)')" Text="NativeResourceCompile failed because RCPath is set to an non-existing rc.exe path." />
<Exec Command='"$(RCPath)" /i $(BaseIntermediateOutputPath) /i $(IntermediateOutputPath) /i $(WindowsSDKPath)\inc /i $(VCSDKPath)\Include /D _UNICODE /D UNICODE /l"0x0409" /r /fo "$(Win32Resource)" "$(MsBuildThisFileDirectory)NativeVersion.rc"' />
</Target>
</Project>

View File

@@ -0,0 +1,8 @@
{
"runtimeOptions": {
"framework": {
"name": "Microsoft.NETCore.App",
"version": "9.9.9"
}
}
}