Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,32 +62,10 @@ NOTE: This file is imported from the following contexts, so be aware when writin
<_InnerToolsPublishAot>false</_InnerToolsPublishAot>
<_InnerToolsPublishAot Condition="$(_HasRIDSpecificTools) and '$(PublishAot)' == 'true'">true</_InnerToolsPublishAot>

<!-- determining if it's safe to change publish-related properties for this evaluation. We can only override default publishing
behavior if
a) we're not restoring (since these flags contain information that influences the assets Restore acquires), and
b) we are actually packing
otherwise, we risk altering something that changes downstream behavior for 'normal' publish operations.
-->
<_IsImplicitRestore>false</_IsImplicitRestore>
<_IsImplicitRestore Condition="'$(MSBuildIsRestoring)' == 'true'">true</_IsImplicitRestore>
<_IsPacking Condition="'$(_IsPacking)' == ''">false</_IsPacking>

<!-- Now we can set load-bearing properties for the package, but only if the previously-computed conditions hold.
We must set these to different values for the 'outer' agnostic package, as well as any RID-agnostic child packages,
so that the Publish of those kinds of packages isn't implicitly coerced to be platform-specific in any way.
We _do_ have to set both SelfContained and PublishSelfContained here because the logic that applies PublishSelfContained to
SelfContained has already run. -->
<PublishSelfContained Condition="!$(_IsRidSpecific) and !$(_IsImplicitRestore) and $(_IsPacking)">false</PublishSelfContained>
<SelfContained Condition="!$(_IsRidSpecific) and !$(_IsImplicitRestore) and $(_IsPacking)">false</SelfContained>
<PublishTrimmed Condition="!$(_IsRidSpecific) and !$(_IsImplicitRestore) and $(_IsPacking)">false</PublishTrimmed>
<PublishReadyToRun Condition="!$(_IsRidSpecific) and !$(_IsImplicitRestore) and $(_IsPacking)">false</PublishReadyToRun>
<PublishSingleFile Condition="!$(_IsRidSpecific) and !$(_IsImplicitRestore) and $(_IsPacking)">false</PublishSingleFile>
<PublishAot Condition="!$(_IsRidSpecific) and !$(_IsImplicitRestore) and $(_IsPacking)">false</PublishAot>

