Skip to content

Commit

Permalink
Stopping AzureFunctionsExample from being packed
Browse files Browse the repository at this point in the history
Also adding an assertion that no extra projects becomes packable
  • Loading branch information
soxtoby committed Dec 20, 2023
1 parent ecc76c2 commit ef9439d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.19.0" />
Expand Down
23 changes: 23 additions & 0 deletions build/Build.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Linq;
using Nuke.Common;
using Nuke.Common.CI;
Expand All @@ -6,6 +7,7 @@
using Nuke.Common.ProjectModel;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Tools.GitVersion;
using Serilog;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.Tools.DotNet.DotNetTasks;

Expand Down Expand Up @@ -60,6 +62,16 @@ class Build : NukeBuild
.SetConfiguration(Configuration)
.EnableNoRestore()
.EnableNoBuild());

var unexpectedPackages = Solution.AllProjects
.Where(p => !ExpectedPackages.Contains(p.Name)
&& p.GetMSBuildProject().GetPropertyValue("IsPackable").Equals("true", StringComparison.OrdinalIgnoreCase))
.ToList();
if (unexpectedPackages.Any())
{
Log.Error("Unexpected packages: {Packages}", unexpectedPackages.Select(p => p.Name));
Assert.Fail("Unexpected packages");
}
});

Target Pack => _ => _
Expand All @@ -76,4 +88,15 @@ class Build : NukeBuild
.EnableNoRestore()
.EnableNoBuild());
});

static readonly string[] ExpectedPackages =
{
"SlackNet",
"SlackNet.AspNetCore",
"SlackNet.Autofac",
"SlackNet.AzureFunctions",
"SlackNet.Bot",
"SlackNet.Extensions.DependencyInjection",
"SlackNet.SimpleInjector"
};
}
1 change: 1 addition & 0 deletions build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<LangVersion>10</LangVersion>
<Nullable>enable</Nullable>
<NukeTelemetryVersion>1</NukeTelemetryVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit ef9439d

Please sign in to comment.