Skip to content

Commit

Permalink
Split the solution in two
Browse files Browse the repository at this point in the history
- #222
- remove links from ASP.NET Core projects to ASP.NET projects
  - copy the C# files over
- remove conditional directives from files that are no longer shared
- rename .msbuild file and focus infrastructure on building AspNetWebHooks.sln
  - will use KoreBuild for ASP.NET Core WebHooks projects

nit: accept VS suggestions in changed files
  • Loading branch information
dougbu committed Jan 15, 2018
1 parent 78491ef commit febed48
Show file tree
Hide file tree
Showing 55 changed files with 2,165 additions and 895 deletions.
10 changes: 1 addition & 9 deletions WebHooks.msbuild → AspNetWebHooks.msbuild
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</PropertyGroup>

<ItemGroup>
<SolutionsToBuild Include="WebHooks.sln">
<SolutionsToBuild Include="AspNetWebHooks.sln">
<BuildInParallel>$(BuildInParallel)</BuildInParallel>
</SolutionsToBuild>
</ItemGroup>
Expand Down Expand Up @@ -125,21 +125,13 @@
<_XunitProject Include="tools\WebHooks.xunit.targets">
<Properties>TestAssembly=%(_TestDLLsXunit.FullPath);XmlPath=$(TestResultsDirectory)%(_TestDLLsXunit.FileName)-XunitResults.xml</Properties>
</_XunitProject>
<_DirectTestProjects Include="test\Microsoft.AspNetCore.*\*.csproj" />
</ItemGroup>

<!-- Recreate the test results directory so that print summary doesn't run on old test results. -->
<RemoveDir Directories="$(TestResultsDirectory)" />
<MakeDir Directories="$(TestResultsDirectory)" />

<MSBuild Projects="@(_XunitProject)" BuildInParallel="$(TestInParallel)" Targets="Xunit" />

<!-- Failures in these projects will fail build. But, results will not be included in test run summary. -->
<MSBuild
BuildInParallel="$(TestInParallel)"
Properties="Configuration=$(Configuration);Platform=$(_Platform)"
Projects="@(_DirectTestProjects)"
Targets="Test" />
</Target>

<Target Name="CheckSkipStrongNames" DependsOnTargets="RestoreSkipStrongNames">
Expand Down
680 changes: 680 additions & 0 deletions AspNetWebHooks.sln

Large diffs are not rendered by default.

717 changes: 30 additions & 687 deletions WebHooks.sln

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ mkdir bin

:Build

REM Find the most recent 32bit MSBuild.exe on the system. Require v15.0 (installed with VS2017) or later since .NET
REM Core projects are coming soon.
REM Find the most recent 32bit MSBuild.exe on the system. Require v15.0 (installed with VS2017) or later.
REM Use `vswhere` for the search since %ProgramFiles(x86)%\msbuild\15.0\Bin\MSBuild.exe almost never exists.
set vswhere="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if not exist %vswhere% (
Expand Down Expand Up @@ -49,12 +48,12 @@ if not exist %StorageEmulator% (

if "%1" == "" goto BuildDefaults

%MSBuild% WebHooks.msbuild /m /nr:false /p:Platform="Any CPU" /p:Desktop=true /v:M /fl /flp:LogFile=bin\msbuild.log;Verbosity=Normal /t:%*
%MSBuild% AspNetWebHooks.msbuild /m /nr:false /p:Platform="Any CPU" /p:Desktop=true /v:M /fl /flp:LogFile=bin\msbuild.log;Verbosity=Normal /t:%*
if %ERRORLEVEL% neq 0 goto BuildFail
goto BuildSuccess

:BuildDefaults
%MSBuild% WebHooks.msbuild /m /nr:false /p:Platform="Any CPU" /p:Desktop=true /v:M /fl /flp:LogFile=bin\msbuild.log;Verbosity=Normal
%MSBuild% AspNetWebHooks.msbuild /m /nr:false /p:Platform="Any CPU" /p:Desktop=true /v:M /fl /flp:LogFile=bin\msbuild.log;Verbosity=Normal
if %ERRORLEVEL% neq 0 goto BuildFail
goto BuildSuccess

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@

using Newtonsoft.Json;

#if NETSTANDARD2_0
namespace Microsoft.AspNetCore.WebHooks
#else
namespace Microsoft.AspNet.WebHooks
#endif
{
/// <summary>
/// Provides information about the condition under which the WebHook notification was sent from Azure Alert Service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
using System;
using Newtonsoft.Json;

#if NETSTANDARD2_0
namespace Microsoft.AspNetCore.WebHooks
#else
namespace Microsoft.AspNet.WebHooks
#endif
{
/// <summary>
/// Provides context information for a WebHook notification sent from Azure Alert Service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
using System.Collections.Generic;
using Newtonsoft.Json;

#if NETSTANDARD2_0
namespace Microsoft.AspNetCore.WebHooks
#else
namespace Microsoft.AspNet.WebHooks
#endif
{
/// <summary>
/// Contains information sent in a WebHook notification from Azure Alert Service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
using System;
using Newtonsoft.Json;

#if NETSTANDARD2_0
namespace Microsoft.AspNetCore.WebHooks
#else
namespace Microsoft.AspNet.WebHooks
#endif
{
/// <summary>
/// Contains information sent in a WebHook notification from Kudu (Azure Web App Deployment Service).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@

using Newtonsoft.Json;

#if NETSTANDARD2_0
namespace Microsoft.AspNetCore.WebHooks
#else
namespace Microsoft.AspNet.WebHooks
#endif
{
/// <summary>
/// Contains information about a Bitbucket author.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@

using Newtonsoft.Json;

#if NETSTANDARD2_0
namespace Microsoft.AspNetCore.WebHooks
#else
namespace Microsoft.AspNet.WebHooks
#endif
{
/// <summary>
/// Contains information about a link in Bitbucket.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
using System.Collections.Generic;
using Newtonsoft.Json;

#if NETSTANDARD2_0
namespace Microsoft.AspNetCore.WebHooks
#else
namespace Microsoft.AspNet.WebHooks
#endif
{
/// <summary>
/// Contains information about a parent commit in Bitbucket.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
using System.Collections.Generic;
using Newtonsoft.Json;

#if NETSTANDARD2_0
namespace Microsoft.AspNetCore.WebHooks
#else
namespace Microsoft.AspNet.WebHooks
#endif
{
/// <summary>
/// Contains information about a Bitbucket repository.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
using System.Collections.ObjectModel;
using Newtonsoft.Json;

#if NETSTANDARD2_0
namespace Microsoft.AspNetCore.WebHooks
#else
namespace Microsoft.AspNet.WebHooks
#endif
{
/// <summary>
/// Contains details about the most recent operation to a Bitbucket repository after a push.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
using System.Collections.Generic;
using Newtonsoft.Json;

#if NETSTANDARD2_0
namespace Microsoft.AspNetCore.WebHooks
#else
namespace Microsoft.AspNet.WebHooks
#endif
{
/// <summary>
/// Contains information about a user in Bitbucket.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
using System.Collections.Generic;
using Newtonsoft.Json;

#if NETSTANDARD2_0
namespace Microsoft.AspNetCore.WebHooks
#else
namespace Microsoft.AspNet.WebHooks
#endif
{
/// <summary>
/// Describes one or more event notifications received as a Pusher WebHook.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
using System.Diagnostics.CodeAnalysis;
using System.Xml.Linq;

#if NETSTANDARD2_0
namespace Microsoft.AspNetCore.WebHooks
#else
namespace Microsoft.AspNet.WebHooks
#endif
{
/// <summary>
/// Common XML namespace URIs used by Salesforce SOAP messages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
using System.Linq;
using System.Xml.Linq;

#if NETSTANDARD2_0
namespace Microsoft.AspNetCore.WebHooks
#else
namespace Microsoft.AspNet.WebHooks
#endif
{
/// <summary>
/// Describes one or more event notifications received as an Outbound Message from Salesforce.
Expand Down Expand Up @@ -163,37 +159,37 @@ public IEnumerable<Dictionary<string, string>> Notifications
internal static IEnumerable<XElement> GetNotificationValues(XElement notification)
{
// Add the notification ID
XElement id = notification.Element(Outbound + "Id");
XName notificationIdName = Outbound + "_NotificationId";
XElement notificationId = new XElement(notificationIdName) { Value = id.Value };
var id = notification.Element(Outbound + "Id");
var notificationIdName = Outbound + "_NotificationId";
var notificationId = new XElement(notificationIdName) { Value = id.Value };
yield return notificationId;

// Add the notification type
XElement salesForceObject = notification.Element(Outbound + "sObject");
XAttribute type = salesForceObject.Attribute(Xsi + "type");
XName notificationTypeName = Outbound + "_NotificationType";
XElement notificationType = new XElement(notificationTypeName) { Value = GetLocalName(type.Value) };
var salesForceObject = notification.Element(Outbound + "sObject");
var type = salesForceObject.Attribute(Xsi + "type");
var notificationTypeName = Outbound + "_NotificationType";
var notificationType = new XElement(notificationTypeName) { Value = GetLocalName(type.Value) };
yield return notificationType;

// Add notification properties
foreach (XElement e in salesForceObject.Elements())
foreach (var e in salesForceObject.Elements())
{
yield return e;
}
}

internal static string GetLocalName(string qualified)
{
int index = qualified != null ? qualified.IndexOf(':') : -1;
string type = index > -1 ? qualified.Substring(index + 1) : qualified;
var index = qualified != null ? qualified.IndexOf(':') : -1;
var type = index > -1 ? qualified.Substring(index + 1) : qualified;
return type;
}

private string GetNotificationsValueOrDefault(string property)
{
try
{
string value = _doc.Element(Soap + "Body").Element(Outbound + "notifications").Element(Outbound + property).Value;
var value = _doc.Element(Soap + "Body").Element(Outbound + "notifications").Element(Outbound + property).Value;
return value;
}
catch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
using System.Collections.Specialized;
using System.Text;

#if NETSTANDARD2_0
namespace Microsoft.AspNetCore.WebHooks
#else
namespace Microsoft.AspNet.WebHooks
#endif
{
/// <summary>
/// This version of <see cref="NameValueCollection"/> creates the output supported by <see cref="SlackCommand.ParseActionWithParameters"/>
Expand All @@ -18,9 +14,9 @@ internal class ParameterCollection : NameValueCollection
/// <inheritdoc />
public override string ToString()
{
bool first = true;
StringBuilder output = new StringBuilder();
foreach (string key in this.AllKeys)
var first = true;
var output = new StringBuilder();
foreach (var key in AllKeys)
{
output.AppendFormat("{0}{1}={2}", first ? string.Empty : "; ", key, this[key]);
first = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
using System.Collections.ObjectModel;
using Newtonsoft.Json;

#if NETSTANDARD2_0
namespace Microsoft.AspNetCore.WebHooks
#else
namespace Microsoft.AspNet.WebHooks
#endif
{
/// <summary>
/// The <see cref="SlackAttachment"/> is used to describe the contents of an <see cref="SlackSlashResponse"/>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
using System;
using Newtonsoft.Json;

#if NETSTANDARD2_0
namespace Microsoft.AspNetCore.WebHooks
#else
namespace Microsoft.AspNet.WebHooks
#endif
{
/// <summary>
/// The <see cref="SlackField"/> class is used for expression table fields as part of a <see cref="SlackAttachment"/>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,13 @@
using System;
using Newtonsoft.Json;

#if NETSTANDARD2_0
namespace Microsoft.AspNetCore.WebHooks
#else
namespace Microsoft.AspNet.WebHooks
#endif
{
#if NETSTANDARD2_0
/// <summary>
/// An Slack WebHook action can post back a response to a Slack channel by returning a <see cref="SlackResponse"/>
/// or an <see cref="Mvc.IActionResult"/> with a <see cref="SlackResponse"/> as its content.
/// </summary>
#else
/// <summary>
/// An <see cref="IWebHookHandler"/> can post back a response to a Slack channel by updating the
/// <see cref="System.Net.Http.HttpResponseMessage"/> on the <see cref="WebHookHandlerContext"/> with a response
/// containing a <see cref="SlackResponse"/>.
/// </summary>
#endif
public class SlackResponse
{
private string _text;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,14 @@
using System.Collections.ObjectModel;
using Newtonsoft.Json;

#if NETSTANDARD2_0
namespace Microsoft.AspNetCore.WebHooks
#else
namespace Microsoft.AspNet.WebHooks
#endif
{
#if NETSTANDARD2_0
/// <summary>
/// An Slack WebHook action can post back a response to a Slack Slash request by returning a
/// <see cref="SlackSlashResponse"/> or an <see cref="Mvc.IActionResult"/> with a <see cref="SlackSlashResponse"/>
/// as its content. Please see <see href="https://api.slack.com/docs/attachments#message_formatting"/> for
/// additional details about Slack Slash messages.
/// </summary>
#else
/// <summary>
/// An <see cref="IWebHookHandler"/> can post a response to a Slack Slash request by updating the
/// <see cref="System.Net.Http.HttpResponseMessage"/> on the <see cref="WebHookHandlerContext"/> with a response
/// containing a <see cref="SlackSlashResponse"/>. Please see <c>https://api.slack.com/docs/attachments#message_formatting</c>
/// for additional details.
/// </summary>
#endif
public class SlackSlashResponse
{
private readonly Collection<SlackAttachment> _attachments = new Collection<SlackAttachment>();
Expand Down Expand Up @@ -69,7 +56,7 @@ public SlackSlashResponse(string text, params SlackAttachment[] attachments)
}

_text = text;
foreach (SlackAttachment att in attachments)
foreach (var att in attachments)
{
_attachments.Add(att);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,10 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
#if NETSTANDARD2_0
using Microsoft.AspNetCore.WebHooks.ModelBinding;
#else
using Microsoft.AspNet.WebHooks.Serialization;
#endif
using Newtonsoft.Json;

#if NETSTANDARD2_0
namespace Microsoft.AspNetCore.WebHooks
#else
namespace Microsoft.AspNet.WebHooks
#endif
{
/// <summary>
/// Contains information sent in a WebHook notification from Stripe, see
Expand Down
Loading

0 comments on commit febed48

Please sign in to comment.