dotnet-installer/test/SdkTests/SdkTests.csproj
2019-08-30 08:53:21 -07:00

204 lines
8.9 KiB
XML

<Project>
<PropertyGroup>
<CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
<CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
<OutputType>Library</OutputType>
<GenerateDependencyFile>false</GenerateDependencyFile>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<ResolvePackageDependenciesForBuild>false</ResolvePackageDependenciesForBuild>
<NonShipping>true</NonShipping>
<NoStdLib>true</NoStdLib>
<ProducesNoOutput>true</ProducesNoOutput>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<LanguageTargets>$(MSBuildToolsPath)\Microsoft.CSharp.targets</LanguageTargets>
<IsPackable>false</IsPackable>
<DeterministicSourcePaths>false</DeterministicSourcePaths>
<TargetFramework>$(CoreSdkTargetFramework)</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<RedistLayoutPath>$(ArtifactsBinDir)redist\$(Configuration)\dotnet\</RedistLayoutPath>
<DotnetToTestPath>$(ArtifactsBinDir)redist\$(Configuration)\dotnet-with-previous-runtimes\</DotnetToTestPath>
</PropertyGroup>
<ItemGroup>
<SdkTest Include="Build" />
<SdkTest Include="Clean" />
<SdkTest Include="Pack" />
<SdkTest Include="Publish" />
<SdkTest Include="Rebuild" />
<SdkTest Include="Restore" />
<SdkTest Include="ToolPack" />
<RuntimeVersionToInstall Include="1.0.5" />
<RuntimeVersionToInstall Include="1.1.2" />
<RuntimeVersionToInstall Include="2.1.0" />
<RuntimeVersionToInstall Include="2.2.4" />
</ItemGroup>
<Target Name="SetupLayoutWithPreviousRuntimes">
<ItemGroup>
<LayoutFilesToCopyToDotnetToTest Include="$(RedistLayoutPath)**"/>
<LayoutFilesToCopyToDotnetToTest>
<DestinationPath>$(DotnetToTestPath)%(RecursiveDir)%(Filename)%(Extension)</DestinationPath>
</LayoutFilesToCopyToDotnetToTest>
</ItemGroup>
<Copy SourceFiles="@(LayoutFilesToCopyToDotnetToTest)"
DestinationFiles="@(LayoutFilesToCopyToDotnetToTest->'%(DestinationPath)')"
SkipUnchangedFiles="true"/>
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="InstallRuntimeToLayout"
Properties="RuntimeVersionToInstall=%(RuntimeVersionToInstall.Identity)"
BuildInParallel="false"/>
</Target>
<Target Name="InstallRuntimeToLayout">
<PropertyGroup>
<RuntimeTargetDirectory>$(DotnetToTestPath)shared\Microsoft.NETCore.App\$(RuntimeVersionToInstall)</RuntimeTargetDirectory>
</PropertyGroup>
<PropertyGroup Condition="'$(OS)' == 'Windows_NT'">
<InstallRuntimeCommand>powershell -NoLogo -NoProfile -ExecutionPolicy ByPass</InstallRuntimeCommand>
<InstallRuntimeCommand>$(InstallRuntimeCommand) "$(_DotNetRoot)dotnet-install.ps1"</InstallRuntimeCommand>
<InstallRuntimeCommand>$(InstallRuntimeCommand) -Version $(RuntimeVersionToInstall)</InstallRuntimeCommand>
<InstallRuntimeCommand>$(InstallRuntimeCommand) -InstallDir $(DotnetToTestPath)</InstallRuntimeCommand>
<InstallRuntimeCommand>$(InstallRuntimeCommand) -Runtime "dotnet"</InstallRuntimeCommand>
</PropertyGroup>
<PropertyGroup Condition="'$(OS)' != 'Windows_NT'">
<InstallRuntimeCommand>/bin/bash</InstallRuntimeCommand>
<InstallRuntimeCommand>$(InstallRuntimeCommand) "$(_DotNetRoot)dotnet-install.sh"</InstallRuntimeCommand>
<InstallRuntimeCommand>$(InstallRuntimeCommand) --version $(RuntimeVersionToInstall)</InstallRuntimeCommand>
<InstallRuntimeCommand>$(InstallRuntimeCommand) --install-dir "$(DotnetToTestPath)"</InstallRuntimeCommand>
<InstallRuntimeCommand>$(InstallRuntimeCommand) --runtime "dotnet"</InstallRuntimeCommand>
</PropertyGroup>
<Exec Command="$(InstallRuntimeCommand)"
Condition="!Exists($(RuntimeTargetDirectory))"
IgnoreStandardErrorWarningFormat="true"
/>
</Target>
<Target Name="RunSdkTests" DependsOnTargets="SetupLayoutWithPreviousRuntimes">
<!-- SDK tests use the $(TEMP)\dotnetSdkTests as the working directory, isolate that from any higher-level
Directory.Build files (TEMP is set to a folder in the repo when running in CI) -->
<Copy SourceFiles="$(RepoRoot)TestAssets\Directory.Build.props;$(RepoRoot)TestAssets\Directory.Build.targets"
DestinationFolder="$(TEMP)\dotnetSdkTests"
SkipUnchangedFiles="true"
/>
<!-- Allow test list to be overridden with ToolTestName property -->
<ItemGroup Condition="'$(ToolTestName)' != ''">
<SdkTest Remove="@(SdkTest)" />
<SdkTest Include="$(ToolTestName)" />
</ItemGroup>
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="RunTestsAsTool"
Properties="ToolTestName=%(SdkTest.Identity)"
BuildInParallel="true"
ContinueOnError="true"
/>
</Target>
<Target Name="RunTestsAsTool">
<PropertyGroup>
<ToolCommandName>testSdk$(ToolTestName)</ToolCommandName>
<TestProjectName>Microsoft.NET.$(ToolTestName).Tests</TestProjectName>
<TestLocalToolFolder>$(ArtifactsTmpDir)$(ToolCommandName)\</TestLocalToolFolder>
</PropertyGroup>
<RemoveDir Directories="$(TestLocalToolFolder)" />
<MakeDir Directories="$(TestLocalToolFolder)" />
<MakeDir Directories="$(ArtifactsTestResultsDir)" />
<Exec Command="dotnet new tool-manifest"
WorkingDirectory="$(TestLocalToolFolder)"/>
<PropertyGroup>
<SdkTestPackageVersion>$(MicrosoftNETSdkPackageVersion)</SdkTestPackageVersion>
<SdkTestPackageFeed>https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json</SdkTestPackageFeed>
<InstallToolCommand>dotnet tool install --local $(ToolCommandName)</InstallToolCommand>
<InstallToolCommand>$(InstallToolCommand) --version $(SdkTestPackageVersion)</InstallToolCommand>
<InstallToolCommand>$(InstallToolCommand) --add-source $(SdkTestPackageFeed)</InstallToolCommand>
</PropertyGroup>
<Exec Command="$(InstallToolCommand)"
WorkingDirectory="$(TestLocalToolFolder)"/>
<Exec Command="dotnet tool restore"
WorkingDirectory="$(TestLocalToolFolder)"/>
<PropertyGroup>
<ResultsXmlPath>$(ArtifactsTestResultsDir)$(TestProjectName).xml</ResultsXmlPath>
<ResultsHtmlPath>$(ArtifactsTestResultsDir)$(TestProjectName).html</ResultsHtmlPath>
<ResultsStdOutPath>$(ArtifactsLogDir)$(TestProjectName).log</ResultsStdOutPath>
<TestArgs>-noautoreporters -noRepoInference</TestArgs>
<TestArgs>$(TestArgs) -dotnetPath $(DotnetToTestPath)\dotnet</TestArgs>
<TestArgs>$(TestArgs) -xml "$(ResultsXmlPath)"</TestArgs>
<TestArgs>$(TestArgs) -html "$(ResultsHtmlPath)" $(TestRunnerAdditionalArguments)</TestArgs>
<TestArgs>$(TestArgs) &gt; $(ResultsStdOutPath)</TestArgs>
</PropertyGroup>
<PropertyGroup Condition="'$(OS)' == 'Windows_NT'">
<ToolRunPrefix>$(ToolRunPrefix)set MSBuildSDKsPath= &amp;&amp; </ToolRunPrefix>
<ToolRunPrefix>$(ToolRunPrefix)set DOTNET_HOST_PATH= &amp;&amp; </ToolRunPrefix>
<ToolRunPrefix>$(ToolRunPrefix)set DOTNET_INSTALLDIR= &amp;&amp; </ToolRunPrefix>
</PropertyGroup>
<PropertyGroup Condition="'$(OS)' != 'Windows_NT'">
<ToolRunPrefix>$(ToolRunPrefix)unset MSBuildSDKsPath &amp;&amp; </ToolRunPrefix>
<ToolRunPrefix>$(ToolRunPrefix)unset DOTNET_HOST_PATH &amp;&amp; </ToolRunPrefix>
<ToolRunPrefix>$(ToolRunPrefix)unset DOTNET_INSTALLDIR &amp;&amp; </ToolRunPrefix>
</PropertyGroup>
<Exec Command="$(ToolRunPrefix)dotnet tool run $(ToolCommandName) -- $(TestArgs)"
WorkingDirectory="$(TestLocalToolFolder)"
IgnoreStandardErrorWarningFormat="true" />
</Target>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<!-- Remove items which light up build logic which could generate warnings / errors -->
<ItemGroup>
<EmbeddedResource Remove="@(EmbeddedResource)" />
<Reference Remove="@(Reference)" />
<PackageReference Remove="@(PackageReference)" />
<ProjectReference Remove="@(ProjectReference)" />
<SwrFile Remove="@(SwrFile)" />
</ItemGroup>
<PropertyGroup>
<TargetPath></TargetPath>
<!-- Prevent projects referencing this from trying to pass us to the compiler -->
</PropertyGroup>
<Target Name="CoreCompile" />
<!-- Prevent Csc from being called -->
<Target Name="GenerateTargetFrameworkMonikerAttribute" />
<!-- Don't generate TFM attribute -->
<Target Name="RuntimeImplementationProjectOutputGroup" />
<!-- Group always attempts resolve runtime, regardless of <CopyNuGetImplementations>-->
<Target Name="GetReferenceAssemblyPaths" />
<!-- Don't go looking for framewoek reference assemblies-->
<Target Name="GetFrameworkPaths" />
<!-- ^ -->
<Target Name="GetBuildVersion" />
<!-- For Packages projects, which use GetNuGetPackageVersionEx which depends on GetBuildVersion -->
<Target Name="Pack" />
<Target Name="Test" DependsOnTargets="RunSdkTests" />
</Project>