comments
This commit is contained in:
@@ -33,7 +33,7 @@ This repository contains an example function that is compatible with Speckle Aut
|
||||
|
||||
## Getting started
|
||||
|
||||
This is essentially a template function, designed to serve as a starting point for creating your own function. The function targets dotnet 7.0 and uses the Speckle.Automate.SDK NuGet package, as well as the Objects Kit.
|
||||
This is essentially a template function, designed to serve as a starting point for creating your own function. The function targets dotnet 8.0 and uses the Speckle.Automate.SDK NuGet package.
|
||||
|
||||
At its core every Speckle Automate function is a CLI application with a specific, standardized set of available commands and arguments ([see below](#anatomy-of-a-function)). Each automate function is then built into a Docker image and published onto Speckle Automate.
|
||||
|
||||
@@ -62,13 +62,14 @@ These arguments are automatically provided by the automate platform every time a
|
||||
|
||||
### Function Boilerplate (`Program.cs`)
|
||||
|
||||
In this file, you'll find a call to `AutomationRunner.Main<TInput>`, which serves as your function's SDK entry point. This method handles argument parsing and accepts:
|
||||
This Program.cs file is the entry point to your CLI app.
|
||||
It contains boilerplate to setup the Automate SDK services, Resolve your function, and run it via the call to `IAutomationRunner.Main<TInput>`. This method handles argument parsing and accepts:
|
||||
|
||||
- `args` -> the arguments provided by Speckle Automate, and
|
||||
- `Func<AutomationContext, TInput>` -> Your custom function that gets executed when the automation is triggered.
|
||||
|
||||
> [!NOTE]
|
||||
> If your function requires no inputs, there is also `AutomationRunner.Main` (non-generic) which takes in a `Func<AutomationContext>` instead.
|
||||
> If your function requires no inputs, there is also `IAutomationRunner.Main` (non-generic) which takes in a `Func<AutomationContext>` instead.
|
||||
|
||||
This sets up a CLI application with two commands:
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SpeckleAutomateDotnetExampl
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestAutomateFunction", "TestAutomateFunction\TestAutomateFunction.csproj", "{8107A920-A5E2-459C-9756-04B91FB63F3F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Automate.Sdk", "..\speckle-sharp-sdk\Speckle.Automate.Sdk\Speckle.Automate.Sdk.csproj", "{8DEBC0DE-0893-4595-A268-42F90655D0F1}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Automate.Sdk", "..\speckle-sharp-sdk\src\Speckle.Automate.Sdk\Speckle.Automate.Sdk.csproj", "{168306CA-D153-4FA6-AF5C-8198F6BFAA32}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -23,10 +23,10 @@ Global
|
||||
{8107A920-A5E2-459C-9756-04B91FB63F3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8107A920-A5E2-459C-9756-04B91FB63F3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8107A920-A5E2-459C-9756-04B91FB63F3F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8DEBC0DE-0893-4595-A268-42F90655D0F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8DEBC0DE-0893-4595-A268-42F90655D0F1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8DEBC0DE-0893-4595-A268-42F90655D0F1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8DEBC0DE-0893-4595-A268-42F90655D0F1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{168306CA-D153-4FA6-AF5C-8198F6BFAA32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{168306CA-D153-4FA6-AF5C-8198F6BFAA32}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{168306CA-D153-4FA6-AF5C-8198F6BFAA32}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{168306CA-D153-4FA6-AF5C-8198F6BFAA32}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Speckle.Automate.Sdk;
|
||||
|
||||
//Boilerplate to setup Automate SDK
|
||||
var serviceCollection = new ServiceCollection();
|
||||
serviceCollection.AddAutomateSdk();
|
||||
serviceCollection.AddSingleton<AutomateFunction>();
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
|
||||
<!-- <PackageReference Include="Speckle.Automate.Sdk" Version="2.21.0" />-->
|
||||
<ProjectReference Include="..\..\speckle-sharp-sdk\Speckle.Automate.Sdk\Speckle.Automate.Sdk.csproj"/>
|
||||
<ProjectReference Include="..\..\speckle-sharp-sdk\src\Speckle.Automate.Sdk\Speckle.Automate.Sdk.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -4,16 +4,21 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2"/>
|
||||
<PackageReference Include="NUnit" Version="3.13.3"/>
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1"/>
|
||||
<PackageReference Include="NUnit.Analyzers" Version="3.3.0"/>
|
||||
<PackageReference Include="coverlet.collector" Version="3.1.2"/>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.0" />
|
||||
<PackageReference Include="NUnit" Version="4.3.2" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="5.0.0"/>
|
||||
<PackageReference Include="NUnit.Analyzers" Version="4.7.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user