Skip to content

Commit 3e208f9

Browse files
authored
Don't put testing global.json in artifacts dir directly (#49819)
1 parent 7c9015b commit 3e208f9

File tree

19 files changed

+48
-47
lines changed

19 files changed

+48
-47
lines changed

Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<TestHostFolder>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'redist', '$(Configuration)'))</TestHostFolder>
3434
<TestHostDotNetRoot>$([MSBuild]::NormalizeDirectory('$(TestHostFolder)', 'dotnet'))</TestHostDotNetRoot>
3535
<TestHostDotNetTool>$(TestHostDotNetRoot)$([System.IO.Path]::GetFileName('$(DotNetTool)'))</TestHostDotNetTool>
36+
<TestLayoutDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsTmpDir)', 'testing'))</TestLayoutDir>
3637

3738
<PackageProjectUrl>https://github.com/dotnet/sdk</PackageProjectUrl>
3839
<PackageLicenseExpression>MIT</PackageLicenseExpression>

eng/pipelines/templates/jobs/sdk-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ jobs:
137137
- ${{ if eq(parameters.runAoTTests, true) }}:
138138
# For the reason this is here, see: https://github.com/dotnet/sdk/issues/22655
139139
- script: $(Build.SourcesDirectory)/artifacts/bin/redist/$(buildConfiguration)/dotnet/dotnet workload install wasm-tools --skip-manifest-update
140-
workingDirectory: $(Build.SourcesDirectory)/artifacts
140+
workingDirectory: $(Build.SourcesDirectory)/artifacts/bin
141141
displayName: 🟣 Install wasm-tools Workload
142142
# For the /p:Projects syntax for PowerShell, see: https://github.com/dotnet/msbuild/issues/471#issuecomment-1146466335
143143
- ${{ if eq(parameters.pool.os, 'windows') }}:

src/Containers/Microsoft.NET.Build.Containers/Microsoft.NET.Build.Containers.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122

123123
<!-- Copy to *.csproj for using in sanity checks integration tests. -->
124124
<Target Name="CopyCsprojToTestExecutionDirectory" AfterTargets="Build">
125-
<Copy SourceFiles="$(MSBuildThisFileFullPath)" DestinationFiles="$(ArtifactsTmpDir)Container\ProjectFiles\$(MSBuildThisFileName).csproj" SkipUnchangedFiles="true" />
125+
<Copy SourceFiles="$(MSBuildThisFileFullPath)" DestinationFiles="$(TestLayoutDir)Container\ProjectFiles\$(MSBuildThisFileName).csproj" SkipUnchangedFiles="true" />
126126
</Target>
127127

128128
</Project>

src/Containers/containerize/containerize.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
<ItemGroup>
2727
<ContainerizeFiles Include="$(ArtifactsBinDir)containerize\$(Configuration)\$(SdkTargetFramework)\**\*.*" />
2828
</ItemGroup>
29-
<Copy SourceFiles="@(ContainerizeFiles)" DestinationFiles="@(ContainerizeFiles->'$(ArtifactsTmpDir)Container\containerize\%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" />
29+
<Copy SourceFiles="@(ContainerizeFiles)" DestinationFiles="@(ContainerizeFiles->'$(TestLayoutDir)Container\containerize\%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" />
3030
</Target>
3131

3232
<!-- Copy to *.csproj for using in sanity checks integration tests. -->
3333
<Target Name="CopyCsprojToTestExecutionDirectory" AfterTargets="Build">
34-
<Copy SourceFiles="$(MSBuildThisFileFullPath)" DestinationFiles="$(ArtifactsTmpDir)Container\ProjectFiles\$(MSBuildThisFileName).csproj" SkipUnchangedFiles="true" />
34+
<Copy SourceFiles="$(MSBuildThisFileFullPath)" DestinationFiles="$(TestLayoutDir)Container\ProjectFiles\$(MSBuildThisFileName).csproj" SkipUnchangedFiles="true" />
3535
</Target>
3636
</Project>

