Skip to content

[release/6.0] Add packaging changes for System.Text.Json - #61703

Merged
safern merged 4 commits into
dotnet:release/6.0from
safern:AddPackagingJson60
Nov 17, 2021
Merged

[release/6.0] Add packaging changes for System.Text.Json#61703
safern merged 4 commits into
dotnet:release/6.0from
safern:AddPackagingJson60

Conversation

@safern

@safernsafern commented Nov 16, 2021

Copy link
Copy Markdown
Member

It seems like we missed packaging changes for JSON on: fd61aef

Also fixes: #61694

@ghost

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/area-system-text-json
See info in area-owners.md if you want to be subscribed.

Issue Details

It seems like we missed packaging changes for JSON on: fd61aef

Author:safern
Assignees:-
Labels:

area-System.Text.Json

Milestone:-

@safern

safern commented Nov 17, 2021

Copy link
Copy Markdown
MemberAuthor

@Anipik@ericstj could you please review: 28b425b

By setting these properties on packaging.targets this was happening too late, after Version.BeforeCommonTargets.targets was imported which is where the Version property is set. So if we want to use arcade version calculation we need to import using the before common targets hooks. The reason why we were seeing package versions 6.0.1 was because the PatchVersion is set to 1.

Also, instead of setting VersionPrefix I had to instead set PatchVersion to ServicingVersion because arcade relies on that and overrides the VersionPrefix when these properties are set:
https://github.com/dotnet/arcade/blob/53cc1bc2e555aa7aea95884575d22e21d63708cf/src/Microsoft.DotNet.Arcade.Sdk/tools/Version.BeforeCommonTargets.targets#L76

We could avoid this complexity by just setting <Version>Major.Minor.ServicingVersion</Version> and then appending the VersionSuffix if not empty, basically copying this logic: https://github.com/dotnet/arcade/blob/53cc1bc2e555aa7aea95884575d22e21d63708cf/src/Microsoft.DotNet.Arcade.Sdk/tools/Version.BeforeCommonTargets.targets#L165

But it felt more right to not duplicate arcade logic on our side.

For .NET 7+ we could fix the VersionSuffix calculation in arcade and make it overridable, rather than always setting it here: https://github.com/dotnet/arcade/blob/53cc1bc2e555aa7aea95884575d22e21d63708cf/src/Microsoft.DotNet.Arcade.Sdk/tools/Version.BeforeCommonTargets.targets#L76

@safern

safern commented Nov 17, 2021

Copy link
Copy Markdown
MemberAuthor

After giving it a thought, I decided to go the simple route which is setting Version on our side. The other change was too complicated for what we wanted to achieve and felt hacky.

Comment threadsrc/libraries/System.DirectoryServices/Directory.Build.props
Comment threadeng/packaging.targets
Condition="$(_AssemblyInTargetingPack) == 'true' and '$(PreReleaseVersionLabel)' == 'servicing'"
Condition="'$(SkipValidateAssemblyVersion)' != 'true' and '$(_AssemblyInTargetingPack)' == 'true' and '$(PreReleaseVersionLabel)' == 'servicing'"
AfterTargets="CoreCompile" >
<Error Condition="'$(AssemblyVersion)' != '$(LastReleasedStableAssemblyVersion)'" Text="AssemblyVersion should match last released assembly version $(LastReleasedStableAssemblyVersion)" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this all the validation we're doing @Anipik? I thought we were going to run a reverse check here:

<ExecCommand="$(_ApiCompatCommand) &quot;$(PreviousNetCoreAppRefPath.TrimEnd('\/'))&quot; @&quot;$(ApiCompatResponseFile)&quot; $(_previousNetCoreAppBaselineParam)"
CustomErrorRegularExpression="^[a-zA-Z]+ :"
StandardOutputImportance="Low"
IgnoreExitCode="true">
<OutputTaskParameter="ExitCode"PropertyName="ApiCompatExitCode" />
</Exec>

To ensure folks don't add API in servicing.

@safernsafernNov 17, 2021

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have an open issue, we haven't enabled it yet.

Comment threadsrc/libraries/System.Text.Json/src/System.Text.Json.csproj
@ericstj

Copy link
Copy Markdown
Member

Don't treat my comment as blocking. Merge when ready.

@safern

Copy link
Copy Markdown
MemberAuthor

Failure is: #50748

@safern
safern merged commit e9036b0 into dotnet:release/6.0Nov 17, 2021
@safern
safern deleted the AddPackagingJson60 branch November 17, 2021 17:29
@ghostghost locked as resolved and limited conversation to collaborators Dec 17, 2021
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[release/6.0] We should enforce that services packages specify ServicingVersion when in a servicing release.

3 participants

@safern@ericstj@Anipik