Skip to content
This repository has been archived by the owner on Oct 18, 2018. It is now read-only.

Align with other ASP.NET Core projects #232

Closed
wants to merge 8 commits into from
Closed

Conversation

dougbu
Copy link
Member

@dougbu dougbu commented Jan 20, 2018

nits:

Aligning dependency versions (using dependencies.props) will come soon.

- part of #228
- use regular LICENSE.txt and Key.snk
- use BuildTools
  - start with aspnet/BuildTools/tree/dev/scripts/bootstrapper files
  - copy other files and pieces of files from aspnet/Mvc repo
  - remove properties that BuildTools sets from root Directory.Build.props
- use Internal.AspNetCore.Sdk
- update version to 1.0.0-preview1
- work around #231 (aka dotnet/standard#567)

nits:
- remove support for `<Configuration>CodeAnalysis</Configuration>`
- centralize references in test projects
- remove a few files I missed in #230

Aligning dependency versions (using dependencies.props) will come soon.
@dougbu
Copy link
Member Author

dougbu commented Jan 20, 2018

@danroth27 / @Eilon the Readme.md file seems a bit sparse after removing the no-longer-relevant documentation links. Do we have a standard paragraph or two describing ASP.NET Core WebHooks?

- should be working soon-ish
- get builds there working
- build.sh file needs to be executable
- not ready for .NET Core App 2.1 with current dependencies
@dougbu
Copy link
Member Author

dougbu commented Jan 20, 2018

🆙📅 to clean CI builds

@@ -0,0 +1,14 @@
<Project>
<PropertyGroup>
<DisablePackageReferenceRestrictions>true</DisablePackageReferenceRestrictions>
Copy link
Member Author

Choose a reason for hiding this comment

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

This will go away when I move to ASP.NET Core 2.1 dependencies and add a dependencies.props file.

<PropertyGroup>
<_ImportParentFile>false</_ImportParentFile>
<_ImportParentFile Condition="$(MSBuildProjectName.StartsWith( 'Microsoft.AspNetCore.' ))">true</_ImportParentFile>
<DeveloperBuildTestTfms>netcoreapp2.0</DeveloperBuildTestTfms>
Copy link
Member Author

Choose a reason for hiding this comment

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

Will change this to netcoreapp2.1 and add netcoreapp2.1 two lines down when I move to ASP.NET Core 2.1 dependencies.

@@ -6,15 +6,17 @@ branches:
- /^(.*\/)?ci-.*$/
- /^rel\/.*/
configuration:
- CodeAnalysis
- Debug
- Release
Copy link
Member Author

Choose a reason for hiding this comment

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

Thoughts? I'm not sure we bother building more than one $(Configuration) elsewhere.

- TFMs weren't lining up
<PropertyGroup>
<_ImportParentFile>false</_ImportParentFile>
<_ImportParentFile Condition="$(MSBuildProjectName.StartsWith( 'Microsoft.AspNetCore.' ))">true</_ImportParentFile>
<DeveloperBuildTestTfms Condition=" '$(DeveloperBuildTestTfms)' == '' ">netcoreapp2.1</DeveloperBuildTestTfms>
Copy link
Member Author

Choose a reason for hiding this comment

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

FYI this Condition is not in the Mvc version of this file. I added it to allow developers to regularly test two TFMs or otherwise override the $(DeveloperBuild) default.

Copy link
Contributor

Choose a reason for hiding this comment

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

Does WebHooks have a particular need for that functionality? If not what's the particular use case you see for this?

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 don't need to test multiple Core TFMs but testing .NET Framework has caught a couple of problems. My AspNetCoreSettings.props file looks like

<Project>
  <PropertyGroup>
    <DeveloperBuild>true</DeveloperBuild>
    <DeveloperBuildTestTfms>netcoreapp2.1</DeveloperBuildTestTfms>
    <DeveloperBuildTestTfms Condition=" '$(OS)' == 'Windows_NT' ">$(DeveloperBuildTestTfms);net461</DeveloperBuildTestTfms>
  </PropertyGroup>
