[A-Za-z]+\d+)?\s*:\s*(?.*?)(?:\s+\[(?[^\[\]]+)\])?\s*$",
- RegexOptions.Compiled
- );
-
- public static RestoreOutcome Run(ToolOptions opts, string target, Action log) {
- var errorLog = Path.Combine(Path.GetTempPath(), $"socket-facts-restore-{Guid.NewGuid():N}.log");
- var psi = new ProcessStartInfo(opts.Dotnet) {
- UseShellExecute = false,
- // Inherit stdout/stderr: the output reaches the user as their own
- // restore output would, and no pipe can be held open by a child.
- RedirectStandardInput = true,
- WorkingDirectory = Path.GetDirectoryName(opts.EntryPath)!,
- };
- psi.ArgumentList.Add("restore");
- psi.ArgumentList.Add(target);
- // Socket reports advisories itself; auditing only adds network calls and
- // NU190x warnings a project may promote to errors.
- psi.ArgumentList.Add("-p:NuGetAudit=false");
- // No lingering MSBuild nodes holding this process's handles.
- psi.ArgumentList.Add("-nodeReuse:false");
- psi.ArgumentList.Add("-fileLogger");
- psi.ArgumentList.Add($"-fileLoggerParameters:LogFile={errorLog};ErrorsOnly;Encoding=UTF-8");
- foreach (var arg in opts.RestoreArgs) psi.ArgumentList.Add(arg);
- log($"running: {opts.Dotnet} {string.Join(' ', psi.ArgumentList)}");
-
- var started = DateTime.UtcNow;
- using var process = Process.Start(psi)
- ?? throw new InvalidOperationException($"could not start `{opts.Dotnet}`");
- process.StandardInput.Close();
- var timedOut = !process.WaitForExit(TimeoutSec * 1000);
- if (timedOut) {
- try {
- process.Kill(entireProcessTree: true);
- } catch (InvalidOperationException) {
- // Exited between the timeout and the kill.
- }
- process.WaitForExit();
- }
- var errors = ReadErrors(errorLog);
- Text.TryDelete(errorLog);
- return new RestoreOutcome(timedOut ? null : process.ExitCode, started, errors);
- }
-
- private static List ReadErrors(string path) {
- var errors = new List();
- if (!File.Exists(path)) return errors;
- foreach (var line in File.ReadAllLines(path)) {
- var m = ErrorLine.Match(Regex.Replace(line.Trim().TrimStart('\uFEFF'), @"^\d+>", ""));
- if (!m.Success) continue;
- // The error's origin is the file it points into, the project for a
- // NuGet error; the bracketed file is what was being built, which for a
- // solution restore is the solution.
- var origin = Regex.Replace(m.Groups["origin"].Value.Trim(), @"\(\d+(,\d+)*\)$", "");
- var built = m.Groups["project"].Value;
- var project = Text.IsProjectFile(origin) && File.Exists(origin)
- ? origin
- : Text.IsProjectFile(built) && File.Exists(built) ? built : "";
- errors.Add(new RestoreError(m.Groups["code"].Value, m.Groups["text"].Value, project));
- }
- return errors;
- }
-}
diff --git a/src/commands/manifest/scripts/dotnet-tool/SolutionContext.cs b/src/commands/manifest/scripts/dotnet-tool/SolutionContext.cs
deleted file mode 100644
index 1f42af6de2..0000000000
--- a/src/commands/manifest/scripts/dotnet-tool/SolutionContext.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-using System.Text.Json;
-using Microsoft.Build.Construction;
-
-namespace Socket.Facts.Dotnet;
-
-// A solution entry: its MSBuild-format members, and the global properties
-// MSBuild's solution metaproject passes each of them (Solution* properties
-// and the project configuration the active solution configuration maps to).
-internal sealed class SolutionContext {
- public readonly Dictionary Members = new(StringComparer.Ordinal);
- private readonly string _solutionPath;
- private readonly string _configurationKey;
-
- public SolutionContext(string entry, IReadOnlyDictionary globalProperties) {
- // A filter (.slnf) names its solution; the Solution* properties describe
- // that solution, as when MSBuild builds the filter.
- HashSet? filtered = null;
- _solutionPath = entry;
- if (entry.EndsWith(".slnf", StringComparison.OrdinalIgnoreCase)) {
- (_solutionPath, filtered) = ReadFilter(entry);
- }
- var solution = SolutionFile.Parse(_solutionPath);
- var configuration = globalProperties.TryGetValue("Configuration", out var c) && c.Length > 0
- ? c
- : solution.GetDefaultConfigurationName();
- var platform = globalProperties.TryGetValue("Platform", out var p) && p.Length > 0
- ? p
- : solution.GetDefaultPlatformName();
- _configurationKey = $"{configuration}|{platform}";
- // Like the solution's own build, restore covers only the projects the
- // active solution configuration builds; a solution without
- // configurations builds them all.
- var configured = solution.SolutionConfigurations.Count > 0;
- foreach (var project in solution.ProjectsInOrder) {
- if (!IsMSBuildProject(project)) continue;
- if (configured
- && !(project.ProjectConfigurations.TryGetValue(_configurationKey, out var mapping) && mapping.IncludeInBuild)) {
- continue;
- }
- var full = Path.GetFullPath(project.AbsolutePath);
- if (filtered != null && !filtered.Contains(full)) continue;
- if (File.Exists(full)) Members[full] = project;
- }
- }
-
- public void Apply(string projectPath, Dictionary props) {
- props["SolutionDir"] = Path.GetDirectoryName(_solutionPath) + Path.DirectorySeparatorChar;
- props["SolutionExt"] = Path.GetExtension(_solutionPath);
- props["SolutionFileName"] = Path.GetFileName(_solutionPath);
- props["SolutionName"] = Path.GetFileNameWithoutExtension(_solutionPath);
- props["SolutionPath"] = _solutionPath;
- if (Members.TryGetValue(projectPath, out var member)
- && member.ProjectConfigurations.TryGetValue(_configurationKey, out var mapped)) {
- props["Configuration"] = mapped.ConfigurationName;
- props["Platform"] = mapped.PlatformName;
- }
- }
-
- // A temporary solution filter over `members`, for restoring a subset of the
- // solution with the solution's own context.
- public string WriteFilter(IReadOnlyList members) {
- var path = Path.Combine(Path.GetTempPath(), $"socket-facts-{Guid.NewGuid():N}.slnf");
- var doc = new {
- solution = new {
- path = _solutionPath,
- projects = members
- .Select(m => Members[m].RelativePath)
- .ToArray(),
- },
- };
- File.WriteAllText(path, JsonSerializer.Serialize(doc));
- return path;
- }
-
- // Solution folders, website folders and shared projects (.shproj, imported
- // into others) are not projects MSBuild builds on their own.
- private static bool IsMSBuildProject(ProjectInSolution project) {
- return project.ProjectType == SolutionProjectType.KnownToBeMSBuildFormat
- || (project.ProjectType == SolutionProjectType.Unknown && Text.IsProjectFile(project.AbsolutePath));
- }
-
- // A solution filter: {"solution": {"path": , "projects": []}}.
- private static (string Solution, HashSet Projects) ReadFilter(string filter) {
- using var doc = JsonDocument.Parse(File.ReadAllText(filter));
- var solution = doc.RootElement.GetProperty("solution");
- var solutionPath = FullPath(Path.GetDirectoryName(filter)!, solution.GetProperty("path").GetString() ?? "");
- var solutionDir = Path.GetDirectoryName(solutionPath)!;
- var projects = new HashSet(StringComparer.Ordinal);
- if (solution.TryGetProperty("projects", out var list)) {
- foreach (var p in list.EnumerateArray()) {
- if (p.GetString() is { Length: > 0 } rel) projects.Add(FullPath(solutionDir, rel));
- }
- }
- return (solutionPath, projects);
- }
-
- private static string FullPath(string dir, string rel) {
- return Path.GetFullPath(Path.Combine(dir, rel.Replace('\\', Path.DirectorySeparatorChar)));
- }
-}
diff --git a/src/commands/manifest/scripts/dotnet-tool/ToolOptions.cs b/src/commands/manifest/scripts/dotnet-tool/ToolOptions.cs
deleted file mode 100644
index 744da70f8b..0000000000
--- a/src/commands/manifest/scripts/dotnet-tool/ToolOptions.cs
+++ /dev/null
@@ -1,167 +0,0 @@
-namespace Socket.Facts.Dotnet;
-
-internal enum ToolMode {
- Facts,
- Members,
- Workspaces,
-}
-
-internal sealed class ToolOptions {
- public const string Usage = """
- Usage: socket-facts-dotnet --records --entry [options] [-- ]
-
- Options:
- --records Records output file (TSV line protocol). Required.
- --entry Solution (.sln/.slnx/.slnf) or project file to scan. Required.
- --dotnet dotnet executable that runs `dotnet restore` (default: dotnet).
- --with-files Also emit resolved artifact and source paths.
- --include-configs Target framework globs; only matching ones are read.
- --exclude-configs Target framework globs to skip (applied after includes).
- --exclude-paths Anchored regex sources over build-root-relative project dirs.
- --exclude-base Directory --exclude-paths is relative to (default: the build root).
- --workspaces Only list the projects (no restore, no dependencies).
- --members Only list the projects the entry builds (no evaluation).
- --verbose Log progress to stderr.
-
- Arguments after `--` go to `dotnet restore` verbatim. MSBuild properties among
- them (-p:K=V, --property:K=V, /p:K=V) and --runtime/-r also apply to project
- evaluation, so evaluation and restore see the same build.
- """;
-
- public string RecordsPath = "";
- public string EntryPath = "";
- public string Dotnet = "dotnet";
- public bool WithFiles;
- public string IncludeConfigs = "";
- public string ExcludeConfigs = "";
- public string ExcludePaths = "";
- public string ExcludeBase = "";
- public ToolMode Mode = ToolMode.Facts;
- public bool Verbose;
- public List RestoreArgs = new();
- public Dictionary GlobalProperties = new(StringComparer.OrdinalIgnoreCase);
-
- public static ToolOptions Parse(string[] args) {
- var opts = new ToolOptions();
- var i = 0;
- for (; i < args.Length; i += 1) {
- var arg = args[i];
- if (arg == "--") {
- i += 1;
- break;
- }
- switch (arg) {
- case "--records":
- opts.RecordsPath = Next(args, ref i, arg);
- break;
- case "--entry":
- opts.EntryPath = Next(args, ref i, arg);
- break;
- case "--dotnet":
- opts.Dotnet = Next(args, ref i, arg);
- break;
- case "--with-files":
- opts.WithFiles = true;
- break;
- case "--include-configs":
- opts.IncludeConfigs = Next(args, ref i, arg);
- break;
- case "--exclude-configs":
- opts.ExcludeConfigs = Next(args, ref i, arg);
- break;
- case "--exclude-paths":
- opts.ExcludePaths = Next(args, ref i, arg);
- break;
- case "--exclude-base":
- opts.ExcludeBase = RealPaths.Dir(Path.GetFullPath(Next(args, ref i, arg)));
- break;
- case "--workspaces":
- opts.SetMode(ToolMode.Workspaces, arg);
- break;
- case "--members":
- opts.SetMode(ToolMode.Members, arg);
- break;
- case "--verbose":
- opts.Verbose = true;
- break;
- default:
- throw new ArgumentException($"Unknown argument `{arg}`");
- }
- }
- var runtimes = new List();
- for (; i < args.Length; i += 1) {
- var arg = args[i];
- opts.RestoreArgs.Add(arg);
- if (TryParseProperty(arg, out var props)) {
- foreach (var (key, value) in props) opts.GlobalProperties[key] = value;
- continue;
- }
- string? rid = null;
- if ((arg == "--runtime" || arg == "-r") && i + 1 < args.Length) {
- i += 1;
- rid = args[i];
- opts.RestoreArgs.Add(rid);
- } else if (arg.StartsWith("--runtime=", StringComparison.Ordinal)) {
- rid = arg.Substring("--runtime=".Length);
- }
- if (!string.IsNullOrEmpty(rid)) runtimes.Add(rid);
- }
- // What `dotnet restore --runtime` forwards: the RuntimeIdentifiers property.
- if (runtimes.Count > 0) opts.GlobalProperties["RuntimeIdentifiers"] = string.Join(';', runtimes);
- if (string.IsNullOrEmpty(opts.RecordsPath) || string.IsNullOrEmpty(opts.EntryPath)) {
- throw new ArgumentException("--records and --entry are required");
- }
- opts.EntryPath = RealPaths.Of(opts.EntryPath);
- return opts;
- }
-
- private void SetMode(ToolMode mode, string arg) {
- if (Mode != ToolMode.Facts) throw new ArgumentException($"{arg} cannot be combined with another mode");
- Mode = mode;
- }
-
- private static string Next(string[] args, ref int i, string arg) {
- i += 1;
- if (i >= args.Length) throw new ArgumentException($"{arg} expects a value");
- return args[i];
- }
-
- // MSBuild's property switch: `-p:A=1;B=2`, also spelled /p:, -property:,
- // --property: (case-insensitive). Per the MSBuild command-line reference,
- // `;` or `,` separates properties; a quoted value keeps its separators.
- private static bool TryParseProperty(string arg, out List<(string Key, string Value)> props) {
- props = new();
- string? rest = null;
- foreach (var prefix in new[] { "-p:", "/p:", "--property:", "-property:", "/property:" }) {
- if (arg.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)) {
- rest = arg.Substring(prefix.Length);
- break;
- }
- }
- if (rest == null) return false;
- foreach (var part in SplitUnquoted(rest)) {
- var eq = part.IndexOf('=');
- if (eq <= 0) continue;
- props.Add((part.Substring(0, eq).Trim(), Unquote(part.Substring(eq + 1).Trim())));
- }
- return props.Count > 0;
- }
-
- private static IEnumerable SplitUnquoted(string s) {
- var start = 0;
- var quoted = false;
- for (var i = 0; i < s.Length; i += 1) {
- if (s[i] == '"') {
- quoted = !quoted;
- } else if (!quoted && (s[i] == ';' || s[i] == ',')) {
- yield return s.Substring(start, i - start);
- start = i + 1;
- }
- }
- yield return s.Substring(start);
- }
-
- private static string Unquote(string v) {
- return v.Length >= 2 && v[0] == '"' && v[^1] == '"' ? v.Substring(1, v.Length - 2) : v;
- }
-}
diff --git a/src/commands/manifest/scripts/dotnet-tool/build-tool.sh b/src/commands/manifest/scripts/dotnet-tool/build-tool.sh
deleted file mode 100755
index 8b65e0af87..0000000000
--- a/src/commands/manifest/scripts/dotnet-tool/build-tool.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/env bash
-# Builds the socket-facts-dotnet tool into ./publish, which the rollup dist
-# build copies to dist/manifest-scripts/dotnet-tool. Requires a .NET 8+ SDK.
-set -euo pipefail
-
-cd "$(dirname "$0")"
-# Publish into a fresh dir and swap it in, so no stale file survives.
-staging="$(mktemp -d "${TMPDIR:-/tmp}/socket-facts-dotnet.XXXXXX")"
-# Vulnerability-feed auditing runs in the dedicated security workflow; restore
-# this locked build input without making the helper build depend on that feed.
-dotnet restore socket-facts-dotnet.csproj --locked-mode -p:NuGetAudit=false --nologo -v quiet
-dotnet publish socket-facts-dotnet.csproj -c Release -o "$staging" --no-restore --nologo -v quiet
-rm -f "$staging"/*.pdb
-if [ -d publish ]; then
- mv publish "$staging.old"
-fi
-mv "$staging" publish
-echo "socket-facts-dotnet tool: $(pwd)/publish/socket-facts-dotnet.dll"
diff --git a/src/commands/manifest/scripts/dotnet-tool/packages.lock.json b/src/commands/manifest/scripts/dotnet-tool/packages.lock.json
deleted file mode 100644
index e4d3badc95..0000000000
--- a/src/commands/manifest/scripts/dotnet-tool/packages.lock.json
+++ /dev/null
@@ -1,281 +0,0 @@
-{
- "version": 1,
- "dependencies": {
- "net6.0": {
- "Microsoft.Build": {
- "type": "Direct",
- "requested": "[17.3.2, )",
- "resolved": "17.3.2",
- "contentHash": "k5+7CfF/aM/hykfnrF93VhbUnhGfpJkGaD+ce8VlhLnOqDyts7WV+8Up3YCP6qmXMZFeeH/Cp23w2wSliP0mBw==",
- "dependencies": {
- "Microsoft.Build.Framework": "17.3.2",
- "Microsoft.NET.StringTools": "17.3.2",
- "System.Collections.Immutable": "6.0.0",
- "System.Configuration.ConfigurationManager": "6.0.0",
- "System.Reflection.Metadata": "6.0.0",
- "System.Reflection.MetadataLoadContext": "6.0.0",
- "System.Security.Principal.Windows": "5.0.0",
- "System.Text.Encoding.CodePages": "6.0.0",
- "System.Text.Json": "6.0.0",
- "System.Threading.Tasks.Dataflow": "6.0.0"
- }
- },
- "Microsoft.Build.Framework": {
- "type": "Direct",
- "requested": "[17.3.2, )",
- "resolved": "17.3.2",
- "contentHash": "iGfJt6rm/vIEowBG6qNX2Udn7UagI6MzalDwwdkDUkSwhvvrGCnDLphyRABAwrrsWHTD/LJlUAJsbW1SkC4CUQ==",
- "dependencies": {
- "System.Security.Permissions": "6.0.0"
- }
- },
- "Microsoft.Build.Locator": {
- "type": "Direct",
- "requested": "[1.7.8, )",
- "resolved": "1.7.8",
- "contentHash": "sPy10x527Ph16S2u0yGME4S6ohBKJ69WfjeGG/bvELYeZVmJdKjxgnlL8cJJJLGV/cZIRqSfB12UDB8ICakOog=="
- },
- "Newtonsoft.Json": {
- "type": "Direct",
- "requested": "[13.0.1, )",
- "resolved": "13.0.1",
- "contentHash": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A=="
- },
- "NuGet.Common": {
- "type": "Direct",
- "requested": "[6.0.6, )",
- "resolved": "6.0.6",
- "contentHash": "EZulYMsyoMAkJjyKQfoUc0mEJ5D+cto/uoAgnNtHEVAFFNieToRuL3rLI3We+0tr63XfF0iOND8hAVCwkgiDag==",
- "dependencies": {
- "NuGet.Frameworks": "6.0.6"
- }
- },
- "NuGet.Configuration": {
- "type": "Direct",
- "requested": "[6.0.6, )",
- "resolved": "6.0.6",
- "contentHash": "yNqg6DmSF65DotTcKpT2f6kFygI8Oi6dHi0jggk+jT+LHTQBiQauVuLOj4VRyEDeKchrltsGjU841tzHuCjiHQ==",
- "dependencies": {
- "NuGet.Common": "6.0.6",
- "System.Security.Cryptography.ProtectedData": "4.4.0"
- }
- },
- "NuGet.DependencyResolver.Core": {
- "type": "Direct",
- "requested": "[6.0.6, )",
- "resolved": "6.0.6",
- "contentHash": "blOZghvcf23rh66rX6A6Ct7qHlALjrTce1KlGtFiq1uhU/qsbkzzySv3ZN/A13aUFpH8lRvd8C4oHcFwgr/WjQ==",
- "dependencies": {
- "NuGet.Configuration": "6.0.6",
- "NuGet.LibraryModel": "6.0.6",
- "NuGet.Protocol": "6.0.6"
- }
- },
- "NuGet.Frameworks": {
- "type": "Direct",
- "requested": "[6.0.6, )",
- "resolved": "6.0.6",
- "contentHash": "Cntffs4It+LZpNWT14s5IVSCooTVGOlnSuO/wV097H/n1Uws0b+22+I/tO7lt8ivyvm2RckeXXO6IgCztovWlQ=="
- },
- "NuGet.LibraryModel": {
- "type": "Direct",
- "requested": "[6.0.6, )",
- "resolved": "6.0.6",
- "contentHash": "nUq9/tpOYrtpqFvqy6vhQKsP52JHIT0V7InbZq+SucvuApR1Qm7liktVCJCRWUsyY0ASGfTgV3XyjaYkH/ZInw==",
- "dependencies": {
- "NuGet.Common": "6.0.6",
- "NuGet.Versioning": "6.0.6"
- }
- },
- "NuGet.Packaging": {
- "type": "Direct",
- "requested": "[6.0.6, )",
- "resolved": "6.0.6",
- "contentHash": "oWk8ZCmAnljB5A1gshZNEHtR0/D04yXp5fDd8qWGcWtnFUIiYLzQvrRHQ73bGDxRNXX+VRSc3r/jphh4im0FTw==",
- "dependencies": {
- "Newtonsoft.Json": "13.0.1",
- "NuGet.Configuration": "6.0.6",
- "NuGet.Versioning": "6.0.6",
- "System.Security.Cryptography.Cng": "5.0.0",
- "System.Security.Cryptography.Pkcs": "5.0.0"
- }
- },
- "NuGet.ProjectModel": {
- "type": "Direct",
- "requested": "[6.0.6, )",
- "resolved": "6.0.6",
- "contentHash": "3PnngLphRDLUGPIEpYkU1J4TWe+bxTYtT0XV990gy3CCcott4SaBwpihUBwDb5mdZOf5aoYbjFp9KZh9mZnOeA==",
- "dependencies": {
- "NuGet.DependencyResolver.Core": "6.0.6"
- }
- },
- "NuGet.Protocol": {
- "type": "Direct",
- "requested": "[6.0.6, )",
- "resolved": "6.0.6",
- "contentHash": "qq9uzbRITI9CogNkTZ9Hqooca79gDeLdrELWvQfAj6LUHyE0ihOaeOSYi6o6U1wUxilFytX0se+noAony4gucQ==",
- "dependencies": {
- "NuGet.Packaging": "6.0.6"
- }
- },
- "NuGet.Versioning": {
- "type": "Direct",
- "requested": "[6.0.6, )",
- "resolved": "6.0.6",
- "contentHash": "9Y2fBEDbR6VRVsXUP5UJQYTsUNHyROguhJR2JGGg6lbahzBKnV5oJjtAxYafA5ffbCE7szNRLwQzDvj3CgPLmw=="
- },
- "System.Formats.Asn1": {
- "type": "Direct",
- "requested": "[6.0.1, )",
- "resolved": "6.0.1",
- "contentHash": "glgtKqWJpH9GDw0m9I5xFiF6WDIQqi/eZXU6MkMRPzAWEERGGAJh+qztkrlWSDbokQ1jalj5NcBNIvVoSDpSSA=="
- },
- "System.Text.Json": {
- "type": "Direct",
- "requested": "[6.0.10, )",
- "resolved": "6.0.10",
- "contentHash": "NSB0kDipxn2ychp88NXWfFRFlmi1bst/xynOutbnpEfRCT9JZkZ7KOmF/I/hNKo2dILiMGnqblm+j1sggdLB9g==",
- "dependencies": {
- "System.Runtime.CompilerServices.Unsafe": "6.0.0",
- "System.Text.Encodings.Web": "6.0.0"
- }
- },
- "Microsoft.NET.StringTools": {
- "type": "Transitive",
- "resolved": "17.3.2",
- "contentHash": "3sIZECEDSY9kP7BqPLOSIHLsiqv0TSU5cIGAMung+NrefIooo1tBMVRt598CGz+kUF1xlbOsO8nPAYpgfokx/Q==",
- "dependencies": {
- "System.Memory": "4.5.5",
- "System.Runtime.CompilerServices.Unsafe": "6.0.0"
- }
- },
- "Microsoft.Win32.SystemEvents": {
- "type": "Transitive",
- "resolved": "6.0.0",
- "contentHash": "hqTM5628jSsQiv+HGpiq3WKBl2c8v1KZfby2J6Pr7pEPlK9waPdgEO6b8A/+/xn/yZ9ulv8HuqK71ONy2tg67A=="
- },
- "System.Collections.Immutable": {
- "type": "Transitive",
- "resolved": "6.0.0",
- "contentHash": "l4zZJ1WU2hqpQQHXz1rvC3etVZN+2DLmQMO79FhOTZHMn8tDRr+WU287sbomD0BETlmKDn0ygUgVy9k5xkkJdA==",
- "dependencies": {
- "System.Runtime.CompilerServices.Unsafe": "6.0.0"
- }
- },
- "System.Configuration.ConfigurationManager": {
- "type": "Transitive",
- "resolved": "6.0.0",
- "contentHash": "7T+m0kDSlIPTHIkPMIu6m6tV6qsMqJpvQWW2jIc2qi7sn40qxFo0q+7mEQAhMPXZHMKnWrnv47ntGlM/ejvw3g==",
- "dependencies": {
- "System.Security.Cryptography.ProtectedData": "6.0.0",
- "System.Security.Permissions": "6.0.0"
- }
- },
- "System.Drawing.Common": {
- "type": "Transitive",
- "resolved": "6.0.0",
- "contentHash": "NfuoKUiP2nUWwKZN6twGqXioIe1zVD0RIj2t976A+czLHr2nY454RwwXs6JU9Htc6mwqL6Dn/nEL3dpVf2jOhg==",
- "dependencies": {
- "Microsoft.Win32.SystemEvents": "6.0.0"
- }
- },
- "System.Memory": {
- "type": "Transitive",
- "resolved": "4.5.5",
- "contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw=="
- },
- "System.Reflection.Metadata": {
- "type": "Transitive",
- "resolved": "6.0.0",
- "contentHash": "sffDOcex1C3HO5kDolOYcWXTwRpZY/LvJujM6SMjn63fWMJWchYAAmkoAJXlbpZ5yf4d+KMgxd+LeETa4gD9sQ==",
- "dependencies": {
- "System.Collections.Immutable": "6.0.0"
- }
- },
- "System.Reflection.MetadataLoadContext": {
- "type": "Transitive",
- "resolved": "6.0.0",
- "contentHash": "SuK8qTHbmG3PToLo1TEq8YSfY31FiKhASBmjozUTAleDgiX4H2X4jm0VPFb+K2soSSmYPyHTpHp35TctfNtDzQ==",
- "dependencies": {
- "System.Collections.Immutable": "6.0.0",
- "System.Reflection.Metadata": "6.0.0"
- }
- },
- "System.Runtime.CompilerServices.Unsafe": {
- "type": "Transitive",
- "resolved": "6.0.0",
- "contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
- },
- "System.Security.AccessControl": {
- "type": "Transitive",
- "resolved": "6.0.0",
- "contentHash": "AUADIc0LIEQe7MzC+I0cl0rAT8RrTAKFHl53yHjEUzNVIaUlhFY11vc2ebiVJzVBuOzun6F7FBA+8KAbGTTedQ=="
- },
- "System.Security.Cryptography.Cng": {
- "type": "Transitive",
- "resolved": "5.0.0",
- "contentHash": "jIMXsKn94T9JY7PvPq/tMfqa6GAaHpElRDpmG+SuL+D3+sTw2M8VhnibKnN8Tq+4JqbPJ/f+BwtLeDMEnzAvRg==",
- "dependencies": {
- "System.Formats.Asn1": "5.0.0"
- }
- },
- "System.Security.Cryptography.Pkcs": {
- "type": "Transitive",
- "resolved": "5.0.0",
- "contentHash": "9TPLGjBCGKmNvG8pjwPeuYy0SMVmGZRwlTZvyPHDbYv/DRkoeumJdfumaaDNQzVGMEmbWtg07zUpSW9q70IlDQ==",
- "dependencies": {
- "System.Formats.Asn1": "5.0.0",
- "System.Security.Cryptography.Cng": "5.0.0"
- }
- },
- "System.Security.Cryptography.ProtectedData": {
- "type": "Transitive",
- "resolved": "6.0.0",
- "contentHash": "rp1gMNEZpvx9vP0JW0oHLxlf8oSiQgtno77Y4PLUBjSiDYoD77Y8uXHr1Ea5XG4/pIKhqAdxZ8v8OTUtqo9PeQ=="
- },
- "System.Security.Permissions": {
- "type": "Transitive",
- "resolved": "6.0.0",
- "contentHash": "T/uuc7AklkDoxmcJ7LGkyX1CcSviZuLCa4jg3PekfJ7SU0niF0IVTXwUiNVP9DSpzou2PpxJ+eNY2IfDM90ZCg==",
- "dependencies": {
- "System.Security.AccessControl": "6.0.0",
- "System.Windows.Extensions": "6.0.0"
- }
- },
- "System.Security.Principal.Windows": {
- "type": "Transitive",
- "resolved": "5.0.0",
- "contentHash": "t0MGLukB5WAVU9bO3MGzvlGnyJPgUlcwerXn1kzBRjwLKixT96XV0Uza41W49gVd8zEMFu9vQEFlv0IOrytICA=="
- },
- "System.Text.Encoding.CodePages": {
- "type": "Transitive",
- "resolved": "6.0.0",
- "contentHash": "ZFCILZuOvtKPauZ/j/swhvw68ZRi9ATCfvGbk1QfydmcXBkIWecWKn/250UH7rahZ5OoDBaiAudJtPvLwzw85A==",
- "dependencies": {
- "System.Runtime.CompilerServices.Unsafe": "6.0.0"
- }
- },
- "System.Text.Encodings.Web": {
- "type": "Transitive",
- "resolved": "6.0.0",
- "contentHash": "Vg8eB5Tawm1IFqj4TVK1czJX89rhFxJo9ELqc/Eiq0eXy13RK00eubyU6TJE6y+GQXjyV5gSfiewDUZjQgSE0w==",
- "dependencies": {
- "System.Runtime.CompilerServices.Unsafe": "6.0.0"
- }
- },
- "System.Threading.Tasks.Dataflow": {
- "type": "Transitive",
- "resolved": "6.0.0",
- "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA=="
- },
- "System.Windows.Extensions": {
- "type": "Transitive",
- "resolved": "6.0.0",
- "contentHash": "IXoJOXIqc39AIe+CIR7koBtRGMiCt/LPM3lI+PELtDIy9XdyeSrwXFdWV9dzJ2Awl0paLWUaknLxFQ5HpHZUog==",
- "dependencies": {
- "System.Drawing.Common": "6.0.0"
- }
- }
- }
- }
-}
diff --git a/src/commands/manifest/scripts/dotnet-tool/socket-facts-dotnet.csproj b/src/commands/manifest/scripts/dotnet-tool/socket-facts-dotnet.csproj
deleted file mode 100644
index 376def0284..0000000000
--- a/src/commands/manifest/scripts/dotnet-tool/socket-facts-dotnet.csproj
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
- Exe
-
- net6.0
- LatestMajor
- 12
- enable
- enable
- socket-facts-dotnet
- Socket.Facts.Dotnet
- true
- en
-
- false
-
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/commands/manifest/scripts/exclude-paths-glob.mts b/src/commands/manifest/scripts/exclude-paths-glob.mts
deleted file mode 100644
index 33e5b0a9b6..0000000000
--- a/src/commands/manifest/scripts/exclude-paths-glob.mts
+++ /dev/null
@@ -1,156 +0,0 @@
-// Single source of truth for --exclude-paths glob semantics against a JVM
-// build root's subproject dirs: anchored, relative, case-sensitive; `*`
-// within one path segment, `**` across zero or more segments, `?` within one
-// segment, and `[...]` character classes with `[!..]`/`[^..]` negation.
-// Entries are assumed pre-validated by assertValidExcludePaths (relative, no
-// negation, no `..`, balanced brackets, comma-free). A malformed entry falls
-// back to a literal match, never throws.
-//
-// Compiled HERE, once, and handed to every producer (the gradle/sbt/maven
-// facts and workspaces scripts) pre-compiled, so there is exactly one
-// implementation and one test suite instead of the same algorithm
-// re-implemented per language.
-//
-// Portability contract: gradle/sbt/maven all run on the JVM and share the
-// exact same regex engine (java.util.regex), so the same emitted subset
-// (`.*`, `[^/]*`, `[^/]`, `[...]`, `[^...]`, backslash-escaped
-// metacharacters) is authoritative for every producer - this compiler and JS
-// RegExp agree on the identical subset. Class bodies escape `&` because Java
-// classes support `&&` intersection (JS treats it literally). Each compiled
-// pattern already means "this path OR its whole subtree", matching the
-// documented --exclude-paths contract, so a producer never needs its own
-// "self + /**" expansion. Patterns transport comma-joined: an input glob can
-// never contain a comma, since --exclude-paths is comma-split before glob
-// parsing reaches this module.
-
-function literalSource(glob: string): string {
- const escaped = glob.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
- return `^(?:${escaped})(?:/.*)?$`
-}
-
-// Strips a trailing `/**` (and trailing slashes) so `dir` and `dir/**` both
-// compile to the same base pattern - the "self OR subtree" wrap below is
-// what actually encodes matching the subtree, not the user's own suffix.
-function stripTrailingGlobstar(glob: string): string {
- let g = glob
- while (g.endsWith('/')) {
- g = g.slice(0, -1)
- }
- while (g.endsWith('/**')) {
- g = g.slice(0, -3)
- while (g.endsWith('/')) {
- g = g.slice(0, -1)
- }
- }
- return g
-}
-
-// Translates one path segment's `*`/`?`/`[...]` - never crosses a `/`.
-function translateSegment(segment: string): string {
- let sb = ''
- let i = 0
- const n = segment.length
- while (i < n) {
- const ch = segment.charAt(i)
- if (ch === '*') {
- sb += '[^/]*'
- i += 1
- } else if (ch === '?') {
- sb += '[^/]'
- i += 1
- } else if (ch === '[') {
- const j = segment.indexOf(']', i + 1)
- // Treat as a class only with a non-empty body; else a literal `[`.
- if (j <= i + 1) {
- sb += '\\['
- i += 1
- } else {
- let body = segment.slice(i + 1, j)
- const neg = body.startsWith('!') || body.startsWith('^')
- if (neg) {
- body = body.slice(1)
- }
- if (!body) {
- // `[!]`/`[^]` would emit `[^]`, which JS accepts but Java rejects;
- // signal the caller to fall back to a whole-glob literal match.
- throw new Error('empty-class')
- }
- // Only literal chars and `-` ranges are meaningful; neutralize
- // regex-class tricks (`&` guards Java's `&&` class intersection).
- body = body
- .replace(/\\/g, '\\\\')
- .replace(/\[/g, '\\[')
- .replace(/\]/g, '\\]')
- .replace(/&/g, '\\&')
- sb += `[${neg ? '^' : ''}${body}]`
- i = j + 1
- }
- } else if ('.\\^$|+(){}]'.includes(ch)) {
- sb += `\\${ch}`
- i += 1
- } else {
- sb += ch
- i += 1
- }
- }
- return sb
-}
-
-export function excludePathGlobToRegexSource(glob: string): string {
- const stripped = stripTrailingGlobstar(glob)
- if (!stripped) {
- // Defensive only: assertValidExcludePaths already rejects a pattern that
- // reduces to "match everything".
- return literalSource(glob)
- }
- try {
- const segments = stripped.split('/')
- let base = ''
- segments.forEach((segment, i) => {
- const isLast = i === segments.length - 1
- if (segment === '**') {
- // Zero or more whole segments: mid-pattern, each consumed segment
- // carries its own trailing slash; as the last segment, anything
- // (including nothing) for the rest of the path.
- base += isLast ? '.*' : '(?:[^/]+/)*'
- } else {
- base += translateSegment(segment)
- if (!isLast) {
- base += '/'
- }
- }
- })
- const source = `^(?:${base})(?:/.*)?$`
- // eslint-disable-next-line no-new
- new RegExp(source)
- return source
- } catch {
- return literalSource(glob)
- }
-}
-
-// A Windows-style `foo\bar` means the path `foo/bar`.
-export function compileExcludePathPatterns(
- paths: readonly string[] | undefined,
-): string[] {
- return (paths ?? []).map(p =>
- excludePathGlobToRegexSource(p.replaceAll('\\', '/')),
- )
-}
-
-// Transport form handed to the build-tool scripts: comma-joined pattern
-// sources. Empty string when there are no patterns.
-export function serializeExcludePathPatterns(
- paths: readonly string[] | undefined,
-): string {
- return compileExcludePathPatterns(paths).join(',')
-}
-
-export type ExcludePathFilter = (relPath: string) => boolean
-
-export function createExcludePathFilter(
- paths: readonly string[] | undefined,
-): ExcludePathFilter {
- const patterns = compileExcludePathPatterns(paths).map(s => new RegExp(s))
- return relPath => patterns.some(p => p.test(relPath))
-}
diff --git a/src/commands/manifest/scripts/exclude-paths-glob.test.mts b/src/commands/manifest/scripts/exclude-paths-glob.test.mts
deleted file mode 100644
index ba21e26453..0000000000
--- a/src/commands/manifest/scripts/exclude-paths-glob.test.mts
+++ /dev/null
@@ -1,196 +0,0 @@
-import { describe, expect, it } from 'vitest'
-
-import {
- createExcludePathFilter,
- excludePathGlobToRegexSource,
- serializeExcludePathPatterns,
-} from './exclude-paths-glob.mts'
-
-// Vector table for the cross-language --exclude-paths contract. Globs are
-// compiled to regex pattern sources here (the ONLY implementation) and handed
-// pre-compiled to the gradle/sbt/maven facts and workspaces scripts, so these
-// vectors define the semantics every producer sees. Every entry means "this
-// path AND its whole subtree", whether or not the user wrote a trailing
-// `/**` themselves.
-const MATCH_VECTORS: Array<{
- glob: string
- matches: string[]
- rejects: string[]
-}> = [
- // A bare entry excludes itself and its whole subtree, without needing an
- // explicit trailing `/**`.
- {
- glob: 'legacy',
- matches: ['legacy', 'legacy/sub', 'legacy/sub/deeper'],
- rejects: ['legacyx', 'xlegacy', 'a/legacy'],
- },
- // An explicit trailing `/**` (or `/`) compiles to the identical pattern.
- {
- glob: 'legacy/**',
- matches: ['legacy', 'legacy/sub'],
- rejects: ['legacyx'],
- },
- {
- glob: 'legacy/',
- matches: ['legacy', 'legacy/sub'],
- rejects: ['legacyx'],
- },
- // `*` spans one path segment, never crossing `/`.
- {
- glob: 'leg*cy',
- matches: ['legacy', 'legcy'],
- rejects: ['leg/acy', 'legacyx'],
- },
- // `?` matches exactly one character, never `/`.
- {
- glob: 'a?c',
- matches: ['abc'],
- rejects: ['ac', 'a/c', 'abbc'],
- },
- // Leading `**/` matches at any depth, including root-level (the NIO
- // zero-depth gap this compiler exists to close without per-language
- // variant expansion).
- {
- glob: '**/legacy',
- matches: ['legacy', 'a/legacy', 'a/b/legacy', 'a/legacy/sub'],
- rejects: ['legacyx', 'a/legacyx'],
- },
- // A mid-pattern `**` spans zero or more whole segments.
- {
- glob: 'src/**/legacy',
- matches: ['src/legacy', 'src/a/legacy', 'src/a/b/legacy'],
- rejects: ['xsrc/legacy', 'src/legacyx', 'legacy'],
- },
- // Character classes: enumerations, ranges, and `[!..]`/`[^..]` negation.
- {
- glob: '[lL]egacy',
- matches: ['legacy', 'Legacy'],
- rejects: ['regacy'],
- },
- {
- glob: 'v[1-3]',
- matches: ['v1', 'v2', 'v3'],
- rejects: ['v4'],
- },
- {
- glob: '[!x]legacy',
- matches: ['ylegacy'],
- rejects: ['xlegacy'],
- },
- {
- glob: '[^x]legacy',
- matches: ['ylegacy'],
- rejects: ['xlegacy'],
- },
- // Regex metacharacters in globs are literals.
- {
- glob: 'a.b',
- matches: ['a.b'],
- rejects: ['axb'],
- },
- // An unterminated `[` is a literal bracket.
- {
- glob: 'a[bc',
- matches: ['a[bc'],
- rejects: ['ab', 'ac'],
- },
- // An empty (possibly negated) class would emit `[^]`, valid in JS but
- // rejected by Java - the whole glob falls back to a literal match.
- {
- glob: '[!]legacy',
- matches: ['[!]legacy'],
- rejects: ['xlegacy', 'legacy'],
- },
- // `&` inside a class is a literal (Java classes support `&&` intersection;
- // the emitted pattern escapes it so both engines agree).
- {
- glob: '[a&]x',
- matches: ['ax', '&x'],
- rejects: ['bx'],
- },
- // A Windows path separator.
- {
- glob: 'app\\core',
- matches: ['app/core', 'app/core/x'],
- rejects: ['app', 'core'],
- },
-]
-
-describe('exclude-paths-glob vectors (cross-language contract)', () => {
- for (const { glob, matches, rejects } of MATCH_VECTORS) {
- it(`\`${glob}\``, () => {
- const filter = createExcludePathFilter([glob])
- for (const relPath of matches) {
- expect(filter(relPath), `${glob} should match ${relPath}`).toBe(true)
- }
- for (const relPath of rejects) {
- expect(filter(relPath), `${glob} should reject ${relPath}`).toBe(false)
- }
- })
- }
-})
-
-describe('multiple entries', () => {
- it('matches if any entry matches', () => {
- const filter = createExcludePathFilter(['legacy', 'vendor'])
- expect(filter('legacy')).toBe(true)
- expect(filter('vendor/pkg')).toBe(true)
- expect(filter('src')).toBe(false)
- })
-
- it('an empty/undefined list matches nothing', () => {
- expect(createExcludePathFilter([])('legacy')).toBe(false)
- expect(createExcludePathFilter(undefined)('legacy')).toBe(false)
- })
-})
-
-describe('emitted pattern sources (transport format)', () => {
- it('wraps every entry in a self-or-subtree suffix', () => {
- expect(excludePathGlobToRegexSource('legacy')).toBe('^(?:legacy)(?:/.*)?$')
- })
-
- it('translates * and ? to segment-bounded classes', () => {
- expect(excludePathGlobToRegexSource('a*b')).toBe('^(?:a[^/]*b)(?:/.*)?$')
- expect(excludePathGlobToRegexSource('a?b')).toBe('^(?:a[^/]b)(?:/.*)?$')
- })
-
- it('translates a leading ** to zero-or-more full segments', () => {
- expect(excludePathGlobToRegexSource('**/legacy')).toBe(
- '^(?:(?:[^/]+/)*legacy)(?:/.*)?$',
- )
- })
-
- it('escapes regex metacharacters as literals', () => {
- expect(excludePathGlobToRegexSource('a.b')).toBe('^(?:a\\.b)(?:/.*)?$')
- })
-
- it('escapes `&` in class bodies (Java `&&` intersection guard)', () => {
- expect(excludePathGlobToRegexSource('[a&]x')).toBe('^(?:[a\\&]x)(?:/.*)?$')
- })
-
- it('normalizes `[!..]` negation to `[^..]`', () => {
- expect(excludePathGlobToRegexSource('[!x]legacy')).toBe(
- '^(?:[^x]legacy)(?:/.*)?$',
- )
- })
-
- it('never emits `[^]` (Java-invalid); empty classes go literal', () => {
- expect(excludePathGlobToRegexSource('[!]legacy')).toBe(
- '^(?:\\[!\\]legacy)(?:/.*)?$',
- )
- })
-
- it('emits nothing a comma-join could break on', () => {
- // The transport comma-joins patterns; globs cannot contain commas (the
- // comma-split precedes glob parsing), so emitted patterns cannot either.
- const serialized = serializeExcludePathPatterns(['legacy', '[a&]x'])
- for (const pattern of serialized.split(',')) {
- expect(() => new RegExp(pattern)).not.toThrow()
- }
- })
-
- it('serializes an empty/undefined list to the empty string', () => {
- expect(serializeExcludePathPatterns([])).toBe('')
- expect(serializeExcludePathPatterns(undefined)).toBe('')
- })
-})
diff --git a/src/commands/manifest/scripts/facts.mts b/src/commands/manifest/scripts/facts.mts
deleted file mode 100644
index 06c09a06ec..0000000000
--- a/src/commands/manifest/scripts/facts.mts
+++ /dev/null
@@ -1,113 +0,0 @@
-export type AnyPURL = {
- type: string
- namespace?: string | undefined
- name: string
- version?: string | undefined
- qualifiers?: Record | undefined
-}
-
-// No sources/targets here: those are local absolute paths, returned in-memory
-// as ResolvedArtifactPaths, never serialized into the SBOM.
-export type SocketFactsSbom = {
- metadata?: SocketFactsSbomMetadata | undefined
- projects?: SocketFactsSbomProject[] | undefined
- components: SocketFactsSbomComponent[]
- dependencies?: SocketFactsSbomDependency[] | undefined
-}
-
-export type SocketFactsSbomMetadata = {
- format: 'socket-facts-sbom'
- tool: 'dotnet' | 'gradle' | 'maven' | 'sbt'
- toolVersion: string
- javaVersion?: string | undefined
- // Lets a facts file be traced back to the generator release that produced it.
- socketCliVersion?: string | undefined
-}
-
-export type SocketFactsSbomComponent = AnyPURL & {
- id: string
- direct?: boolean | undefined
- dev?: boolean | undefined
- // A module of the scanned build itself (same GAV as a projects[] entry).
- firstParty?: true | undefined
-}
-
-// Relative to the facts file's directory.
-export type SocketFactsManifestReference = {
- file: string
-}
-
-// A component with one exact subtree, shared by every position whose subtree
-// is identical.
-export type SocketFactsSbomDependency = {
- // Index into components[].
- component: number
- // Indices into dependencies[].
- children?: number[] | undefined
-}
-
-export type SocketFactsSbomProject = AnyPURL & {
- // The build tool's own project identity, unique within the facts file:
- // Maven's GAV, Gradle's project path, sbt's project id, the project file's
- // build-root-relative path for dotnet.
- id: string
- subprojectDir: string
- // The build files the tool reports for the project, e.g. a POM other than
- // `/pom.xml`, or a Gradle build file absent on disk.
- manifestFiles?: SocketFactsManifestReference[] | undefined
- // Indices into dependencies[]: this subproject's direct dependencies.
- children: number[]
-}
-
-// One dotnet build of a project: a target framework, and a runtime where
-// restore resolved one. `framework` is the NuGet short folder name, `alias` the
-// project's own name for it; ids are those of the facts file's components.
-export type ProjectFramework = {
- alias: string
- framework: string
- runtime?: string | undefined
- targetFrameworkMoniker?: string | undefined
- language?: string | undefined
- langVersion?: string | undefined
- nullable?: string | undefined
- assemblyName?: string | undefined
- frameworkReferences: string[]
- // As evaluated: the SDK's implicit framework symbols (NET8_0_OR_GREATER,
- // ...) are absent.
- defineConstants: string[]
- usings: Array<{ namespace: string; alias?: string; static?: true }>
- // In compiler order, as evaluated: sources that build targets generate
- // are absent.
- sources: string[]
- targets: string[]
- dependencies: string[]
- classpath: string[]
-}
-
-// A package's runtime assemblies in one target framework (and runtime); no
-// `targets` when restore's assemblies for it are missing.
-export type ComponentFramework = {
- framework: string
- runtime?: string | undefined
- targets?: string[] | undefined
- // What the project's sources compile against (often reference assemblies).
- compile?: string[] | undefined
-}
-
-// Resolved on-disk paths for a --with-files run, keyed by component or project
-// id (a project and its own component share one). `targets` = classpath
-// entries (jars / module output dirs), absent when the component's artifact
-// did not resolve; `sources` = module source roots.
-export type ResolvedArtifactPaths = {
- pathsById: Map
- // Component ids on each project's resolved classpath (union over its
- // configurations), keyed by project id. A component on no classpath, such as
- // a Maven 4 `none` dependency, is in the SBOM but not here.
- classpathByProject: Map
- // Component ids of each project's direct dependencies on its classpath, keyed
- // by project id.
- directDependenciesByProject: Map
- // dotnet only: the same per target framework.
- frameworksByProject?: Map | undefined
- frameworksById?: Map | undefined
-}
diff --git a/src/commands/manifest/scripts/maven-extension/.gitignore b/src/commands/manifest/scripts/maven-extension/.gitignore
deleted file mode 100644
index b8d44bdaca..0000000000
--- a/src/commands/manifest/scripts/maven-extension/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# Build artifacts — the jar is compiled from source (build-jar.sh), never committed.
-target/
-coana-maven-extension.jar
diff --git a/src/commands/manifest/scripts/maven-extension/.mvn/wrapper/maven-wrapper.properties b/src/commands/manifest/scripts/maven-extension/.mvn/wrapper/maven-wrapper.properties
deleted file mode 100644
index ffcab66aa2..0000000000
--- a/src/commands/manifest/scripts/maven-extension/.mvn/wrapper/maven-wrapper.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-wrapperVersion=3.3.4
-distributionType=only-script
-distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
diff --git a/src/commands/manifest/scripts/maven-extension/build-jar.sh b/src/commands/manifest/scripts/maven-extension/build-jar.sh
deleted file mode 100755
index eeaef2f672..0000000000
--- a/src/commands/manifest/scripts/maven-extension/build-jar.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env bash
-# Compile the Coana Maven core extension to a self-contained jar and place it at the path the TS
-# runner resolves: manifest-scripts/maven-extension/coana-maven-extension.jar. Run by the npm-package
-# build and the manifest-maven CI job. Uses the bundled Maven wrapper, so it needs only a JDK.
-set -euo pipefail
-
-here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-( cd "$here" && ./mvnw -q --batch-mode package )
-cp -f "$here/target/coana-maven-extension.jar" "$here/coana-maven-extension.jar"
-echo "Coana Maven extension jar: $here/coana-maven-extension.jar"
diff --git a/src/commands/manifest/scripts/maven-extension/mvnw b/src/commands/manifest/scripts/maven-extension/mvnw
deleted file mode 100755
index bd8896bf22..0000000000
--- a/src/commands/manifest/scripts/maven-extension/mvnw
+++ /dev/null
@@ -1,295 +0,0 @@
-#!/bin/sh
-# ----------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# ----------------------------------------------------------------------------
-
-# ----------------------------------------------------------------------------
-# Apache Maven Wrapper startup batch script, version 3.3.4
-#
-# Optional ENV vars
-# -----------------
-# JAVA_HOME - location of a JDK home dir, required when download maven via java source
-# MVNW_REPOURL - repo url base for downloading maven distribution
-# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
-# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
-# ----------------------------------------------------------------------------
-
-set -euf
-[ "${MVNW_VERBOSE-}" != debug ] || set -x
-
-# OS specific support.
-native_path() { printf %s\\n "$1"; }
-case "$(uname)" in
-CYGWIN* | MINGW*)
- [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
- native_path() { cygpath --path --windows "$1"; }
- ;;
-esac
-
-# set JAVACMD and JAVACCMD
-set_java_home() {
- # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
- if [ -n "${JAVA_HOME-}" ]; then
- if [ -x "$JAVA_HOME/jre/sh/java" ]; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- JAVACCMD="$JAVA_HOME/jre/sh/javac"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- JAVACCMD="$JAVA_HOME/bin/javac"
-
- if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
- echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
- echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
- return 1
- fi
- fi
- else
- JAVACMD="$(
- 'set' +e
- 'unset' -f command 2>/dev/null
- 'command' -v java
- )" || :
- JAVACCMD="$(
- 'set' +e
- 'unset' -f command 2>/dev/null
- 'command' -v javac
- )" || :
-
- if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
- echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
- return 1
- fi
- fi
-}
-
-# hash string like Java String::hashCode
-hash_string() {
- str="${1:-}" h=0
- while [ -n "$str" ]; do
- char="${str%"${str#?}"}"
- h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
- str="${str#?}"
- done
- printf %x\\n $h
-}
-
-verbose() { :; }
-[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
-
-die() {
- printf %s\\n "$1" >&2
- exit 1
-}
-
-trim() {
- # MWRAPPER-139:
- # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds.
- # Needed for removing poorly interpreted newline sequences when running in more
- # exotic environments such as mingw bash on Windows.
- printf "%s" "${1}" | tr -d '[:space:]'
-}
-
-scriptDir="$(dirname "$0")"
-scriptName="$(basename "$0")"
-
-# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
-while IFS="=" read -r key value; do
- case "${key-}" in
- distributionUrl) distributionUrl=$(trim "${value-}") ;;
- distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;;
- esac
-done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties"
-[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
-
-case "${distributionUrl##*/}" in
-maven-mvnd-*bin.*)
- MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
- case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
- *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
- :Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
- :Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
- :Linux*x86_64*) distributionPlatform=linux-amd64 ;;
- *)
- echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
- distributionPlatform=linux-amd64
- ;;
- esac
- distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
- ;;
-maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
-*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
-esac
-
-# apply MVNW_REPOURL and calculate MAVEN_HOME
-# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/
-[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
-distributionUrlName="${distributionUrl##*/}"
-distributionUrlNameMain="${distributionUrlName%.*}"
-distributionUrlNameMain="${distributionUrlNameMain%-bin}"
-MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}"
-MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
-
-exec_maven() {
- unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
- exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
-}
-
-if [ -d "$MAVEN_HOME" ]; then
- verbose "found existing MAVEN_HOME at $MAVEN_HOME"
- exec_maven "$@"
-fi
-
-case "${distributionUrl-}" in
-*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
-*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
-esac
-
-# prepare tmp dir
-if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
- clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
- trap clean HUP INT TERM EXIT
-else
- die "cannot create temp dir"
-fi
-
-mkdir -p -- "${MAVEN_HOME%/*}"
-
-# Download and Install Apache Maven
-verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
-verbose "Downloading from: $distributionUrl"
-verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
-
-# select .zip or .tar.gz
-if ! command -v unzip >/dev/null; then
- distributionUrl="${distributionUrl%.zip}.tar.gz"
- distributionUrlName="${distributionUrl##*/}"
-fi
-
-# verbose opt
-__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
-[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
-
-# normalize http auth
-case "${MVNW_PASSWORD:+has-password}" in
-'') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
-has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
-esac
-
-if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
- verbose "Found wget ... using wget"
- wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
-elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
- verbose "Found curl ... using curl"
- curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
-elif set_java_home; then
- verbose "Falling back to use Java to download"
- javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
- targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
- cat >"$javaSource" <<-END
- public class Downloader extends java.net.Authenticator
- {
- protected java.net.PasswordAuthentication getPasswordAuthentication()
- {
- return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
- }
- public static void main( String[] args ) throws Exception
- {
- setDefault( new Downloader() );
- java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
- }
- }
- END
- # For Cygwin/MinGW, switch paths to Windows format before running javac and java
- verbose " - Compiling Downloader.java ..."
- "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
- verbose " - Running Downloader.java ..."
- "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
-fi
-
-# If specified, validate the SHA-256 sum of the Maven distribution zip file
-if [ -n "${distributionSha256Sum-}" ]; then
- distributionSha256Result=false
- if [ "$MVN_CMD" = mvnd.sh ]; then
- echo "Checksum validation is not supported for maven-mvnd." >&2
- echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
- exit 1
- elif command -v sha256sum >/dev/null; then
- if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then
- distributionSha256Result=true
- fi
- elif command -v shasum >/dev/null; then
- if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
- distributionSha256Result=true
- fi
- else
- echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
- echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
- exit 1
- fi
- if [ $distributionSha256Result = false ]; then
- echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
- echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
- exit 1
- fi
-fi
-
-# unzip and move
-if command -v unzip >/dev/null; then
- unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
-else
- tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
-fi
-
-# Find the actual extracted directory name (handles snapshots where filename != directory name)
-actualDistributionDir=""
-
-# First try the expected directory name (for regular distributions)
-if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then
- if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then
- actualDistributionDir="$distributionUrlNameMain"
- fi
-fi
-
-# If not found, search for any directory with the Maven executable (for snapshots)
-if [ -z "$actualDistributionDir" ]; then
- # enable globbing to iterate over items
- set +f
- for dir in "$TMP_DOWNLOAD_DIR"/*; do
- if [ -d "$dir" ]; then
- if [ -f "$dir/bin/$MVN_CMD" ]; then
- actualDistributionDir="$(basename "$dir")"
- break
- fi
- fi
- done
- set -f
-fi
-
-if [ -z "$actualDistributionDir" ]; then
- verbose "Contents of $TMP_DOWNLOAD_DIR:"
- verbose "$(ls -la "$TMP_DOWNLOAD_DIR")"
- die "Could not find Maven distribution directory in extracted archive"
-fi
-
-verbose "Found extracted Maven distribution directory: $actualDistributionDir"
-printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url"
-mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
-
-clean || :
-exec_maven "$@"
diff --git a/src/commands/manifest/scripts/maven-extension/mvnw.cmd b/src/commands/manifest/scripts/maven-extension/mvnw.cmd
deleted file mode 100644
index 92450f9327..0000000000
--- a/src/commands/manifest/scripts/maven-extension/mvnw.cmd
+++ /dev/null
@@ -1,189 +0,0 @@
-<# : batch portion
-@REM ----------------------------------------------------------------------------
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM ----------------------------------------------------------------------------
-
-@REM ----------------------------------------------------------------------------
-@REM Apache Maven Wrapper startup batch script, version 3.3.4
-@REM
-@REM Optional ENV vars
-@REM MVNW_REPOURL - repo url base for downloading maven distribution
-@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
-@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output
-@REM ----------------------------------------------------------------------------
-
-@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0)
-@SET __MVNW_CMD__=
-@SET __MVNW_ERROR__=
-@SET __MVNW_PSMODULEP_SAVE=%PSModulePath%
-@SET PSModulePath=
-@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @(
- IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B)
-)
-@SET PSModulePath=%__MVNW_PSMODULEP_SAVE%
-@SET __MVNW_PSMODULEP_SAVE=
-@SET __MVNW_ARG0_NAME__=
-@SET MVNW_USERNAME=
-@SET MVNW_PASSWORD=
-@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*)
-@echo Cannot start maven from wrapper >&2 && exit /b 1
-@GOTO :EOF
-: end batch / begin powershell #>
-
-$ErrorActionPreference = "Stop"
-if ($env:MVNW_VERBOSE -eq "true") {
- $VerbosePreference = "Continue"
-}
-
-# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties
-$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl
-if (!$distributionUrl) {
- Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties"
-}
-
-switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) {
- "maven-mvnd-*" {
- $USE_MVND = $true
- $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip"
- $MVN_CMD = "mvnd.cmd"
- break
- }
- default {
- $USE_MVND = $false
- $MVN_CMD = $script -replace '^mvnw','mvn'
- break
- }
-}
-
-# apply MVNW_REPOURL and calculate MAVEN_HOME
-# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/
-if ($env:MVNW_REPOURL) {
- $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" }
- $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')"
-}
-$distributionUrlName = $distributionUrl -replace '^.*/',''
-$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$',''
-
-$MAVEN_M2_PATH = "$HOME/.m2"
-if ($env:MAVEN_USER_HOME) {
- $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME"
-}
-
-if (-not (Test-Path -Path $MAVEN_M2_PATH)) {
- New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null
-}
-
-$MAVEN_WRAPPER_DISTS = $null
-if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) {
- $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists"
-} else {
- $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists"
-}
-
-$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain"
-$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join ''
-$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME"
-
-if (Test-Path -Path "$MAVEN_HOME" -PathType Container) {
- Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME"
- Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
- exit $?
-}
-
-if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) {
- Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl"
-}
-
-# prepare tmp dir
-$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile
-$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir"
-$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null
-trap {
- if ($TMP_DOWNLOAD_DIR.Exists) {
- try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
- catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
- }
-}
-
-New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null
-
-# Download and Install Apache Maven
-Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
-Write-Verbose "Downloading from: $distributionUrl"
-Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
-
-$webclient = New-Object System.Net.WebClient
-if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) {
- $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD)
-}
-[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
-$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null
-
-# If specified, validate the SHA-256 sum of the Maven distribution zip file
-$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum
-if ($distributionSha256Sum) {
- if ($USE_MVND) {
- Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties."
- }
- Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash
- if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) {
- Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property."
- }
-}
-
-# unzip and move
-Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null
-
-# Find the actual extracted directory name (handles snapshots where filename != directory name)
-$actualDistributionDir = ""
-
-# First try the expected directory name (for regular distributions)
-$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain"
-$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD"
-if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) {
- $actualDistributionDir = $distributionUrlNameMain
-}
-
-# If not found, search for any directory with the Maven executable (for snapshots)
-if (!$actualDistributionDir) {
- Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object {
- $testPath = Join-Path $_.FullName "bin/$MVN_CMD"
- if (Test-Path -Path $testPath -PathType Leaf) {
- $actualDistributionDir = $_.Name
- }
- }
-}
-
-if (!$actualDistributionDir) {
- Write-Error "Could not find Maven distribution directory in extracted archive"
-}
-
-Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir"
-Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null
-try {
- Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null
-} catch {
- if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) {
- Write-Error "fail to move MAVEN_HOME"
- }
-} finally {
- try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null }
- catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" }
-}
-
-Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD"
diff --git a/src/commands/manifest/scripts/maven-extension/pom.xml b/src/commands/manifest/scripts/maven-extension/pom.xml
deleted file mode 100644
index 8a867a7d9e..0000000000
--- a/src/commands/manifest/scripts/maven-extension/pom.xml
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
- 4.0.0
-
- tech.coana
- coana-maven-extension
- 1.0
-
- jar
- Coana Maven extension
- Core extension that emits Coana's dependency-graph records (socket-facts) without a local-repo install.
-
-
- 8
- 8
- UTF-8
-
- 3.9.6
-
-
-
-
- coana-maven-extension
-
-
-
- org.eclipse.sisu
- sisu-maven-plugin
- 0.9.0.M3
-
-
- index-project
-
- main-index
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-shade-plugin
- 3.5.1
-
-
- package
-
- shade
-
-
- false
-
-
- META-INF/sisu/javax.inject.Named
-
-
-
-
-
-
-
-
-
-
-
-
- javax.inject
- javax.inject
- 1
- provided
-
-
-
-
- org.apache.maven
- maven-core
- ${maven.version}
- provided
-
-
- org.apache.maven
- maven-model
- ${maven.version}
- provided
-
-
- org.apache.maven
- maven-artifact
- ${maven.version}
- provided
-
-
-
- org.apache.maven.resolver
- maven-resolver-api
- 1.9.18
- provided
-
-
- org.slf4j
- slf4j-api
- 1.7.36
- provided
-
-
-
diff --git a/src/commands/manifest/scripts/maven-extension/src/main/java/tech/coana/ext/CoanaFactsEventSpy.java b/src/commands/manifest/scripts/maven-extension/src/main/java/tech/coana/ext/CoanaFactsEventSpy.java
deleted file mode 100644
index 089964c759..0000000000
--- a/src/commands/manifest/scripts/maven-extension/src/main/java/tech/coana/ext/CoanaFactsEventSpy.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package tech.coana.ext;
-
-import org.apache.maven.eventspy.AbstractEventSpy;
-import org.eclipse.aether.RepositoryEvent;
-import tech.coana.socket.CollectionObserver;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-/**
- * Relays repository events to the facts engine while it collects. Every Maven chains its event
- * spies into the session's repository listener, which an extension cannot replace: the session is
- * read-only since Maven 3.1 and immutable in Maven 4.
- */
-@Named("coana-facts-events")
-@Singleton
-public class CoanaFactsEventSpy extends AbstractEventSpy {
-
- // Static: the container may hand the dispatcher and the participant different instances.
- private static volatile CollectionObserver observer;
-
- static void observe(CollectionObserver o) {
- observer = o;
- }
-
- @Override
- public void onEvent(Object event) {
- CollectionObserver o = observer;
- if (o != null && event instanceof RepositoryEvent) o.onEvent((RepositoryEvent) event);
- }
-}
diff --git a/src/commands/manifest/scripts/maven-extension/src/main/java/tech/coana/ext/CoanaFactsLifecycleParticipant.java b/src/commands/manifest/scripts/maven-extension/src/main/java/tech/coana/ext/CoanaFactsLifecycleParticipant.java
deleted file mode 100644
index 5a20e5ac26..0000000000
--- a/src/commands/manifest/scripts/maven-extension/src/main/java/tech/coana/ext/CoanaFactsLifecycleParticipant.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package tech.coana.ext;
-
-import org.apache.maven.AbstractMavenLifecycleParticipant;
-import org.apache.maven.MavenExecutionException;
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.project.ProjectDependenciesResolver;
-import org.apache.maven.rtinfo.RuntimeInformation;
-import org.eclipse.aether.RepositorySystem;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import tech.coana.socket.CollectionObserver;
-import tech.coana.socket.SocketFactsRecordsEngine;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-import java.io.File;
-import java.io.IOException;
-import java.util.Properties;
-
-/**
- * Core extension loaded via {@code -Dmaven.ext.class.path}, gated by {@code -Dcoana.task=socket-facts}
- * (inert otherwise; no local-repo install, pom untouched). Runs at {@code afterSessionEnd} so
- * {@code -Dsocket.withFiles} sees compiled classes / generated sources.
- */
-@Named("coana-facts")
-@Singleton
-public class CoanaFactsLifecycleParticipant extends AbstractMavenLifecycleParticipant {
-
- private static final Logger LOG = LoggerFactory.getLogger("coana");
-
- private final ProjectDependenciesResolver dependenciesResolver;
- private final RepositorySystem repositorySystem;
- private final RuntimeInformation runtimeInformation;
-
- @Inject
- public CoanaFactsLifecycleParticipant(
- ProjectDependenciesResolver dependenciesResolver,
- RepositorySystem repositorySystem,
- RuntimeInformation runtimeInformation) {
- this.dependenciesResolver = dependenciesResolver;
- this.repositorySystem = repositorySystem;
- this.runtimeInformation = runtimeInformation;
- }
-
- @Override
- public void afterSessionEnd(MavenSession session) throws MavenExecutionException {
- if (!"socket-facts".equals(normalize(opt(session, "coana.task")))) {
- return;
- }
- String recordsFile = opt(session, "socket.recordsFile");
- if (recordsFile == null || recordsFile.isEmpty()) {
- throw new MavenExecutionException("socket-facts requires -Dsocket.recordsFile", new IllegalStateException());
- }
- SocketFactsRecordsEngine.Options opts = new SocketFactsRecordsEngine.Options();
- opts.recordsFile = recordsFile;
- opts.withFiles = optBoolean(session, "socket.withFiles");
- opts.populateFilesFor = opt(session, "socket.populateFilesFor");
- opts.includeConfigs = opt(session, "socket.includeConfigs");
- opts.excludeConfigs = opt(session, "socket.excludeConfigs");
- opts.excludePaths = opt(session, "socket.excludePaths");
- opts.excludeBase = opt(session, "socket.excludeBase");
- File rootDir = new File(session.getExecutionRootDirectory());
- CollectionObserver observer = new CollectionObserver();
- CoanaFactsEventSpy.observe(observer);
- try {
- new SocketFactsRecordsEngine(
- dependenciesResolver, repositorySystem, runtimeInformation.getMavenVersion(), observer, LOG)
- .run(session, session.getProjects(), rootDir, opts);
- } catch (IOException exception) {
- throw new MavenExecutionException("Cannot write socket facts records", exception);
- } finally {
- CoanaFactsEventSpy.observe(null);
- }
- }
-
- // Accept the cross-tool camelCase alias used by the CLI / Gradle / SBT scripts.
- private static String normalize(String task) {
- return "socketFacts".equals(task) ? "socket-facts" : task;
- }
-
- // -D values arrive as both session user-properties and JVM system properties; prefer the former.
- private static String opt(MavenSession session, String key) {
- Properties user = session.getUserProperties();
- if (user != null && user.getProperty(key) != null) return user.getProperty(key);
- return System.getProperty(key);
- }
-
- private static boolean optBoolean(MavenSession session, String key) {
- return Boolean.parseBoolean(opt(session, key));
- }
-}
diff --git a/src/commands/manifest/scripts/maven-extension/src/main/java/tech/coana/ext/CoanaWorkspacesLifecycleParticipant.java b/src/commands/manifest/scripts/maven-extension/src/main/java/tech/coana/ext/CoanaWorkspacesLifecycleParticipant.java
deleted file mode 100644
index 3001b546e7..0000000000
--- a/src/commands/manifest/scripts/maven-extension/src/main/java/tech/coana/ext/CoanaWorkspacesLifecycleParticipant.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package tech.coana.ext;
-
-import org.apache.maven.AbstractMavenLifecycleParticipant;
-import org.apache.maven.MavenExecutionException;
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.rtinfo.RuntimeInformation;
-import tech.coana.socket.SocketWorkspacesRecordsEngine;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.inject.Singleton;
-import java.io.File;
-import java.io.IOException;
-import java.util.Properties;
-
-/**
- * Sibling of {@link CoanaFactsLifecycleParticipant}, gated by {@code -Dcoana.task=socket-workspaces}.
- * Hooks {@code afterProjectsRead} (fires once the reactor project list is known, before any
- * lifecycle phase runs) since it only needs that list, never a dependency graph.
- */
-@Named("coana-workspaces")
-@Singleton
-public class CoanaWorkspacesLifecycleParticipant extends AbstractMavenLifecycleParticipant {
-
- private final RuntimeInformation runtimeInformation;
-
- @Inject
- public CoanaWorkspacesLifecycleParticipant(RuntimeInformation runtimeInformation) {
- this.runtimeInformation = runtimeInformation;
- }
-
- @Override
- public void afterProjectsRead(MavenSession session) throws MavenExecutionException {
- if (!"socket-workspaces".equals(opt(session, "coana.task"))) {
- return;
- }
- String recordsFile = opt(session, "socket.recordsFile");
- if (recordsFile == null || recordsFile.isEmpty()) {
- throw new MavenExecutionException("socket-workspaces requires -Dsocket.recordsFile", new IllegalStateException());
- }
- SocketWorkspacesRecordsEngine.Options opts = new SocketWorkspacesRecordsEngine.Options();
- opts.recordsFile = recordsFile;
- opts.excludePaths = opt(session, "socket.excludePaths");
- opts.excludeBase = opt(session, "socket.excludeBase");
- File rootDir = new File(session.getExecutionRootDirectory());
- try {
- SocketWorkspacesRecordsEngine.run(session.getProjects(), rootDir, opts, runtimeInformation.getMavenVersion());
- } catch (IOException exception) {
- throw new MavenExecutionException("Cannot write socket workspace records", exception);
- }
- }
-
- // -D values arrive as both session user-properties and JVM system properties; prefer the former.
- private static String opt(MavenSession session, String key) {
- Properties user = session.getUserProperties();
- if (user != null && user.getProperty(key) != null) return user.getProperty(key);
- return System.getProperty(key);
- }
-}
diff --git a/src/commands/manifest/scripts/maven-extension/src/main/java/tech/coana/socket/CollectionObserver.java b/src/commands/manifest/scripts/maven-extension/src/main/java/tech/coana/socket/CollectionObserver.java
deleted file mode 100644
index f56dcd067d..0000000000
--- a/src/commands/manifest/scripts/maven-extension/src/main/java/tech/coana/socket/CollectionObserver.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package tech.coana.socket;
-
-import org.eclipse.aether.RepositoryEvent;
-import org.eclipse.aether.RequestTrace;
-import org.eclipse.aether.collection.CollectStepData;
-import org.eclipse.aether.graph.Dependency;
-import org.eclipse.aether.graph.DependencyNode;
-
-import java.util.HashSet;
-import java.util.IdentityHashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * What the repository events of dependency collection reveal beyond its result: the POMs Maven's
- * default {@code ArtifactDescriptorPolicy} tolerated as missing or invalid (the node stays, its
- * dependencies are lost, and no collection error is raised), build-wide, and the graph position of
- * each collect step of the current module.
- */
-public final class CollectionObserver {
-
- // CollectStepData is maven-resolver 1.8.1+ (Maven 3.9+); older resolvers trace no collect step.
- private static final boolean COLLECT_STEPS = classExists("org.eclipse.aether.collection.CollectStepData");
-
- // The resolver caches a tolerated POM build-wide, so only the first module to reach one sees its
- // event; that module's detail is kept.
- private final Map incompleteDescriptors = new LinkedHashMap<>();
- private final Set incompleteInModule = new HashSet<>();
- private final Map