Skip to content

Commit

Permalink
Updated to use latest functions runtime (supporst DI) and the new ver…
Browse files Browse the repository at this point in the history
…sion does as well! +semver:minor
  • Loading branch information
david-driscoll committed Aug 25, 2018
1 parent 4cf475c commit 6f20f83
Show file tree
Hide file tree
Showing 18 changed files with 728 additions and 175 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,4 @@ project.lock.json
/tools/*.exe
/tools/*.md5sum
!tools/packages.config
*.pubxml
1 change: 1 addition & 0 deletions Azure.sln
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".build", ".build", "{2D7895
build.ps1 = build.ps1
cakefile.cake = cakefile.cake
Common.Build.props = Common.Build.props
Common.Build.targets = Common.Build.targets
..\..\gitlab\Azure\tools\packages.config = ..\..\gitlab\Azure\tools\packages.config
EndProjectSection
EndProject
Expand Down
30 changes: 15 additions & 15 deletions Common.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
<ItemGroup>
<PackageReference Update="Microsoft.NET.Sdk.Functions" Version="1.0.14" />
<PackageReference Update="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Update="Microsoft.Azure.WebJobs" Version="3.0.0-beta5" />
<PackageReference Update="Microsoft.Azure.WebJobs.Extensions" Version="3.0.0-beta5" />
<PackageReference Update="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.0.0-beta5" />
<PackageReference Update="Microsoft.Azure.WebJobs" Version="3.0.0-beta7-11351" />
<PackageReference Update="Microsoft.Azure.WebJobs.Extensions" Version="3.0.0-beta7-10640" />
<PackageReference Update="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.0.0-beta7-10640" />
<PackageReference Update="Microsoft.Extensions.Hosting" Version="2.1.0" />
<PackageReference Update="Rocket.Surgery.Extensions" Version="0.8.3" />
<PackageReference Update="Rocket.Surgery.Extensions.DependencyInjection" Version="0.11.0" />
<PackageReference Update="Rocket.Surgery.Extensions" Version="0.9.0" />
<PackageReference Update="Rocket.Surgery.Extensions.Autofac" Version="0.12.0" />
<PackageReference Update="Rocket.Surgery.Extensions.Configuration" Version="0.8.0" />
<PackageReference Update="Microsoft.Extensions.Logging" Version="2.1.0" />
<PackageReference Update="WindowsAzure.Storage" Version="9.3.0" />
<PackageReference Update="Rocket.Surgery.Linq.Extensions" Version="0.8.3" />
<PackageReference Update="Rocket.Surgery.Reactive.Extensions" Version="0.8.3" />
<PackageReference Update="WindowsAzure.Storage" Version="9.3.1" />
<PackageReference Update="Rocket.Surgery.Linq.Extensions" Version="0.9.0" />
<PackageReference Update="Rocket.Surgery.Reactive.Extensions" Version="0.9.0" />
<PackageReference Update="Microsoft.Extensions.Options" Version="2.1.0" />
<PackageReference Update="Microsoft.Extensions.Logging.Abstractions" Version="2.1.0" />
<PackageReference Update="NodaTime" Version="2.3.0" />
<PackageReference Update="NodaTime.Serialization.JsonNet" Version="2.0.0" />
<PackageReference Update="NodaTime" Version="2.4.0" />
<PackageReference Update="NodaTime.Serialization.JsonNet" Version="2.1.0-beta01" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="Rocket.Surgery.Build.Metadata" Version="2.1.0" PrivateAssets="All" />
Expand All @@ -25,13 +25,13 @@
</ItemGroup>
<ItemGroup>
<PackageReference Update="Autofac.Extras.FakeItEasy" Version="5.0.1" />
<PackageReference Update="Bogus" Version="22.3.2" />
<PackageReference Update="coverlet.msbuild" Version="2.1.1" />
<PackageReference Update="FakeItEasy" Version="4.7.1" />
<PackageReference Update="FakeItEasy.Analyzer.CSharp" Version="4.7.1" />
<PackageReference Update="Bogus" Version="23.0.2" />
<PackageReference Update="coverlet.msbuild" Version="2.2.1" />
<PackageReference Update="FakeItEasy" Version="4.8.0" />
<PackageReference Update="FakeItEasy.Analyzer.CSharp" Version="4.8.0" />
<PackageReference Update="FluentAssertions" Version="5.4.1" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Update="Rocket.Surgery.Extensions.Testing" Version="0.8.2" />
<PackageReference Update="Rocket.Surgery.Extensions.Testing" Version="0.9.0" />
<PackageReference Update="xunit" Version="2.4.0" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Update="XunitXml.TestLogger" Version="2.0.0" />
Expand Down
1 change: 1 addition & 0 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
</packageRestore>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="azure-app-service" value="https://www.myget.org/F/azure-appservice/api/v3/index.json" />
<add key="Cake" value="https://www.myget.org/F/cake/api/v3/index.json" protocolVersion="3" />
<add key="RocketSurgeonsGuild" value="https://www.myget.org/F/rocket-surgeons-guild/api/v3/index.json" protocolVersion="3" />
</packageSources>
Expand Down
2 changes: 1 addition & 1 deletion cakefile.cake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#load "nuget:?package=Rocket.Surgery.Cake.Library&version=0.5.1";
#load "nuget:?package=Rocket.Surgery.Cake.Library&version=0.6.0";

Task("Default")
.IsDependentOn("dotnet");
Expand Down
19 changes: 11 additions & 8 deletions samples/FunctionApp1/Function1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,25 @@ public void Register(IServiceConventionContext context)
public static class Function1
{
[FunctionName(nameof(HealthFunction))]
public static Task HealthFunction(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "health")]HttpRequest req,
ILogger logger, ExecutionContext executionContext, CancellationToken token) => FunctionExecutor.RunAsync(typeof(Function1), nameof(Health), logger, executionContext, token);

public static async Task Health(HelloWorld helloWorld, ILogger logger, CancellationToken token)
public static async Task HealthFunction(
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "health")]
HttpRequest req,
[_] HelloWorld helloWorld,
ILogger logger, ExecutionContext executionContext, CancellationToken token)
{
await Task.Yield();
logger.LogInformation($"C# Timer: {helloWorld.Value}");
logger.LogInformation($"C# Timer trigger function executed at: {helloWorld.Date}");
}


[FunctionName(nameof(Function12))]
public static async Task Function12([TimerTrigger("* * * * * *")]TimerInfo myTimer, ILogger logger, ExecutionContext executionContext, CancellationToken token)
public static async Task Function12([TimerTrigger("* * * * * */10")]TimerInfo myTimer,
[_] HelloWorld helloWorld,
ILogger logger, ExecutionContext executionContext, CancellationToken token)
{
await FunctionExecutor.RunAsync(typeof(Function1), nameof(Health), logger, executionContext, token);
await Task.Yield();
logger.LogInformation($"C# Timer: {helloWorld.Value}");
logger.LogInformation($"C# Timer trigger function executed at: {helloWorld.Date}");
}
}
}
15 changes: 15 additions & 0 deletions samples/FunctionApp1/Function2.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//using System;
//using Microsoft.Azure.WebJobs;
//using Microsoft.Azure.WebJobs.Host;

//namespace FunctionApp1
//{
// public static class Function2
// {
// [FunctionName("Function2")]
// public static void Run([TimerTrigger("0 * * * */5 *")]TimerInfo myTimer, TraceWriter log)
// {
// log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
// }
// }
//}
148 changes: 0 additions & 148 deletions src/Azure.Functions/FunctionExecutor.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/Azure.Functions/Rocket.Surgery.Azure.Functions.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
</PropertyGroup>
Expand All @@ -7,7 +7,7 @@
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" />
<PackageReference Include="Microsoft.Extensions.Hosting" />
<PackageReference Include="Rocket.Surgery.Extensions" />
<PackageReference Include="Rocket.Surgery.Extensions.DependencyInjection" />
<PackageReference Include="Rocket.Surgery.Extensions.Autofac" />
<PackageReference Include="Rocket.Surgery.Extensions.Configuration" />
<PackageReference Include="Microsoft.Extensions.Logging" />
</ItemGroup>
Expand Down
Loading

0 comments on commit 6f20f83

Please sign in to comment.