diff --git a/README.md b/README.md index 831591c0..0abd9abd 100644 --- a/README.md +++ b/README.md @@ -20,5 +20,3 @@ This project has adopted the code of conduct defined by the [Contributor Covenan ## License .NET Core (including this repo) is licensed under the MIT license. -# MSBuildBinLogQuery -Work in progress diff --git a/lab.sln b/lab.sln index cfe40288..15cbb73c 100644 --- a/lab.sln +++ b/lab.sln @@ -7,10 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-core-uninstall", "sr EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-core-uninstall.Tests", "test\dotnet-core-uninstall.Tests\dotnet-core-uninstall.Tests.csproj", "{5F533EB4-7C04-4243-914F-7C9092F6FB8F}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MSBuildBinLogQuery", "src\MSBuildBinLogQuery\MSBuildBinLogQuery.csproj", "{A7FF737E-4ADE-4B5A-BA1C-3F4B7129590F}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MSBuildBinLogQuery.Tests", "test\MSBuildBinLogQuery.Tests\MSBuildBinLogQuery.Tests.csproj", "{9664B2B1-3B5D-4F99-A0D5-B38BF3E96672}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "redist", "src\redist\redist.csproj", "{9D9C4522-1992-4820-9248-9630C38FC25E}" EndProject Global @@ -57,38 +53,6 @@ Global {5F533EB4-7C04-4243-914F-7C9092F6FB8F}.Release|x64.Build.0 = Release|Any CPU {5F533EB4-7C04-4243-914F-7C9092F6FB8F}.Release|x86.ActiveCfg = Release|Any CPU {5F533EB4-7C04-4243-914F-7C9092F6FB8F}.Release|x86.Build.0 = Release|Any CPU - {A7FF737E-4ADE-4B5A-BA1C-3F4B7129590F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A7FF737E-4ADE-4B5A-BA1C-3F4B7129590F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A7FF737E-4ADE-4B5A-BA1C-3F4B7129590F}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {A7FF737E-4ADE-4B5A-BA1C-3F4B7129590F}.Debug|ARM64.Build.0 = Debug|Any CPU - {A7FF737E-4ADE-4B5A-BA1C-3F4B7129590F}.Debug|x64.ActiveCfg = Debug|Any CPU - {A7FF737E-4ADE-4B5A-BA1C-3F4B7129590F}.Debug|x64.Build.0 = Debug|Any CPU - {A7FF737E-4ADE-4B5A-BA1C-3F4B7129590F}.Debug|x86.ActiveCfg = Debug|Any CPU - {A7FF737E-4ADE-4B5A-BA1C-3F4B7129590F}.Debug|x86.Build.0 = Debug|Any CPU - {A7FF737E-4ADE-4B5A-BA1C-3F4B7129590F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A7FF737E-4ADE-4B5A-BA1C-3F4B7129590F}.Release|Any CPU.Build.0 = Release|Any CPU - {A7FF737E-4ADE-4B5A-BA1C-3F4B7129590F}.Release|ARM64.ActiveCfg = Release|Any CPU - {A7FF737E-4ADE-4B5A-BA1C-3F4B7129590F}.Release|ARM64.Build.0 = Release|Any CPU - {A7FF737E-4ADE-4B5A-BA1C-3F4B7129590F}.Release|x64.ActiveCfg = Release|Any CPU - {A7FF737E-4ADE-4B5A-BA1C-3F4B7129590F}.Release|x64.Build.0 = Release|Any CPU - {A7FF737E-4ADE-4B5A-BA1C-3F4B7129590F}.Release|x86.ActiveCfg = Release|Any CPU - {A7FF737E-4ADE-4B5A-BA1C-3F4B7129590F}.Release|x86.Build.0 = Release|Any CPU - {9664B2B1-3B5D-4F99-A0D5-B38BF3E96672}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9664B2B1-3B5D-4F99-A0D5-B38BF3E96672}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9664B2B1-3B5D-4F99-A0D5-B38BF3E96672}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {9664B2B1-3B5D-4F99-A0D5-B38BF3E96672}.Debug|ARM64.Build.0 = Debug|Any CPU - {9664B2B1-3B5D-4F99-A0D5-B38BF3E96672}.Debug|x64.ActiveCfg = Debug|Any CPU - {9664B2B1-3B5D-4F99-A0D5-B38BF3E96672}.Debug|x64.Build.0 = Debug|Any CPU - {9664B2B1-3B5D-4F99-A0D5-B38BF3E96672}.Debug|x86.ActiveCfg = Debug|Any CPU - {9664B2B1-3B5D-4F99-A0D5-B38BF3E96672}.Debug|x86.Build.0 = Debug|Any CPU - {9664B2B1-3B5D-4F99-A0D5-B38BF3E96672}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9664B2B1-3B5D-4F99-A0D5-B38BF3E96672}.Release|Any CPU.Build.0 = Release|Any CPU - {9664B2B1-3B5D-4F99-A0D5-B38BF3E96672}.Release|ARM64.ActiveCfg = Release|Any CPU - {9664B2B1-3B5D-4F99-A0D5-B38BF3E96672}.Release|ARM64.Build.0 = Release|Any CPU - {9664B2B1-3B5D-4F99-A0D5-B38BF3E96672}.Release|x64.ActiveCfg = Release|Any CPU - {9664B2B1-3B5D-4F99-A0D5-B38BF3E96672}.Release|x64.Build.0 = Release|Any CPU - {9664B2B1-3B5D-4F99-A0D5-B38BF3E96672}.Release|x86.ActiveCfg = Release|Any CPU - {9664B2B1-3B5D-4F99-A0D5-B38BF3E96672}.Release|x86.Build.0 = Release|Any CPU {9D9C4522-1992-4820-9248-9630C38FC25E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9D9C4522-1992-4820-9248-9630C38FC25E}.Debug|Any CPU.Build.0 = Debug|Any CPU {9D9C4522-1992-4820-9248-9630C38FC25E}.Debug|ARM64.ActiveCfg = Debug|Any CPU diff --git a/src/MSBuildBinLogQuery/Ast/AstNodeWithConstraints.cs b/src/MSBuildBinLogQuery/Ast/AstNodeWithConstraints.cs deleted file mode 100644 index 9087d425..00000000 --- a/src/MSBuildBinLogQuery/Ast/AstNodeWithConstraints.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.Build.Logging.Query.Result; - -namespace Microsoft.Build.Logging.Query.Ast -{ - public abstract class AstNodeWithConstraints : - IAstNode - where TThis : class, IQueryResult - where TBefore : class, IQueryResult - { - public IReadOnlyList> Constraints => _constraints; - - private readonly List> _constraints; - - public AstNodeWithConstraints(List> constraints = null) : base() - { - _constraints = constraints ?? new List>(); - } - - protected bool Equals(AstNodeWithConstraints other) - { - return other != null && - Constraints.SequenceEqual(other.Constraints); -; } - - protected int GetConstraintHashCode() - { - var hashCode = new HashCode(); - - foreach (var constraint in Constraints) - { - hashCode.Add(constraint); - } - - return hashCode.ToHashCode(); - } - - protected IEnumerable FilterByConstraints(IEnumerable components) - { - foreach (var constraint in Constraints) - { - components = constraint.Filter(components); - } - - return components; - } - - public abstract IEnumerable Filter(IEnumerable components); - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Ast/ComponentNode.cs b/src/MSBuildBinLogQuery/Ast/ComponentNode.cs deleted file mode 100644 index 70a5dd3b..00000000 --- a/src/MSBuildBinLogQuery/Ast/ComponentNode.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.Build.Logging.Query.Result; - -namespace Microsoft.Build.Logging.Query.Ast -{ - public abstract class ComponentNode : AstNodeWithConstraints - where TThis : Component - where TBefore : Component - { - public IAstNode Next { get; } - - public ComponentNode(IAstNode next, List> constraints = null) : - base(constraints) - { - Next = next; - } - - protected bool Equals(ComponentNode other) - { - return base.Equals(other) && - EqualityComparer>.Default.Equals(Next, other.Next); -; } - - public override int GetHashCode() - { - return HashCode.Combine(GetConstraintHashCode(), Next); - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Ast/ConstraintNode.cs b/src/MSBuildBinLogQuery/Ast/ConstraintNode.cs deleted file mode 100644 index 9631db3b..00000000 --- a/src/MSBuildBinLogQuery/Ast/ConstraintNode.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.Build.Logging.Query.Result; - -namespace Microsoft.Build.Logging.Query.Ast -{ - public abstract class ConstraintNode : IAstNode, IFilterable - where TParent : class, IQueryResult - { - public ConstraintNode() : base() - { - } - - public abstract IEnumerable Filter(IEnumerable components); - } - - public abstract class ConstraintNode : ConstraintNode - where TParent : class, IQueryResult - { - public TValue Value { get; } - - public ConstraintNode(TValue value) : base() - { - Value = value; - } - - protected bool Equals(ConstraintNode other) - { - return other != null && - EqualityComparer.Default.Equals(Value, other.Value); - } - - public override int GetHashCode() - { - return HashCode.Combine(Value); - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Ast/ErrorNode.cs b/src/MSBuildBinLogQuery/Ast/ErrorNode.cs deleted file mode 100644 index 0b4d972f..00000000 --- a/src/MSBuildBinLogQuery/Ast/ErrorNode.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; -using Microsoft.Build.Logging.Query.Result; - -namespace Microsoft.Build.Logging.Query.Ast -{ - public sealed class ErrorNode : LogNode, IEquatable - { - public ErrorNode(LogNodeType type) : base(type) - { - } - - public override bool Equals(object obj) - { - return Equals(obj as ErrorNode); - } - - public bool Equals([AllowNull] ErrorNode other) - { - return base.Equals(other); - } - - public override int GetHashCode() - { - return base.GetHashCode(); - } - - public override IEnumerable Filter(IEnumerable components) - { - return FilterErrors(components); - } - - public override IEnumerable Filter(IEnumerable components) - { - return FilterErrors(components); - } - - public override IEnumerable Filter(IEnumerable components) - { - return FilterErrors(components); - } - - public override IEnumerable Filter(IEnumerable components) - { - return FilterErrors(components); - } - - public override IEnumerable Filter(IEnumerable components) - { - return FilterErrors(components); - } - - private IEnumerable FilterErrors(IEnumerable components) - { - return Type switch - { - LogNodeType.All => components.SelectMany(component => component.AllErrors), - LogNodeType.Direct => components.SelectMany(Component => Component.Errors), - _ => throw new ArgumentOutOfRangeException(), - }; - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Ast/IAstNode.cs b/src/MSBuildBinLogQuery/Ast/IAstNode.cs deleted file mode 100644 index 0dc4008b..00000000 --- a/src/MSBuildBinLogQuery/Ast/IAstNode.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Microsoft.Build.Logging.Query.Result; - -namespace Microsoft.Build.Logging.Query.Ast -{ - public interface IAstNode - { - } - - public interface IAstNode : IAstNode, IFilterable - where TBefore : class, IQueryResult - { - } - - public interface IAstNode : IAstNode - where TThis : class, IQueryResult - where TBefore : class, IQueryResult - { - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Ast/IFilterable.cs b/src/MSBuildBinLogQuery/Ast/IFilterable.cs deleted file mode 100644 index 992184c4..00000000 --- a/src/MSBuildBinLogQuery/Ast/IFilterable.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Collections.Generic; -using Microsoft.Build.Logging.Query.Result; - -namespace Microsoft.Build.Logging.Query.Ast -{ - public interface IFilterable - where TIn : IQueryResult - where TOut : IQueryResult - { - IEnumerable Filter(IEnumerable components); - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Ast/IdNode.cs b/src/MSBuildBinLogQuery/Ast/IdNode.cs deleted file mode 100644 index 565f669e..00000000 --- a/src/MSBuildBinLogQuery/Ast/IdNode.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; -using Microsoft.Build.Logging.Query.Result; - -namespace Microsoft.Build.Logging.Query.Ast -{ - public sealed class IdNode : ConstraintNode, IEquatable> - where TParent : class, IQueryResult, IResultWithId - { - public IdNode(int value) : base(value) - { - } - - public override bool Equals(object obj) - { - return Equals(obj as IdNode); - } - - public bool Equals([AllowNull] IdNode other) - { - return base.Equals(other); - } - - public override int GetHashCode() - { - return base.GetHashCode(); - } - - public override IEnumerable Filter(IEnumerable components) - { - return components - .Where(component => component.Id == Value); - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Ast/LogNode.cs b/src/MSBuildBinLogQuery/Ast/LogNode.cs deleted file mode 100644 index bf273dc6..00000000 --- a/src/MSBuildBinLogQuery/Ast/LogNode.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using Microsoft.Build.Logging.Query.Result; - -namespace Microsoft.Build.Logging.Query.Ast -{ - public abstract class LogNode : - IAstNode, - IAstNode, - IAstNode, - IAstNode - { - public LogNode() - { - } - - public abstract IEnumerable Filter(IEnumerable components); - public abstract IEnumerable Filter(IEnumerable components); - public abstract IEnumerable Filter(IEnumerable components); - public abstract IEnumerable Filter(IEnumerable components); - } - - public abstract class LogNode : LogNode, IAstNode where TThis : Log - { - public LogNodeType Type { get; } - - public LogNode(LogNodeType type) : base() - { - Type = type; - } - - protected bool Equals(LogNode other) - { - return other != null && - Type == other.Type; - } - - public override int GetHashCode() - { - return HashCode.Combine(Type); - } - - public abstract IEnumerable Filter(IEnumerable components); - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Ast/LogNodeType.cs b/src/MSBuildBinLogQuery/Ast/LogNodeType.cs deleted file mode 100644 index e4368ead..00000000 --- a/src/MSBuildBinLogQuery/Ast/LogNodeType.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Ast -{ - public enum LogNodeType - { - Direct, - All - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Ast/MessageNode.cs b/src/MSBuildBinLogQuery/Ast/MessageNode.cs deleted file mode 100644 index a0928b5d..00000000 --- a/src/MSBuildBinLogQuery/Ast/MessageNode.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; -using Microsoft.Build.Logging.Query.Result; - -namespace Microsoft.Build.Logging.Query.Ast -{ - public sealed class MessageNode : LogNode, IEquatable - { - public MessageNode(LogNodeType type) : base(type) - { - } - - public override bool Equals(object obj) - { - return Equals(obj as MessageNode); - } - - public bool Equals([AllowNull] MessageNode other) - { - return base.Equals(other); - } - - public override int GetHashCode() - { - return base.GetHashCode(); - } - - public override IEnumerable Filter(IEnumerable components) - { - return FilterMessages(components); - } - - public override IEnumerable Filter(IEnumerable components) - { - return FilterMessages(components); - } - - public override IEnumerable Filter(IEnumerable components) - { - return FilterMessages(components); - } - - public override IEnumerable Filter(IEnumerable components) - { - return FilterMessages(components); - } - - public override IEnumerable Filter(IEnumerable components) - { - return FilterMessages(components); - } - - private IEnumerable FilterMessages(IEnumerable components) - { - return Type switch - { - LogNodeType.All => components.SelectMany(component => component.AllMessages), - LogNodeType.Direct => components.SelectMany(Component => Component.Messages), - _ => throw new ArgumentOutOfRangeException(), - }; - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Ast/NameNode.cs b/src/MSBuildBinLogQuery/Ast/NameNode.cs deleted file mode 100644 index 11431768..00000000 --- a/src/MSBuildBinLogQuery/Ast/NameNode.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; -using Microsoft.Build.Logging.Query.Result; - -namespace Microsoft.Build.Logging.Query.Ast -{ - public sealed class NameNode : ConstraintNode, IEquatable> - where TParent : class, IQueryResult, IResultWithName - { - public NameNode(string value) : base(value) - { - } - - public override bool Equals(object obj) - { - return Equals(obj as NameNode); - } - - public bool Equals([AllowNull] NameNode other) - { - return base.Equals(other); - } - - public override int GetHashCode() - { - return base.GetHashCode(); - } - - public override IEnumerable Filter(IEnumerable components) - { - return components - .Where(component => component.Name == Value); - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Ast/PathNode.cs b/src/MSBuildBinLogQuery/Ast/PathNode.cs deleted file mode 100644 index d3169ebf..00000000 --- a/src/MSBuildBinLogQuery/Ast/PathNode.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; -using Microsoft.Build.Logging.Query.Result; - -namespace Microsoft.Build.Logging.Query.Ast -{ - public sealed class PathNode : ConstraintNode, IEquatable> - where TParent : class, IQueryResult, IResultWithPath - { - public PathNode(string value) : base(value) - { - } - - public override bool Equals(object obj) - { - return Equals(obj as PathNode); - } - - public bool Equals([AllowNull] PathNode other) - { - return base.Equals(other); - } - - public override int GetHashCode() - { - return base.GetHashCode(); - } - - public override IEnumerable Filter(IEnumerable components) - { - return components - .Where(component => component.Path == Value); - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Ast/ProjectNode.cs b/src/MSBuildBinLogQuery/Ast/ProjectNode.cs deleted file mode 100644 index a28ed5de..00000000 --- a/src/MSBuildBinLogQuery/Ast/ProjectNode.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; -using Microsoft.Build.Logging.Query.Result; - -namespace Microsoft.Build.Logging.Query.Ast -{ - public sealed class ProjectNode : - ComponentNode, - IEquatable - { - public ProjectNode(List> constraints = null) : base(null, constraints) - { - } - - public ProjectNode(IAstNode next, List> constraints = null) : - base(next ?? throw new ArgumentNullException(), constraints) - { - } - - public override bool Equals(object obj) - { - return Equals(obj as ProjectNode); - } - - public bool Equals([AllowNull] ProjectNode other) - { - return base.Equals(other); - } - - public override int GetHashCode() - { - return base.GetHashCode(); - } - - public override IEnumerable Filter(IEnumerable components) - { - var projects = components - .SelectMany(build => build.ProjectsById.Values); - - var filteredProjects = FilterByConstraints(projects); - - return Next?.Filter(filteredProjects) ?? filteredProjects; - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Ast/TargetNode.cs b/src/MSBuildBinLogQuery/Ast/TargetNode.cs deleted file mode 100644 index 326fb605..00000000 --- a/src/MSBuildBinLogQuery/Ast/TargetNode.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; -using Microsoft.Build.Logging.Query.Result; - -namespace Microsoft.Build.Logging.Query.Ast -{ - public sealed class TargetNode : ComponentNode, IEquatable - { - public TargetNode(List> constraints = null) : base(null, constraints) - { - } - - public TargetNode(IAstNode next, List> constraints = null) : - base(next ?? throw new ArgumentNullException(), constraints) - { - } - - public override bool Equals(object obj) - { - return Equals(obj as TargetNode); - } - - public bool Equals([AllowNull] TargetNode other) - { - return base.Equals(other); - } - - public override int GetHashCode() - { - return base.GetHashCode(); - } - - public override IEnumerable Filter(IEnumerable components) - { - var targets = components - .SelectMany(project => project.OrderedTargets); - - var filteredTargets = FilterByConstraints(targets); - - return Next?.Filter(filteredTargets) ?? filteredTargets; - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Ast/TaskNode.cs b/src/MSBuildBinLogQuery/Ast/TaskNode.cs deleted file mode 100644 index 5eaaa104..00000000 --- a/src/MSBuildBinLogQuery/Ast/TaskNode.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; -using Microsoft.Build.Logging.Query.Result; - -namespace Microsoft.Build.Logging.Query.Ast -{ - public sealed class TaskNode : ComponentNode, IEquatable - { - public TaskNode(List> constraints = null) : base(null, constraints) - { - } - - public TaskNode(IAstNode next, List> constraints = null) : - base(next ?? throw new ArgumentNullException(), constraints) - { - } - - public override bool Equals(object obj) - { - return Equals(obj as TaskNode); - } - - public bool Equals([AllowNull] TaskNode other) - { - return base.Equals(other); - } - - public override int GetHashCode() - { - return base.GetHashCode(); - } - - public override IEnumerable Filter(IEnumerable components) - { - var tasks = components - .SelectMany(target => target.OrderedTasks); - - var filteredTasks = FilterByConstraints(tasks); - - return Next?.Filter(filteredTasks) ?? filteredTasks; - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Ast/WarningNode.cs b/src/MSBuildBinLogQuery/Ast/WarningNode.cs deleted file mode 100644 index 1388812c..00000000 --- a/src/MSBuildBinLogQuery/Ast/WarningNode.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; -using Microsoft.Build.Logging.Query.Result; - -namespace Microsoft.Build.Logging.Query.Ast -{ - public sealed class WarningNode : LogNode, IEquatable - { - public WarningNode(LogNodeType type) : base(type) - { - } - - public override bool Equals(object obj) - { - return Equals(obj as WarningNode); - } - - public bool Equals([AllowNull] WarningNode other) - { - return base.Equals(other); - } - - public override int GetHashCode() - { - return base.GetHashCode(); - } - - public override IEnumerable Filter(IEnumerable components) - { - return FilterWarnings(components); - } - - public override IEnumerable Filter(IEnumerable components) - { - return FilterWarnings(components); - } - - public override IEnumerable Filter(IEnumerable components) - { - return FilterWarnings(components); - } - - public override IEnumerable Filter(IEnumerable components) - { - return FilterWarnings(components); - } - - public override IEnumerable Filter(IEnumerable components) - { - return FilterWarnings(components); - } - - private IEnumerable FilterWarnings(IEnumerable components) - { - return Type switch - { - LogNodeType.All => components.SelectMany(component => component.AllWarnings), - LogNodeType.Direct => components.SelectMany(Component => Component.Warnings), - _ => throw new ArgumentOutOfRangeException(), - }; - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Construction/BinaryLogReader.cs b/src/MSBuildBinLogQuery/Construction/BinaryLogReader.cs deleted file mode 100644 index e61d602b..00000000 --- a/src/MSBuildBinLogQuery/Construction/BinaryLogReader.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.IO.Compression; -using Microsoft.Build.Framework; - -namespace Microsoft.Build.Logging.Query.Construction -{ - public class BinaryLogReader : IDisposable - { - private readonly FileStream _fileStream; - private readonly GZipStream _gZipStream; - private readonly BinaryReader _binaryReader; - private readonly int _fileFormatVersion; - private IEnumerable _buildEvents; - - public BinaryLogReader(string path) - { - _fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read); - _gZipStream = new GZipStream(_fileStream, CompressionMode.Decompress, leaveOpen: true); - _binaryReader = new BinaryReader(_gZipStream); - _fileFormatVersion = _binaryReader.ReadInt32(); - } - - public void Dispose() - { - _fileStream.Dispose(); - _gZipStream.Dispose(); - _binaryReader.Dispose(); - } - - public IEnumerable ReadEvents() - { - if (_buildEvents != null) - { - return _buildEvents; - } - - var buildEventArgsReader = new BuildEventArgsReader(_binaryReader, _fileFormatVersion); - var buildEvents = new List(); - - while (true) - { - var buildEventArgs = buildEventArgsReader.Read(); - - if (buildEventArgs == null) - { - break; - } - - buildEvents.Add(buildEventArgs); - } - - _buildEvents = buildEvents; - return _buildEvents; - } - } -} diff --git a/src/MSBuildBinLogQuery/Construction/GraphBuilder.cs b/src/MSBuildBinLogQuery/Construction/GraphBuilder.cs deleted file mode 100644 index 1ad60658..00000000 --- a/src/MSBuildBinLogQuery/Construction/GraphBuilder.cs +++ /dev/null @@ -1,257 +0,0 @@ -using System.Linq; -using System.Collections.Generic; -using Microsoft.Build.Framework; -using Microsoft.Build.Logging.Query.Result; - -namespace Microsoft.Build.Logging.Query.Construction -{ - public class GraphBuilder - { - private readonly EventArgsDispatcher _eventArgsDispatcher; - private readonly List _projectArgs; - private readonly Dictionary> _targetArgs; - private readonly Dictionary<(int projectId, int targetId), List> _taskArgs; - private readonly Dictionary> _targetsByName; - private readonly List _messageArgs; - private readonly List _warningArgs; - private readonly List _errorArgs; - - public GraphBuilder() - { - _eventArgsDispatcher = new EventArgsDispatcher(); - _projectArgs = new List(); - _targetArgs = new Dictionary>(); - _targetsByName = new Dictionary>(); - _taskArgs = new Dictionary<(int projectId, int targetId), List>(); - _messageArgs = new List(); - _warningArgs = new List(); - _errorArgs = new List(); - - _eventArgsDispatcher.ProjectStarted += ProjectStarted; - _eventArgsDispatcher.TargetStarted += TargetStarted; - _eventArgsDispatcher.TaskStarted += TaskStarted; - _eventArgsDispatcher.MessageRaised += MessageRaised; - _eventArgsDispatcher.WarningRaised += WarningRaised; - _eventArgsDispatcher.ErrorRaised += ErrorRaised; - } - - public Result.Build HandleEvents(params BuildEventArgs[] buildEvents) - { - foreach (var buildEvent in buildEvents) - { - _eventArgsDispatcher.Dispatch(buildEvent); - } - - var build = new Result.Build(); - - AddProjects(build); - AddLogs(build); - - return build; - } - - private void ProjectStarted(object sender, ProjectStartedEventArgs args) - { - var id = args.BuildEventContext.ProjectInstanceId; - - _projectArgs.Add(args); - - if (!_targetArgs.ContainsKey(id)) - { - _targetArgs[id] = new List(); - } - - if (!_targetsByName.ContainsKey(id)) - { - _targetsByName[id] = new Dictionary(); - } - } - - private void TargetStarted(object sender, TargetStartedEventArgs args) - { - var id = args.BuildEventContext.TargetId; - var projectId = args.BuildEventContext.ProjectInstanceId; - - _targetArgs[projectId].Add(args); - _taskArgs[(projectId, targetId: id)] = new List(); - } - - private void TaskStarted(object sender, TaskStartedEventArgs args) - { - var projectId = args.BuildEventContext.ProjectInstanceId; - var targetId = args.BuildEventContext.TargetId; - - _taskArgs[(projectId, targetId)].Add(args); - } - - private void MessageRaised(object sender, BuildMessageEventArgs args) - { - _messageArgs.Add(args); - } - - private void WarningRaised(object sender, BuildWarningEventArgs args) - { - _warningArgs.Add(args); - } - - private void ErrorRaised(object sender, BuildErrorEventArgs args) - { - _errorArgs.Add(args); - } - - private void AddProjects(Result.Build build) - { - var projectArgsById = new Dictionary(); - - foreach (var args in _projectArgs) - { - var id = args.BuildEventContext.ProjectInstanceId; - var targetsByName = _targetsByName[id]; - - projectArgsById[id] = args; - - var project = build.AddProject( - id, - args.ProjectFile, - args.Items, - args.Properties, - args.GlobalProperties); - - var entryPointTargetNames = args.TargetNames - .Split(';') - .Where(name => !string.IsNullOrWhiteSpace(name.Trim())) - .ToHashSet(); - - AddTargets(project, id, entryPointTargetNames); - } - - foreach (var pair in build.ProjectsById) - { - var id = pair.Key; - var project = pair.Value; - var args = projectArgsById[id]; - var parentId = args.ParentProjectBuildEventContext.ProjectInstanceId; - - if (build.ProjectsById.TryGetValue(parentId, out var parent)) - { - parent.Node_BeforeThis.AdjacentNodes.Add(project.Node_BeforeThis); - } - } - } - - private void AddTargets(Project project, int projectId, HashSet entryPointTargetNames) - { - var targetArgs = _targetArgs[projectId]; - var targetArgsById = new Dictionary(); - - foreach (var args in targetArgs) - { - var targetId = args.BuildEventContext.TargetId; - var name = args.TargetName; - - var target = project.AddTarget(targetId, name, entryPointTargetNames.Contains(name)); - - targetArgsById[targetId] = args; - - AddTasks(target, projectId, targetId); - } - - foreach (var pair in project.TargetsById) - { - var id = pair.Key; - var target = pair.Value; - var args = targetArgsById[id]; - - if (!string.IsNullOrWhiteSpace(args.ParentTarget)) - { - var parent = - project.TargetsByName.ContainsKey(args.ParentTarget) ? - project.TargetsByName[args.ParentTarget] : - project.AddTarget(BuildEventContext.InvalidTargetId, args.ParentTarget, entryPointTargetNames.Contains(args.ParentTarget)); - - if (args.BuildReason == TargetBuiltReason.DependsOn) - { - target.Node_BeforeThis.AdjacentNodes.Add(parent.Node_BeforeThis); - } - else if (args.BuildReason == TargetBuiltReason.BeforeTargets) - { - parent.Node_BeforeThis.AdjacentNodes.Add(target.Node_BeforeThis); - } - else if (args.BuildReason == TargetBuiltReason.AfterTargets) - { - // TODO: args.ParentTarget is empty when args.BuildReason is AfterTargets - parent.Node_AfterThis.AdjacentNodes.Add(target.Node_AfterThis); - } - } - } - } - - private void AddTasks(Target target, int projectId, int targetId) - { - var taskArgs = _taskArgs[(projectId, targetId)]; - - foreach (var args in taskArgs) - { - var taskId = args.BuildEventContext.TaskId; - target.AddTask(taskId, args.TaskName, args.TaskFile); - } - } - - private void AddLogs(Result.Build build) - { - foreach (var args in _messageArgs) - { - var parent = GetParentComponent(args, build); - var message = new Message(args.Message, parent, args.Importance); - parent.AddMessage(message); - } - - foreach (var args in _warningArgs) - { - var parent = GetParentComponent(args, build); - var warning = new Warning(args.Message, parent); - parent.AddWarning(warning); - } - - foreach (var args in _errorArgs) - { - var parent = GetParentComponent(args, build); - var error = new Error(args.Message, parent); - parent.AddError(error); - } - } - - private Result.Component GetParentComponent(BuildEventArgs args, Result.Build build) - { - return GetParentComponent( - args.BuildEventContext.ProjectInstanceId, - args.BuildEventContext.TargetId, - args.BuildEventContext.TaskId, - build); - } - - private Result.Component GetParentComponent(int projectId, int targetId, int taskId, Result.Build build) - { - if (projectId == BuildEventContext.InvalidProjectInstanceId || projectId == 0) - { - return build; - } - - var project = build.ProjectsById[projectId]; - - if (targetId == BuildEventContext.InvalidTargetId) - { - return project; - } - - var target = project.TargetsById[targetId]; - - if (taskId == BuildEventContext.InvalidTaskId) - { - return target; - } - - return target.TasksById[taskId]; - } - } -} diff --git a/src/MSBuildBinLogQuery/Graph/DirectedAcyclicGraph.cs b/src/MSBuildBinLogQuery/Graph/DirectedAcyclicGraph.cs deleted file mode 100644 index 4db7f87a..00000000 --- a/src/MSBuildBinLogQuery/Graph/DirectedAcyclicGraph.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Microsoft.Build.Logging.Query.Graph -{ - public class DirectedAcyclicGraph - where T : IDirectedAcyclicGraphNode, - IShallowCopyableGraphNode, - IEquatable - { - public IEnumerable Nodes { get; } - - public DirectedAcyclicGraph(IEnumerable nodes) - { - Nodes = nodes; - } - - public bool TopologicalSort(out List topologicalOrdering) - { - var inDegrees = new Dictionary(); - - foreach (var node in Nodes) - { - inDegrees[node] = 0; - } - - foreach (var node in Nodes) - { - foreach (var adjacentNode in node.AdjacentNodes) - { - inDegrees[adjacentNode]++; - } - } - - var queue = new Queue(); - - foreach (var node in Nodes) - { - if (inDegrees[node] == 0) - { - queue.Enqueue(node); - } - } - - topologicalOrdering = new List(); - - while (queue.TryDequeue(out var first)) - { - topologicalOrdering.Add(first); - - foreach (var adjacentNode in first.AdjacentNodes) - { - inDegrees[adjacentNode]--; - - if (inDegrees[adjacentNode] == 0) - { - queue.Enqueue(adjacentNode); - } - } - } - - return Nodes.All(node => inDegrees[node] == 0); - } - - public bool GetReachableNodes(out Dictionary> reachables) - { - var reversedGraph = Reverse(); - - reachables = new Dictionary>(); - - if (!reversedGraph.TopologicalSort(out var topologicalOrdering)) - { - return false; - } - - foreach (var node in reversedGraph.Nodes) - { - reachables[node] = new HashSet(); - } - - foreach (var node in topologicalOrdering) - { - foreach (var adjacentNode in node.AdjacentNodes) - { - reachables[adjacentNode].UnionWith(reachables[node]); - reachables[adjacentNode].Add(node); - } - } - - return true; - } - - public DirectedAcyclicGraph Reverse() - { - var reversedNodes = Nodes.ToDictionary( - node => node, - node => node.ShallowCopyAndClearEdges()); - - foreach (var node in Nodes) - { - foreach (var adjacentNode in node.AdjacentNodes) - { - reversedNodes[adjacentNode].AdjacentNodes.Add(reversedNodes[node]); - } - } - - return new DirectedAcyclicGraph(reversedNodes.Values); - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Graph/IDirectedAcyclicGraphNode.cs b/src/MSBuildBinLogQuery/Graph/IDirectedAcyclicGraphNode.cs deleted file mode 100644 index 15b64a16..00000000 --- a/src/MSBuildBinLogQuery/Graph/IDirectedAcyclicGraphNode.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Collections.Generic; - -namespace Microsoft.Build.Logging.Query.Graph -{ - public interface IDirectedAcyclicGraphNode - { - } - - public interface IDirectedAcyclicGraphNode : IDirectedAcyclicGraphNode where T : IDirectedAcyclicGraphNode - { - ISet AdjacentNodes { get; } - } -} diff --git a/src/MSBuildBinLogQuery/Graph/IShallowCopyableGraphNode.cs b/src/MSBuildBinLogQuery/Graph/IShallowCopyableGraphNode.cs deleted file mode 100644 index 4b254087..00000000 --- a/src/MSBuildBinLogQuery/Graph/IShallowCopyableGraphNode.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Graph -{ - public interface IShallowCopyableGraphNode where T : IDirectedAcyclicGraphNode - { - T ShallowCopyAndClearEdges(); - } -} diff --git a/src/MSBuildBinLogQuery/Graph/ProjectNode_BeforeThis.cs b/src/MSBuildBinLogQuery/Graph/ProjectNode_BeforeThis.cs deleted file mode 100644 index 08b1f27c..00000000 --- a/src/MSBuildBinLogQuery/Graph/ProjectNode_BeforeThis.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using Microsoft.Build.Logging.Query.Result; - -namespace Microsoft.Build.Logging.Query.Graph -{ - public class ProjectNode_BeforeThis : - IDirectedAcyclicGraphNode, - IShallowCopyableGraphNode, - IEquatable - { - public Project ProjectInfo { get; } - - public ISet AdjacentNodes { get; private set; } - - public ProjectNode_BeforeThis(Project projectInfo) - { - ProjectInfo = projectInfo; - AdjacentNodes = new HashSet(); - } - - public ProjectNode_BeforeThis ShallowCopyAndClearEdges() - { - var copy = MemberwiseClone() as ProjectNode_BeforeThis; - copy.AdjacentNodes = new HashSet(); - return copy; - } - - public bool Equals([AllowNull] ProjectNode_BeforeThis other) - { - return other != null && - EqualityComparer.Default.Equals(ProjectInfo, other.ProjectInfo); - } - - public override int GetHashCode() - { - return HashCode.Combine(ProjectInfo); - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Graph/TargetNode_AfterThis.cs b/src/MSBuildBinLogQuery/Graph/TargetNode_AfterThis.cs deleted file mode 100644 index 059b7c1e..00000000 --- a/src/MSBuildBinLogQuery/Graph/TargetNode_AfterThis.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using Microsoft.Build.Logging.Query.Result; - -namespace Microsoft.Build.Logging.Query.Graph -{ - public class TargetNode_AfterThis : - IDirectedAcyclicGraphNode, - IShallowCopyableGraphNode, - IEquatable - { - public Target TargetInfo { get; } - public ISet AdjacentNodes { get; private set; } - - public TargetNode_AfterThis(Target targetInfo) - { - TargetInfo = targetInfo; - AdjacentNodes = new HashSet(); - } - - public TargetNode_AfterThis ShallowCopyAndClearEdges() - { - var copy = MemberwiseClone() as TargetNode_AfterThis; - copy.AdjacentNodes = new HashSet(); - return copy; - } - - public bool Equals([AllowNull] TargetNode_AfterThis other) - { - return other != null && - EqualityComparer.Default.Equals(TargetInfo, other.TargetInfo); - } - - public override int GetHashCode() - { - return HashCode.Combine(TargetInfo); - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Graph/TargetNode_BeforeThis.cs b/src/MSBuildBinLogQuery/Graph/TargetNode_BeforeThis.cs deleted file mode 100644 index 3616f08b..00000000 --- a/src/MSBuildBinLogQuery/Graph/TargetNode_BeforeThis.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using Microsoft.Build.Logging.Query.Result; - -namespace Microsoft.Build.Logging.Query.Graph -{ - public class TargetNode_BeforeThis : - IDirectedAcyclicGraphNode, - IShallowCopyableGraphNode, - IEquatable - { - public Target TargetInfo { get; } - public ISet AdjacentNodes { get; private set; } - - public TargetNode_BeforeThis(Target targetInfo) - { - TargetInfo = targetInfo; - AdjacentNodes = new HashSet(); - } - - public TargetNode_BeforeThis ShallowCopyAndClearEdges() - { - var copy = MemberwiseClone() as TargetNode_BeforeThis; - copy.AdjacentNodes = new HashSet(); - return copy; - } - - public bool Equals([AllowNull] TargetNode_BeforeThis other) - { - return other != null && - EqualityComparer.Default.Equals(TargetInfo, other.TargetInfo); - } - - public override int GetHashCode() - { - return HashCode.Combine(TargetInfo); - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Interpret/Interpreter.cs b/src/MSBuildBinLogQuery/Interpret/Interpreter.cs deleted file mode 100644 index b61aadcc..00000000 --- a/src/MSBuildBinLogQuery/Interpret/Interpreter.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Collections.Generic; -using Microsoft.Build.Logging.Query.Ast; -using Microsoft.Build.Logging.Query.Parse; -using Microsoft.Build.Logging.Query.Result; - -namespace Microsoft.Build.Logging.Query.Interpret -{ - public class Interpreter - { - private readonly IAstNode _ast; - - public Interpreter(IAstNode ast) - { - _ast = ast; - } - - public Interpreter(string expression) - { - _ast = Parser.Parse(expression); - } - - public IEnumerable Filter(Result.Build build) - { - return _ast.Filter(new[] { build }); - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/MSBuildBinLogQuery.csproj b/src/MSBuildBinLogQuery/MSBuildBinLogQuery.csproj deleted file mode 100644 index 51e4d91d..00000000 --- a/src/MSBuildBinLogQuery/MSBuildBinLogQuery.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - net8.0 - Microsoft.Build.Logging.Query - preview - - - - - - - diff --git a/src/MSBuildBinLogQuery/Parse/ParseException.cs b/src/MSBuildBinLogQuery/Parse/ParseException.cs deleted file mode 100644 index d26bc788..00000000 --- a/src/MSBuildBinLogQuery/Parse/ParseException.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace Microsoft.Build.Logging.Query.Parse -{ - public class ParseException : Exception - { - public ParseException(string expression) : base(expression) - { - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Parse/Parser.cs b/src/MSBuildBinLogQuery/Parse/Parser.cs deleted file mode 100644 index 0c85ce3a..00000000 --- a/src/MSBuildBinLogQuery/Parse/Parser.cs +++ /dev/null @@ -1,339 +0,0 @@ -using System.Collections.Generic; -using Microsoft.Build.Logging.Query.Ast; -using Microsoft.Build.Logging.Query.Result; -using Microsoft.Build.Logging.Query.Scan; -using Microsoft.Build.Logging.Query.Token; - -namespace Microsoft.Build.Logging.Query.Parse -{ - public class Parser - { - private readonly Scanner _scanner; - - private delegate bool TryConstraintParser(out ConstraintNode constraint) - where TParent : class, IQueryResult, IResultWithId; - - private Parser(Scanner scanner) - { - _scanner = scanner; - } - - public static IAstNode Parse(Scanner scanner) - { - var parser = new Parser(scanner); - var queryNode = parser.ParseQuery(); - - if (parser._scanner.Token is EofToken) - { - return queryNode; - } - - throw new ParseException(parser._scanner.Expression); - } - - public static IAstNode Parse(string expression) - { - var scanner = new Scanner(expression); - return Parse(scanner); - } - - private TToken Consume() where TToken : Token.Token - { - if (_scanner.Token is TToken) - { - var result = _scanner.Token as TToken; - _scanner.ReadNextToken(); - - return result; - } - else - { - throw new ParseException(_scanner.Expression); - } - } - - private LogNodeType ParseSlash() - { - switch (_scanner.Token) - { - case SingleSlashToken _: - Consume(); - return LogNodeType.Direct; - case DoubleSlashToken _: - Consume(); - return LogNodeType.All; - default: - throw new ParseException(_scanner.Expression); - } - } - - private LogNode ParseLogNodeWithType(LogNodeType type) - { - switch (_scanner.Token) - { - case MessageToken _: - Consume(); - return new MessageNode(type); - case WarningToken _: - Consume(); - return new WarningNode(type); - case ErrorToken _: - Consume(); - return new ErrorNode(type); - default: - throw new ParseException(_scanner.Expression); - } - } - - private LogNode ParseLogNode() - { - var type = ParseSlash(); - return ParseLogNodeWithType(type); - } - - private LogNode ParseNullableLogNode() - { - switch (_scanner.Token) - { - case SingleSlashToken _: - case DoubleSlashToken _: - return ParseLogNode(); - default: - return null; - } - } - - private IdNode ParseIdConstraint() - where TParent : class, IQueryResult, IResultWithId - { - Consume(); - Consume(); - - var value = Consume().Value; - return new IdNode(value); - } - - private NameNode ParseNameConstraint() - where TParent : class, IQueryResult, IResultWithName - { - Consume(); - Consume(); - - var value = Consume().Value; - return new NameNode(value); - } - - private PathNode ParsePathConstraint() - where TParent : class, IQueryResult, IResultWithPath - { - Consume(); - Consume(); - - var value = Consume().Value; - return new PathNode(value); - } - - private bool TryParseTaskConstraint(out ConstraintNode constraint) - { - switch (_scanner.Token) - { - case IdToken _: - constraint = ParseIdConstraint(); - return true; - case NameToken _: - constraint = ParseNameConstraint(); - return true; - default: - constraint = null; - return false; - }; - } - - private bool TryParseTargetConstraint(out ConstraintNode constraint) - { - switch (_scanner.Token) - { - case IdToken _: - constraint = ParseIdConstraint(); - return true; - case NameToken _: - constraint = ParseNameConstraint(); - return true; - default: - constraint = null; - return false; - }; - } - - private bool TryParseProjectConstraint(out ConstraintNode constraint) - { - switch (_scanner.Token) - { - case IdToken _: - constraint = ParseIdConstraint(); - return true; - case NameToken _: - constraint = ParseNameConstraint(); - return true; - case PathToken _: - constraint = ParsePathConstraint(); - return true; - default: - constraint = null; - return false; - }; - } - - private List> ParseConstraints(TryConstraintParser tryConstraintParser) - where TParent : class, IQueryResult, IResultWithId - { - var constraints = new List>(); - - if (!(_scanner.Token is LeftBracketToken)) - { - return constraints; - } - - Consume(); - - if (!tryConstraintParser.Invoke(out var constraint)) - { - Consume(); - return constraints; - } - - constraints.Add(constraint); - - while (_scanner.Token is CommaToken) - { - Consume(); - - if (!tryConstraintParser.Invoke(out var anotherConstraint)) - { - throw new ParseException(_scanner.Expression); - } - - constraints.Add(anotherConstraint); - } - - Consume(); - - return constraints; - } - - private TaskNode ParseTaskNode() - { - Consume(); - - var constraints = ParseConstraints(TryParseTaskConstraint); - var next = ParseNullableLogNode(); - var task = next == null ? - new TaskNode(constraints) : - new TaskNode(next, constraints); - - return task; - } - - private TargetNode ParseTargetNode() - { - Consume(); - - var constraints = ParseConstraints(TryParseTargetConstraint); - var next = ParseNullableNodeUnderTarget(); - var target = next == null ? - new TargetNode(constraints) : - new TargetNode(next, constraints); - - return target; - } - - private ProjectNode ParseProjectNode() - { - Consume(); - - var constraints = ParseConstraints(TryParseProjectConstraint); - var next = ParseNullableNodeUnderProject(); - var project = next == null ? - new ProjectNode(constraints) : - new ProjectNode(next, constraints); - - return project; - } - - private IAstNode ParseSingleSlashNodeUnderTarget() - { - return _scanner.Token switch - { - TaskToken _ => ParseTaskNode() as IAstNode, - _ => ParseLogNodeWithType(LogNodeType.Direct), - }; - } - - private IAstNode ParseNullableNodeUnderTarget() - { - switch (_scanner.Token) - { - case SingleSlashToken _: - Consume(); - return ParseSingleSlashNodeUnderTarget(); - case DoubleSlashToken _: - Consume(); - return ParseLogNodeWithType(LogNodeType.All); - default: - return null; - } - } - - private IAstNode ParseSingleSlashNodeUnderProject() - { - return _scanner.Token switch - { - TargetToken _ => ParseTargetNode() as IAstNode, - TaskToken _ => new TargetNode(ParseTaskNode()), - _ => ParseLogNodeWithType(LogNodeType.Direct), - }; - } - - private IAstNode ParseNullableNodeUnderProject() - { - switch (_scanner.Token) - { - case SingleSlashToken _: - Consume(); - return ParseSingleSlashNodeUnderProject(); - case DoubleSlashToken _: - Consume(); - return ParseLogNodeWithType(LogNodeType.All); - default: - return null; - } - } - - private IAstNode ParseSingleSlashQueryNode() - { - return _scanner.Token switch - { - ProjectToken _ => ParseProjectNode() as IAstNode, - TargetToken _ => new ProjectNode(ParseTargetNode()), - TaskToken _ => new ProjectNode(new TargetNode(ParseTaskNode())), - _ => ParseLogNodeWithType(LogNodeType.Direct), - }; - } - - private IAstNode ParseQuery() - { - switch (_scanner.Token) - { - case SingleSlashToken _: - Consume(); - return ParseSingleSlashQueryNode(); - case DoubleSlashToken _: - Consume(); - return ParseLogNodeWithType(LogNodeType.All); - default: - throw new ParseException(_scanner.Expression); - - } - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Result/Build.cs b/src/MSBuildBinLogQuery/Result/Build.cs deleted file mode 100644 index f571f02c..00000000 --- a/src/MSBuildBinLogQuery/Result/Build.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using Microsoft.Build.Framework; - -namespace Microsoft.Build.Logging.Query.Result -{ - public class Build : Component - { - public IReadOnlyDictionary ProjectsById => _projectsById; - public override Component Parent => null; - - private readonly Dictionary _projectsById; - - public Build() : base() - { - _projectsById = new Dictionary(); - } - - public Project AddProject( - int id, - string projectFile, - IEnumerable items, - IEnumerable properties, - IDictionary globalProperties) - { - var project = new Project( - id, - projectFile, - items, - properties, - globalProperties, - this); - - if (id != BuildEventContext.InvalidProjectInstanceId) - { - _projectsById[id] = project; - } - - return project; - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Result/Component.cs b/src/MSBuildBinLogQuery/Result/Component.cs deleted file mode 100644 index eb7a9e33..00000000 --- a/src/MSBuildBinLogQuery/Result/Component.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Microsoft.Build.Logging.Query.Result -{ - public abstract class Component : IQueryResult - { - public abstract Component Parent { get; } - public IReadOnlyList Messages => _messages; - public IReadOnlyList Warnings => _warnings; - public IReadOnlyList Errors => _errors; - - /// - /// `AllMessages`, `AllWarnings` and `AllErrors` are messages, warnings - /// and errors that occur under this component, either directly or - /// indirectly. - /// - public IReadOnlyList AllMessages => _allMessages; - public IReadOnlyList AllWarnings => _allWarnings; - public IReadOnlyList AllErrors => _allErrors; - - private readonly List _messages; - private readonly List _warnings; - private readonly List _errors; - private readonly List _allMessages; - private readonly List _allWarnings; - private readonly List _allErrors; - - public Component() - { - _messages = new List(); - _warnings = new List(); - _errors = new List(); - - _allMessages = new List(); - _allWarnings = new List(); - _allErrors = new List(); - } - - public void AddMessage(Message message) - { - _messages.Add(message); - GoUpToRoot(component => component._allMessages.Add(message)); - } - - public void AddWarning(Warning warning) - { - _warnings.Add(warning); - GoUpToRoot(component => component._allWarnings.Add(warning)); - } - - public void AddError(Error error) - { - _errors.Add(error); - GoUpToRoot(component => component._allErrors.Add(error)); - } - - private void GoUpToRoot(Action action) - { - for (var current = this; current != null; current = current.Parent) - { - action.Invoke(current); - } - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Result/Error.cs b/src/MSBuildBinLogQuery/Result/Error.cs deleted file mode 100644 index 88283a42..00000000 --- a/src/MSBuildBinLogQuery/Result/Error.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Result -{ - public class Error : Log - { - public Error(string text, Component parent) : base(text, parent) - { - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Result/IQueryResult.cs b/src/MSBuildBinLogQuery/Result/IQueryResult.cs deleted file mode 100644 index f87c3f61..00000000 --- a/src/MSBuildBinLogQuery/Result/IQueryResult.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Result -{ - public interface IQueryResult - { - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Result/IResultWithId.cs b/src/MSBuildBinLogQuery/Result/IResultWithId.cs deleted file mode 100644 index fb94ccd0..00000000 --- a/src/MSBuildBinLogQuery/Result/IResultWithId.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Result -{ - public interface IResultWithId : IQueryResult - { - int Id { get; } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Result/IResultWithName.cs b/src/MSBuildBinLogQuery/Result/IResultWithName.cs deleted file mode 100644 index a82234b5..00000000 --- a/src/MSBuildBinLogQuery/Result/IResultWithName.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Result -{ - public interface IResultWithName : IQueryResult - { - string Name { get; } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Result/IResultWithPath.cs b/src/MSBuildBinLogQuery/Result/IResultWithPath.cs deleted file mode 100644 index 41a6d427..00000000 --- a/src/MSBuildBinLogQuery/Result/IResultWithPath.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Result -{ - public interface IResultWithPath : IQueryResult - { - string Path { get; } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Result/Log.cs b/src/MSBuildBinLogQuery/Result/Log.cs deleted file mode 100644 index e071e6e2..00000000 --- a/src/MSBuildBinLogQuery/Result/Log.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Result -{ - public abstract class Log : IQueryResult - { - public string Text { get; } - public Component Parent { get; } - - public Log(string text, Component parent) - { - Text = text; - Parent = parent; - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Result/Message.cs b/src/MSBuildBinLogQuery/Result/Message.cs deleted file mode 100644 index d4226ea4..00000000 --- a/src/MSBuildBinLogQuery/Result/Message.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Microsoft.Build.Framework; - -namespace Microsoft.Build.Logging.Query.Result -{ - public class Message : Log - { - public MessageImportance Importance { get; } - - public Message(string text, Component parent, MessageImportance importance) : base(text, parent) - { - Importance = importance; - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Result/Project.cs b/src/MSBuildBinLogQuery/Result/Project.cs deleted file mode 100644 index 496681d8..00000000 --- a/src/MSBuildBinLogQuery/Result/Project.cs +++ /dev/null @@ -1,134 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; -using Microsoft.Build.Framework; -using Microsoft.Build.Logging.Query.Graph; -using Microsoft.Build.Logging.Query.Utility; - -namespace Microsoft.Build.Logging.Query.Result -{ - public class Project : Component, IEquatable, IResultWithId, IResultWithName, IResultWithPath - { - public int Id { get; } - public string ProjectFile { get; } - public Build ParentBuild { get; } - public ItemManager Items { get; } - public PropertyManager Properties { get; } - public PropertyManager GlobalProperties { get; } - public ProjectNode_BeforeThis Node_BeforeThis { get; } - - public IReadOnlyDictionary TargetsById => _targetsById; - public IReadOnlyDictionary TargetsByName => _targetsByName; - public IReadOnlyList OrderedTargets => _orderedTargets; - // TODO: A single project instance can be built concurrently with - // distinct EntryPointTargets. Those should be tracked as part of - // the overall Project. - public IReadOnlyList EntryPointTargets => _entryPointTargets; - public override Component Parent => ParentBuild; - public string Name => System.IO.Path.GetFileNameWithoutExtension(ProjectFile); - public string Path => ProjectFile; - - private readonly Dictionary _targetsById; - private readonly Dictionary _targetsByName; - private readonly List _orderedTargets; - private readonly List _entryPointTargets; - - public Project( - int id, - string projectFile, - IEnumerable items, - IEnumerable properties, - IDictionary globalProperties, - Build parentBuild) : base() - { - Id = id; - ProjectFile = projectFile; - ParentBuild = parentBuild; - Items = new ItemManager(); - Properties = new PropertyManager(); - GlobalProperties = new PropertyManager(); - Node_BeforeThis = new ProjectNode_BeforeThis(this); - - _targetsById = new Dictionary(); - _targetsByName = new Dictionary(); - _orderedTargets = new List(); - _entryPointTargets = new List(); - - CopyItems(items); - CopyProperties(properties); - CopyGlobalProperties(globalProperties); - } - - public Target AddTarget(int id, string name, bool isEntryPointTarget) - { - var target = new Target(id, name, this); - - _targetsByName[name] = target; - _orderedTargets.Add(target); - - if (id != BuildEventContext.InvalidTargetId) - { - _targetsById[id] = target; - } - - if (isEntryPointTarget) - { - _entryPointTargets.Add(target); - } - - return target; - } - - private void CopyItems(IEnumerable items) - { - if (items == null) - { - return; - } - - foreach (var item in items.Cast()) - { - Items.Add(item.Key as string, item.Value as ITaskItem); - } - } - - private void CopyProperties(IEnumerable properties) - { - if (properties == null) - { - return; - } - - foreach (var property in properties.Cast()) - { - Properties.Set(property.Key as string, property.Value as string); - } - } - - private void CopyGlobalProperties(IDictionary globalProperties) - { - if (globalProperties == null) - { - return; - } - - foreach (var globalProperty in globalProperties) - { - GlobalProperties.Set(globalProperty.Key, globalProperty.Value); - } - } - - public bool Equals([AllowNull] Project other) - { - return other != null && - Id == other.Id; - } - - public override int GetHashCode() - { - return HashCode.Combine(Id); - } - } -} diff --git a/src/MSBuildBinLogQuery/Result/Target.cs b/src/MSBuildBinLogQuery/Result/Target.cs deleted file mode 100644 index 7d7ed399..00000000 --- a/src/MSBuildBinLogQuery/Result/Target.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using Microsoft.Build.Framework; -using Microsoft.Build.Logging.Query.Graph; - -namespace Microsoft.Build.Logging.Query.Result -{ - public class Target : Component, IEquatable, IResultWithId, IResultWithName - { - public int Id { get; } - public string Name { get; } - public Project ParentProject { get; } - public TargetNode_BeforeThis Node_BeforeThis { get; } - public TargetNode_AfterThis Node_AfterThis { get; } - public override Component Parent => ParentProject; - - public IReadOnlyDictionary TasksById => _tasksById; - public IReadOnlyList OrderedTasks => _orderedTasks; - - private readonly Dictionary _tasksById; - private readonly List _orderedTasks; - - public Target(int id, string name, Project parentProject) : base() - { - Id = id; - Name = name; - ParentProject = parentProject; - Node_BeforeThis = new TargetNode_BeforeThis(this); - Node_AfterThis = new TargetNode_AfterThis(this); - - _tasksById = new Dictionary(); - _orderedTasks = new List(); - } - - public Task AddTask(int id, string name, string taskFile) - { - var task = new Task(id, name, taskFile, this); - - _orderedTasks.Add(task); - - if (id != BuildEventContext.InvalidTaskId) - { - _tasksById[id] = task; - } - - return task; - } - - public bool Equals([AllowNull] Target other) - { - return other != null && - Id == other.Id && - EqualityComparer.Default.Equals(ParentProject, other.ParentProject); - } - - public override int GetHashCode() - { - return HashCode.Combine(Id, ParentProject); - } - } -} diff --git a/src/MSBuildBinLogQuery/Result/Task.cs b/src/MSBuildBinLogQuery/Result/Task.cs deleted file mode 100644 index 87e1ba7d..00000000 --- a/src/MSBuildBinLogQuery/Result/Task.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using Microsoft.Build.Logging.Query.Utility; - -namespace Microsoft.Build.Logging.Query.Result -{ - public class Task : Component, IEquatable, IResultWithId, IResultWithName - { - public int Id { get; } - public string Name { get; } - public string TaskFile { get; } - public Target ParentTarget { get; } - public PropertyManager Parameters { get; } - public override Component Parent => ParentTarget; - - public Task(int id, string name, string taskFile, Target parentTarget) : base() - { - Id = id; - Name = name; - TaskFile = taskFile; - ParentTarget = parentTarget; - Parameters = new PropertyManager(); - } - - public bool Equals([AllowNull] Task other) - { - return other != null && - Id == other.Id && - EqualityComparer.Default.Equals(ParentTarget, other.ParentTarget); - } - - public override int GetHashCode() - { - return HashCode.Combine(Id); - } - } -} diff --git a/src/MSBuildBinLogQuery/Result/Warning.cs b/src/MSBuildBinLogQuery/Result/Warning.cs deleted file mode 100644 index 6f449cf6..00000000 --- a/src/MSBuildBinLogQuery/Result/Warning.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Result -{ - public class Warning : Log - { - public Warning(string text, Component parent) : base(text, parent) - { - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Scan/ScanException.cs b/src/MSBuildBinLogQuery/Scan/ScanException.cs deleted file mode 100644 index 65185583..00000000 --- a/src/MSBuildBinLogQuery/Scan/ScanException.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace Microsoft.Build.Logging.Query.Scan -{ - public class ScanException : Exception - { - public ScanException(string expression) : base(expression) - { - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Scan/Scanner.cs b/src/MSBuildBinLogQuery/Scan/Scanner.cs deleted file mode 100644 index 4f4922eb..00000000 --- a/src/MSBuildBinLogQuery/Scan/Scanner.cs +++ /dev/null @@ -1,214 +0,0 @@ -using System; -using System.Text; -using Microsoft.Build.Logging.Query.Token; - -namespace Microsoft.Build.Logging.Query.Scan -{ - public class Scanner - { - public Token.Token Token { get; private set; } - public string Expression { get; } - - private int _index; - private char _char; - - public Scanner(string expression) - { - Expression = expression ?? throw new ArgumentNullException(); - _index = 0; - - ReadNextCharacter(); - ReadNextToken(); - } - - public void ReadNextToken() - { - SkipWhiteSpace(); - - switch (_char) - { - case '\0': - Token = EofToken.Instance; - break; - case '/': - ReadNextCharacter(); - - if (_char == '/') - { - ReadNextCharacter(); - Token = DoubleSlashToken.Instance; - } - else - { - Token = SingleSlashToken.Instance; - } - - break; - case '[': - ReadNextCharacter(); - Token = LeftBracketToken.Instance; - break; - case ']': - ReadNextCharacter(); - Token = RightBracketToken.Instance; - break; - case '=': - ReadNextCharacter(); - Token = EqualToken.Instance; - break; - case ',': - ReadNextCharacter(); - Token = CommaToken.Instance; - break; - case '\"': - ReadNextCharacter(); - Token = new StringToken(ReadNextString()); - break; - case 'M': - case 'm': - ReadNextKeyword("MESSAGE", () => MessageToken.Instance); - break; - case 'W': - case 'w': - ReadNextKeyword("WARNING", () => WarningToken.Instance); - break; - case 'E': - case 'e': - ReadNextKeyword("ERROR", () => ErrorToken.Instance); - break; - case 'P': - case 'p': - ReadNextCharacter(); - - if (char.ToUpper(_char) == 'R') - { - ReadNextKeyword("ROJECT", () => ProjectToken.Instance); - } - else if (char.ToUpper(_char) == 'A') - { - ReadNextKeyword("ATH", () => PathToken.Instance); - } - else - { - throw new ScanException(Expression); - } - - break; - case 'T': - case 't': - ReadNextCharacter(); - - if (char.ToUpper(_char) != 'A') - { - throw new ScanException(Expression); - } - - ReadNextCharacter(); - - if (char.ToUpper(_char) == 'R') - { - ReadNextKeyword("RGET", () => TargetToken.Instance); - } - else if (char.ToUpper(_char) == 'S') - { - ReadNextKeyword("SK", () => TaskToken.Instance); - } - else - { - throw new ScanException(Expression); - } - - break; - case 'I': - case 'i': - ReadNextKeyword("ID", () => IdToken.Instance); - break; - case 'N': - case 'n': - ReadNextKeyword("NAME", () => NameToken.Instance); - break; - default: - if (char.IsDigit(_char)) - { - Token = new IntegerToken(ReadNextInteger()); - break; - } - - throw new ScanException(Expression); - } - } - - private string ReadNextString() - { - var stringBuilder = new StringBuilder(); - - while (_char != '\"') - { - stringBuilder.Append(_char); - ReadNextCharacter(); - } - - ReadNextCharacter(); - return stringBuilder.ToString(); - } - - private void ReadNextKeyword(string keyword, Func thunk) - { - var stringBuilder = new StringBuilder(); - - for (var i = 0; i < keyword.Length; i++) - { - if (char.ToUpper(_char) != char.ToUpper(keyword[i])) - { - throw new ScanException(Expression); - } - - stringBuilder.Append(_char); - - ReadNextCharacter(); - } - - Token = thunk.Invoke(); - } - - private int ReadNextInteger() - { - var stringBuilder = new StringBuilder(); - - while (char.IsDigit(_char)) - { - stringBuilder.Append(_char); - ReadNextCharacter(); - } - - if (int.TryParse(stringBuilder.ToString(), out var value)) - { - return value; - } - - throw new ScanException(Expression); - } - - private bool ReadNextCharacter() - { - if (_index < Expression.Length) - { - _char = Expression[_index++]; - return true; - } - - _char = '\0'; - return false; - } - - private void SkipWhiteSpace() - { - while (IsWhiteSpace(_char) && ReadNextCharacter()) { } - } - - private static bool IsWhiteSpace(char c) - { - return c == ' ' || c == '\t' || c == '\n' || c == '\r'; - } - } -} diff --git a/src/MSBuildBinLogQuery/Token/CommaToken.cs b/src/MSBuildBinLogQuery/Token/CommaToken.cs deleted file mode 100644 index 9416319c..00000000 --- a/src/MSBuildBinLogQuery/Token/CommaToken.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Token -{ - public class CommaToken : Token - { - public static CommaToken Instance { get; } = new CommaToken(); - - private CommaToken() : base() - { - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Token/DoubleSlashToken.cs b/src/MSBuildBinLogQuery/Token/DoubleSlashToken.cs deleted file mode 100644 index cf5e6b2c..00000000 --- a/src/MSBuildBinLogQuery/Token/DoubleSlashToken.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Token -{ - public class DoubleSlashToken : Token - { - public static DoubleSlashToken Instance { get; } = new DoubleSlashToken(); - - private DoubleSlashToken() : base() - { - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Token/EofToken.cs b/src/MSBuildBinLogQuery/Token/EofToken.cs deleted file mode 100644 index 1831320d..00000000 --- a/src/MSBuildBinLogQuery/Token/EofToken.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Token -{ - public class EofToken : Token - { - public static EofToken Instance { get; } = new EofToken(); - - private EofToken() : base() - { - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Token/EqualToken.cs b/src/MSBuildBinLogQuery/Token/EqualToken.cs deleted file mode 100644 index 2afcbd5e..00000000 --- a/src/MSBuildBinLogQuery/Token/EqualToken.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Token -{ - public class EqualToken : Token - { - public static EqualToken Instance { get; } = new EqualToken(); - - private EqualToken() : base() - { - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Token/ErrorToken.cs b/src/MSBuildBinLogQuery/Token/ErrorToken.cs deleted file mode 100644 index 428b4e79..00000000 --- a/src/MSBuildBinLogQuery/Token/ErrorToken.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Token -{ - public class ErrorToken : Token - { - public static ErrorToken Instance { get; } = new ErrorToken(); - - private ErrorToken() : base() - { - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Token/IdToken.cs b/src/MSBuildBinLogQuery/Token/IdToken.cs deleted file mode 100644 index 1edcad20..00000000 --- a/src/MSBuildBinLogQuery/Token/IdToken.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Token -{ - public class IdToken : Token - { - public static IdToken Instance { get; } = new IdToken(); - - private IdToken() : base() - { - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Token/IntegerToken.cs b/src/MSBuildBinLogQuery/Token/IntegerToken.cs deleted file mode 100644 index 89aec91c..00000000 --- a/src/MSBuildBinLogQuery/Token/IntegerToken.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Diagnostics.CodeAnalysis; - -namespace Microsoft.Build.Logging.Query.Token -{ - public sealed class IntegerToken : Token, IEquatable - { - public int Value { get; } - - public IntegerToken(int value) : base() - { - Value = value; - } - - public override bool Equals(object obj) - { - return Equals(obj as IntegerToken); - } - - public bool Equals([AllowNull] IntegerToken other) - { - return other != null && - Value == other.Value; - } - - public override int GetHashCode() - { - return HashCode.Combine(Value); - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Token/LeftBracketToken.cs b/src/MSBuildBinLogQuery/Token/LeftBracketToken.cs deleted file mode 100644 index 9dd6dd2e..00000000 --- a/src/MSBuildBinLogQuery/Token/LeftBracketToken.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Token -{ - public class LeftBracketToken : Token - { - public static LeftBracketToken Instance { get; } = new LeftBracketToken(); - - private LeftBracketToken() : base() - { - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Token/MessageToken.cs b/src/MSBuildBinLogQuery/Token/MessageToken.cs deleted file mode 100644 index 6591c674..00000000 --- a/src/MSBuildBinLogQuery/Token/MessageToken.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Token -{ - public class MessageToken : Token - { - public static MessageToken Instance { get; } = new MessageToken(); - - private MessageToken() : base() - { - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Token/NameToken.cs b/src/MSBuildBinLogQuery/Token/NameToken.cs deleted file mode 100644 index 9e6a34cf..00000000 --- a/src/MSBuildBinLogQuery/Token/NameToken.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Token -{ - public class NameToken : Token - { - public static NameToken Instance { get; } = new NameToken(); - - private NameToken() : base() - { - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Token/PathToken.cs b/src/MSBuildBinLogQuery/Token/PathToken.cs deleted file mode 100644 index 97518dd9..00000000 --- a/src/MSBuildBinLogQuery/Token/PathToken.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Token -{ - public class PathToken : Token - { - public static PathToken Instance { get; } = new PathToken(); - - private PathToken() : base() - { - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Token/ProjectToken.cs b/src/MSBuildBinLogQuery/Token/ProjectToken.cs deleted file mode 100644 index b7b526ca..00000000 --- a/src/MSBuildBinLogQuery/Token/ProjectToken.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Token -{ - public class ProjectToken : Token - { - public static ProjectToken Instance { get; } = new ProjectToken(); - - private ProjectToken() : base() - { - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Token/RightBracketToken.cs b/src/MSBuildBinLogQuery/Token/RightBracketToken.cs deleted file mode 100644 index 05cdd7fb..00000000 --- a/src/MSBuildBinLogQuery/Token/RightBracketToken.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Token -{ - public class RightBracketToken : Token - { - public static RightBracketToken Instance { get; } = new RightBracketToken(); - - private RightBracketToken() : base() - { - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Token/SingleSlashToken.cs b/src/MSBuildBinLogQuery/Token/SingleSlashToken.cs deleted file mode 100644 index b7a8bbdc..00000000 --- a/src/MSBuildBinLogQuery/Token/SingleSlashToken.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Token -{ - public class SingleSlashToken : Token - { - public static SingleSlashToken Instance { get; } = new SingleSlashToken(); - - private SingleSlashToken() : base() - { - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Token/StringToken.cs b/src/MSBuildBinLogQuery/Token/StringToken.cs deleted file mode 100644 index 0e2de47f..00000000 --- a/src/MSBuildBinLogQuery/Token/StringToken.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Diagnostics.CodeAnalysis; - -namespace Microsoft.Build.Logging.Query.Token -{ - public sealed class StringToken : Token, IEquatable - { - public string Value { get; } - - public StringToken(string value) : base() - { - Value = value; - } - - public override bool Equals(object obj) - { - return Equals(obj as StringToken); - } - - public bool Equals([AllowNull] StringToken other) - { - return other != null && - Value == other.Value; - } - - public override int GetHashCode() - { - return HashCode.Combine(Value); - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Token/TargetToken.cs b/src/MSBuildBinLogQuery/Token/TargetToken.cs deleted file mode 100644 index f7d866bd..00000000 --- a/src/MSBuildBinLogQuery/Token/TargetToken.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Token -{ - public class TargetToken : Token - { - public static TargetToken Instance { get; } = new TargetToken(); - - private TargetToken() : base() - { - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Token/TaskToken.cs b/src/MSBuildBinLogQuery/Token/TaskToken.cs deleted file mode 100644 index d503da44..00000000 --- a/src/MSBuildBinLogQuery/Token/TaskToken.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Token -{ - public class TaskToken : Token - { - public static TaskToken Instance { get; } = new TaskToken(); - - private TaskToken() : base() - { - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Token/Token.cs b/src/MSBuildBinLogQuery/Token/Token.cs deleted file mode 100644 index 0dbb7109..00000000 --- a/src/MSBuildBinLogQuery/Token/Token.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Token -{ - public abstract class Token - { - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Token/WarningToken.cs b/src/MSBuildBinLogQuery/Token/WarningToken.cs deleted file mode 100644 index d6e0a0fe..00000000 --- a/src/MSBuildBinLogQuery/Token/WarningToken.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Microsoft.Build.Logging.Query.Token -{ - public class WarningToken : Token - { - public static WarningToken Instance { get; } = new WarningToken(); - - private WarningToken() : base() - { - } - } -} \ No newline at end of file diff --git a/src/MSBuildBinLogQuery/Utility/ItemManager.cs b/src/MSBuildBinLogQuery/Utility/ItemManager.cs deleted file mode 100644 index 3935d5c3..00000000 --- a/src/MSBuildBinLogQuery/Utility/ItemManager.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Collections.Concurrent; -using Microsoft.Build.Framework; - -namespace Microsoft.Build.Logging.Query.Utility -{ - public class ItemManager - { - private readonly ConcurrentDictionary> _items; - - public ItemManager() - { - _items = new ConcurrentDictionary>(); - } - - public void Add(string name, ITaskItem taskItem) - { - var item = _items.GetOrAdd(name, new ConcurrentBag()); - item.Add(taskItem); - } - - public bool TryGet(string name, out ConcurrentBag elements) - { - return _items.TryGetValue(name, out elements); - } - } -} diff --git a/src/MSBuildBinLogQuery/Utility/PropertyManager.cs b/src/MSBuildBinLogQuery/Utility/PropertyManager.cs deleted file mode 100644 index 0611bedd..00000000 --- a/src/MSBuildBinLogQuery/Utility/PropertyManager.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Collections.Concurrent; - -namespace Microsoft.Build.Logging.Query.Utility -{ - public class PropertyManager - { - private readonly ConcurrentDictionary _properties; - - public PropertyManager() - { - _properties = new ConcurrentDictionary(); - } - - public void Set(string key, string value) - { - _properties.AddOrUpdate(key, k => value, (k, v) => value); - } - - public bool TryGet(string key, out string value) - { - return _properties.TryGetValue(key, out value); - } - } -} diff --git a/src/dotnet-bootstrapper/BootstrapperCommandParser.cs b/src/dotnet-bootstrapper/BootstrapperCommandParser.cs deleted file mode 100644 index e754a6ae..00000000 --- a/src/dotnet-bootstrapper/BootstrapperCommandParser.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System; -using System.CommandLine; -using System.CommandLine.Builder; -using System.CommandLine.Invocation; -using System.CommandLine.Parsing; -using System.Reflection; - -namespace Microsoft.DotNet.Tools.Bootstrapper -{ - internal static class BootstrapperCommandParser - { - public static Parser BootstrapParser; - - public static RootCommand BootstrapperRootCommand = new RootCommand("dotnet bootstrapper"); - - public static readonly Command VersionCommand = new Command("--version"); - - private static readonly Lazy _assemblyVersion = - new Lazy(() => - { - var assembly = Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly(); - var assemblyVersionAttribute = assembly.GetCustomAttribute(); - if (assemblyVersionAttribute == null) - { - return assembly.GetName().Version.ToString(); - } - else - { - return assemblyVersionAttribute.InformationalVersion; - } - }); - - static BootstrapperCommandParser() - { - BootstrapperRootCommand.AddCommand(VersionCommand); - VersionCommand.Handler = CommandHandler.Create(() => - { - Console.WriteLine(_assemblyVersion.Value); - }); - - BootstrapParser = new CommandLineBuilder(BootstrapperRootCommand) - .UseDefaults() - // .UseHelpBuilder(context => new UninstallHelpBuilder(context.Console)) - .Build(); - } - } -} diff --git a/src/dotnet-bootstrapper/LocalizableStrings.resx b/src/dotnet-bootstrapper/LocalizableStrings.resx deleted file mode 100644 index 8b2ff64a..00000000 --- a/src/dotnet-bootstrapper/LocalizableStrings.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/src/dotnet-bootstrapper/Program.cs b/src/dotnet-bootstrapper/Program.cs deleted file mode 100644 index 9985c164..00000000 --- a/src/dotnet-bootstrapper/Program.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System.CommandLine; -using System.CommandLine.Builder; -using System.CommandLine.Parsing; -using System.IO; -using System.Threading.Tasks; -namespace Microsoft.DotNet.Tools.Bootstrapper; - -class Program -{ - static int Main(string[] args) - { - return BootstrapperCommandParser.BootstrapParser.InvokeAsync(args).Result; - } -} diff --git a/src/dotnet-bootstrapper/README.md b/src/dotnet-bootstrapper/README.md deleted file mode 100644 index 65ba4623..00000000 --- a/src/dotnet-bootstrapper/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# dotnet-bootstrapper - -This project is a placeholder for a standalone tool that manages and installs .NET versions. \ No newline at end of file diff --git a/src/dotnet-bootstrapper/dotnet-bootstrapper.csproj b/src/dotnet-bootstrapper/dotnet-bootstrapper.csproj deleted file mode 100644 index 3c081deb..00000000 --- a/src/dotnet-bootstrapper/dotnet-bootstrapper.csproj +++ /dev/null @@ -1,45 +0,0 @@ - - - dotnet-bootstrapper - Exe - true - true - net8.0 - true - true - false - true - true - true - LatestMajor - - - - preview - Microsoft.DotNet.Tools.Bootstrapper - - - - - - - - - - - - - True - True - LocalizableStrings.resx - - - - - - ResXFileCodeGenerator - LocalizableStrings.Designer.cs - - - - diff --git a/src/dotnet-bootstrapper/xlf/LocalizableStrings.cs.xlf b/src/dotnet-bootstrapper/xlf/LocalizableStrings.cs.xlf deleted file mode 100644 index e028ecc8..00000000 --- a/src/dotnet-bootstrapper/xlf/LocalizableStrings.cs.xlf +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/dotnet-bootstrapper/xlf/LocalizableStrings.de.xlf b/src/dotnet-bootstrapper/xlf/LocalizableStrings.de.xlf deleted file mode 100644 index 02f57c3c..00000000 --- a/src/dotnet-bootstrapper/xlf/LocalizableStrings.de.xlf +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/dotnet-bootstrapper/xlf/LocalizableStrings.es.xlf b/src/dotnet-bootstrapper/xlf/LocalizableStrings.es.xlf deleted file mode 100644 index bd51c90f..00000000 --- a/src/dotnet-bootstrapper/xlf/LocalizableStrings.es.xlf +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/dotnet-bootstrapper/xlf/LocalizableStrings.fr.xlf b/src/dotnet-bootstrapper/xlf/LocalizableStrings.fr.xlf deleted file mode 100644 index 353aa168..00000000 --- a/src/dotnet-bootstrapper/xlf/LocalizableStrings.fr.xlf +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/dotnet-bootstrapper/xlf/LocalizableStrings.it.xlf b/src/dotnet-bootstrapper/xlf/LocalizableStrings.it.xlf deleted file mode 100644 index 8521fc88..00000000 --- a/src/dotnet-bootstrapper/xlf/LocalizableStrings.it.xlf +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/dotnet-bootstrapper/xlf/LocalizableStrings.ja.xlf b/src/dotnet-bootstrapper/xlf/LocalizableStrings.ja.xlf deleted file mode 100644 index a4bdbd56..00000000 --- a/src/dotnet-bootstrapper/xlf/LocalizableStrings.ja.xlf +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/dotnet-bootstrapper/xlf/LocalizableStrings.ko.xlf b/src/dotnet-bootstrapper/xlf/LocalizableStrings.ko.xlf deleted file mode 100644 index dfe7ff8c..00000000 --- a/src/dotnet-bootstrapper/xlf/LocalizableStrings.ko.xlf +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/dotnet-bootstrapper/xlf/LocalizableStrings.pl.xlf b/src/dotnet-bootstrapper/xlf/LocalizableStrings.pl.xlf deleted file mode 100644 index edb8d7de..00000000 --- a/src/dotnet-bootstrapper/xlf/LocalizableStrings.pl.xlf +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/dotnet-bootstrapper/xlf/LocalizableStrings.pt-BR.xlf b/src/dotnet-bootstrapper/xlf/LocalizableStrings.pt-BR.xlf deleted file mode 100644 index 616bbc89..00000000 --- a/src/dotnet-bootstrapper/xlf/LocalizableStrings.pt-BR.xlf +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/dotnet-bootstrapper/xlf/LocalizableStrings.ru.xlf b/src/dotnet-bootstrapper/xlf/LocalizableStrings.ru.xlf deleted file mode 100644 index 8e47a5f3..00000000 --- a/src/dotnet-bootstrapper/xlf/LocalizableStrings.ru.xlf +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/dotnet-bootstrapper/xlf/LocalizableStrings.tr.xlf b/src/dotnet-bootstrapper/xlf/LocalizableStrings.tr.xlf deleted file mode 100644 index 770cdf4a..00000000 --- a/src/dotnet-bootstrapper/xlf/LocalizableStrings.tr.xlf +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/dotnet-bootstrapper/xlf/LocalizableStrings.zh-Hans.xlf b/src/dotnet-bootstrapper/xlf/LocalizableStrings.zh-Hans.xlf deleted file mode 100644 index 1832bb6c..00000000 --- a/src/dotnet-bootstrapper/xlf/LocalizableStrings.zh-Hans.xlf +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/dotnet-bootstrapper/xlf/LocalizableStrings.zh-Hant.xlf b/src/dotnet-bootstrapper/xlf/LocalizableStrings.zh-Hant.xlf deleted file mode 100644 index 4a6c48aa..00000000 --- a/src/dotnet-bootstrapper/xlf/LocalizableStrings.zh-Hant.xlf +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/dotnet-core-uninstall/LocalizableStrings.resx.bak b/src/dotnet-core-uninstall/LocalizableStrings.resx.bak new file mode 100644 index 00000000..43c52582 --- /dev/null +++ b/src/dotnet-core-uninstall/LocalizableStrings.resx.bak @@ -0,0 +1,413 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + You must specify exactly one of: {0}. + + + The specified version is not valid: "{0}". + + + This command is not supported on this operating system. + + + List .NET Core SDKs or Runtimes that can be removed with this tool. + + + .NET Core Runtimes: + + + .NET Core SDKs: + + + You must specify only one of the options: {0}. + + + Required argument missing for the uninstall command. + + + Remove .NET Core Runtimes only. + + + Remove .NET Core SDKs only. + + + The specified version is not found: "{0}". + + + VERSION + + + Remove .NET Core SDKs or Runtimes below the specified version. The specified version will remain. (*) + + + Remove .NET Core SDKs or Runtimes, except the one highest version. (*) + + + VERSIONS + + + Remove .NET Core SDKs or Runtimes, except those specified. (*) + + + Remove .NET Core SDKs or Runtimes superseded by higher patches. Protects global.json. (*) + + + Remove all .NET Core SDKs or Runtimes. (*) + + + Remove .NET Core SDKs or Runtimes marked as previews, except the one highest preview. (*) + + + Remove .NET Core SDKs or Runtimes marked as previews. (*) + + + Timeout during uninstall: {0}. + + + The uninstallation operation failed. Exit code was {1} for "{0}". + + + MAJOR_MINOR + + + Remove .NET Core SDKs or Runtimes that match the specified `major.minor` version. + + + The specified version to uninstall. You may list several versions. Response files are supported. + + + VERSION + + + Remove specified .NET Core SDKs or Runtimes. This tool can only uninstall items that were installed using Visual Studio, .NET Core SDK, or Runtime installers. By default, this tool does not uninstall versions that might be needed for Visual Studio. Read the documentation for the .NET Core Uninstall Tool at https://aka.ms/dotnet-core-uninstall-docs. + + + LEVEL + + + Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]. + + + Can be used with --sdk, --runtime, --aspnet-runtime and --windows-desktop-runtime to remove x64. + + + Can be used with --sdk, --runtime, --aspnet-runtime and --windows-desktop-runtime to remove x86. + + + The current user does not have adequate privileges. See https://aka.ms/dotnet-core-uninstall-docs. + + + You must specify exactly one version for option: {0}. + + + You cannot specify a version for option: {0}. + + + Do not use a version before an option: {0}. + + + Allowed verbosity levels are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]. + + + Uninstalling: {0}. + + + Microsoft .NET Core {0} {1} ({2}) + + + Canceling: waiting for the current uninstall to complete. + + + Remove ASP.NET Core Runtimes only. + + + ASP.NET Core Runtimes: + + + Remove .NET Core Runtime & Hosting Bundles only. + + + .NET Core Runtime & Hosting Bundles: + + + "{0}" is treated as a version {1} in this tool. + + + Remove Windows Desktop Runtimes only. + + + Windows Desktop Runtimes: + + + List Windows Desktop Runtimes. + + + List ASP.NET Core Runtimes. + + + List .NET Core Runtime & Hosting Bundles. + + + List .NET Core Runtimes that can be uninstalled. + + + List .NET Core SDKs that can be uninstalled. + + + List x64 .NET Core SDKs or Runtimes. + + + List x86 .NET Core SDKs or Runtimes. + + + Display .NET Core SDKs and Runtimes that will be removed. + + + Execute the command without requiring y/n confirmation. + + + *** DRY RUN OUTPUT +Specified versions: +{0} +*** END DRY RUN OUTPUT + +To avoid breaking Visual Studio or other problems, read https://aka.ms/dotnet-core-uninstall-docs. + +Run as administrator and use the remove command to uninstall these items. + + + The following items will be removed: +{0} + +To avoid breaking Visual Studio or other problems, read https://aka.ms/dotnet-core-uninstall-docs. + +Do you want to continue? [y/n] + + + Allowed values are "Y", "YES", and "N". + + + Remove the specified .NET Core SDKs or Runtimes. + + + Uninstallation not allowed. This tool cannot uninstall .NET Core SDKs with version {0} or above. + + + +{0}: {1} + +Uninstalling this item will cause Visual Studio to break. + +Are you sure you want to continue? [y/n] + + + +Warning: {0}: {1} +Uninstalling this item will cause Visual Studio to break. + + + + Display .NET Core Uninstall Tool version information. + + + Cannot uninstall version {0} and above + + + Used by Visual Studio{0}. Specify individually or use —-force to remove + + + Force removal of versions that might be used by Visual Studio. + + + Force removal of versions that might be used by Visual Studio for Mac or SDKs. + + + +This tool cannot uninstall versions of the runtime or SDK that are  + - SDKs installed using Visual Studio 2019 Update 3 or later. + - SDKs and runtimes installed via zip/scripts. + - Runtimes installed with SDKs (these should be removed by removing that SDK). +The versions that can be uninstalled with this tool are: + + + + Remove specified .NET Core SDKs or Runtimes. By default, this tool does not uninstall versions that might be needed for SDKs. Read the documentation for the .NET Core Uninstall Tool at https://aka.ms/dotnet-core-uninstall-docs. + + + Used by SDKs. Specify individually or use —-force to remove + + + +This tool cannot uninstall versions of the runtime or SDK that are installed using zip/scripts. The versions that can be uninstalled with this tool are: + + + + (*) Use --preserve-vs-for-mac-sdks to prevent removal of SDKs and Runtimes that have a high probability of being used by Visual Studio for Mac (Note: Visual Studio for Mac is out of support) or SDKs. SDKs and Runtimes are available for download at https://aka.ms/dotnet-core-download. + + + (*) By default, SDKs and Runtimes that have a high probability of being used by Visual Studio are not removed. To remove these, specify them individually or use --force. If removing SDKs or Runtimes causes issues with your installation of Visual Studio, run “Repair”. SDKs and Runtimes are available for download at https://aka.ms/dotnet-core-download. + + + The following items will be removed: +{0} + +For any problems, read https://aka.ms/dotnet-core-uninstall-docs. + +Do you want to continue? [y/n] + + + *** DRY RUN OUTPUT +Specified versions: +{0} +*** END DRY RUN OUTPUT + +For any problems, read https://aka.ms/dotnet-core-uninstall-docs. + +Run as administrator and use the remove command to uninstall these items. + + + +{0}: {1} + +Uninstalling this item will cause Visual Studio for Mac to break. (Note: Visual Studio for Mac is out of support). + +Are you sure you want to continue? [y/n] + + + +Warning: {0}: {1} +Uninstalling this item will cause Visual Studio for to break. + + + + List arm64 .NET Core SDKs or Runtimes. + + + Can be used with --sdk, --runtime, --aspnet-runtime and --windows-desktop-runtime to remove arm64. + + + Prevent removal of SDKs and Runtimes that have a high probability of being used by Visual Studio for Mac (Note: Visual Studio for Mac is out of support). + + + Uninstalling this item will cause Visual Studio for Mac to break. (Note: Visual Studio for Mac is out of support). + + +Friday, November 21, 2025 10:36:45 AM + diff --git a/test/MSBuildBinLogQuery.Tests/Interpret/InterpreterTests.cs b/test/MSBuildBinLogQuery.Tests/Interpret/InterpreterTests.cs deleted file mode 100644 index ad462de3..00000000 --- a/test/MSBuildBinLogQuery.Tests/Interpret/InterpreterTests.cs +++ /dev/null @@ -1,164 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using FluentAssertions; -using Microsoft.Build.Framework; -using Microsoft.Build.Logging.Query.Interpret; -using Microsoft.Build.Logging.Query.Result; -using Xunit; - -namespace Microsoft.Build.Logging.Query.Tests.Interpret -{ - public class InterpreterTests - { - public static IEnumerable GetDataForTestFilter() - { - var testBuild1 = new Result.Build(); - - yield return new object[] - { - "/Project", - testBuild1, - new List() - }; - - yield return new object[] - { - "/Task", - testBuild1, - new List() - }; - - var testBuild2 = new Result.Build(); - var testMessage1_Build2 = new Message("build message 1", testBuild2, MessageImportance.High); - var testMessage2_Build2 = new Message("build message 2", testBuild2, MessageImportance.Low); - testBuild2.AddMessage(testMessage1_Build2); - testBuild2.AddMessage(testMessage2_Build2); - - var testProject1_Build2 = testBuild2.AddProject( - 1, - "./Proj1.csproj", - Enumerable.Empty(), - Enumerable.Empty(), - new Dictionary()); - var testMessage3_Build2 = new Message("project message 1", testProject1_Build2, MessageImportance.Normal); - var testMessage4_Build2 = new Message("project message 2", testProject1_Build2, MessageImportance.Low); - testProject1_Build2.AddMessage(testMessage3_Build2); - testProject1_Build2.AddMessage(testMessage4_Build2); - - var testProject2_Build2 = testBuild2.AddProject( - 2, - "./Proj2.csproj", - Enumerable.Empty(), - Enumerable.Empty(), - new Dictionary()); - var testMessage5_Build2 = new Message("project message 3", testProject2_Build2, MessageImportance.Normal); - testProject2_Build2.AddMessage(testMessage5_Build2); - - var testTarget1_Project2_Build2 = testProject2_Build2.AddTarget(10, "CoreCompile", true); - var testMessage6_Build2 = new Message("target message 1", testTarget1_Project2_Build2, MessageImportance.Low); - testTarget1_Project2_Build2.AddMessage(testMessage6_Build2); - - var testTarget2_Project2_Build2 = testProject2_Build2.AddTarget(11, "Optimize", false); - var testMessage7_Build2 = new Message("target message 2", testTarget2_Project2_Build2, MessageImportance.High); - var testMessage8_Build2 = new Message("target message 3", testTarget2_Project2_Build2, MessageImportance.High); - testTarget2_Project2_Build2.AddMessage(testMessage7_Build2); - testTarget2_Project2_Build2.AddMessage(testMessage8_Build2); - - yield return new object[] - { - "/Message", - testBuild2, - new[] { testMessage1_Build2, testMessage2_Build2 } - }; - - yield return new object[] - { - "//Message", - testBuild2, - new[] - { - testMessage1_Build2, - testMessage2_Build2, - testMessage3_Build2, - testMessage4_Build2, - testMessage5_Build2, - testMessage6_Build2, - testMessage7_Build2, - testMessage8_Build2 - } - }; - - yield return new object[] - { - "/Project/Message", - testBuild2, - new[] { testMessage3_Build2, testMessage4_Build2, testMessage5_Build2 } - }; - - yield return new object[] - { - "/Project[Id=1]/Message", - testBuild2, - new[] { testMessage3_Build2, testMessage4_Build2 } - }; - - yield return new object[] - { - "/Project[Id=2]/Message", - testBuild2, - new[] { testMessage5_Build2 } - }; - - yield return new object[] - { - "/Project[Id=2]//Message", - testBuild2, - new[] { testMessage5_Build2, testMessage6_Build2, testMessage7_Build2, testMessage8_Build2 } - }; - - yield return new object[] - { - "/Target[Id=11]/Message", - testBuild2, - new[] { testMessage7_Build2, testMessage8_Build2 } - }; - - yield return new object[] - { - "/Project", - testBuild2, - new[] { testProject1_Build2, testProject2_Build2 } - }; - - yield return new object[] - { - "/Project[Name=\"Proj1\"]", - testBuild2, - new[] { testProject1_Build2 } - }; - - yield return new object[] - { - "/Project[Name=\"Proj2\"]/Target[Name=\"Optimize\"]", - testBuild2, - new[] { testTarget2_Project2_Build2 } - }; - } - - [Theory] - [MemberData(nameof(GetDataForTestFilter))] - public void TestFilter(string expression, Result.Build build, IList expected) - { - var interpreter = new Interpreter(expression); - var actual = interpreter.Filter(build).ToList(); - - actual.Count.Should().Be(expected.Count); - - for (var i = 0; i < expected.Count; i++) - { - actual[i].Should().Be(expected[i]); - } - } - } -} \ No newline at end of file diff --git a/test/MSBuildBinLogQuery.Tests/MSBuildBinLogQuery.Tests.csproj b/test/MSBuildBinLogQuery.Tests/MSBuildBinLogQuery.Tests.csproj deleted file mode 100644 index ef3792e4..00000000 --- a/test/MSBuildBinLogQuery.Tests/MSBuildBinLogQuery.Tests.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - net8.0 - - false - Exe - - - - - - - - - - - diff --git a/test/MSBuildBinLogQuery.Tests/Parse/ParserTests.cs b/test/MSBuildBinLogQuery.Tests/Parse/ParserTests.cs deleted file mode 100644 index d7da69c0..00000000 --- a/test/MSBuildBinLogQuery.Tests/Parse/ParserTests.cs +++ /dev/null @@ -1,336 +0,0 @@ -using System; -using System.Collections.Generic; -using FluentAssertions; -using Microsoft.Build.Logging.Query.Ast; -using Microsoft.Build.Logging.Query.Parse; -using Microsoft.Build.Logging.Query.Result; -using Xunit; - -namespace Microsoft.Build.Logging.Query.Tests.Parse -{ - public class ParserTests - { - public static IEnumerable GenerateDataForTestParsedAst() - { - yield return new object[] - { - "/message", - new MessageNode(LogNodeType.Direct) - }; - - yield return new object[] - { - "/warning", - new WarningNode(LogNodeType.Direct) - }; - - yield return new object[] - { - "/error", - new ErrorNode(LogNodeType.Direct) - }; - - yield return new object[] - { - "/task", - new ProjectNode(new TargetNode(new TaskNode())) - }; - - yield return new object[] - { - "/target", - new ProjectNode(new TargetNode()) - }; - - yield return new object[] - { - "/project", - new ProjectNode() - }; - - yield return new object[] - { - "/task/message", - new ProjectNode(new TargetNode(new TaskNode(new MessageNode(LogNodeType.Direct)))) - }; - - yield return new object[] - { - "/target/warning", - new ProjectNode(new TargetNode(new WarningNode(LogNodeType.Direct))) - }; - - yield return new object[] - { - "/project/error", - new ProjectNode(new ErrorNode(LogNodeType.Direct)) - }; - - yield return new object[] - { - "/target/task/message", - new ProjectNode(new TargetNode(new TaskNode(new MessageNode(LogNodeType.Direct)))) - }; - - yield return new object[] - { - "/project/task/warning", - new ProjectNode(new TargetNode(new TaskNode(new WarningNode(LogNodeType.Direct)))) - }; - - yield return new object[] - { - "/project/target/task/error", - new ProjectNode(new TargetNode(new TaskNode(new ErrorNode(LogNodeType.Direct)))) - }; - - yield return new object[] - { - "//message", - new MessageNode(LogNodeType.All) - }; - - yield return new object[] - { - "/project//warning", - new ProjectNode(new WarningNode(LogNodeType.All)) - }; - - yield return new object[] - { - "/target/task//error", - new ProjectNode(new TargetNode(new TaskNode(new ErrorNode(LogNodeType.All)))) - }; - - yield return new object[] - { - "/project/task//message", - new ProjectNode(new TargetNode(new TaskNode(new MessageNode(LogNodeType.All)))) - }; - - yield return new object[] - { - "/Task[]", - new ProjectNode(new TargetNode(new TaskNode())) - }; - - yield return new object[] - { - "/Task[ID=341]/Message", - new ProjectNode(new TargetNode(new TaskNode( - new MessageNode(LogNodeType.Direct), - new List> { new IdNode(341) }))) - }; - - yield return new object[] - { - "/Project/Task[id=1, Id=2, ID=3]//Warning", - new ProjectNode(new TargetNode(new TaskNode( - new WarningNode(LogNodeType.All), - new List> - { - new IdNode(1), - new IdNode(2), - new IdNode(3) - }))) - }; - - yield return new object[] - { - "/Target[]", - new ProjectNode(new TargetNode()) - }; - - yield return new object[] - { - "/Target[Id=153]", - new ProjectNode(new TargetNode(new List> { new IdNode(153) })) - }; - - yield return new object[] - { - "/Project/Target[Id=980321]//Error", - new ProjectNode( - new TargetNode( - new ErrorNode(LogNodeType.All), - new List> { new IdNode(980321) })) - }; - - yield return new object[] - { - "/Target[Id=9]/Task[ID=81]/Warning", - new ProjectNode(new TargetNode( - new TaskNode( - new WarningNode(LogNodeType.Direct), - new List> { new IdNode(81) }), - new List> { new IdNode(9) })) - }; - - yield return new object[] - { - "/Project[]", - new ProjectNode() - }; - - yield return new object[] - { - "/Project[Id=536]", - new ProjectNode(new List> { new IdNode(536) }) - }; - - yield return new object[] - { - "/Project[ID=448]/Error", - new ProjectNode( - new ErrorNode(LogNodeType.Direct), - new List> { new IdNode(448) }) - }; - - yield return new object[] - { - "/Project[Id=121]/Task[Id=421]", - new ProjectNode( - new TargetNode( - new TaskNode(new List> { new IdNode(421) })), - new List> { new IdNode(121) }) - }; - - yield return new object[] - { - "/Project[Id=1]/Target[Id=2]/Task[Id=3]//Message", - new ProjectNode( - new TargetNode( - new TaskNode( - new MessageNode(LogNodeType.All), - new List> { new IdNode(3) }), - new List> { new IdNode(2) }), - new List> { new IdNode(1) }) - }; - - yield return new object[] - { - "/Target[Name=\"Compile\"]", - new ProjectNode( - new TargetNode( - new List> { new NameNode("Compile") })) - }; - - yield return new object[] - { - "/Task[Name=\"Message\"]", - new ProjectNode( - new TargetNode( - new TaskNode( - new List> { new NameNode("Message") }))) - }; - - yield return new object[] - { - "/Target[Name=\"Compile\"]//Message", - new ProjectNode( - new TargetNode( - new MessageNode(LogNodeType.All), - new List> { new NameNode("Compile") })) - }; - - yield return new object[] - { - "/Project[Id=1]/Target[Name=\"Compile\"]/Warning", - new ProjectNode( - new TargetNode( - new WarningNode(LogNodeType.Direct), - new List> { new NameNode("Compile") }), - new List> { new IdNode(1) } - ) - }; - - yield return new object[] - { - "/Project[Id=1]/Task[Name=\"Message\"]//Warning", - new ProjectNode( - new TargetNode(new TaskNode( - new WarningNode(LogNodeType.All), - new List> { new NameNode("Message") })), - new List> { new IdNode(1) } - ) - }; - - yield return new object[] - { - "/Project[Name=\"MSBuildBinLogQuery\"]", - new ProjectNode( - new List> { new NameNode("MSBuildBinLogQuery") }) - }; - - yield return new object[] - { - "/Project[Name=\"MSBuildBinLogQuery\"]//Message", - new ProjectNode( - new MessageNode(LogNodeType.All), - new List> { new NameNode("MSBuildBinLogQuery") }) - }; - - yield return new object[] - { - "/Project[Path=\"./Proj1.csproj\"]", - new ProjectNode( - new List> { new PathNode("./Proj1.csproj") }) - }; - - yield return new object[] - { - "/Project[Path=\"./test/Proj1.Tests/Proj1.Tests.csproj\"]/Task[Name=\"ResolveSdk\"]/Warning", - new ProjectNode( - new TargetNode(new TaskNode( - new WarningNode(LogNodeType.Direct), - new List> { new NameNode("ResolveSdk") })), - new List> { new PathNode("./test/Proj1.Tests/Proj1.Tests.csproj") }) - }; - } - - [Theory] - [MemberData(nameof(GenerateDataForTestParsedAst))] - public void TestParsedAst(string expression, IAstNode expectedAst) - { - var actualAst = Parser.Parse(expression); - actualAst.Should().Be(expectedAst); - } - - [Theory] - [InlineData("")] - [InlineData("/")] - [InlineData("//")] - [InlineData("message")] - [InlineData("project/message")] - [InlineData("/warning/")] - [InlineData("/message/project")] - [InlineData("/task/task")] - [InlineData("/project/target/target/task/error")] - [InlineData("/project//target")] - [InlineData("//message/target")] - [InlineData("/project/target/task//warning/task")] - [InlineData("/message/message")] - [InlineData("/warning//error")] - [InlineData("//error/message")] - [InlineData("//warning//message")] - [InlineData("/Task[ID=\"123\"]")] - [InlineData("/Task[ID==123]")] - [InlineData("/Task[ID]")] - [InlineData("/Task[ID=123")] - [InlineData("/Target[Id=\"999\"]/Task")] - [InlineData("/Target[Id,Id=123]")] - [InlineData("/Target[Name=123")] - [InlineData("/Project[[Id=1]]")] - [InlineData("/Project[Name=123]")] - [InlineData("/Project[Path=123]")] - public void TestParsedAstException(string expression) - { - Action action = () => - { - var _ = Parser.Parse(expression); - }; - - action.Should().Throw(expression); - } - } -} \ No newline at end of file diff --git a/test/MSBuildBinLogQuery.Tests/Scan/ScannerTests.cs b/test/MSBuildBinLogQuery.Tests/Scan/ScannerTests.cs deleted file mode 100644 index d224d89b..00000000 --- a/test/MSBuildBinLogQuery.Tests/Scan/ScannerTests.cs +++ /dev/null @@ -1,530 +0,0 @@ -using System; -using System.Collections.Generic; -using FluentAssertions; -using Microsoft.Build.Logging.Query.Scan; -using Microsoft.Build.Logging.Query.Token; -using Xunit; - -namespace Microsoft.Build.Logging.Query.Tests.Scan -{ - public class ScannerTests - { - public static IEnumerable GenerateDataForTestScannedTokens() - { - yield return new object[] - { - "message", - new Token.Token[] - { - MessageToken.Instance - } - }; - - yield return new object[] - { - "Message", - new Token.Token[] - { - MessageToken.Instance - } - }; - - yield return new object[] - { - "MESSAGE", - new Token.Token[] - { - MessageToken.Instance - } - }; - - yield return new object[] - { - "warning", - new Token.Token[] - { - WarningToken.Instance - } - }; - - yield return new object[] - { - "Warning", - new Token.Token[] - { - WarningToken.Instance - } - }; - - yield return new object[] - { - "WARNING", - new Token.Token[] - { - WarningToken.Instance - } - }; - - yield return new object[] - { - "error", - new Token.Token[] - { - ErrorToken.Instance - } - }; - - yield return new object[] - { - "Error", - new Token.Token[] - { - ErrorToken.Instance - } - }; - - yield return new object[] - { - "ERROR", - new Token.Token[] - { - ErrorToken.Instance - } - }; - - yield return new object[] - { - "project", - new Token.Token[] - { - ProjectToken.Instance - } - }; - - yield return new object[] - { - "Project", - new Token.Token[] - { - ProjectToken.Instance - } - }; - - yield return new object[] - { - "PROJECT", - new Token.Token[] - { - ProjectToken.Instance - } - }; - - yield return new object[] - { - "target", - new Token.Token[] - { - TargetToken.Instance - } - }; - - yield return new object[] - { - "Target", - new Token.Token[] - { - TargetToken.Instance - } - }; - - yield return new object[] - { - "TARGET", - new Token.Token[] - { - TargetToken.Instance - } - }; - - yield return new object[] - { - "task", - new Token.Token[] - { - TaskToken.Instance - } - }; - - yield return new object[] - { - "Task", - new Token.Token[] - { - TaskToken.Instance - } - }; - - yield return new object[] - { - "TASK", - new Token.Token[] - { - TaskToken.Instance - } - }; - - yield return new object[] - { - "/", - new Token.Token[] - { - SingleSlashToken.Instance - } - }; - - yield return new object[] - { - "//", - new Token.Token[] - { - DoubleSlashToken.Instance - } - }; - - yield return new object[] - { - "[", - new Token.Token[] - { - LeftBracketToken.Instance - } - }; - - yield return new object[] - { - "]", - new Token.Token[] - { - RightBracketToken.Instance - } - }; - - yield return new object[] - { - "=", - new Token.Token[] - { - EqualToken.Instance - } - }; - - yield return new object[] - { - ",", - new Token.Token[] - { - CommaToken.Instance - } - }; - - yield return new object[] - { - "\"\"", - new Token.Token[] - { - new StringToken("") - } - }; - - yield return new object[] - { - "\"test\"", - new Token.Token[] - { - new StringToken("test") - } - }; - - yield return new object[] - { - "\"hello world\"", - new Token.Token[] - { - new StringToken("hello world") - } - }; - - yield return new object[] - { - "\"'hello world'\"", - new Token.Token[] - { - new StringToken("'hello world'") - } - }; - - yield return new object[] - { - "9", - new Token.Token[] - { - new IntegerToken(9) - } - }; - - yield return new object[] - { - "19980321", - new Token.Token[] - { - new IntegerToken(19980321) - } - }; - - yield return new object[] - { - "0321", - new Token.Token[] - { - new IntegerToken(321) - } - }; - - yield return new object[] - { - "/message", - new Token.Token[] - { - SingleSlashToken.Instance, - MessageToken.Instance - } - }; - - yield return new object[] - { - "/project[]/target/error", - new Token.Token[] - { - SingleSlashToken.Instance, - ProjectToken.Instance, - LeftBracketToken.Instance, - RightBracketToken.Instance, - SingleSlashToken.Instance, - TargetToken.Instance, - SingleSlashToken.Instance, - ErrorToken.Instance - } - }; - - yield return new object[] - { - " / target[ ] / warning", - new Token.Token[] - { - SingleSlashToken.Instance, - TargetToken.Instance, - LeftBracketToken.Instance, - RightBracketToken.Instance, - SingleSlashToken.Instance, - WarningToken.Instance - } - }; - - yield return new object[] - { - "///message////warning/error//", - new Token.Token[] - { - DoubleSlashToken.Instance, - SingleSlashToken.Instance, - MessageToken.Instance, - DoubleSlashToken.Instance, - DoubleSlashToken.Instance, - WarningToken.Instance, - SingleSlashToken.Instance, - ErrorToken.Instance, - DoubleSlashToken.Instance - } - }; - - yield return new object[] - { - "message message", - new Token.Token[] - { - MessageToken.Instance, - MessageToken.Instance - } - }; - - yield return new object[] - { - "messagemessage", - new Token.Token[] - { - MessageToken.Instance, - MessageToken.Instance - } - }; - - yield return new object[] - { - "///////", - new Token.Token[] - { - DoubleSlashToken.Instance, - DoubleSlashToken.Instance, - DoubleSlashToken.Instance, - SingleSlashToken.Instance - } - }; - - yield return new object[] - { - "/project[task] // target /message", - new Token.Token[] - { - SingleSlashToken.Instance, - ProjectToken.Instance, - LeftBracketToken.Instance, - TaskToken.Instance, - RightBracketToken.Instance, - DoubleSlashToken.Instance, - TargetToken.Instance, - SingleSlashToken.Instance, - MessageToken.Instance - } - }; - - yield return new object[] - { - "/Project[Path=\"./project.csproj\"]/Target[Name=\"CoreCompile\"]//Error", - new Token.Token[] - { - SingleSlashToken.Instance, - ProjectToken.Instance, - LeftBracketToken.Instance, - PathToken.Instance, - EqualToken.Instance, - new StringToken("./project.csproj"), - RightBracketToken.Instance, - SingleSlashToken.Instance, - TargetToken.Instance, - LeftBracketToken.Instance, - NameToken.Instance, - EqualToken.Instance, - new StringToken("CoreCompile"), - RightBracketToken.Instance, - DoubleSlashToken.Instance, - ErrorToken.Instance - } - }; - - yield return new object[] - { - "/Target[Name=\"Optimize\"]/Task[Id=81]//Warning", - new Token.Token[] - { - SingleSlashToken.Instance, - TargetToken.Instance, - LeftBracketToken.Instance, - NameToken.Instance, - EqualToken.Instance, - new StringToken("Optimize"), - RightBracketToken.Instance, - SingleSlashToken.Instance, - TaskToken.Instance, - LeftBracketToken.Instance, - IdToken.Instance, - EqualToken.Instance, - new IntegerToken(81), - RightBracketToken.Instance, - DoubleSlashToken.Instance, - WarningToken.Instance - } - }; - - yield return new object[] - { - "/Project[Id=7]/Target[Id=42, Name=\"Link\"]//Message", - new Token.Token[] - { - SingleSlashToken.Instance, - ProjectToken.Instance, - LeftBracketToken.Instance, - IdToken.Instance, - EqualToken.Instance, - new IntegerToken(7), - RightBracketToken.Instance, - SingleSlashToken.Instance, - TargetToken.Instance, - LeftBracketToken.Instance, - IdToken.Instance, - EqualToken.Instance, - new IntegerToken(42), - CommaToken.Instance, - NameToken.Instance, - EqualToken.Instance, - new StringToken("Link"), - RightBracketToken.Instance, - DoubleSlashToken.Instance, - MessageToken.Instance - } - }; - } - - [Theory] - [MemberData(nameof(GenerateDataForTestScannedTokens))] - public void TestScannedTokens(string expression, IList expectedTokens) - { - var scanner = new Scanner(expression); - var actualTokens = new List(); - - for (; !(scanner.Token is EofToken); scanner.ReadNextToken()) - { - actualTokens.Add(scanner.Token); - } - - actualTokens.Count.Should().Be(expectedTokens.Count); - - for (var i = 0; i < actualTokens.Count; i++) - { - actualTokens[i].Should().Be(expectedTokens[i]); - } - } - - [Theory] - [InlineData("\\")] - [InlineData("?")] - [InlineData("()")] - [InlineData("<>")] - [InlineData("hello")] - [InlineData("messages")] - [InlineData("-123456")] - [InlineData("123.456")] - [InlineData("0x123def")] - [InlineData("9876543210")] - [InlineData("/project[]/message?")] - [InlineData("\\project[]\\message")] - [InlineData("/Project[Id=536S]")] - [InlineData("/Project[Identity=123]")] - [InlineData("/Project[Path=HelloWorld]")] - [InlineData("/Target[Id=HelloWorld]")] - [InlineData("/Target[Name=HelloWorld]")] - [InlineData("/Task[Id<123]")] - public void TestScannedTokensException(string expression) - { - Action action = () => - { - var scanner = new Scanner(expression); - - while (!(scanner.Token is EofToken)) - { - scanner.ReadNextToken(); - } - }; - - action.Should().Throw(expression); - } - } -} \ No newline at end of file diff --git a/test/dotnet-bootstrapper.Tests/EndToEndTests.cs b/test/dotnet-bootstrapper.Tests/EndToEndTests.cs deleted file mode 100644 index 5b0456ac..00000000 --- a/test/dotnet-bootstrapper.Tests/EndToEndTests.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using FluentAssertions; -using Microsoft.DotNet.Tools.Bootstrapper.Tests; -using System; -using System.Diagnostics; -using System.IO; -using System.Runtime.InteropServices; -using Xunit; - -namespace Microsoft.DotNet.Tools.Bootstrapper -{ - public class EndToEndBootstrapperTest - { - private readonly static string artifactsDirectory = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..", "..", "artifacts")); - private readonly static string executablePath = Path.Combine(artifactsDirectory, "bin", "dotnet-bootstrapper", TestUtilities.GetConfiguration(), TestUtilities.GetTargetFramework(), TestUtilities.GetRuntimeIdentifier(), - RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "dotnet-bootstrapper.exe" : "dotnet-bootstrapper"); - - [Fact] - internal void ItReturnsZeroOnExit() - { - File.Exists(executablePath).Should().BeTrue($"Expected the executable to exist at {executablePath}" + - $"\nFiles in directory: ${String.Join("\n", Directory.GetDirectories(Directory.GetParent(Directory.GetParent(Directory.GetParent(executablePath).ToString()).ToString()).ToString(), "*", SearchOption.AllDirectories))}"); - - var process = new Process - { - StartInfo = new ProcessStartInfo - { - FileName = executablePath, - RedirectStandardOutput = true, - RedirectStandardError = true, - UseShellExecute = false, - CreateNoWindow = true, - Arguments = "--version" - } - }; - - process.Start(); - process.WaitForExit(); - process.ExitCode.Should().Be(0, "The bootstrapper should exit with a code of 0."); - } - - } -} diff --git a/test/dotnet-bootstrapper.Tests/TestUtilities.cs b/test/dotnet-bootstrapper.Tests/TestUtilities.cs deleted file mode 100644 index 6da7090b..00000000 --- a/test/dotnet-bootstrapper.Tests/TestUtilities.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System; -using System.Runtime.InteropServices; - -namespace Microsoft.DotNet.Tools.Bootstrapper.Tests -{ - static class TestUtilities - { - public static string GetTargetFramework() - { - return "net8.0"; - } - - public static string GetConfiguration() - { -#if DEBUG - return "Debug"; -#elif RELEASE - return "Release"; -#else - return "Custom"; -#endif - } - - public static string GetRuntimeIdentifier() - { - return RuntimeInformation.RuntimeIdentifier; - } - } -} diff --git a/test/dotnet-bootstrapper.Tests/dotnet-bootstrapper.Tests.csproj b/test/dotnet-bootstrapper.Tests/dotnet-bootstrapper.Tests.csproj deleted file mode 100644 index 779abbd0..00000000 --- a/test/dotnet-bootstrapper.Tests/dotnet-bootstrapper.Tests.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - net8.0 - Exe - - - - - - - - - - -