Skip to content

Conversation

@omajid
Copy link
Member

@omajid omajid commented Feb 9, 2023

@omajid omajid force-pushed the source-build-externals-public-sign branch from a2b0bc5 to f719b0c Compare February 10, 2023 00:28
<BuildCommandArgs>$(BuildCommandArgs) /v:$(LogVerbosity)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) $(RedirectRepoOutputToLog)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:MicrosoftSourceLinkVersion=$(MicrosoftSourceLinkVersion)</BuildCommandArgs>
<BuildCommandArgs>$(BuildCommandArgs) /p:PublicSign=$(PublicSign)</BuildCommandArgs>
Copy link
Member Author

Choose a reason for hiding this comment

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

Should I also consider passing along other related arcade properties like SignAssemblies?

Copy link
Member

Choose a reason for hiding this comment

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

@crummel - Can you share your thoughts on this one? I tend to think no.

Copy link
Member

Choose a reason for hiding this comment

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

ping @crummel

Copy link
Contributor

Choose a reason for hiding this comment

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

No, I think this should be fine without the extra properties.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually taking a second look at this they are pretty tied together so they probably should all be passed, sorry.

Copy link
Member Author

Choose a reason for hiding this comment

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

Looking at the properties that are defined at https://github.com/dotnet/arcade/blob/main/src/Microsoft.DotNet.Arcade.Sdk/tools/StrongName.targets:

    Writes variables:
      DelaySign
      PublicSign
      PublicKey
      PublicKeyToken
      AssemblyOriginatorKeyFile

I can see passing DelaySign, PublicSign properties. The other three seem like they would override whatever the public key, token and the snk file that the repo is using. That doesn't seem like a good idea to me. Thoughts?

Copy link
Member Author

@omajid omajid Mar 8, 2023

Choose a reason for hiding this comment

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

Okay, looked at other projects and it seems like they are only passing those 2 properties too (if not just one).

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think that makes sense.

@omajid omajid force-pushed the source-build-externals-public-sign branch from f719b0c to 82c112c Compare February 10, 2023 18:39
@omajid omajid force-pushed the source-build-externals-public-sign branch 2 times, most recently from 9036407 to 6210397 Compare March 8, 2023 19:02
<NewtonsoftJsonDirectory>$(ProjectDirectory)/Src/Newtonsoft.Json/</NewtonsoftJsonDirectory>
<NewtonsoftJsonProjectPath>$(NewtonsoftJsonDirectory)Newtonsoft.Json.csproj</NewtonsoftJsonProjectPath>
<DotnetToolCommandArguments>"/p:DotnetOnly=true" "/p:Configuration=$(Configuration)" "/p:AssemblyOriginatorKeyFile=$(NewtonsoftJsonKeyFilePath)" "/p:SignAssembly=true" "/p:PublicSign=true" "/p:TreatWarningsAsErrors=false" "/p:AdditionalConstants=SIGNED"</DotnetToolCommandArguments>
<DotnetToolCommandArguments>"/p:DotnetOnly=true" "/p:Configuration=$(Configuration)" "/p:AssemblyOriginatorKeyFile=$(NewtonsoftJsonKeyFilePath)" "/p:SignAssembly=true" "/p:DelaySign=$(DelaySign)" "/p:PublicSign=true" "/p:TreatWarningsAsErrors=false" "/p:AdditionalConstants=SIGNED"</DotnetToolCommandArguments>
Copy link
Member Author

Choose a reason for hiding this comment

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

I also tried "/p:PublicSign=$(PublicSign)" but that results in a runtime value of /p:PublicSign= being passed, which doesn't work. Any idea why PublicSign is undefined at this point?

Copy link
Contributor

Choose a reason for hiding this comment

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

DelaySign is also set by MSBuild's common targets in MS.Common.CurrentVersion.targets: https://github.com/dotnet/msbuild/blob/1a6d753a7648baf0cc991af0c0d254a41d36eba6/src/Tasks/Microsoft.Common.CurrentVersion.targets#L567. PublicSign is not, so I think this is expected. We're passing in the SDK's default value for for DelaySign here instead of Arcade's due to this, but I think that's okay in this case since the rules for what we want to set it to are the same in both cases.

Pass the value of the PublicSign property to individual builds. Arcade
sets this property correctly and things just work automagically.

Fixes: dotnet/source-build#2907
@omajid omajid force-pushed the source-build-externals-public-sign branch from 6210397 to ec936b7 Compare March 13, 2023 22:40
@MichaelSimons MichaelSimons merged commit a261cee into dotnet:main Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 projects that use SignAssembly, but not PublicSign

3 participants