Skip to content

Commit

Permalink
NuGet.Client builds: Don't use Visual Studio version in bin, obj fold…
Browse files Browse the repository at this point in the history
…er paths (NuGet#4109)
  • Loading branch information
zivkan authored Jun 15, 2021
1 parent 7ef63cf commit 3dc7b4d
Show file tree
Hide file tree
Showing 27 changed files with 288 additions and 483 deletions.
11 changes: 4 additions & 7 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ Trace-Log "Build #$BuildNumber started at $startTime"

Test-BuildEnvironment -CI:$CI

if (-not $VSToolsetInstalled) {
Warning-Log "The build is requested, but no toolset is available"
exit 1
}

$BuildErrors = @()

Invoke-BuildStep 'Cleaning artifacts' {
Expand All @@ -104,6 +99,8 @@ else {
$VSMessage = "Running Build, Pack, Core unit tests, and Unit tests";
}

$MSBuildExe = Get-MSBuildExe

Invoke-BuildStep 'Running Restore' {
# Restore
$args = "build\build.proj", "/t:EnsurePackageReferenceVersionsInSolution", "/p:Configuration=$Configuration"
Expand All @@ -115,7 +112,7 @@ Invoke-BuildStep 'Running Restore' {
Trace-Log ". `"$MSBuildExe`" $args"
& $MSBuildExe @args

$args = "build\build.proj", "/t:RestoreVS", "/p:Configuration=$Configuration", "/p:ReleaseLabel=$ReleaseLabel", "/p:BuildNumber=$BuildNumber", "/p:IncludeApex=$IncludeApex", "/v:m", "/m:1"
$args = "build\build.proj", "/t:RestoreVS", "/p:Configuration=$Configuration", "/p:ReleaseLabel=$ReleaseLabel", "/p:BuildNumber=$BuildNumber", "/p:IncludeApex=$IncludeApex", "/v:m", "/m"
if ($Binlog)
{
$args += "-bl:msbuild.restore.binlog"
Expand Down Expand Up @@ -163,7 +160,7 @@ Invoke-BuildStep 'Creating the EndToEnd test package' {
param($Configuration)
$EndToEndScript = Join-Path $PSScriptRoot scripts\cibuild\CreateEndToEndTestPackage.ps1 -Resolve
$OutDir = Join-Path $Artifacts VS15
& $EndToEndScript -c $Configuration -tv 16 -out $OutDir
& $EndToEndScript -c $Configuration -out $OutDir
} `
-args $Configuration `
-skip:(-not $PackageEndToEnd) `
Expand Down
61 changes: 25 additions & 36 deletions build/build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -130,21 +130,21 @@
============================================================
-->
<Target Name="RunVS" DependsOnTargets="BuildVS;Pack;CoreUnitTests;UnitTestsVS">
<Message Text="Running NuGet Build for VS $(VisualStudioVersion)" Importance="high" />
<Message Text="Running NuGet Build" Importance="high" />
</Target>

<!--
============================================================
Build
Build
============================================================
-->
<Target Name="BuildVS" Condition=" '$(IsXPlat)' != 'true' " >
<Message Text="Building for VS $(VisualStudioVersion)" Importance="high" />
<Message Text="Building" Importance="high" />
</Target>

<!--
============================================================
Build for XPLAT
Build for XPLAT
============================================================
-->
<Target Name="BuildXPLAT" DependsOnTargets="GetXPLATProjects">
Expand All @@ -157,12 +157,11 @@
============================================================
-->
<Target Name="BuildNoVSIX" AfterTargets="BuildVS" Condition=" '$(IsXPlat)' != 'true' ">
<Message Text="Building for VS $(VisualStudioVersion)" Importance="high" />
<Message Text="Building" Importance="high" />

<MSBuild Projects="@(SolutionProjectsWithoutVSIX)"
Targets="Build"
Properties="$(CommonMSBuildProperties);
VisualStudioVersion=$(VisualStudioVersion);" />
Properties="$(CommonMSBuildProperties)" />
</Target>

<!--
Expand All @@ -175,8 +174,7 @@

<MSBuild Projects="@(XPLATProjects)"
Targets="Build"
Properties="$(CommonMSBuildProperties);
VisualStudioVersion=$(VisualStudioVersion);" />
Properties="$(CommonMSBuildProperties);" />
</Target>

<!--
Expand All @@ -187,14 +185,13 @@
============================================================
-->
<Target Name="BuildVSIX" AfterTargets= "BuildVS" Condition=" '$(IsXPlat)' != 'true' AND '$(BuildRTM)' != 'true'">
<Message Text="Building the VSIX for VS $(VisualStudioVersion)" Importance="high" />
<Message Text="Building the VSIX" Importance="high" />

<MSBuild Projects="$(VSIXProject)"
Targets="Build"
Properties="$(CommonMSBuildProperties);
BuildProjectReferences=false;
IsVsixBuild=true;
VisualStudioVersion=$(VisualStudioVersion);" />
IsVsixBuild=true;" />
</Target>

<!--
Expand All @@ -209,8 +206,7 @@
<MSBuild BuildInParallel="true"
Projects="@(SolutionProjects)"
Targets="Clean"
Properties="$(CommonMSBuildProperties);
VisualStudioVersion=$(VisualStudioVersion);" />
Properties="$(CommonMSBuildProperties);" />
</Target>

<!--
Expand All @@ -219,13 +215,12 @@
============================================================
-->
<Target Name="Pack">
<Message Text="Packing for Visual Studio $(VisualStudioVersion)" Importance="high" />
<Message Text="Packing" Importance="high" />

<MSBuild BuildInParallel="false"
Projects="@(SolutionProjects)"
Targets="PackProjects"
Properties="$(CommonMSBuildProperties);
VisualStudioVersion=$(VisualStudioVersion);" />
Properties="$(CommonMSBuildProperties)" />
</Target>

<!--
Expand All @@ -239,8 +234,7 @@
<MSBuild BuildInParallel="false"
Projects="@(XPLATProjects)"
Targets="PackProjects"
Properties="$(CommonMSBuildProperties);
VisualStudioVersion=$(VisualStudioVersion);" />
Properties="$(CommonMSBuildProperties)" />
</Target>

<!--
Expand All @@ -249,7 +243,7 @@
============================================================
-->
<Target Name="Restore">
<Message Text="Restoring for Visual Studio $(VisualStudioVersion)" Importance="high" />
<Message Text="Restoring" Importance="high" />

<!-- Convert list of projects to a property -->
<PropertyGroup>
Expand All @@ -260,8 +254,7 @@
Projects="restorehelper.targets"
Targets="Restore"
Properties="RestoreGraphProjectInput=$(ProjectListValue);
$(CommonMSBuildProperties);
VisualStudioVersion=$(VisualStudioVersion)">
$(CommonMSBuildProperties)">
</MSBuild>
</Target>

Expand All @@ -274,8 +267,7 @@
<MSBuild
Projects="$(MSBuildThisFileFullPath)"
Targets="Restore"
Properties="$(CommonMSBuildProperties);
VisualStudioVersion=$(VisualStudioVersion)">
Properties="$(CommonMSBuildProperties)">
</MSBuild>
</Target>

Expand All @@ -286,7 +278,7 @@
-->
<Target Name="RestoreXPLAT" DependsOnTargets="GetXPLATProjects">
<Message Text="Restoring for XPLAT" Importance="high" />

<PropertyGroup>
<ProjectListValue>@(XPLATProjects)</ProjectListValue>
</PropertyGroup>
Expand All @@ -295,14 +287,13 @@
Projects="restorehelper.targets"
Targets="Restore"
Properties="RestoreGraphProjectInput=$(ProjectListValue);
$(CommonMSBuildProperties);
VisualStudioVersion=$(VisualStudioVersion)">
$(CommonMSBuildProperties)">
</MSBuild>
</Target>

<!--
============================================================
Restore Apex
Restore Apex
============================================================
-->
<Target Name="RestoreApex">
Expand All @@ -316,8 +307,7 @@
Projects="restorehelper.targets"
Targets="Restore"
Properties="RestoreGraphProjectInput=$(ProjectListValue);
$(CommonMSBuildProperties);
VisualStudioVersion=$(VisualStudioVersion)">
$(CommonMSBuildProperties)">
</MSBuild>
</Target>

Expand Down Expand Up @@ -370,7 +360,7 @@
<!--
============================================================
RunTestsOnProjects
Finds all test assemblies and allows Xunit to run them as
Finds all test assemblies and allows Xunit to run them as
efficiently as the xunit.runner.json settings allow.
============================================================
-->
Expand All @@ -384,8 +374,7 @@
<MSBuild
Projects="@(TestProjectToSearch)"
Targets="GetTestAssemblies"
Properties="$(CommonMSBuildProperties);
VisualStudioVersion=$(VisualStudioVersion);"
Properties="$(CommonMSBuildProperties)"
Condition=" '$(TestProjectPaths)' != '' ">
<Output TaskParameter="TargetOutputs"
ItemName="TestAssemblyPath" />
Expand All @@ -408,7 +397,7 @@
<!-- Sort assemblies -->
<DesktopInputTestAssemblies>@(TestAssemblyPath->WithMetadataValue("IsDesktop", "true"))</DesktopInputTestAssemblies>
<DesktopInputTestAssembliesSpaced>$(DesktopInputTestAssemblies.Replace(';', ' '))</DesktopInputTestAssembliesSpaced>

<!-- Build exe commands -->
<DesktopTestCommand>$(XunitConsoleExePath) $(DesktopInputTestAssembliesSpaced) -verbose</DesktopTestCommand>
<DesktopTestCommand Condition=" '$(TestResultsXunit)' != '' ">$(DesktopTestCommand) -$(TestResultOutputFormat) $(TestResultsXunit)</DesktopTestCommand>
Expand All @@ -423,7 +412,7 @@
</PropertyGroup>

<!-- Desktop -->
<Message Text="Running $(DesktopTestCommand)"
<Message Text="Running $(DesktopTestCommand)"
Condition=" '$(SkipDesktopAssemblies)' != 'true' AND '$(DesktopInputTestAssemblies)' != '' "/>

<Exec Command="$(DesktopTestCommand)"
Expand All @@ -433,7 +422,7 @@
</Exec>

<!-- VSTest/NETCore -->
<Message Text="Running $(VSTestCommand)"
<Message Text="Running $(VSTestCommand)"
Condition=" '$(SkipCoreAssemblies)' != 'true' AND '$(CoreInputTestAssemblies)' != '' "/>

<Exec Command="$(VSTestCommand)"
Expand Down
15 changes: 3 additions & 12 deletions build/common.project.props
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
<SharedDirectory>$(BuildCommonDirectory)Shared</SharedDirectory>
<NuGetCoreSrcDirectory>$(RepositoryRootDirectory)src\NuGet.Core\</NuGetCoreSrcDirectory>
<NuGetClientsSrcDirectory>$(RepositoryRootDirectory)src\NuGet.Clients\</NuGetClientsSrcDirectory>
<NupkgOutputDirectory Condition=" '$(BuildRTM)' != 'true' ">$(ArtifactsDirectory)nupkgs\</NupkgOutputDirectory>
<NupkgOutputDirectory Condition=" '$(BuildRTM)' == 'true' ">$(ArtifactsDirectory)ReleaseNupkgs\</NupkgOutputDirectory>
<NupkgOutputDirectory>$(ArtifactsDirectory)nupkgs\</NupkgOutputDirectory>
<SolutionPackagesFolder>$(RepositoryRootDirectory)packages\</SolutionPackagesFolder>
<XunitConsoleExePath>$(SolutionPackagesFolder)xunit.runner.console\2.4.1\tools\net472\xunit.console.x86.exe</XunitConsoleExePath>
<ILMergeExePath>$(SolutionPackagesFolder)ilmerge\3.0.21\tools\net452\ILMerge.exe</ILMergeExePath>
Expand Down Expand Up @@ -113,10 +112,6 @@
<VsixPublishDestination>$(ArtifactRoot)$(VsixOutputDirName)\</VsixPublishDestination>
</PropertyGroup>

<PropertyGroup Condition=" '$(BuildRTM)' == 'true' ">
<VsixOutputDirName>$(VsixOutputDirName)-RTM</VsixOutputDirName>
</PropertyGroup>

<PropertyGroup Condition=" '$(PreReleaseVersion)' == '' ">
<PreReleaseVersion>0</PreReleaseVersion>
</PropertyGroup>
Expand Down Expand Up @@ -146,17 +141,13 @@
<Version>$(SemanticVersion)$(PreReleaseInformationVersion)</Version>
</PropertyGroup>

<PropertyGroup>
<BuildVariationFolder>$(VisualStudioVersion)</BuildVariationFolder>
<BuildVariationFolder Condition=" '$(BuildRTM)' == 'true' ">$(BuildVariationFolder)-RTM</BuildVariationFolder>
</PropertyGroup>
<!-- Set the output location for all non-test projects -->
<!-- Test projects currently fail when the output dir is moved -->
<PropertyGroup Condition=" '$(TestProject)' != 'true' OR '$(Shipping)' == 'true'">
<!-- output paths -->
<BaseIntermediateOutputPath>$(ArtifactsDirectory)$(MSBuildProjectName)\$(BuildVariationFolder)\obj\</BaseIntermediateOutputPath>
<BaseIntermediateOutputPath>$(ArtifactsDirectory)$(MSBuildProjectName)\obj\</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
<BaseOutputPath>$(ArtifactsDirectory)$(MSBuildProjectName)\$(BuildVariationFolder)\bin\</BaseOutputPath>
<BaseOutputPath>$(ArtifactsDirectory)$(MSBuildProjectName)\bin\</BaseOutputPath>
<OutputPath>$(BaseOutputPath)$(Configuration)\</OutputPath>
<AppxPackageDir>$(OutputPath)</AppxPackageDir>
</PropertyGroup>
Expand Down
Loading

0 comments on commit 3dc7b4d

Please sign in to comment.