From 1171057831247db57347a4e9ff144da8355538a0 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Thu, 14 Nov 2024 11:47:24 +0100 Subject: [PATCH] NOTICE.txt includes all dep's notices for container redistribution (#69) --- NOTICE.txt | 89 +++++++++++++++++++++++++++++++++++++++++++++-- build/Program.cs | 55 ++++++++++++++++++++++++++++- dotnet-tools.json | 13 +++++-- 3 files changed, 152 insertions(+), 5 deletions(-) diff --git a/NOTICE.txt b/NOTICE.txt index bfdee3d..8525e95 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,2 +1,87 @@ -Elastic .NET OpenTelemetry Distribution -Copyright 2012-2024 Elasticsearch B.V. +Elastic Documentation Tooling +Copyright 2024-2024 Elasticsearch B.V. + + +License notice for Errata (v0.13.0) +------------------------------------ +https://github.com/spectreconsole/errata at 2f819fb40220b14f00e4678a5499768f7437c1ee +Patrik Svensson, Phil Scott, James Randall +Licensed under MIT +Available at https://licenses.nuget.org/MIT + +License notice for GitHub.Actions.Core (v8.1.1) +------------------------------------ +https://github.com/IEvangelist/dotnet-github-actions-sdk at 57f96243866a8143e0c52dd00776d7a345c15681 +Copyright © 2022-2024 David Pine +Licensed under MIT +Available at https://licenses.nuget.org/MIT + +License notice for DotNet.Glob (v3.1.3) +------------------------------------ +https://github.com/dazinator/DotNet.Glob.git at 6f8a320a9cc6069e80f36bb24f777a21d1c48064 +https://github.com/dazinator/DotNet.Glob +License available at https://github.com/dazinator/DotNet.Glob/blob/master/LICENSE + +License notice for Markdig (v0.37.0) +------------------------------------ +https://github.com/xoofx/markdig at 1a1bbecc467a800dd6b39e68825df50309f6065c +https://github.com/lunet-io/markdig +Alexandre Mutel +Licensed under BSD-2-Clause +Available at https://licenses.nuget.org/BSD-2-Clause + +License notice for RazorSlices (v0.8.1) +------------------------------------ +https://github.com/DamianEdwards/RazorSlices at 65fde587ac2363d8af45ca551eb845d141aba7d2 +Copyright © Damian Edwards +Licensed under MIT +Available at https://licenses.nuget.org/MIT + +License notice for Slugify.Core (v4.0.1) +------------------------------------ +https://github.com/ctolkien/Slugify at d480e12e3a1451e4b5ca5f070b7fb58db8f48b6c +Licensed under MIT +Available at https://licenses.nuget.org/MIT + +License notice for Spectre.Console (v0.47.0) +------------------------------------ +https://github.com/spectreconsole/spectre.console at 018f4ebd17b379e6455b3ac071ad144fc648a84a +Patrik Svensson, Phil Scott, Nils Andresen +Licensed under MIT +Available at https://licenses.nuget.org/MIT + +License notice for TestableIO.System.IO.Abstractions (v21.0.29) +------------------------------------ +https://github.com/TestableIO/System.IO.Abstractions at f4afa40042a9ebea35abee195d5d49a46846523f +Copyright © Tatham Oddie & friends 2010-2024 +Licensed under MIT +Available at https://licenses.nuget.org/MIT + +License notice for TestableIO.System.IO.Abstractions.Wrappers (v21.0.29) +------------------------------------ +https://github.com/TestableIO/System.IO.Abstractions at f4afa40042a9ebea35abee195d5d49a46846523f +Copyright © Tatham Oddie & friends 2010-2024 +Licensed under MIT +Available at https://licenses.nuget.org/MIT + +License notice for Utf8StreamReader (v1.3.2) +------------------------------------ +https://github.com/Cysharp/Utf8StreamReader at 35e2361b7a67e0838b777262c4a7798da50206ca +Copyright © Cysharp, Inc. +Licensed under MIT +Available at https://licenses.nuget.org/MIT + +License notice for Vecc.YamlDotNet.Analyzers.StaticGenerator (v16.1.3) +------------------------------------ +https://github.com/aaubry/YamlDotNet.git +https://github.com/aaubry/YamlDotNet/wiki +Available at https://aka.ms/deprecateLicenseUrl +LICENSE.txt + +License notice for YamlDotNet (v16.1.3) +------------------------------------ +https://github.com/aaubry/YamlDotNet at 7923dd8e600f7fea7710f3b45f3fadcfa1aa589c +https://github.com/aaubry/YamlDotNet/wiki +Copyright (c) Antoine Aubry and contributors +Licensed under MIT +Available at https://licenses.nuget.org/MIT diff --git a/build/Program.cs b/build/Program.cs index ef3c05a..f729dd5 100644 --- a/build/Program.cs +++ b/build/Program.cs @@ -8,11 +8,64 @@ //using static Zx.Env; var app = ConsoleApp.Create(); -app.Add("", async (Cancel _) => + +app.Add("", async Task (Cancel ctx) => { await "dotnet tool restore"; await "dotnet build -c Release --verbosity minimal"; + await File.WriteAllTextAsync("NOTICE.txt", + $""" + Elastic Documentation Tooling + Copyright 2024-{DateTime.UtcNow.Year} Elasticsearch B.V. + + + """, ctx); + await "dotnet thirdlicense --project src/docs-builder/docs-builder.csproj --output .artifacts/NOTICE_temp.txt"; + await File.AppendAllTextAsync("NOTICE.txt", File.ReadAllText(".artifacts/NOTICE_temp.txt"), ctx); + + //bit hacky for now clean this up later + var lines = await File.ReadAllLinesAsync("NOTICE.txt"); + var newLines = new List(lines.Length); + var bclReference = false; + for (var index = 0; index < lines.Length; index++) + { + var line = lines[index]; + if (index <= 2) + { + newLines.Add(line); + continue; + } + + if (line.StartsWith("License notice for")) + { + if (line.StartsWith("License notice for System.") || line.StartsWith("License notice for Microsoft.")) + bclReference = true; + else + { + bclReference = false; + newLines.Add(""); + } + } + if (string.IsNullOrWhiteSpace(line) || bclReference) continue; + newLines.Add(line); + } + await File.WriteAllLinesAsync("NOTICE.txt", newLines, ctx); + + try + { + await "git status --porcelain"; + } + catch (Exception ex) + { + Console.WriteLine(ex.ToString()); + Console.WriteLine("The build left unchecked artifacts in the source folder"); + await "git diff NOTICE.txt"; + return 1; + } + + return 0; }); + app.Add("publish", async (Cancel _) => { var source = "src/docs-builder/docs-builder.csproj"; diff --git a/dotnet-tools.json b/dotnet-tools.json index 517a590..cee44a3 100644 --- a/dotnet-tools.json +++ b/dotnet-tools.json @@ -6,13 +6,22 @@ "version": "5.0.0", "commands": [ "minver" - ] + ], + "rollForward": false }, "dotnet-project-licenses": { "version": "2.7.1", "commands": [ "dotnet-project-licenses" - ] + ], + "rollForward": false + }, + "thirdlicense": { + "version": "1.3.1", + "commands": [ + "thirdlicense" + ], + "rollForward": false } } } \ No newline at end of file