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

Add source control information extensibility point #3063

Merged
merged 1 commit into from
Mar 14, 2018

Conversation

tmat
Copy link
Member

@tmat tmat commented Mar 7, 2018

Adds a few extensibility points to common targets that enable source control and SourceLink package features and fully deterministic compilation.

See https://github.com/tmat/repository-info/blob/master/docs/Readme.md for details.

TODO:

Supersedes #2960

@tmat
Copy link
Member Author

tmat commented Mar 7, 2018

@rainersigwald @AndyGerlicher @eerhardt @jeffkl @nguerrera PTAL
Implements the proposal based on our last meeting discussion.

Any target that reads SourceRevisionId, PrivateRepositoryUrl, and other source control related
properties and items should depend on this target.

Source control information provider that sets these properties and items shall override this target
Copy link
Member

Choose a reason for hiding this comment

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

Should they override this target? or BeforeTargets it?

Copy link
Member

Choose a reason for hiding this comment

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

The issue is there can be only one override, so if 2 things want to set these properties/items...

Copy link
Member Author

Choose a reason for hiding this comment

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

There can only be one source control provider for a project. Having multiple doesn't make much sense.

Copy link
Member Author

@tmat tmat Mar 8, 2018

Choose a reason for hiding this comment

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

I'll change it to BeforeTargets. There might potentially be scenario when one target fills in some information and another target (using the same source control) fills in more info.

<!--
PrivateRepositoryUrl is the URL of the repository supplied by the CI server or retrieved from source control manager.

This value is not directly embedded in build outputs to avoid inadvertently publishing links to private repositories.
Copy link
Member

Choose a reason for hiding this comment

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

I don't think I follow what this property is actually used for. Here we say what it is NOT used for, but never what it IS used for.

Copy link
Member Author

Choose a reason for hiding this comment

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

The next line explains. I'm open to suggestions to word it better.

Copy link
Member

Choose a reason for hiding this comment

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

The next line says ‘PublishRepositoryUrl’ property. Is that a type-o or really a different property? I thought it was a different prop

Copy link
Member Author

@tmat tmat Mar 8, 2018

Choose a reason for hiding this comment

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

It's different property. Let me reword this to be clearer.

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

Just some nits on the comments.

@tmat
Copy link
Member Author

tmat commented Mar 8, 2018

@richlander FYI

@tmat
Copy link
Member Author

tmat commented Mar 8, 2018

@eerhardt Updated the comments. Let me know if it's clearer now.

PrivateRepositoryUrl is the URL of the repository supplied by the CI server or retrieved from source control manager.

Targets consuming this property shall not publish its value implicitly as it might inadvertently reveal an internal URL.
Instead, they shall only do so if the project sets PublishRepositoryUrl property to true. For example, the NuGet Pack target
Copy link
Member

Choose a reason for hiding this comment

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

they shall only do so if the project sets PublishRepositoryUrl property to true

Ok - this helped me understand what is going on. Thanks!

@tmat
Copy link
Member Author

tmat commented Mar 8, 2018

@rainersigwald I'd like to get this into VS 15.7 and the next dotnet SDK (whatever the version number is). Should I retarget the PR to vs15.7 branch?

Copy link
Contributor

@AndyGerlicher AndyGerlicher left a comment

Choose a reason for hiding this comment

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

Looks good to me. If @rainersigwald is ok with it we can merge. master is correct for 15.7.

this target (by including InitializeSourceControlInformation in its BeforeTargets) and set
source control properties and items that haven't been initialized yet.
-->
<Target Name="InitializeSourceControlInformation" />
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to insert the DependsOn property we talked about somewhere so folks can inject into this but still have a package compatible with VS2015?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, i'll add the property.

I also have one more piece of feedback coming from NuGet team to look into before we merge.

@tmat tmat force-pushed the SourceInformationExtensibility branch 2 times, most recently from 9bfd5ef to c34c7fe Compare March 13, 2018 22:47
@tmat
Copy link
Member Author

tmat commented Mar 13, 2018

@AndyGerlicher @rainersigwald Based on feedback from NuGet team I have conditioned reading the STANDARD_CI variables based on a new UseStandardCIVariables property. We want to avoid potential (build or test) breaks that initializing these properties from the Standard CI variables might cause.

For example, if Deterministic is on the compiler emits deterministic paths when running on CI build (ContinuousIntegrationBuild is true). This might affect unit tests running on the CI that read paths via CallerFilePathAttribute.

UseStandardCIVariables property will be switched on by the SourceLink package, so that customers who use that package and build deterministically (the default in .NET SDK projects) get all the deterministic goodness as well. Customers not using SourceLink can switch it on themselves.

@tmat
Copy link
Member Author

tmat commented Mar 13, 2018

@nguerrera FYI

@tmat tmat force-pushed the SourceInformationExtensibility branch from c34c7fe to 5a1c178 Compare March 14, 2018 15:58
@tmat
Copy link
Member Author

tmat commented Mar 14, 2018

On second thought, since we need to make the usage of Standard CI opt-in and thus they are not defaults anymore it seems it would be better to look at Standard CI as another source information provider and move the properties to a separate package (Microsoft.Build.StandardCI). Dropping in this package opts into reading source control info from Standard CI env variables. SourceLink package would then depend on this package.

Updated PR to only include the target that serves as a sync point for consumers and producers of the source control info.

@tmat
Copy link
Member Author

tmat commented Mar 14, 2018

@rainersigwald Could you please merge?

Source control information provider that sets these properties and items shall execute before this target (by including
InitializeSourceControlInformation in its BeforeTargets) and set source control properties and items that haven't been initialized yet.
-->
<Target Name="InitializeSourceControlInformation" />
Copy link
Member

Choose a reason for hiding this comment

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

Did you decide that we didn't need a DependsOn property here? I thought we wanted that for some packages that wanted to support downlevel.

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 have added SourceControlInformationFeatureSupported so that they can condition on that. Let me double check that this property is actually reasonable to use.

Copy link
Member Author

Choose a reason for hiding this comment

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

@rainersigwald rainersigwald merged commit b4805af into dotnet:master Mar 14, 2018
@tmat
Copy link
Member Author

tmat commented Mar 14, 2018

Thanks everyone!

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.

4 participants