<!-- Tool implementation files are not included in the primary package when the tool has RID-specific packages. So only pack the tool implementation
(and only depend on publish) if there are no RID-specific packages, or if the RuntimeIdentifier is set. -->
<_ToolPackageShouldIncludeImplementation Condition=" '$(_ToolPackageShouldIncludeImplementation)' == '' And '$(PackAsTool)' == 'true' And
('$(_UserSpecifiedToolPackageRids)' == ''
(!$(_HasRIDSpecificTools)
or '$(RuntimeIdentifier)' != '')">true</_ToolPackageShouldIncludeImplementation>
<_ToolPackageShouldIncludeImplementation Condition="'$(_ToolPackageShouldIncludeImplementation)' == ''">false</_ToolPackageShouldIncludeImplementation>

Expand All @@ -112,6 +90,23 @@ NOTE: This file is imported from the following contexts, so be aware when writin
Because this target is inherently TFM-specific, and NuGet handles invoking this target once per TFM as part of the packaging process. -->
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackTool</TargetsForTfmSpecificContentInPackage>
</PropertyGroup>

<!-- The Publish* properties impact Restore in that they cause runtime packs, AOT support packs, etc to be downloaded.
Therefore, we don't alter the Publish* properties for Restore scenarios, or for tools that are not RID specific.
If we are a RID-specific Tool Package that's actually Packing though, we need to not use these properties for the top-level
agnostic package. -->
<PropertyGroup Label="Overrides for Properties that Affect Publish Output for top-level tool packages"
Condition="!$(_IsRidSpecific) and '$(MSBuildIsRestoring)' != 'true' and '$(_IsPacking)' == 'true'">
<!-- We _do_ have to set both SelfContained and PublishSelfContained here because the logic that applies PublishSelfContained to
SelfContained has already run. -->
<PublishSelfContained>false</PublishSelfContained>
<SelfContained>false</SelfContained>
<PublishTrimmed>false</PublishTrimmed>
<PublishReadyToRun>false</PublishReadyToRun>
<PublishSingleFile>false</PublishSingleFile>
<PublishAot>false</PublishAot>
</PropertyGroup>

<!--

TODO:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ Copyright (c) .NET Foundation. All rights reserved.
<PreferNativeArm64 Condition="'$(PreferNativeArm64)'==''">false</PreferNativeArm64>
<SignAssembly Condition="'$(SignAssembly)'==''">false</SignAssembly>
<DelaySign Condition="'$(DelaySign)'==''">false</DelaySign>
<!-- TODO: should we set _IsPacking=true on the NuGet Pack targets when they hook up the 'generate package on build' stuff -->
<GeneratePackageOnBuild Condition="'$(GeneratePackageOnBuild)'==''">false</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance Condition="'$(PackageRequireLicenseAcceptance)'==''">false</PackageRequireLicenseAcceptance>
<DebugSymbols Condition="'$(DebugSymbols)'==''">false</DebugSymbols>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,13 @@ public void It_builds_the_project_successfully_with_static_graph_and_isolation()
public void It_cleans_the_project_successfully_with_static_graph_and_isolation()
{
var (testAsset, outputDirectories) = BuildAppWithTransitiveDependenciesAndTransitiveCompileReference(new[] { "/graph", "/bl:build-{}.binlog" });
var binlogDestPath = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT") is { } ciOutputRoot && Environment.GetEnvironmentVariable("HELIX_WORKITEM_ID") is { } helixGuid ?
Path.Combine(ciOutputRoot, "binlog", helixGuid, $"{nameof(It_cleans_the_project_successfully_with_static_graph_and_isolation)}.binlog") :
"./msbuild.binlog";

var cleanCommand = new DotnetCommand(
Log,
"msbuild",
Path.Combine(testAsset.TestRoot, "1", "1.csproj"),
"/t:clean",
"/graph",
$"/bl:{binlogDestPath}");
"/graph");

cleanCommand
.Execute()
Expand Down Expand Up @@ -184,13 +180,8 @@ public void It_builds_the_project_successfully_when_RAR_does_not_find_all_refere
{
var buildCommand = new BuildCommand(testAsset, "1");
buildCommand.WithWorkingDirectory(testAsset.TestRoot);
var binlogDestPath = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT") is { } ciOutputRoot && Environment.GetEnvironmentVariable("HELIX_WORKITEM_ID") is { } helixGuid ?
Path.Combine(ciOutputRoot, "binlog", helixGuid, $"{callingMethod}.binlog") :
"./msbuild.binlog";
var buildResult = buildCommand.ExecuteWithoutRestore([..msbuildArguments, $"/bl:{binlogDestPath}"]);

var buildResult = buildCommand.ExecuteWithoutRestore(msbuildArguments);
var outputDirectories = targetFrameworks.ToImmutableDictionary(tf => tf, tf => buildCommand.GetOutputDirectory(tf));

return (buildResult, outputDirectories);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -853,14 +853,9 @@ public void It_can_disable_cetcompat(bool? cetCompat)
testProject.AdditionalProperties.Add("CetCompat", cetCompat.ToString());
}

var binlogDestPath = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT") is { } ciOutputRoot && Environment.GetEnvironmentVariable("HELIX_WORKITEM_ID") is { } helixGuid ?
Path.Combine(ciOutputRoot, "binlog", helixGuid, $"{nameof(It_can_disable_cetcompat)}_{cetCompat?.ToString() ?? "null"}.binlog") :
"./msbuild.binlog";


var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: cetCompat.HasValue ? cetCompat.Value.ToString() : "default");
var publishCommand = new PublishCommand(testAsset);
publishCommand.Execute(PublishSingleFile, "/bl:" + binlogDestPath)
publishCommand.Execute(PublishSingleFile)
.Should()
.Pass();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,7 @@ public void It_can_publish_selfcontained_and_has_apphost()
{
var testAsset = SetupTestAsset().SetProjProperty("PublishSelfContained", "true");
var publishCommand = new PublishCommand(testAsset);

var binlogDestPath = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT") is { } ciOutputRoot ?
Path.Combine(ciOutputRoot, "binlog", $"{nameof(It_can_publish_selfcontained_and_has_apphost)}.binlog") :
"./msbuild.binlog";

publishCommand.WithWorkingDirectory(testAsset.Path).Execute($"-bl:{binlogDestPath}");

publishCommand.WithWorkingDirectory(testAsset.Path).Execute();
publishCommand.GetOutputDirectory(targetFramework: ToolsetInfo.CurrentTargetFramework, runtimeIdentifier: System.Runtime.InteropServices.RuntimeInformation.RuntimeIdentifier)
.Should().HaveFile("consoledemo" + Constants.ExeSuffix)
.And.HaveFile(HostfxrName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,10 @@ public void It_cleans_between_renames()
};
var testAsset = _testAssetsManager.CreateTestProject(testProject, testProject.Name);

var binlogDestPath = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT") is { } ciOutputRoot && Environment.GetEnvironmentVariable("HELIX_WORKITEM_ID") is { } helixGuid ?
Path.Combine(ciOutputRoot, "binlog", helixGuid, $"{nameof(It_cleans_between_renames)}.binlog") :
"./msbuild.binlog";

// Publish as a single file
var publishCommand = new PublishCommand(testAsset);
publishCommand
.Execute(@"/p:PublishSingleFile=true", $"-bl:{binlogDestPath}")
.Execute(@"/p:PublishSingleFile=true")
.Should()
.Pass();

Expand Down Expand Up @@ -107,14 +103,9 @@ public void It_cleans_between_single_file_publishes()
};
var testAsset = _testAssetsManager.CreateTestProject(testProject, testProject.Name);

var binlogDestPath = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT") is { } ciOutputRoot && Environment.GetEnvironmentVariable("HELIX_WORKITEM_ID") is { } helixGuid ?
Path.Combine(ciOutputRoot, "binlog", helixGuid, $"{nameof(It_cleans_between_single_file_publishes)}.binlog") :
"./msbuild.binlog";


var publishCommand = new PublishCommand(testAsset).WithWorkingDirectory(testAsset.Path) as PublishCommand;
publishCommand
.Execute(@"/p:PublishSingleFile=true", $"-bl:{binlogDestPath}")
.Execute(@"/p:PublishSingleFile=true")
.Should()
.Pass();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,7 @@ public void It_contains_shim_with_no_build(bool multiTarget, string targetFramew
buildCommand.Execute().Should().Pass();

var packCommand = new PackCommand(testAsset).WithWorkingDirectory(testAsset.Path) as PackCommand;
var binlogDestPath = Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT") is { } ciOutputRoot ?
Path.Combine(ciOutputRoot, "binlog", $"{nameof(It_contains_shim_with_no_build)}_{multiTarget}_{targetFramework}.binlog") :
"./msbuild.binlog";

packCommand.Execute($"/p:NoBuild=true", $"/bl:{binlogDestPath}").Should().Pass();
packCommand.Execute($"/p:NoBuild=true").Should().Pass();
var nugetPackage = packCommand.GetNuGetPackage();

using (var nupkgReader = new PackageArchiveReader(nugetPackage))
Expand Down
Loading