src/Containers/packaging/package.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@
112112
<!-- Hacky workaround for the fact that we don't publish the package yet. -->
113113
<Target Name="CopyNupkgToCustomFolder" AfterTargets="Pack">
114114
<Copy SourceFiles="$(ArtifactsDir)packages/$(Configuration)/Shipping/Microsoft.NET.Build.Containers.$(Version).nupkg"
115-
DestinationFiles="$(ArtifactsTmpDir)Container/package/Microsoft.NET.Build.Containers.$(Version).nupkg" />
115+
DestinationFiles="$(TestLayoutDir)Container/package/Microsoft.NET.Build.Containers.$(Version).nupkg" />
116116
</Target>
117117

118118
<!-- Copy files that are needed by Integration tests. -->
119119
<Target Name="CopyPropsAndTargets" AfterTargets="Pack">
120120
<Copy SourceFiles="./build/Microsoft.NET.Build.Containers.props"
121-
DestinationFiles="$(ArtifactsTmpDir)Container/packaging/Microsoft.NET.Build.Containers.props" />
121+
DestinationFiles="$(TestLayoutDir)Container/packaging/Microsoft.NET.Build.Containers.props" />
122122
<Copy SourceFiles="./build/Microsoft.NET.Build.Containers.targets"
123-
DestinationFiles="$(ArtifactsTmpDir)Container/packaging/Microsoft.NET.Build.Containers.targets" />
123+
DestinationFiles="$(TestLayoutDir)Container/packaging/Microsoft.NET.Build.Containers.targets" />
124124
</Target>
125125
</Project>
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<Project>
2-
<PropertyGroup>
3-
<!-- We put this in the root of the artifacts dir so that any usage (not just from ./tmp, but also from ./bin) gets redirected. -->
4-
<_TestingGlobalJsonPath>$(ArtifactsDir)global.json</_TestingGlobalJsonPath>
5-
</PropertyGroup>
2+
<ItemGroup>
3+
<_TestingGlobalJsonPath Include="$(ArtifactsBinDir)global.json" />
4+
<_TestingGlobalJsonPath Include="$(TestLayoutDir)global.json" />
5+
</ItemGroup>
66

