Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should the DotNet.ReproducibleBuilds package be an SDK instead? #45

Open
MattKotsenas opened this issue Jul 25, 2024 · 2 comments
Open

Comments

@MattKotsenas
Copy link
Member

MattKotsenas commented Jul 25, 2024

The DotNet.ReproducibleBuilds.Isolated package is an SDK, DotNet.ReproducibleBuilds is not. Should they both be?

The specific issue that prompts this issue is that I see devs using properties set by RB like $(ContinuousIntegrationBuild) in Directory.Build.props, but the D.B.props file is imported first per dotnet/msbuild#994 (comment).

Since RB is essentially an extension to the SDK, this feels like a defensible change to me. Open question about how much of a breaking change this would be. We likely could leave a stub .props file behind that emits a warning to explain the upgrade path.

@MattKotsenas MattKotsenas changed the title Should the DotNet.ReproducibleBuilds package also be an SDK? Should the DotNet.ReproducibleBuilds package be an SDK instead? Jul 25, 2024
@baronfel
Copy link
Member

I think if we did fix this we'd need to do a staged migration - keeping the Sdk.props and Sdk.targets but delegating those to import props and targets from the 'normal' build/DotNet.ReproducibleBuilds.[props|targets] locations so that users can reference it as an SDK or a PackageReference.

Then we could break after enough time for folks to migrate.

MattKotsenas added a commit to rjmurillo/moq.analyzers that referenced this issue Jul 29, 2024
#91 intended to enable warnings as errors in CI. However,
`$(ContinuousIntegrationBuild)` is set by `DotNet.ReproducibleBuilds`,
and that package's .props file is imported _after_ our own
Directory.Build.props. As a result, the properties were evaluated before
they were set.

This change moves them into the .targets file as "computed properties"
in order for them to pick up the configuration from .props files. This
aligns with the [documented
guidance](https://learn.microsoft.com/en-us/visualstudio/msbuild/customize-your-build?view=vs-2022#choose-between-adding-properties-to-a-props-or-targets-file)
"Set dependent properties in .targets files, because they pick up
customizations from individual projects.". I've also filed
dotnet/reproducible-builds#45 to see if we can
make the reproducible-builds package more intuitive.

Lastly, this cleans up existing warnings:

- Fixes whitespace issues
- Suppresses StyleCop warnings about documenting public members in
tests, which already had the built-in rules suppressed
- Reorders static members to be above instance members
- Adds a single suppression for a long method to keep the change small
@AraHaan
Copy link
Member

AraHaan commented Sep 6, 2024

Yes, I think SDK instead is better.

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

No branches or pull requests

3 participants