</Project>

Without this Condition, my $(DeveloperBuildTestTfms) settings would be ignored. What is the problem with supporting this override?

That said, I could do something more like how we handle $(DotNetRestoreSources) in sources.repo i.e consume a new property that is not defined by default e.g.

<DeveloperBuildTestTfms>$(AdditonalDeveloperBuildTestTargets);netcoreapp2.1</DeveloperBuildTestTfms>

dougbu added a commit that referenced this pull request Jan 21, 2018
@dougbu dougbu mentioned this pull request Jan 21, 2018
dougbu added a commit that referenced this pull request Jan 21, 2018
@dougbu dougbu mentioned this pull request Jan 21, 2018
dougbu added a commit that referenced this pull request Jan 21, 2018
Copy link
Contributor

@ryanbrandenburg ryanbrandenburg left a comment

Choose a reason for hiding this comment

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

Mostly questions and clarifications. My big concern is that we not merge this with DisablePackageReferenceRestrictions turned on.


<Import Project="version.props" />
<Import Project="build\sources.props" />
Copy link
Contributor

@ryanbrandenburg ryanbrandenburg Jan 22, 2018

Choose a reason for hiding this comment

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

<Import Project="build\dependencies.props" />

Copy link
Member Author

Choose a reason for hiding this comment

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

Discussed offline. Will do this before adding this repo to Universe.

<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<MSBuildAllProjects>$(MSBuildAllProjects);$(RepositoryRoot)version.props</MSBuildAllProjects>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileDirectory)version.props</MSBuildAllProjects>
Copy link
Contributor

Choose a reason for hiding this comment

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

Use https://github.com/aspnet/Mvc/blob/dev/Directory.Build.props as an example, we don't do this there, where did you get the idea to do this here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Depending on a file that can change everything about the build without invalidating previous builds is a bad practice. IOW the MVC version of this file looks like it's missing something important.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's fine, let's just move it inside version.props.

</PackageOutputPath>
<!-- Delayed because $(TargetFramework) may not be set when Directory.Build.props is imported. -->
<PropertyGroup>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">2.0.0</RuntimeFrameworkVersion>
Copy link
Contributor

Choose a reason for hiding this comment

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

If you're aligning with other repos these two should be variables.

Copy link
Member Author

Choose a reason for hiding this comment

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

Coming with dependencies.props. Will add that before adding this repo to Universe.

</PropertyGroup>

<!-- Default items are added after Directory.Build.props runs, causing invalid duplicate entries. -->
<ItemGroup Condition="$(_ImportParentFile) AND Exists( '$(MSBuildProjectDirectory)\Properties\Resources.resx' )">
<!-- Delayed because default items are added after Directory.Build.props is imported, causing invalid duplicate entries. -->
Copy link
Contributor

Choose a reason for hiding this comment

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

As someone who's never touched WebHooks this comment doesn't really mean much to me, could you clarify or give more detail?

Copy link
Member Author

Choose a reason for hiding this comment

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

This isn't really about WebHooks in particular except that WebHooks doesn't add or link resources in individual project files. IOW the <ItemGroup> exists just to remove repeated junk from the projects.

Expanding the comment: The <ItemGroup> isn't in Directory.Build.props because that runs too early. What that means is a version in Directory.Build.props would have to add the <Compile> and <EmbeddedResource> items. Then the default additions would run and complain because something already exists. This way, the items are just updated.

Copy link
Contributor

Choose a reason for hiding this comment

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

That makes sense now, lets just say "This is in .targets instead of .props because..."

- [Stripe](/samples/StripeReceiver)
- [VSTS](/samples/VstsReceiver)
- [Zendesk](/samples/ZendeskReceiver)

#### ASP.NET Core
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we get a more descriptive title or add a description here? I'm unclear on what these are links to.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure what's needed, please clarify. This is a sub-section under the Samples heading.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's merge this sub-section into its parent.