77
<!-- Since the dotnet binary respects sdk.paths in global.json now, and we use this in the repo root to make sure that we consistently use the repo-local
88
SDK for building/etc, we need to put something in place so that tests don't use the repo-local SDK and instead use the redist SDK. -->
99
<Target Name="CreateRedistGlobalJsonForTesting"
1010
BeforeTargets="AfterBuild"
11-
Outputs="$(_TestingGlobalJsonPath)">
11+
Outputs="@(_TestingGlobalJsonPath)">
1212
<PropertyGroup>
1313
<_TestingRedistDotnetPath>$(TestHostDotNetRoot.Replace('\', '\\'))</_TestingRedistDotnetPath>
1414
</PropertyGroup>
@@ -21,13 +21,13 @@
2121
<_RedistGlobalJsonLines Include=" }" />
2222
<_RedistGlobalJsonLines Include="}" />
2323
</ItemGroup>
24-
<WriteLinesToFile File="$(_TestingGlobalJsonPath)"
24+
<WriteLinesToFile File="%(_TestingGlobalJsonPath.Identity)"
2525
Lines="@(_RedistGlobalJsonLines)"
2626
Overwrite="true"
2727
Encoding="utf-8"
2828
WriteOnlyWhenDifferent="true" />
2929
<ItemGroup>
30-
<FileWrites Include="$(_TestingGlobalJsonPath)" />
30+
<FileWrites Include="@(_TestingGlobalJsonPath)" />
3131
</ItemGroup>
3232
</Target>
3333
</Project>

template_feed/Microsoft.DotNet.Common.ItemTemplates/Microsoft.DotNet.Common.ItemTemplates.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<IncludeBuildOutput>False</IncludeBuildOutput>
55
<IncludeSource>False</IncludeSource>
66
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
7-
<OutputPath>$(ArtifactsTmpDir)</OutputPath>
7+
<OutputPath>$(TestLayoutDir)</OutputPath>
88
<EnableDefaultItems>False</EnableDefaultItems>
99
<UsingToolTemplateLocalizer>true</UsingToolTemplateLocalizer>
1010
<IsPackable>true</IsPackable>

template_feed/Microsoft.DotNet.Common.ProjectTemplates.10.0/Microsoft.DotNet.Common.ProjectTemplates.10.0.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<IncludeBuildOutput>False</IncludeBuildOutput>
55
<IncludeSource>False</IncludeSource>
66
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
7-
<OutputPath>$(ArtifactsTmpDir)</OutputPath>
7+
<OutputPath>$(TestLayoutDir)</OutputPath>
88
<EnableDefaultItems>False</EnableDefaultItems>
99
<UsingToolTemplateLocalizer>true</UsingToolTemplateLocalizer>
1010
<IsPackable>true</IsPackable>

test/Directory.Build.targets

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@
1919
<!-- Set this to true for test project only because test assets contains .editorconfig file -->
2020
<NoDefaultExcludes>true</NoDefaultExcludes>
2121
</PropertyGroup>
22-
22+
2323
<ItemGroup Condition="'$(IsTestProject)' == 'true' AND '$(OutputType)' == 'Exe' AND '$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
2424
<Compile Include="$(MSBuildThisFileDirectory)Common\Program.cs" />
2525
</ItemGroup>
2626

2727
<Target Name="TestAsTool" DependsOnTargets="Pack;_InnerGetTestsToRun">
2828
<PropertyGroup>
29-
<TestLocalToolFolder>$(ArtifactsTmpDir)$(ToolCommandName)\</TestLocalToolFolder>
30-
<TestLocalToolExecutionFolder>$(ArtifactsTmpDir)$(ToolCommandName)\w</TestLocalToolExecutionFolder>
31-
<DOTNET_CLI_HOME>$(ArtifactsTmpDir)DOTNET_CLI_HOME\</DOTNET_CLI_HOME>
29+
<TestLocalToolFolder>$(TestLayoutDir)$(ToolCommandName)\</TestLocalToolFolder>
30+
<TestLocalToolExecutionFolder>$(TestLayoutDir)$(ToolCommandName)\w</TestLocalToolExecutionFolder>
31+
<DOTNET_CLI_HOME>$(TestLayoutDir)DOTNET_CLI_HOME\</DOTNET_CLI_HOME>
3232
</PropertyGroup>
3333

3434
<RemoveDir Directories="$(TestLocalToolExecutionFolder)" />
@@ -46,11 +46,11 @@
4646
IgnoreStandardErrorWarningFormat="true"
4747
WorkingDirectory="$(TestLocalToolFolder)"
4848
EnvironmentVariables="DOTNET_CLI_HOME=$(DOTNET_CLI_HOME)"/>
49-
49+
5050
<Exec Command="dotnet tool install --local $(ToolCommandName) --version $(PackageVersion) --add-source $(ArtifactsNonShippingPackagesDir)"
5151
WorkingDirectory="$(TestLocalToolFolder)"
5252
EnvironmentVariables="DOTNET_CLI_HOME=$(DOTNET_CLI_HOME)"/>
53-
53+
5454
<Exec Command="dotnet tool restore"
5555
WorkingDirectory="$(TestLocalToolFolder)"
5656
EnvironmentVariables="DOTNET_CLI_HOME=$(DOTNET_CLI_HOME)"/>

test/Microsoft.DotNet.PackageInstall.Tests/TestToolBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class TestToolBuilderCollection : ICollectionFixture<TestToolBuilder>
1919
// global packages folder to ensure that the newly built package is used the next time a test tries to install it.
2020
//
2121
// The main thing this class can't handle is if the way the .NET SDK builds packages changes. In CI runs, we should use a clean test execution folder each time (I think!), so this shouldn't be an issue.
22-
// For local testing, you may need to delete the artifacts\tmp\Debug\TestTools folder if the SDK changes in a way that affects the built package.
22+
// For local testing, you may need to delete the artifacts\tmp\Debug\testing\TestTools folder if the SDK changes in a way that affects the built package.
2323
public class TestToolBuilder
2424
{
2525
public class TestToolSettings

0 commit comments

Comments
 (0)