From 2e089de7ec543e5ff1c8c0c3fb06f99887752b15 Mon Sep 17 00:00:00 2001 From: Joe DeCock Date: Fri, 15 Nov 2024 13:17:42 -0600 Subject: [PATCH] Add PackAndMove build target --- .github/workflow-gen/workflow-gen.csproj | 1 + Directory.Build.targets | 10 ++++ .../samples/Directory.Build.props | 4 ++ .../AccessTokenManagement.Tests.csproj | 1 - docs/README.md | 7 +++ docs/nuget/local.md | 52 +++++++++++++++++++ .../clients/Directory.Build.props | 4 ++ .../samples/Directory.Build.props | 4 ++ .../TrimmableAnalysis.csproj | 3 +- samples.props | 12 +++++ src.props | 4 +- test.props | 3 +- 12 files changed, 99 insertions(+), 6 deletions(-) create mode 100644 Directory.Build.targets create mode 100644 access-token-management/samples/Directory.Build.props create mode 100644 docs/README.md create mode 100644 docs/nuget/local.md create mode 100644 identity-model-oidc-client/clients/Directory.Build.props create mode 100644 identity-model-oidc-client/samples/Directory.Build.props create mode 100644 samples.props diff --git a/.github/workflow-gen/workflow-gen.csproj b/.github/workflow-gen/workflow-gen.csproj index 188c129f..555b52c9 100644 --- a/.github/workflow-gen/workflow-gen.csproj +++ b/.github/workflow-gen/workflow-gen.csproj @@ -6,6 +6,7 @@ workflow_gen enable enable + false diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 00000000..64f283a4 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,10 @@ + + + $(MSBuildThisFileDirectory)packages + + + + + + + \ No newline at end of file diff --git a/access-token-management/samples/Directory.Build.props b/access-token-management/samples/Directory.Build.props new file mode 100644 index 00000000..3fde4c3a --- /dev/null +++ b/access-token-management/samples/Directory.Build.props @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/access-token-management/test/AccessTokenManagement.Tests/AccessTokenManagement.Tests.csproj b/access-token-management/test/AccessTokenManagement.Tests/AccessTokenManagement.Tests.csproj index 23bc3a3b..8dc57e76 100644 --- a/access-token-management/test/AccessTokenManagement.Tests/AccessTokenManagement.Tests.csproj +++ b/access-token-management/test/AccessTokenManagement.Tests/AccessTokenManagement.Tests.csproj @@ -4,7 +4,6 @@ enable enable Duende.AccessTokenManagement - false diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 00000000..157ad8a9 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,7 @@ +This directory contains internal documentation for the foss repository, with notes on the +build process and tooling. See +[here](https://github.com/DuendeSoftware/docs.duendesoftware.com/) for user documentation. + +## Topics +### NuGet +- [Local Packages](nuget/local.md) diff --git a/docs/nuget/local.md b/docs/nuget/local.md new file mode 100644 index 00000000..5d4d081c --- /dev/null +++ b/docs/nuget/local.md @@ -0,0 +1,52 @@ +# Building Packages Locally + +## PackAndMove +Each project in this repository includes a `PackAndMove` target (see +Directory.Build.targets), which will compile and package the project as a NuGet package +and then copy the output to a configurable directory (\packages by default). You can +`PackAndMove` a single project by changing to its directory and running `dotnet build +-t:PackAndMove`, or you can run the same command from the root of the repository to pack +and move all packages in the repo. + +The intent of PackAndMove is to be a convenience when building packages locally. By +default, `dotnet pack` scatters its output into many nested subdirectories like +`\identity-model\src\IdentityModel\bin\Debug\`. Moving all the packages into a single +location makes it quick to access them and allows you to easily consume the package from a +test or sample project. + +### Configuring Output Dir for PackAndMove +To configure the output directory, either set the `DuendePackageDir` environment variable, +or pass the `DuendePackageDir` property to the build command: + +#### Environment Variable +```ps +# powershell +$Env:DuendePackageDir=C:\packages +dotnet build -t:PackAndMove +``` + +#### Command Line Argument +``` +dotnet build -t:PackAndMove -p:DuendePackageDir=C:\packages +``` + + +## Consuming Local Packages +If you want to try out local builds of your packages, you can add a directory (such as the +directory you use for PackAndMove) as a package source to NuGet. To do so, add the feed to +your NuGet.Config file. You can do this for your entire user account or on a per-project +basis. On windows, you personal config file is located at %appdata%\NuGet\NuGet.Config. +More details from Microsoft's docs +[here](https://learn.microsoft.com/en-us/nuget/consume-packages/configuring-nuget-behavior). + +```xml + + + + + + + +``` + +You can also set this configuration via most IDEs. \ No newline at end of file diff --git a/identity-model-oidc-client/clients/Directory.Build.props b/identity-model-oidc-client/clients/Directory.Build.props new file mode 100644 index 00000000..3fde4c3a --- /dev/null +++ b/identity-model-oidc-client/clients/Directory.Build.props @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/identity-model-oidc-client/samples/Directory.Build.props b/identity-model-oidc-client/samples/Directory.Build.props new file mode 100644 index 00000000..3fde4c3a --- /dev/null +++ b/identity-model-oidc-client/samples/Directory.Build.props @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/identity-model/src/TrimmableAnalysis/TrimmableAnalysis.csproj b/identity-model/src/TrimmableAnalysis/TrimmableAnalysis.csproj index 276c06f1..a07392ca 100644 --- a/identity-model/src/TrimmableAnalysis/TrimmableAnalysis.csproj +++ b/identity-model/src/TrimmableAnalysis/TrimmableAnalysis.csproj @@ -7,7 +7,8 @@ true false true - NU1507 + $(NoWarn);NU1507 + false diff --git a/samples.props b/samples.props new file mode 100644 index 00000000..8b38673d --- /dev/null +++ b/samples.props @@ -0,0 +1,12 @@ + + + + $(NoWarn);1591;NU1507 + latest + false + true + enable + + + + \ No newline at end of file diff --git a/src.props b/src.props index 9bea6d7f..676c4b97 100644 --- a/src.props +++ b/src.props @@ -6,14 +6,14 @@ Duende Software full enable - preview + latest true true true true True true - CS1591,NU1507 + $(NoWarn);CS1591,NU1507 false true true diff --git a/test.props b/test.props index 9590521b..2f7ffcf8 100644 --- a/test.props +++ b/test.props @@ -6,11 +6,10 @@ full false true - preview true enable true - NU1507 + $(NoWarn);NU1507