endlocal
exit /B 0
@ECHO OFF
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0run.ps1' default-build %*; exit $LASTEXITCODE"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm just going to assume you copied the bootstrappers wholesale from aspnet/BuildTools and not review them by hand. If you didn't copy them from there please double check that they're identical.

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 took them directly from aspnet/BuildTools.

<DotNetCoreRuntime Include="2.1.0-preview1-26016-05" />
</ItemGroup>

<Target Name="GetBuildNumber">
Copy link
Contributor

@ryanbrandenburg ryanbrandenburg Jan 22, 2018

Choose a reason for hiding this comment

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

Other repos shouldn't be doing the time-based build number by default now. Is this specific to Webhooks for some reason or did you get it from another repo?

Copy link
Member Author

Choose a reason for hiding this comment

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

This isn't called by default. It's a repo-specific target people can use.

I find this target incredibly useful because I often install WebHooks packages locally and use them in other projects. It also helps to work around issues like NuGet/Home#6379 and create a self-consistent set of packages.

The pattern is:

> git clean -dfx
...
> .\build.cmd /t:GetBuildNumber /nologo
Using KoreBuild 2.1.0-preview1-15678
Adding C:\Users\dougbu\.dotnet\x64 to PATH
.NET Core runtime 2.0.5 is already installed. Skipping installation.
.NET Core SDK 2.2.0-preview1-007947 is already installed. Skipping installation.
>>> dotnet.exe msbuild @C:\dd\dnx\Universe++\WebHooks\artifacts\logs\msbuild.rsp
  /p:BuildNumber=t005c1c2fc

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:01.02
> .\build.cmd /p:BuildNumber=t005c1c2fc /nologo
...

Copy link
Contributor

Choose a reason for hiding this comment

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

repo.targets then.


<PropertyGroup Condition="$(_ImportParentFile)">
<DefineConstants>$(DefineConstants);ASPNETWEBHOOKS</DefineConstants>
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<RootNamespace>Microsoft.AspNetCore.WebHooks</RootNamespace>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to set the RootNamespace to be the same for all the packages?

Copy link
Member Author

Choose a reason for hiding this comment

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

Need? The default namespace is the same in all projects (except samples). This avoids either repetitive edits as we add classes (if I left <RootNamespace> out entirely) or boilerplate (if <RootNamespace> were in all the projects).


<PropertyGroup Condition="$(_ImportParentFile)">
<DefineConstants>$(DefineConstants);ASPNETWEBHOOKS</DefineConstants>
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Copy link
Contributor

Choose a reason for hiding this comment

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

We should make a point of moving the GenerateDocumentationFile property in other repos up into src/Directory.Build.props as you've done here. Less boilerplate in csproj files and gives us the desired result by default 👍

<PropertyGroup>
<_ImportParentFile>false</_ImportParentFile>
<_ImportParentFile Condition="$(MSBuildProjectName.StartsWith( 'Microsoft.AspNetCore.' ))">true</_ImportParentFile>
<DeveloperBuildTestTfms Condition=" '$(DeveloperBuildTestTfms)' == '' ">netcoreapp2.1</DeveloperBuildTestTfms>
Copy link
Contributor

Choose a reason for hiding this comment

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

Does WebHooks have a particular need for that functionality? If not what's the particular use case you see for this?

Copy link
Contributor

@ryanbrandenburg ryanbrandenburg left a comment

Choose a reason for hiding this comment

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

Approved once a couple minor tweaks go in.

@dougbu
Copy link
Member Author

dougbu commented Jan 23, 2018

25473ff

@dougbu dougbu closed this Jan 23, 2018
@dougbu dougbu deleted the dougbu/in.the.small branch January 23, 2018 02:28
dougbu added a commit that referenced this pull request Jan 23, 2018
dougbu added a commit that referenced this pull request Jan 23, 2018
dougbu added a commit that referenced this pull request Jan 24, 2018
dougbu added a commit that referenced this pull request Jan 24, 2018
dougbu added a commit that referenced this pull request Jan 24, 2018
- #231
- avoid returning a `ValueTuple` and hitting dotnet/standard#567
- reenable tests skipped in #232
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants