Skip to content

Commit

Permalink
Clean up package creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrimc62 committed Oct 4, 2016
1 parent 7420ff9 commit 1b2069e
Show file tree
Hide file tree
Showing 19 changed files with 78 additions and 42 deletions.
4 changes: 2 additions & 2 deletions CSharp/Library/Dialogs/DialogModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ protected override void Load(ContainerBuilder builder)
.InstancePerLifetimeScope();

builder
.Register(c => new LogToUser(new MapToChannelData_BotToUser(
.Register(c => new LogBotToUser(new MapToChannelData_BotToUser(
c.Resolve<AlwaysSendDirect_BotToUser>(),
new List<IMessageActivityMapper> { new KeyboardCardMapper() }), c.Resolve<IActivityLogger>())
new List<IMessageActivityMapper> { new KeyboardCardMapper() }), c.Resolve<IActivityLogger>()))
.As<IBotToUser>()
.InstancePerLifetimeScope();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
<authors>Microsoft</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>
Provide Microsoft Azure extensions to the Microsoft Bot Builder. In particular this include:
* Activity logger for table storage which allows recording and retrieving conversation activities.
Provide Microsoft Azure extensions to the Microsoft Bot Builder. In particular this includes:
* TableLogger -- Activity logger for table storage which allows recording and retrieving conversation activities.
* ReplayTranscript -- Replay activity history on any channel.
</description>
<projectUrl>https://github.com/Microsoft/BotBuilder</projectUrl>
<iconUrl>http://docs.botframework.com/images/bot_icon.png</iconUrl>
<summary>Microsoft Azure extensions for Microsoft.Bot.Builder.</summary>
<summary>Microsoft Azure extensions for Microsoft Bot Builder.</summary>
<language>en-US</language>
<dependencies>
<dependency id="Microsoft.Bot.Builder" version="3.3"/>
<dependency id="Microsoft.Bot.Builder.History" version="3.0"/>
<dependency id="Microsoft.Bot.Builder.History" version="$history$"/>
<dependency id="Newtonsoft.Json" version="8.0.3" />
<dependency id="WindowsAzure.Storage" version="7.2.1" />
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.0.0")]
34 changes: 20 additions & 14 deletions CSharp/Library/Microsoft.Bot.Builder.Azure/TableLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
using Microsoft.Bot.Connector;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Table;
using Microsoft.WindowsAzure.Storage.Table.Protocol;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -183,8 +184,7 @@ public static string GenerateRowKey(DateTime timestamp)
/// <param name="table">Table stroage to use for storing activities.</param>
public TableLogger(CloudTable table)
{
SetField.CheckNull(nameof(_table), table);
_table = table;
SetField.NotNull(out _table, nameof(_table), table);
}

/// <summary>
Expand Down Expand Up @@ -245,8 +245,8 @@ async Task IActivityManager.DeleteConversationAsync(string channelId, string con
{
var pk = ActivityEntity.GeneratePartitionKey(channelId, conversationId);
var query = new TableQuery<ActivityEntity>()
.Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, pk))
.Select(new string[] { "PartitionKey", "RowKey" });
.Where(TableQuery.GenerateFilterCondition(TableConstants.PartitionKey, QueryComparisons.Equal, pk))
.Select(new string[] { TableConstants.PartitionKey, TableConstants.RowKey });
await DeleteAsync(query, cancel);
}

Expand All @@ -259,14 +259,14 @@ async Task IActivityManager.DeleteBeforeAsync(DateTime oldest, CancellationToken
{
var rowKey = ActivityEntity.GenerateRowKey(oldest);
var query = new TableQuery<ActivityEntity>()
.Where(TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.LessThan, rowKey))
.Select(new string[] { "PartitionKey", "RowKey" });
.Where(TableQuery.GenerateFilterCondition(TableConstants.RowKey, QueryComparisons.LessThan, rowKey))
.Select(new string[] { TableConstants.PartitionKey, TableConstants.RowKey });
await DeleteAsync(query, cancel);
}

async Task IActivityManager.DeleteUserActivitiesAsync(string userId, CancellationToken cancel)
{
var query = new TableQuery<ActivityEntity>().Select(new string[] { "PartitionKey", "RowKey", "From", "Recipient" });
var query = new TableQuery<ActivityEntity>().Select(new string[] { TableConstants.PartitionKey, TableConstants.RowKey, "From", "Recipient" });
await DeleteAsync(query, cancel, qs => (from r in qs where r.From == userId || r.Recipient == userId select r));
}

Expand All @@ -277,17 +277,17 @@ private static TableQuery BuildQuery(string channelId, string conversationId, Da
if (channelId != null && conversationId != null)
{
var pkey = ActivityEntity.GeneratePartitionKey(channelId, conversationId);
filter = TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, pkey);
filter = TableQuery.GenerateFilterCondition(TableConstants.PartitionKey, QueryComparisons.Equal, pkey);
}
else if (channelId != null)
{
var pkey = ActivityEntity.GeneratePartitionKey(channelId, "");
filter = TableQuery.GenerateFilterCondition("ParitionKey", QueryComparisons.GreaterThanOrEqual, pkey);
filter = TableQuery.GenerateFilterCondition(TableConstants.PartitionKey, QueryComparisons.GreaterThanOrEqual, pkey);
}
if (oldest != default(DateTime))
{
var rowKey = ActivityEntity.GenerateRowKey(oldest);
var rowFilter = TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.GreaterThanOrEqual, rowKey);
var rowFilter = TableQuery.GenerateFilterCondition(TableConstants.RowKey, QueryComparisons.GreaterThanOrEqual, rowKey);
if (filter == null)
{
filter = rowFilter;
Expand Down Expand Up @@ -411,10 +411,11 @@ protected override void Load(ContainerBuilder builder)

static partial class Extensions
{
public static void Forget<T>(this Task<T> task)
{
}

/// <summary>
/// Compress a string into a byte array.
/// </summary>
/// <param name="str">String to compress.</param>
/// <returns>Compressed byte array.</returns>
public static byte[] Compress(this string str)
{
var bytes = Encoding.UTF8.GetBytes(str);
Expand All @@ -430,6 +431,11 @@ public static byte[] Compress(this string str)
}
}

/// <summary>
/// Decompress a string from a byte array.
/// </summary>
/// <param name="bytes">Compressed string.</param>
/// <returns>Uncompressed string.</returns>
public static string Decompress(this byte[] bytes)
{
using (var msi = new MemoryStream(bytes))
Expand Down
8 changes: 6 additions & 2 deletions CSharp/Library/Microsoft.Bot.Builder.Azure/createpackage.cmd
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
@echo off
echo *** Building Microsoft.Bot.Builder.Azure
setlocal
setlocal enabledelayedexpansion
setlocal enableextensions
set errorlevel=0
erase /s *.nupkg
mkdir ..\nuget
erase /s ..\nuget\Microsoft.Bot.Builder.Azure*nupkg
msbuild /property:Configuration=release Microsoft.Bot.Builder.Azure.csproj
for /f %%v in ('powershell -noprofile "(Get-Command .\bin\release\Microsoft.Bot.Builder.History.dll).FileVersionInfo.FileVersion"') do set history=%%v
for /f %%v in ('powershell -noprofile "(Get-Command .\bin\release\Microsoft.Bot.Builder.Azure.dll).FileVersionInfo.FileVersion"') do set version=%%v
..\..\packages\NuGet.CommandLine.3.4.3\tools\NuGet.exe pack Microsoft.Bot.Builder.Azure.nuspec -symbols -properties version=%version%
..\..\packages\NuGet.CommandLine.3.4.3\tools\NuGet.exe pack Microsoft.Bot.Builder.Azure.nuspec -symbols -properties version=%version%;history=%history% -OutputDirectory ..\nuget
echo *** Finished building Microsoft.Bot.Builder.Azure

Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.0.0")]
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
@echo off
echo *** Building Microsoft.Bot.Builder.Calling
setlocal
setlocal enabledelayedexpansion
setlocal enableextensions
set errorlevel=0
erase /s *.nupkg
mkdir ..\nuget
erase /s ..\nuget\Microsoft.Bot.Builder.Calling*nupkg
msbuild /property:Configuration=release Microsoft.Bot.Builder.Calling.csproj
for /f %%v in ('powershell -noprofile "(Get-Command .\bin\release\Microsoft.Bot.Builder.dll).FileVersionInfo.FileVersion"') do set builder=%%v
for /f %%v in ('powershell -noprofile "(Get-Command .\bin\release\Microsoft.Bot.Builder.Calling.dll).FileVersionInfo.FileVersion"') do set version=%%v
..\..\packages\NuGet.CommandLine.3.4.3\tools\NuGet.exe pack Microsoft.Bot.Builder.Calling.nuspec -symbols -properties version=%version%;builder=%builder%
..\..\packages\NuGet.CommandLine.3.4.3\tools\NuGet.exe pack Microsoft.Bot.Builder.Calling.nuspec -symbols -properties version=%version%;builder=%builder% -OutputDirectory ..\nuget
echo *** Finished building Microsoft.Bot.Builder.Calling

Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
@echo off
echo *** Building Microsoft.Bot.Builder.FormFlow.Json
setlocal
setlocal enabledelayedexpansion
setlocal enableextensions
set errorlevel=0
erase /s *.nupkg
mkdir ..\nuget
erase /s ..\nuget\Microsoft.Bot.Builder.FormFlow.Json*nupkg
msbuild /property:Configuration=release Microsoft.Bot.Builder.FormFlow.Json.csproj
for /f %%v in ('powershell -noprofile "(Get-Command .\bin\release\Microsoft.Bot.Builder.FormFlow.Json.dll).FileVersionInfo.FileVersion"') do set version=%%v
for /f %%v in ('powershell -noprofile "(Get-Command .\bin\release\Microsoft.Bot.Builder.dll).FileVersionInfo.FileVersion"') do set builder=%%v
..\..\packages\NuGet.CommandLine.3.4.3\tools\NuGet.exe pack Microsoft.Bot.Builder.FormFlow.Json.nuspec -symbols -properties version=%version%;builder=%builder%
..\..\packages\NuGet.CommandLine.3.4.3\tools\NuGet.exe pack Microsoft.Bot.Builder.FormFlow.Json.nuspec -symbols -properties version=%version%;builder=%builder% -OutputDirectory ..\nuget
echo *** Finished building Microsoft.Bot.Builder.FormFlow.Json

Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@

namespace Microsoft.Bot.Builder.History
{
/// <summary>
/// Interface for managing activity history.
/// </summary>
public interface IActivityManager
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\Microsoft.Bot.Builder.History.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand All @@ -29,6 +30,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\Microsoft.Bot.Builder.History.XML</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<summary>Microsoft History extensions for Microsoft.Bot.Builder.</summary>
<language>en-US</language>
<dependencies>
<dependency id="Microsoft.Bot.Builder" version="3.0.0"/>
<dependency id="Microsoft.Bot.Builder" version="$builder$"/>
</dependencies>
</metadata>
<files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public sealed class ReplayTranscript
/// <summary>
/// Constructor.
/// </summary>
/// <param name="botToUser">Where to replay transcript.</param>
/// <param name="header">Function for defining the transcript header on each message.</param>
public ReplayTranscript(IBotToUser botToUser, Func<IActivity, string> header = null)
{
Expand Down Expand Up @@ -82,6 +83,9 @@ public async Task Replay(IActivity activity)
}
act.From = msg.From;
act.Recipient = msg.Recipient;
act.ReplyToId = msg.ReplyToId;
act.ChannelId = msg.ChannelId;
act.Conversation = msg.Conversation;
await _botToUser.PostAsync(act);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
@echo off
echo *** Building Microsoft.Bot.Builder.History
setlocal
setlocal enabledelayedexpansion
setlocal enableextensions
set errorlevel=0
erase /s *.nupkg
mkdir ..\nuget
erase /s ..\nuget\Microsoft.Bot.Builder.History*nupkg
msbuild /property:Configuration=release Microsoft.Bot.Builder.History.csproj
for /f %%v in ('powershell -noprofile "(Get-Command .\bin\release\Microsoft.Bot.Builder.dll).FileVersionInfo.FileVersion"') do set builder=%%v
for /f %%v in ('powershell -noprofile "(Get-Command .\bin\release\Microsoft.Bot.Builder.History.dll).FileVersionInfo.FileVersion"') do set version=%%v
..\..\packages\NuGet.CommandLine.3.4.3\tools\NuGet.exe pack Microsoft.Bot.Builder.History.nuspec -symbols -properties version=%version%
..\..\packages\NuGet.CommandLine.3.4.3\tools\NuGet.exe pack Microsoft.Bot.Builder.History.nuspec -symbols -properties version=%version%;builder=%builder% -OutputDirectory ..\nuget
echo *** Finished building Microsoft.Bot.Builder.History

5 changes: 3 additions & 2 deletions CSharp/Library/Microsoft.Bot.Connector/createpackage.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ setlocal
setlocal enabledelayedexpansion
setlocal enableextensions
set errorlevel=0
erase /s *.nupkg
mkdir ..\nuget
erase /s ..\nuget\Microsoft.Bot.Connector*nupkg
msbuild /property:Configuration=release Microsoft.Bot.Connector.csproj
for /f %%v in ('powershell -noprofile "(Get-Command .\bin\release\Microsoft.Bot.Connector.dll).FileVersionInfo.FileVersion"') do set version=%%v
..\..\packages\NuGet.CommandLine.3.4.3\tools\NuGet.exe pack Microsoft.Bot.Connector.nuspec -symbols -properties version=%version%
..\..\packages\NuGet.CommandLine.3.4.3\tools\NuGet.exe pack Microsoft.Bot.Connector.nuspec -symbols -properties version=%version% -OutputDirectory ..\nuget
4 changes: 2 additions & 2 deletions CSharp/Library/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.2.1.0")]
[assembly: AssemblyFileVersion("3.2.1.0")]
[assembly: AssemblyVersion("3.3.0.0")]
[assembly: AssemblyFileVersion("3.3.0.0")]

[assembly: InternalsVisibleTo("Microsoft.Bot.Builder.Tests")]
[assembly: InternalsVisibleTo("Microsoft.Bot.Sample.Tests")]
Expand Down
3 changes: 3 additions & 0 deletions CSharp/Library/createallpackages.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ popd
pushd Microsoft.Bot.Builder.Calling
call createpackage.cmd
popd
pushd Microsoft.Bot.Builder.History
call createpackage.cmd
popd
pushd Microsoft.Bot.Builder.Azure
call createpackage.cmd
popd
8 changes: 5 additions & 3 deletions CSharp/Library/createpackage.cmd
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
@echo off
echo *** Building Microsoft.Bot.Builder
setlocal
setlocal enabledelayedexpansion
setlocal enableextensions
set errorlevel=0
erase /s *.nupkg
mkdir nuget
erase /s nuget\*.nupkg
msbuild /property:Configuration=release Microsoft.Bot.Connector\Microsoft.Bot.Connector.csproj
msbuild /property:Configuration=release Microsoft.Bot.Builder.csproj
msbuild /property:Configuration=release Microsoft.Bot.Builder.FormFlow.Json\Microsoft.Bot.Builder.FormFlow.Json.csproj
msbuild /property:Configuration=release ..\tools\rview\rview.csproj
for /f %%v in ('powershell -noprofile "(Get-Command .\bin\release\Microsoft.Bot.Builder.dll).FileVersionInfo.FileVersion"') do set version=%%v
..\packages\NuGet.CommandLine.3.4.3\tools\NuGet.exe pack Microsoft.Bot.Builder.nuspec -symbols -properties version=%version%
..\packages\NuGet.CommandLine.3.4.3\tools\NuGet.exe pack Microsoft.Bot.Builder.nuspec -symbols -properties version=%version% -OutputDirectory nuget
echo *** Finished building Microsoft.Bot.Builder

1 change: 1 addition & 0 deletions CSharp/Library/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
<package id="Chronic.Signed" version="0.3.2" targetFramework="net46" />
<package id="Microsoft.Rest.ClientRuntime" version="2.3.2" targetFramework="net46" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net46" />
<package id="NuGet.CommandLine" version="3.4.3" targetFramework="net46" developmentDependency="true" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public int GetHashCode(IActivity obj)
[TestCategory("Azure")]
public async Task TableLoggerTest()
{
var tableName = "Activities";
var tableName = "TableLoggerTestActivities";
var account = CloudStorageAccount.DevelopmentStorageAccount;
account.CreateCloudTableClient().GetTableReference(tableName).DeleteIfExists();
var builder = new ContainerBuilder();
Expand Down

0 comments on commit 1b2069e

Please sign in to comment.