Skip to content
Merged
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 @@ -98,6 +98,9 @@ public static async Task<string> PrepareBuildArgumentsAsync(string assetDirector
string sourceGenModeArg = metadataMode == MetadataMode.AotSourceGeneration
? " -p:MSTestSourceGenMode=ReflectionFree"
: " -p:MSTestSourceGenMode=Rooting";
string warningsAsErrorsArg = metadataMode == MetadataMode.AotSourceGeneration
? " -p:MSBuildTreatWarningsAsErrors=true -p:TreatWarningsAsErrors=true"
: string.Empty;

// - CustomBeforeMicrosoftCommonProps injects the source-generator PackageReference early
// enough for restore to see it, without clobbering any Directory.Build.props.
Expand All @@ -107,11 +110,15 @@ public static async Task<string> PrepareBuildArgumentsAsync(string assetDirector
// escape the quote on Windows and corrupt the argument. MSBuild accepts forward slashes on
// all platforms.
// - The version property feeds the resolved package version into the injected props.
// - ReflectionFree warnings are errors so AOTSG diagnostics for unsupported shapes cannot
// silently drop tests from the generated registry. MSBuild warnings remain errors as well,
// preserving the warning-clean build guarantee documented in the injected props.
return $"-p:CustomBeforeMicrosoftCommonProps=\"{propsPath}\" "
+ $"-p:BaseOutputPath=\"bin/{outputSubFolder}/\" "
+ $"-p:BaseIntermediateOutputPath=\"obj/{outputSubFolder}/\" "
+ $"-p:{versionProperty}={version}"
+ sourceGenModeArg;
+ sourceGenModeArg
+ warningsAsErrorsArg;
}

private static string BuildPropsContent(string packageId, string versionProperty) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ public async Task InitializeAsync(CancellationToken cancellationToken)
DotnetMuxerResult sourceGenResult = await DotnetCli.RunAsync(
$"build {testAsset.TargetAssetPath} -c Release {sourceGenArgs}",
failIfReturnValueIsNotZero: false,
// ReflectionFree carries its own warning promotion in sourceGenArgs. Disable the
// shared default here so acceptance runs verify that mode-specific contract.
warnAsError: mode != MetadataMode.AotSourceGeneration,
callerMemberName: $"{assetName}_{AcceptanceSourceGen.GetOutputSubFolder(mode)}",
cancellationToken: cancellationToken);

Expand Down
Loading