diff --git a/src/CTA.FeatureDetection.AuthType/CTA.FeatureDetection.AuthType.csproj b/src/CTA.FeatureDetection.AuthType/CTA.FeatureDetection.AuthType.csproj index e96a7b7d..9383a73a 100644 --- a/src/CTA.FeatureDetection.AuthType/CTA.FeatureDetection.AuthType.csproj +++ b/src/CTA.FeatureDetection.AuthType/CTA.FeatureDetection.AuthType.csproj @@ -15,7 +15,7 @@ - + diff --git a/src/CTA.FeatureDetection.Common/CTA.FeatureDetection.Common.csproj b/src/CTA.FeatureDetection.Common/CTA.FeatureDetection.Common.csproj index 6b2906ed..49adcd46 100644 --- a/src/CTA.FeatureDetection.Common/CTA.FeatureDetection.Common.csproj +++ b/src/CTA.FeatureDetection.Common/CTA.FeatureDetection.Common.csproj @@ -10,8 +10,7 @@ - - + @@ -19,7 +18,7 @@ - + diff --git a/src/CTA.FeatureDetection.Common/packages.lock.json b/src/CTA.FeatureDetection.Common/packages.lock.json index 69d52b83..12c62bb3 100644 --- a/src/CTA.FeatureDetection.Common/packages.lock.json +++ b/src/CTA.FeatureDetection.Common/packages.lock.json @@ -4,16 +4,14 @@ ".NETCoreApp,Version=v3.1": { "Codelyzer.Analysis": { "type": "Direct", - "requested": "[1.4.5, )", - "resolved": "1.4.5", - "contentHash": "+TS4dnOAeIzlup5OXY2liou7cfhHqEL8lGGqpHbZJmy46FQ/UqGUXhq73J9NPQU0Bssa+z0kVfSuXB3RwcISYg==", + "requested": "[1.4.8-alpha-g29c192f06d, )", + "resolved": "1.4.8-alpha-g29c192f06d", + "contentHash": "Zm5CDILJPLKnip/cIAcLeIwHlcWHzh3FXR+kUd+fr2YgLlQXSUMY2Hw56BW8k/AfNfv15paeRAtR2tbIlVlu3Q==", "dependencies": { - "Codelyzer.Analysis.Build": "1.4.5", - "Codelyzer.Analysis.CSharp": "1.4.5", + "Codelyzer.Analysis.Build": "1.4.8-alpha-g29c192f06d", + "Codelyzer.Analysis.CSharp": "1.4.8-alpha-g29c192f06d", "CommandLineParser": "2.8.0", - "Microsoft.CodeAnalysis.CSharp": "3.6.0", - "Microsoft.Extensions.Logging": "3.1.8", - "Microsoft.Extensions.Logging.Console": "3.1.8" + "Microsoft.Extensions.Logging.Console": "5.0.0" } }, "Microsoft.SourceLink.GitHub": { @@ -28,22 +26,16 @@ }, "Nerdbank.GitVersioning": { "type": "Direct", - "requested": "[3.3.37, )", - "resolved": "3.3.37", - "contentHash": "YlDKV/gSHQGDThWSGqVyPfKeNP/kx1fj/NPFFgGc/cxzgIbXv4jtYOcbFOz3ZIeAKtpCcSAmVNDOikBs3OxI/A==" - }, - "Newtonsoft.Json": { - "type": "Direct", - "requested": "[12.0.3, )", - "resolved": "12.0.3", - "contentHash": "6mgjfnRB4jKMlzHSl+VD+oUc1IebOZabkbyWj2RiTgWwYPPuaK1H97G1sHqGwPlS5npiF5Q0OrxN1wni2n5QWg==" + "requested": "[3.4.194, )", + "resolved": "3.4.194", + "contentHash": "f4V2lLy9G0BnddqGhfaVa+dKsbu8iCiLiUARHKBo0l899MgJdRjVU2C7e29gHrZWxc2HZkq3aq28OHHK7q0/iQ==" }, "Buildalyzer": { "type": "Transitive", - "resolved": "3.0.1", - "contentHash": "WxXxlfoF8O2El7AN4CWshL3+L7em7yAT/MiOX+eySG2dzsdLw1/5z75xEuSOt1kvJtQce3xpIzr+z4g02aJ3wQ==", + "resolved": "3.2.0", + "contentHash": "clK8nODLS0tuvhXi8tLAPsC4dZn2LLpCjmXh8xjDKsNc53JRCNff/KX0gjFtFUCxNfLdqAe4zY5JCREqtgfYiA==", "dependencies": { - "Buildalyzer.Logger": "3.0.1", + "Buildalyzer.Logger": "3.2.0", "MSBuild.StructuredLogger": "2.1.133", "Microsoft.Build": "16.5.0", "Microsoft.Build.Framework": "16.5.0", @@ -58,66 +50,61 @@ }, "Buildalyzer.Logger": { "type": "Transitive", - "resolved": "3.0.1", - "contentHash": "L6Y8hXDTGJUyNivg5DCgH36r/dwknJa5J05iT6IYyQZgOzQLDAWuXODUAaL7FPR2+43cSp0ioja0p/fhDF5Y+g==", + "resolved": "3.2.0", + "contentHash": "ag6y+Tu5nOg0U0g1LOwdvV3AXNqu40k0C0qPk5MYlnqP99PEL9+7ypHntJ+jyj25Aps1E0X+B6uAtGEm1qkJ0g==", "dependencies": { "NETStandard.Library": "1.6.1" } }, "Buildalyzer.Workspaces": { "type": "Transitive", - "resolved": "3.0.1", - "contentHash": "qcxVhrS2jyKABZBSRQSgK7PKL68/M6xgfoJIegI6crgnI1PxaeQUGV+tzAypl1L40KpcZjIbPcuDjDIT9f/TOA==", + "resolved": "3.2.0", + "contentHash": "wanixUMfeQznxMogHaensmiqjVaC5IC68ZpGfpBt0MOFae6qJpVWvW8jd85nUFYVUSdn9zZLW66iJL2FkEVAYQ==", "dependencies": { - "Buildalyzer": "3.0.1", - "Microsoft.CodeAnalysis.CSharp.Workspaces": "3.6.0", - "Microsoft.CodeAnalysis.VisualBasic.Workspaces": "3.6.0" + "Buildalyzer": "3.2.0", + "Microsoft.CodeAnalysis.CSharp.Workspaces": "3.8.0", + "Microsoft.CodeAnalysis.VisualBasic.Workspaces": "3.8.0" } }, "Codelyzer.Analysis.Build": { "type": "Transitive", - "resolved": "1.4.5", - "contentHash": "h2TOa0B8zH+Yva2NEWW1zDzXQCktv2ZZST2uaSXz16DNSJmbxSRHyv5NHhxNXO9gurVFEOMShKJtOCBJBXcoGQ==", + "resolved": "1.4.8-alpha-g29c192f06d", + "contentHash": "GocGFZ9s0QCdj47Jx5d91anqF6LYTfSOZOK8lMVLD51fCH2oqfitNSAlIx4tYRa9rJVPDB60tUGjA64vX77NpA==", "dependencies": { - "Buildalyzer": "3.0.1", - "Buildalyzer.Logger": "3.0.1", - "Buildalyzer.Workspaces": "3.0.1", - "Codelyzer.Analysis.CSharp": "1.4.5", - "Microsoft.CodeAnalysis.CSharp": "3.6.0", - "Microsoft.Extensions.Logging": "3.1.8", - "NuGet.Packaging": "5.7.0" + "Buildalyzer": "3.2.0", + "Buildalyzer.Logger": "3.2.0", + "Buildalyzer.Workspaces": "3.2.0", + "Codelyzer.Analysis.CSharp": "1.4.8-alpha-g29c192f06d", + "Microsoft.Extensions.Logging": "5.0.0", + "NuGet.Packaging": "5.9.1" } }, "Codelyzer.Analysis.Common": { "type": "Transitive", - "resolved": "1.4.5", - "contentHash": "CW+5i13fl79P9xCQs0DJznvwoMjL4aZRHID0u0U5fi07jWvItFbayWovzjs0LSJpgwopSTMeJfRjPfSxIH1iGw==", + "resolved": "1.4.8-alpha-g29c192f06d", + "contentHash": "ySXN66Xqishw0PDYk6hDm/8dz5wmZ6jUJegdIbSWQw7krfJJl/1ZKlM+/5LvcXsjL4HJ9lG3q5jVliBj/xb/Tg==", "dependencies": { - "Codelyzer.Analysis.Model": "1.4.5", - "Microsoft.CodeAnalysis.Common": "3.6.0", - "Microsoft.Extensions.Logging": "3.1.8", - "Newtonsoft.Json": "12.0.3" + "Codelyzer.Analysis.Model": "1.4.8-alpha-g29c192f06d", + "Newtonsoft.Json": "13.0.1" } }, "Codelyzer.Analysis.CSharp": { "type": "Transitive", - "resolved": "1.4.5", - "contentHash": "L3sPvfANfqyIeo+DtZDHllf3vPOUKkbZKGnMO1/aY/45crmMLJl70ankAyfNd5BEqF8zA5cyV1ShRY6kgzHu0A==", + "resolved": "1.4.8-alpha-g29c192f06d", + "contentHash": "pwDqA7pQ5y0T2LVqOajIunp8vKnWNltB4M5yYB0N4dDId81Wo9oKooxydICytWzrXH3flC4gPyR4BqTb4g+n2A==", "dependencies": { - "Codelyzer.Analysis.Common": "1.4.5", - "Codelyzer.Analysis.Model": "1.4.5", - "Microsoft.CodeAnalysis.CSharp": "3.6.0", - "Microsoft.Extensions.Logging": "3.1.8" + "Codelyzer.Analysis.Common": "1.4.8-alpha-g29c192f06d", + "Codelyzer.Analysis.Model": "1.4.8-alpha-g29c192f06d" } }, "Codelyzer.Analysis.Model": { "type": "Transitive", - "resolved": "1.4.5", - "contentHash": "jbKSuAPdTNTrqS9W0CMyKBmvYAriJv82hlK4bKNcyevzuL5+yZruzSleQJ2QPnIDOx+FWWOixqJSsKhr5Ikbag==", + "resolved": "1.4.8-alpha-g29c192f06d", + "contentHash": "ta4vC/pAYmG1xzmZN8Jv2a4mMyvgieHrl0e3tArrk0W0ISeoOnceqGGXSrS9nDqsz8fVINC5bZMZQ4pL0zXmxA==", "dependencies": { - "Microsoft.CodeAnalysis.Common": "3.6.0", - "Microsoft.Extensions.Logging": "3.1.8", - "Newtonsoft.Json": "12.0.3" + "Microsoft.CodeAnalysis.CSharp": "3.8.0", + "Microsoft.Extensions.Logging": "5.0.0", + "Newtonsoft.Json": "13.0.1" } }, "CommandLineParser": { @@ -135,8 +122,8 @@ }, "Microsoft.Bcl.AsyncInterfaces": { "type": "Transitive", - "resolved": "1.1.0", - "contentHash": "1Am6l4Vpn3/K32daEqZI+FFr96OlZkgwK2LcT3pZ2zWubR5zTPW3/FkO1Rat9kb7oQOa4rxgl9LJHc5tspCWfg==" + "resolved": "1.1.1", + "contentHash": "yuvf07qFWFqtK3P/MRkEKLhn5r2UbSpVueRziSqj0yJQIKFwG1pq9mOayK3zE5qZCTs0CbrwL9M6R8VwqyGy2w==" }, "Microsoft.Build": { "type": "Transitive", @@ -207,62 +194,62 @@ }, "Microsoft.CodeAnalysis.Common": { "type": "Transitive", - "resolved": "3.6.0", - "contentHash": "jQxDeYyQbNZwx/9O8hiyApTqZ7+KR3xVA6Ogbb50qsODfjAKRWuH7z3lGkU/62PYUz4yiDtgXlRtntWNdhFPfQ==", + "resolved": "3.8.0", + "contentHash": "8YTZ7GpsbTdC08DITx7/kwV0k4SC6cbBAFqc13cOm5vKJZcEIAh51tNSyGSkWisMgYCr96B2wb5Zri1bsla3+g==", "dependencies": { "Microsoft.CodeAnalysis.Analyzers": "3.0.0", - "System.Collections.Immutable": "1.5.0", - "System.Memory": "4.5.3", - "System.Reflection.Metadata": "1.6.0", - "System.Runtime.CompilerServices.Unsafe": "4.7.0", + "System.Collections.Immutable": "5.0.0", + "System.Memory": "4.5.4", + "System.Reflection.Metadata": "5.0.0", + "System.Runtime.CompilerServices.Unsafe": "4.7.1", "System.Text.Encoding.CodePages": "4.5.1", - "System.Threading.Tasks.Extensions": "4.5.3" + "System.Threading.Tasks.Extensions": "4.5.4" } }, "Microsoft.CodeAnalysis.CSharp": { "type": "Transitive", - "resolved": "3.6.0", - "contentHash": "kflVAdezWxqIfKNvEi4cmWZchX0Cgm3bRk1asYSnAQWQPTMddecrHzb9D8+ZDfYUeyYKkF4DETwjmONeSChCqA==", + "resolved": "3.8.0", + "contentHash": "hKqFCUSk9TIMBDjiYMF8/ZfK9p9mzpU+slM73CaCHu4ctfkoqJGHLQhyT8wvrYsIg+ufrUWBF8hcJYmyr5rc5Q==", "dependencies": { - "Microsoft.CodeAnalysis.Common": "[3.6.0]" + "Microsoft.CodeAnalysis.Common": "[3.8.0]" } }, "Microsoft.CodeAnalysis.CSharp.Workspaces": { "type": "Transitive", - "resolved": "3.6.0", - "contentHash": "HpMIxUIaHOJ5Vmy5RFnq/itS563FXZdXlsSf8bHU3urrKnOdVkQZ5fktCIxGD5RG6kG/WbPEi0eW18jE2J5/zw==", + "resolved": "3.8.0", + "contentHash": "rdEBvPWqe/IIscsnp7OkZ4tQin8khxBcSLyV9tU+sHdw9uW9U0GKL+Dv2rD4voC1bZBaO18Hp+m4Vkyfmaz0OA==", "dependencies": { "Humanizer.Core": "2.2.0", - "Microsoft.CodeAnalysis.CSharp": "[3.6.0]", - "Microsoft.CodeAnalysis.Common": "[3.6.0]", - "Microsoft.CodeAnalysis.Workspaces.Common": "[3.6.0]" + "Microsoft.CodeAnalysis.CSharp": "[3.8.0]", + "Microsoft.CodeAnalysis.Common": "[3.8.0]", + "Microsoft.CodeAnalysis.Workspaces.Common": "[3.8.0]" } }, "Microsoft.CodeAnalysis.VisualBasic": { "type": "Transitive", - "resolved": "3.6.0", - "contentHash": "ZS9FhxIut643uKyf9gOjTdwJNENa4pqcbUSS4herYjp8lvYsXOa7QgazySHcNCAut4/SlYgvydpGZgwoasD7vw==", + "resolved": "3.8.0", + "contentHash": "G3/0o6sb9ZZQjBD+6bHj7GaxyeMZbBJXNtBC6YGmbSodMup9A1QPgCSrSn/ktbxWjKI8AMlJHP6CHCwfBXTmpg==", "dependencies": { - "Microsoft.CodeAnalysis.Common": "[3.6.0]" + "Microsoft.CodeAnalysis.Common": "[3.8.0]" } }, "Microsoft.CodeAnalysis.VisualBasic.Workspaces": { "type": "Transitive", - "resolved": "3.6.0", - "contentHash": "Evddkuon+vbcjApMg8+xt96/67nw/YSwg4c1tx4r7YYWzthz+IfgIamSdRi4P+3Du3LnIlsGo2MFxo36hIWFhg==", + "resolved": "3.8.0", + "contentHash": "qBkq9WB7NLdMf65FJ7HkoGlZbr8G7QYI5jtJsqBzHbF5RUclKHRmpQwLq2RgcyLQY8qGpBPDbJX9OMG3+VOlvA==", "dependencies": { - "Microsoft.CodeAnalysis.Common": "[3.6.0]", - "Microsoft.CodeAnalysis.VisualBasic": "[3.6.0]", - "Microsoft.CodeAnalysis.Workspaces.Common": "[3.6.0]" + "Microsoft.CodeAnalysis.Common": "[3.8.0]", + "Microsoft.CodeAnalysis.VisualBasic": "[3.8.0]", + "Microsoft.CodeAnalysis.Workspaces.Common": "[3.8.0]" } }, "Microsoft.CodeAnalysis.Workspaces.Common": { "type": "Transitive", - "resolved": "3.6.0", - "contentHash": "DmaIzcx9cpZMY97SH0IDfEsq/QujuvnC0nNDAskOO8zFKxKTaZJw8/jKV/nPUk3OgpOAP1ypaz9VborDfnSf+g==", + "resolved": "3.8.0", + "contentHash": "GPYVydsmOmScOWDJA1LFky7/MkoXpx1JI3lZJShxC+bvVUvL9zVKE8WDZMLsYJ5MAbry2xkZftdfeMpZ+kvLDQ==", "dependencies": { - "Microsoft.Bcl.AsyncInterfaces": "1.1.0", - "Microsoft.CodeAnalysis.Common": "[3.6.0]", + "Microsoft.Bcl.AsyncInterfaces": "1.1.1", + "Microsoft.CodeAnalysis.Common": "[3.8.0]", "System.Composition": "1.0.31" } }, @@ -490,8 +477,8 @@ }, "Namotion.Reflection": { "type": "Transitive", - "resolved": "1.0.14", - "contentHash": "wuJGiFvGfehH2w7jAhMbCJt0/rvUuHyqSZn0sMhNTviDfBZRyX8LFlR/ndQcofkGWulPDfH5nKYTeGXE8xBHPA==", + "resolved": "1.0.19", + "contentHash": "+eY1uabKkJEvjfHvr8uHLB1lvrb8S+akpXOe6fKMLTeZEMYIQywFL0/5+zrpNFklJIYzaEoApw2p3zFx357LjQ==", "dependencies": { "Microsoft.CSharp": "4.3.0" } @@ -547,56 +534,58 @@ "System.Xml.XDocument": "4.3.0" } }, + "Newtonsoft.Json": { + "type": "Transitive", + "resolved": "13.0.1", + "contentHash": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==" + }, "NJsonSchema": { "type": "Transitive", - "resolved": "10.3.1", - "contentHash": "k5ptrRSxMy1lZXxU7dXW2Gy9Q7uPufSGtb609tfuFdo+w45UMHdBolvbWeEq482BPXhYfoBZ2uNzjJgcny2o3g==", + "resolved": "10.4.1", + "contentHash": "XzOfrW2QRS7B6/Z4dVfXXta740oVXvonV2W3OXfhzW+g5tF5FXzwtgseR2vBOf0c6LvLNcR4Wj4vop8uqiSIJA==", "dependencies": { - "Namotion.Reflection": "1.0.14", + "Namotion.Reflection": "1.0.19", "Newtonsoft.Json": "9.0.1" } }, "NuGet.Common": { "type": "Transitive", - "resolved": "5.7.0", - "contentHash": "KJa+Bh4oWVUMe8AVvooCTCEX16C62BMoECK1qDRHKQMkaredcx1zXwcEwoJgsn9h7b/eq0GUk+UOXd/a+jj4TA==", + "resolved": "5.9.1", + "contentHash": "BRX0V8k8QXcEWL33V2HcBU1+eu/Qp5LDJlheYFSZ03hKjlHVHFfLquvUUYLgSNO7tiBxCFe7pTSgO4XanyzteQ==", "dependencies": { - "NuGet.Frameworks": "5.7.0", - "System.Diagnostics.Process": "4.3.0", - "System.Threading.Thread": "4.3.0" + "NuGet.Frameworks": "5.9.1" } }, "NuGet.Configuration": { "type": "Transitive", - "resolved": "5.7.0", - "contentHash": "vMENBdcf2fCy/om4jGYcEEwPDNYfOhHVIisl0uzVPEUVQav6NIu8su7x13YC3Ke2gpfw33iLY2J0gvulvDu0aw==", + "resolved": "5.9.1", + "contentHash": "dpjLDYEuhR1J8L3s9c1qVHEBaWqFI2/x3qRmhqVYDLB5B9ETVe1jVkxLkFQreQVgh+N5cVgtZWx1jGuArj7QaQ==", "dependencies": { - "NuGet.Common": "5.7.0", - "System.Security.Cryptography.ProtectedData": "4.3.0" + "NuGet.Common": "5.9.1", + "System.Security.Cryptography.ProtectedData": "4.4.0" } }, "NuGet.Frameworks": { "type": "Transitive", - "resolved": "5.7.0", - "contentHash": "7Q/wUoB3jCBcq9zoBOBGHFhe78C13jViPmvjvzTwthVV8DAjMfpXnqAYtgwdaRLJMkTXrtdLxfPBIFFhmlsnIQ==" + "resolved": "5.9.1", + "contentHash": "LuJA875MQpPMdik6KUsDUnEDSXWX+T/sExFikA0A5zGFkEW37weP5b6NxljWlrw4UNOWTgmTeumm802Jwz20sw==" }, "NuGet.Packaging": { "type": "Transitive", - "resolved": "5.7.0", - "contentHash": "sDGJDRDiuZPC0W7Z2mntNa/Ak1EZC13BPSk447iFVkhU4aJ1JF0jAhT9EKMixLbeDAyHTONrRXM6nSbTiV1WmQ==", + "resolved": "5.9.1", + "contentHash": "deaGBf7KGllJxXZ0u2gQkoQuvMhbJhntUwJZcmlA5fZdAhw6SsDgaRG0bW4x4dX4K09Bxqhh8pfow/0AP0ke7Q==", "dependencies": { "Newtonsoft.Json": "9.0.1", - "NuGet.Configuration": "5.7.0", - "NuGet.Versioning": "5.7.0", - "System.Dynamic.Runtime": "4.3.0", - "System.Security.Cryptography.Cng": "5.0.0-preview.3.20214.6", - "System.Security.Cryptography.Pkcs": "5.0.0-preview.3.20214.6" + "NuGet.Configuration": "5.9.1", + "NuGet.Versioning": "5.9.1", + "System.Security.Cryptography.Cng": "5.0.0", + "System.Security.Cryptography.Pkcs": "5.0.0" } }, "NuGet.Versioning": { "type": "Transitive", - "resolved": "5.7.0", - "contentHash": "wS84PkpHd7V+HWdNiehlWnQ5tnqtlJakXVXovskdrnTJVTUf/IU4tJ2vvVfwdLyES5Z1CxkMmkh7Qmx2Wp2zzQ==" + "resolved": "5.9.1", + "contentHash": "I/2Z/dAcV6tz8Bri9lYbcMoq6R9J1J8Vv23gDCAnWjwrIdwunhmnWgiZx/b7cmlEXaD1r0kxen18fXYoyqs4rg==" }, "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", @@ -759,8 +748,8 @@ }, "System.Collections.Immutable": { "type": "Transitive", - "resolved": "1.5.0", - "contentHash": "EXKiDFsChZW0RjrZ4FYHu9aW6+P4MCgEDCklsVseRfhoO0F+dXeMSsMRAlVXIo06kGJ/zv+2w1a2uc2+kxxSaQ==" + "resolved": "5.0.0", + "contentHash": "FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==" }, "System.Composition": { "type": "Transitive", @@ -885,34 +874,6 @@ "resolved": "5.0.0", "contentHash": "tCQTzPsGZh/A9LhhA6zrqCRV4hOHsK90/G7q3Khxmn6tnB1PuNU0cRaKANP2AWcF9bn0zsuOoZOSrHuJk6oNBA==" }, - "System.Diagnostics.Process": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "J0wOX07+QASQblsfxmIMFc9Iq7KTXYL3zs2G/Xc704Ylv3NpuVdo6gij6V3PGiptTxqsK0K7CdXenRvKUnkA2g==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.Win32.Primitives": "4.3.0", - "Microsoft.Win32.Registry": "4.3.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Thread": "4.3.0", - "System.Threading.ThreadPool": "4.3.0", - "runtime.native.System": "4.3.0" - } - }, "System.Diagnostics.Tools": { "type": "Transitive", "resolved": "4.3.0", @@ -970,6 +931,11 @@ "System.Threading": "4.3.0" } }, + "System.Formats.Asn1": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "MTvUIktmemNB+El0Fgw9egyqT9AYSIk6DTJeoDSpc3GIHxHCMo8COqkWT1mptX5tZ1SlQ6HJZ0OsSvMth1c12w==" + }, "System.Globalization": { "type": "Transitive", "resolved": "4.3.0", @@ -1132,8 +1098,8 @@ }, "System.Memory": { "type": "Transitive", - "resolved": "4.5.3", - "contentHash": "3oDzvc/zzetpTKWMShs1AADwZjQ/36HnsufHRPcOjyRAAMLDlu2iD33MBI2opxnezcVUtXyqDXXjoFMOU9c7SA==" + "resolved": "4.5.4", + "contentHash": "1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==" }, "System.Net.Http": { "type": "Transitive", @@ -1262,8 +1228,11 @@ }, "System.Reflection.Metadata": { "type": "Transitive", - "resolved": "1.6.0", - "contentHash": "COC1aiAJjCoA5GBF+QKL2uLqEBew4JsCkQmoHKbN3TlOZKa2fKLz5CpiRQKDz0RsAOEGsVKqOD5bomsXq/4STQ==" + "resolved": "5.0.0", + "contentHash": "5NecZgXktdGg34rh1OenY1rFNDCI8xSjFr+Z4OU4cU06AQHUdRnIIEeWENu3Wl4YowbzkymAIMvi3WyK9U53pQ==", + "dependencies": { + "System.Collections.Immutable": "5.0.0" + } }, "System.Reflection.Primitives": { "type": "Transitive", @@ -1321,8 +1290,8 @@ }, "System.Runtime.CompilerServices.Unsafe": { "type": "Transitive", - "resolved": "4.7.0", - "contentHash": "IpU1lcHz8/09yDr9N+Juc7SCgNUz+RohkCQI+KsWKR67XxpFr8Z6c8t1iENCXZuRuNCc4HBwme/MDHNVCwyAKg==" + "resolved": "4.7.1", + "contentHash": "zOHkQmzPCn5zm/BH+cxC1XbUS3P4Yoi3xzW7eRgVpDR2tPGSzyMZ17Ig1iRkfJuY0nhxkQQde8pgePNiA7z7TQ==" }, "System.Runtime.Extensions": { "type": "Transitive", @@ -1438,8 +1407,11 @@ }, "System.Security.Cryptography.Cng": { "type": "Transitive", - "resolved": "5.0.0-preview.3.20214.6", - "contentHash": "dqufaGuwo4a3yhe49TuH0ZCSCAktOAkbSMCpH2JcGHBxJzy8h1q4RVM5p2XzshduIRXn646ipkKg9qPIEnjr6g==" + "resolved": "5.0.0", + "contentHash": "jIMXsKn94T9JY7PvPq/tMfqa6GAaHpElRDpmG+SuL+D3+sTw2M8VhnibKnN8Tq+4JqbPJ/f+BwtLeDMEnzAvRg==", + "dependencies": { + "System.Formats.Asn1": "5.0.0" + } }, "System.Security.Cryptography.Csp": { "type": "Transitive", @@ -1502,10 +1474,11 @@ }, "System.Security.Cryptography.Pkcs": { "type": "Transitive", - "resolved": "5.0.0-preview.3.20214.6", - "contentHash": "wg02cS0DJRtdcYF0N0hRjY7WCFWFZXZyOXNvJeWD0SSFk6zrrp1t3iFVfRcHg2vIJ/q5NFcXVRvS6TLbSWxdzw==", + "resolved": "5.0.0", + "contentHash": "9TPLGjBCGKmNvG8pjwPeuYy0SMVmGZRwlTZvyPHDbYv/DRkoeumJdfumaaDNQzVGMEmbWtg07zUpSW9q70IlDQ==", "dependencies": { - "System.Security.Cryptography.Cng": "5.0.0-preview.3.20214.6" + "System.Formats.Asn1": "5.0.0", + "System.Security.Cryptography.Cng": "5.0.0" } }, "System.Security.Cryptography.Primitives": { @@ -1524,15 +1497,8 @@ }, "System.Security.Cryptography.ProtectedData": { "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "qBUHUk7IqrPHY96THHTa1akCxw0GsNFpsk3XFHbi0A0tMUDBpQprtY1Tbl6yaS1x4c96ilcXU8PocYtmSmkaQQ==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0" - } + "resolved": "4.4.0", + "contentHash": "cJV7ScGW7EhatRsjehfvvYVBvtiSMKgN8bOVI0bQhnF5bU7vnHVIsH49Kva7i7GWaWYvmEzkYVk1TC+gZYBEog==" }, "System.Security.Cryptography.X509Certificates": { "type": "Transitive", @@ -1664,24 +1630,15 @@ }, "System.Threading.Tasks.Extensions": { "type": "Transitive", - "resolved": "4.5.3", - "contentHash": "+MvhNtcvIbqmhANyKu91jQnvIRVSTiaOiFNfKWwXGHG48YAb4I/TyH8spsySiPYla7gKal5ZnF3teJqZAximyQ==" + "resolved": "4.5.4", + "contentHash": "zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==" }, "System.Threading.Thread": { "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "OHmbT+Zz065NKII/ZHcH9XO1dEuLGI1L2k7uYss+9C1jLxTC9kTZZuzUOyXHayRk+dft9CiDf3I/QZ0t8JKyBQ==", - "dependencies": { - "System.Runtime": "4.3.0" - } - }, - "System.Threading.ThreadPool": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "k/+g4b7vjdd4aix83sTgC9VG6oXYKAktSfNIJUNGxPEj7ryEOfzHHhfnmsZvjxawwcD9HyWXKCXmPjX8U4zeSw==", + "resolved": "4.0.0", + "contentHash": "gIdJqDXlOr5W9zeqFErLw3dsOsiShSCYtF9SEHitACycmvNvY8odf9kiKvp6V7aibc8C4HzzNBkWXjyfn7plbQ==", "dependencies": { - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" + "System.Runtime": "4.1.0" } }, "System.Threading.Timer": { @@ -1741,7 +1698,7 @@ "Microsoft.Extensions.Logging": "5.0.0", "Microsoft.Extensions.Logging.Abstractions": "5.0.0", "Microsoft.Extensions.Logging.Console": "5.0.0", - "NJsonSchema": "10.3.1" + "NJsonSchema": "10.4.1" } } } diff --git a/src/CTA.FeatureDetection.Load/CTA.FeatureDetection.Load.csproj b/src/CTA.FeatureDetection.Load/CTA.FeatureDetection.Load.csproj index c74c2f6a..665f3bf8 100644 --- a/src/CTA.FeatureDetection.Load/CTA.FeatureDetection.Load.csproj +++ b/src/CTA.FeatureDetection.Load/CTA.FeatureDetection.Load.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/CTA.FeatureDetection.ProjectType/CTA.FeatureDetection.ProjectType.csproj b/src/CTA.FeatureDetection.ProjectType/CTA.FeatureDetection.ProjectType.csproj index 11981606..32ca1e25 100644 --- a/src/CTA.FeatureDetection.ProjectType/CTA.FeatureDetection.ProjectType.csproj +++ b/src/CTA.FeatureDetection.ProjectType/CTA.FeatureDetection.ProjectType.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/CTA.FeatureDetection/CTA.FeatureDetection.csproj b/src/CTA.FeatureDetection/CTA.FeatureDetection.csproj index cc6c8f9b..fc804cff 100644 --- a/src/CTA.FeatureDetection/CTA.FeatureDetection.csproj +++ b/src/CTA.FeatureDetection/CTA.FeatureDetection.csproj @@ -14,7 +14,7 @@ - + diff --git a/src/CTA.Rules.Actions/ActionsLoader.cs b/src/CTA.Rules.Actions/ActionsLoader.cs index 422f853a..c4647b97 100644 --- a/src/CTA.Rules.Actions/ActionsLoader.cs +++ b/src/CTA.Rules.Actions/ActionsLoader.cs @@ -216,8 +216,8 @@ public Func G public Func GetProjectLevelActions(string name, dynamic value) => GetAction> (projectLevelActions, projectLevelObject, name, value); - public Func, Dictionary, List, string> GetProjectFileActions(string name, dynamic value) => - GetAction, Dictionary, List, string>> + public Func, Dictionary, List, List, string> GetProjectFileActions(string name, dynamic value) => + GetAction, Dictionary, List, List, string>> (projectFileActions, projectFileObject, name, value); public Func GetElementAccessExpressionActions(string name, dynamic value) => GetAction> diff --git a/src/CTA.Rules.Actions/CTA.Rules.Actions.csproj b/src/CTA.Rules.Actions/CTA.Rules.Actions.csproj index c48f9b4a..c39c6833 100644 --- a/src/CTA.Rules.Actions/CTA.Rules.Actions.csproj +++ b/src/CTA.Rules.Actions/CTA.Rules.Actions.csproj @@ -19,7 +19,7 @@ - + diff --git a/src/CTA.Rules.Actions/ClassActions.cs b/src/CTA.Rules.Actions/ClassActions.cs index 427e3375..f6268973 100644 --- a/src/CTA.Rules.Actions/ClassActions.cs +++ b/src/CTA.Rules.Actions/ClassActions.cs @@ -45,7 +45,15 @@ public Func Get { ClassDeclarationSyntax AddBaseClass(SyntaxGenerator syntaxGenerator, ClassDeclarationSyntax node) { - node = (ClassDeclarationSyntax)syntaxGenerator.AddBaseType(node, SyntaxFactory.ParseName(baseClass)); + if (syntaxGenerator != null) + { + node = (ClassDeclarationSyntax)syntaxGenerator.AddBaseType(node, SyntaxFactory.ParseName(baseClass)); + } + else + { + var baseType = SyntaxFactory.SimpleBaseType(SyntaxFactory.ParseTypeName(baseClass)); + node = node.AddBaseListTypes(baseType); + } return node; } return AddBaseClass; diff --git a/src/CTA.Rules.Actions/ProjectFileActions.cs b/src/CTA.Rules.Actions/ProjectFileActions.cs index 37844d5b..8c3fda53 100644 --- a/src/CTA.Rules.Actions/ProjectFileActions.cs +++ b/src/CTA.Rules.Actions/ProjectFileActions.cs @@ -11,18 +11,17 @@ namespace CTA.Rules.Actions /// public class ProjectFileActions { - public Func, Dictionary, List, string> GetMigrateProjectFileAction(string _) + public Func, Dictionary, List, List, string> GetMigrateProjectFileAction(string _) { static string func -(string projectDir, ProjectType projectType, List targetVersion, Dictionary packageReferences, List projectReferences) +(string projectDir, ProjectType projectType, List targetVersion, Dictionary packageReferences, List projectReferences, List metaReferences) { ProjectFileCreator projectFileCreator = new ProjectFileCreator(projectDir, targetVersion, - packageReferences, projectReferences.ToList(), projectType); + packageReferences, projectReferences.ToList(), projectType, metaReferences); var result = projectFileCreator.Create(); return result ? "Project file created" : string.Empty; } - return func; } } diff --git a/src/CTA.Rules.Analysis/CTA.Rules.Analysis.csproj b/src/CTA.Rules.Analysis/CTA.Rules.Analysis.csproj index e3cb47d3..d78a5542 100644 --- a/src/CTA.Rules.Analysis/CTA.Rules.Analysis.csproj +++ b/src/CTA.Rules.Analysis/CTA.Rules.Analysis.csproj @@ -18,7 +18,7 @@ - + diff --git a/src/CTA.Rules.Analysis/RulesAnalysis.cs b/src/CTA.Rules.Analysis/RulesAnalysis.cs index 612bc780..270452c0 100644 --- a/src/CTA.Rules.Analysis/RulesAnalysis.cs +++ b/src/CTA.Rules.Analysis/RulesAnalysis.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -47,6 +48,31 @@ public ProjectActions Analyze() return _projectActions; } + public ProjectActions AnalyzeFiles(ProjectActions projectActions, List updatedFiles) + { + var options = new ParallelOptions() { MaxDegreeOfParallelism = Constants.ThreadCount }; + var selectedSourceFileResults = _sourceFileResults.Where(s => updatedFiles.Contains(s.FileFullPath)); + + Parallel.ForEach(selectedSourceFileResults, options, result => + { + var fileAction = new FileActions() { FilePath = result.FileFullPath }; + + if (AnalyzeChildren(fileAction, result.Children, 0)) + { + var existingFileAction = _projectActions.FileActions.FirstOrDefault(f => f.FilePath == fileAction.FilePath); + if (existingFileAction != null) + { + existingFileAction = fileAction; + } + else + { + _projectActions.FileActions.Add(fileAction); + } + } + }); + return _projectActions; + } + /// /// Analyzes children of nodes in a particular file /// @@ -523,6 +549,10 @@ private void AddNamedActions(FileActions fileAction, NodeToken token, string ide { var nodeToken = token.Clone(); nodeToken.TextSpan = textSpan; + nodeToken.AllActions.ForEach(action => + { + action.Key = identifier; + }); fileAction.NodeTokens.Add(nodeToken); } } diff --git a/src/CTA.Rules.Common/CTA.Rules.Common.csproj b/src/CTA.Rules.Common/CTA.Rules.Common.csproj index 64aef83b..aeb60c73 100644 --- a/src/CTA.Rules.Common/CTA.Rules.Common.csproj +++ b/src/CTA.Rules.Common/CTA.Rules.Common.csproj @@ -13,7 +13,7 @@ - + diff --git a/src/CTA.Rules.Config/CTA.Rules.Config.csproj b/src/CTA.Rules.Config/CTA.Rules.Config.csproj index 4223b54d..0b2bec5b 100644 --- a/src/CTA.Rules.Config/CTA.Rules.Config.csproj +++ b/src/CTA.Rules.Config/CTA.Rules.Config.csproj @@ -8,11 +8,11 @@ - + - + diff --git a/src/CTA.Rules.Metrics/CTA.Rules.Metrics.csproj b/src/CTA.Rules.Metrics/CTA.Rules.Metrics.csproj index 07002802..c877dac0 100644 --- a/src/CTA.Rules.Metrics/CTA.Rules.Metrics.csproj +++ b/src/CTA.Rules.Metrics/CTA.Rules.Metrics.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/CTA.Rules.Models/Actions/ProjectLevelAction.cs b/src/CTA.Rules.Models/Actions/ProjectLevelAction.cs index 990c2041..c89b4096 100644 --- a/src/CTA.Rules.Models/Actions/ProjectLevelAction.cs +++ b/src/CTA.Rules.Models/Actions/ProjectLevelAction.cs @@ -6,7 +6,7 @@ namespace CTA.Rules.Models public class ProjectLevelAction : GenericAction { public Func ProjectLevelActionFunc { get; set; } - public Func, Dictionary, List, string> ProjectFileActionFunc { get; set; } + public Func, Dictionary, List, List, string> ProjectFileActionFunc { get; set; } public override bool Equals(object obj) { var action = (ProjectLevelAction)obj; diff --git a/src/CTA.Rules.Models/CTA.Rules.Models.csproj b/src/CTA.Rules.Models/CTA.Rules.Models.csproj index bd6170aa..874a6fb2 100644 --- a/src/CTA.Rules.Models/CTA.Rules.Models.csproj +++ b/src/CTA.Rules.Models/CTA.Rules.Models.csproj @@ -11,9 +11,8 @@ - - - + + @@ -24,7 +23,7 @@ - + diff --git a/src/CTA.Rules.Models/Enums.cs b/src/CTA.Rules.Models/Enums.cs index 17bee194..34e58628 100644 --- a/src/CTA.Rules.Models/Enums.cs +++ b/src/CTA.Rules.Models/Enums.cs @@ -23,7 +23,9 @@ public enum ProjectType WebApi, Mvc, WebClassLibrary, - ClassLibrary + ClassLibrary, + CoreWebApi, + CoreMvc } public enum FileTypeCreation { diff --git a/src/CTA.Rules.Models/FileActions/FileActions.cs b/src/CTA.Rules.Models/FileActions/FileActions.cs index 838d77c3..fe381d95 100644 --- a/src/CTA.Rules.Models/FileActions/FileActions.cs +++ b/src/CTA.Rules.Models/FileActions/FileActions.cs @@ -47,6 +47,7 @@ public List AllActions allActions.AddRange(ClassDeclarationActions); allActions.AddRange(InterfaceDeclarationActions); allActions.AddRange(ElementAccessActions); + allActions.AddRange(MemberAccessActions); allActions.AddRange(IdentifierNameActions); allActions.AddRange(InvocationExpressionActions); allActions.AddRange(MemberAccessActions); diff --git a/src/CTA.Rules.Models/IDEFileActions.cs b/src/CTA.Rules.Models/IDEFileActions.cs new file mode 100644 index 00000000..11d6c7af --- /dev/null +++ b/src/CTA.Rules.Models/IDEFileActions.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Codelyzer.Analysis.Model; + +namespace CTA.Rules.Models +{ + public class IDEFileActions + { + public string FilePath { get; set; } + public TextSpan TextSpan { get; set; } + public string Description { get; set; } + public IList TextChanges { get; set; } + } +} diff --git a/src/CTA.Rules.Models/ProjectActions.cs b/src/CTA.Rules.Models/ProjectActions.cs index b9c4541a..001f7373 100644 --- a/src/CTA.Rules.Models/ProjectActions.cs +++ b/src/CTA.Rules.Models/ProjectActions.cs @@ -20,6 +20,7 @@ public ProjectActions() public BlockingCollection PackageActions { get; set; } public BlockingCollection ProjectReferenceActions { get; set; } public List ProjectLevelActions { get; set; } + public RootNodes ProjectRules { get; set; } public override string ToString() { diff --git a/src/CTA.Rules.Models/ProjectConfiguration.cs b/src/CTA.Rules.Models/ProjectConfiguration.cs index a5f012f1..25a7aa0a 100644 --- a/src/CTA.Rules.Models/ProjectConfiguration.cs +++ b/src/CTA.Rules.Models/ProjectConfiguration.cs @@ -17,6 +17,8 @@ public ProjectConfiguration() public string RulesDir; public Dictionary> PackageReferences; public bool IsMockRun = false; + public bool PortProject = true; + public bool PortCode = true; public ProjectType ProjectType = ProjectType.ClassLibrary; } } diff --git a/src/CTA.Rules.Models/TextChange.cs b/src/CTA.Rules.Models/TextChange.cs new file mode 100644 index 00000000..f29e7e48 --- /dev/null +++ b/src/CTA.Rules.Models/TextChange.cs @@ -0,0 +1,29 @@ +using System; +using Microsoft.CodeAnalysis; + +namespace CTA.Rules.Models +{ + public class TextChange + { + public string NewText { get; set; } + public FileLinePositionSpan FileLinePositionSpan { get; set; } + + public bool Equals(TextChange textChange) + { + if (textChange == null) return false; + + return NewText == textChange.NewText + && FileLinePositionSpan.Equals(textChange.FileLinePositionSpan); + } + + public override bool Equals(object obj) + { + return Equals(obj as TextChange); + } + + public override int GetHashCode() + { + return HashCode.Combine(FileLinePositionSpan, NewText); + } + } +} diff --git a/src/CTA.Rules.Models/Tokens/NodeToken.cs b/src/CTA.Rules.Models/Tokens/NodeToken.cs index 5eaba4af..aa1d6630 100644 --- a/src/CTA.Rules.Models/Tokens/NodeToken.cs +++ b/src/CTA.Rules.Models/Tokens/NodeToken.cs @@ -1,6 +1,7 @@ -using System.Collections.Generic; -using Codelyzer.Analysis.Model; +using System.Collections.Concurrent; +using System.Collections.Generic; using CTA.Rules.Config; +using TextSpan = Codelyzer.Analysis.Model.TextSpan; namespace CTA.Rules.Models.Tokens { @@ -24,6 +25,7 @@ public NodeToken() ProjectLevelActions = new List(); ProjectFileActions = new List(); TargetCPU = new List(); + TextChanges = new List(); } public string Key { get; set; } public string TrimmedKey => !string.IsNullOrEmpty(Key) ? Utils.EscapeAllWhitespace(Key) : string.Empty; @@ -32,6 +34,7 @@ public NodeToken() public string FullKey { get; set; } public TextSpan TextSpan { get; set; } public string Description { get; set; } + public IList TextChanges { get; set; } public List TargetCPU { get; set; } public List AttributeActions { get; set; } public List AttributeListActions { get; set; } @@ -51,5 +54,27 @@ public NodeToken() public NodeToken Clone() => (NodeToken)this.MemberwiseClone(); + public List AllActions + { + get + { + var allActions = new List(); + allActions.AddRange(AttributeActions); + allActions.AddRange(AttributeListActions); + allActions.AddRange(MethodDeclarationActions); + allActions.AddRange(ClassDeclarationActions); + allActions.AddRange(InterfaceDeclarationActions); + allActions.AddRange(ElementAccessActions); + allActions.AddRange(MemberAccessActions); + allActions.AddRange(IdentifierNameActions); + allActions.AddRange(InvocationExpressionActions); + allActions.AddRange(MemberAccessActions); + allActions.AddRange(UsingActions); + allActions.AddRange(ObjectCreationExpressionActions); + allActions.AddRange(NamespaceActions); + return allActions; + } + } + } } diff --git a/src/CTA.Rules.Models/packages.lock.json b/src/CTA.Rules.Models/packages.lock.json index fc02481d..6abc5044 100644 --- a/src/CTA.Rules.Models/packages.lock.json +++ b/src/CTA.Rules.Models/packages.lock.json @@ -4,27 +4,25 @@ ".NETCoreApp,Version=v3.1": { "Codelyzer.Analysis": { "type": "Direct", - "requested": "[1.4.5, )", - "resolved": "1.4.5", - "contentHash": "+TS4dnOAeIzlup5OXY2liou7cfhHqEL8lGGqpHbZJmy46FQ/UqGUXhq73J9NPQU0Bssa+z0kVfSuXB3RwcISYg==", + "requested": "[1.4.8-alpha-g29c192f06d, )", + "resolved": "1.4.8-alpha-g29c192f06d", + "contentHash": "Zm5CDILJPLKnip/cIAcLeIwHlcWHzh3FXR+kUd+fr2YgLlQXSUMY2Hw56BW8k/AfNfv15paeRAtR2tbIlVlu3Q==", "dependencies": { - "Codelyzer.Analysis.Build": "1.4.5", - "Codelyzer.Analysis.CSharp": "1.4.5", + "Codelyzer.Analysis.Build": "1.4.8-alpha-g29c192f06d", + "Codelyzer.Analysis.CSharp": "1.4.8-alpha-g29c192f06d", "CommandLineParser": "2.8.0", - "Microsoft.CodeAnalysis.CSharp": "3.6.0", - "Microsoft.Extensions.Logging": "3.1.8", - "Microsoft.Extensions.Logging.Console": "3.1.8" + "Microsoft.Extensions.Logging.Console": "5.0.0" } }, "Codelyzer.Analysis.Model": { "type": "Direct", - "requested": "[1.4.5, )", - "resolved": "1.4.5", - "contentHash": "jbKSuAPdTNTrqS9W0CMyKBmvYAriJv82hlK4bKNcyevzuL5+yZruzSleQJ2QPnIDOx+FWWOixqJSsKhr5Ikbag==", + "requested": "[1.4.8-alpha-g29c192f06d, )", + "resolved": "1.4.8-alpha-g29c192f06d", + "contentHash": "ta4vC/pAYmG1xzmZN8Jv2a4mMyvgieHrl0e3tArrk0W0ISeoOnceqGGXSrS9nDqsz8fVINC5bZMZQ4pL0zXmxA==", "dependencies": { - "Microsoft.CodeAnalysis.Common": "3.6.0", - "Microsoft.Extensions.Logging": "3.1.8", - "Newtonsoft.Json": "12.0.3" + "Microsoft.CodeAnalysis.CSharp": "3.8.0", + "Microsoft.Extensions.Logging": "5.0.0", + "Newtonsoft.Json": "13.0.1" } }, "Microsoft.SourceLink.GitHub": { @@ -39,15 +37,9 @@ }, "Nerdbank.GitVersioning": { "type": "Direct", - "requested": "[3.3.37, )", - "resolved": "3.3.37", - "contentHash": "YlDKV/gSHQGDThWSGqVyPfKeNP/kx1fj/NPFFgGc/cxzgIbXv4jtYOcbFOz3ZIeAKtpCcSAmVNDOikBs3OxI/A==" - }, - "Newtonsoft.Json": { - "type": "Direct", - "requested": "[12.0.3, )", - "resolved": "12.0.3", - "contentHash": "6mgjfnRB4jKMlzHSl+VD+oUc1IebOZabkbyWj2RiTgWwYPPuaK1H97G1sHqGwPlS5npiF5Q0OrxN1wni2n5QWg==" + "requested": "[3.4.194, )", + "resolved": "3.4.194", + "contentHash": "f4V2lLy9G0BnddqGhfaVa+dKsbu8iCiLiUARHKBo0l899MgJdRjVU2C7e29gHrZWxc2HZkq3aq28OHHK7q0/iQ==" }, "System.ComponentModel.Annotations": { "type": "Direct", @@ -57,10 +49,10 @@ }, "Buildalyzer": { "type": "Transitive", - "resolved": "3.0.1", - "contentHash": "WxXxlfoF8O2El7AN4CWshL3+L7em7yAT/MiOX+eySG2dzsdLw1/5z75xEuSOt1kvJtQce3xpIzr+z4g02aJ3wQ==", + "resolved": "3.2.0", + "contentHash": "clK8nODLS0tuvhXi8tLAPsC4dZn2LLpCjmXh8xjDKsNc53JRCNff/KX0gjFtFUCxNfLdqAe4zY5JCREqtgfYiA==", "dependencies": { - "Buildalyzer.Logger": "3.0.1", + "Buildalyzer.Logger": "3.2.0", "MSBuild.StructuredLogger": "2.1.133", "Microsoft.Build": "16.5.0", "Microsoft.Build.Framework": "16.5.0", @@ -75,56 +67,51 @@ }, "Buildalyzer.Logger": { "type": "Transitive", - "resolved": "3.0.1", - "contentHash": "L6Y8hXDTGJUyNivg5DCgH36r/dwknJa5J05iT6IYyQZgOzQLDAWuXODUAaL7FPR2+43cSp0ioja0p/fhDF5Y+g==", + "resolved": "3.2.0", + "contentHash": "ag6y+Tu5nOg0U0g1LOwdvV3AXNqu40k0C0qPk5MYlnqP99PEL9+7ypHntJ+jyj25Aps1E0X+B6uAtGEm1qkJ0g==", "dependencies": { "NETStandard.Library": "1.6.1" } }, "Buildalyzer.Workspaces": { "type": "Transitive", - "resolved": "3.0.1", - "contentHash": "qcxVhrS2jyKABZBSRQSgK7PKL68/M6xgfoJIegI6crgnI1PxaeQUGV+tzAypl1L40KpcZjIbPcuDjDIT9f/TOA==", + "resolved": "3.2.0", + "contentHash": "wanixUMfeQznxMogHaensmiqjVaC5IC68ZpGfpBt0MOFae6qJpVWvW8jd85nUFYVUSdn9zZLW66iJL2FkEVAYQ==", "dependencies": { - "Buildalyzer": "3.0.1", - "Microsoft.CodeAnalysis.CSharp.Workspaces": "3.6.0", - "Microsoft.CodeAnalysis.VisualBasic.Workspaces": "3.6.0" + "Buildalyzer": "3.2.0", + "Microsoft.CodeAnalysis.CSharp.Workspaces": "3.8.0", + "Microsoft.CodeAnalysis.VisualBasic.Workspaces": "3.8.0" } }, "Codelyzer.Analysis.Build": { "type": "Transitive", - "resolved": "1.4.5", - "contentHash": "h2TOa0B8zH+Yva2NEWW1zDzXQCktv2ZZST2uaSXz16DNSJmbxSRHyv5NHhxNXO9gurVFEOMShKJtOCBJBXcoGQ==", + "resolved": "1.4.8-alpha-g29c192f06d", + "contentHash": "GocGFZ9s0QCdj47Jx5d91anqF6LYTfSOZOK8lMVLD51fCH2oqfitNSAlIx4tYRa9rJVPDB60tUGjA64vX77NpA==", "dependencies": { - "Buildalyzer": "3.0.1", - "Buildalyzer.Logger": "3.0.1", - "Buildalyzer.Workspaces": "3.0.1", - "Codelyzer.Analysis.CSharp": "1.4.5", - "Microsoft.CodeAnalysis.CSharp": "3.6.0", - "Microsoft.Extensions.Logging": "3.1.8", - "NuGet.Packaging": "5.7.0" + "Buildalyzer": "3.2.0", + "Buildalyzer.Logger": "3.2.0", + "Buildalyzer.Workspaces": "3.2.0", + "Codelyzer.Analysis.CSharp": "1.4.8-alpha-g29c192f06d", + "Microsoft.Extensions.Logging": "5.0.0", + "NuGet.Packaging": "5.9.1" } }, "Codelyzer.Analysis.Common": { "type": "Transitive", - "resolved": "1.4.5", - "contentHash": "CW+5i13fl79P9xCQs0DJznvwoMjL4aZRHID0u0U5fi07jWvItFbayWovzjs0LSJpgwopSTMeJfRjPfSxIH1iGw==", + "resolved": "1.4.8-alpha-g29c192f06d", + "contentHash": "ySXN66Xqishw0PDYk6hDm/8dz5wmZ6jUJegdIbSWQw7krfJJl/1ZKlM+/5LvcXsjL4HJ9lG3q5jVliBj/xb/Tg==", "dependencies": { - "Codelyzer.Analysis.Model": "1.4.5", - "Microsoft.CodeAnalysis.Common": "3.6.0", - "Microsoft.Extensions.Logging": "3.1.8", - "Newtonsoft.Json": "12.0.3" + "Codelyzer.Analysis.Model": "1.4.8-alpha-g29c192f06d", + "Newtonsoft.Json": "13.0.1" } }, "Codelyzer.Analysis.CSharp": { "type": "Transitive", - "resolved": "1.4.5", - "contentHash": "L3sPvfANfqyIeo+DtZDHllf3vPOUKkbZKGnMO1/aY/45crmMLJl70ankAyfNd5BEqF8zA5cyV1ShRY6kgzHu0A==", + "resolved": "1.4.8-alpha-g29c192f06d", + "contentHash": "pwDqA7pQ5y0T2LVqOajIunp8vKnWNltB4M5yYB0N4dDId81Wo9oKooxydICytWzrXH3flC4gPyR4BqTb4g+n2A==", "dependencies": { - "Codelyzer.Analysis.Common": "1.4.5", - "Codelyzer.Analysis.Model": "1.4.5", - "Microsoft.CodeAnalysis.CSharp": "3.6.0", - "Microsoft.Extensions.Logging": "3.1.8" + "Codelyzer.Analysis.Common": "1.4.8-alpha-g29c192f06d", + "Codelyzer.Analysis.Model": "1.4.8-alpha-g29c192f06d" } }, "CommandLineParser": { @@ -142,8 +129,8 @@ }, "Microsoft.Bcl.AsyncInterfaces": { "type": "Transitive", - "resolved": "1.1.0", - "contentHash": "1Am6l4Vpn3/K32daEqZI+FFr96OlZkgwK2LcT3pZ2zWubR5zTPW3/FkO1Rat9kb7oQOa4rxgl9LJHc5tspCWfg==" + "resolved": "1.1.1", + "contentHash": "yuvf07qFWFqtK3P/MRkEKLhn5r2UbSpVueRziSqj0yJQIKFwG1pq9mOayK3zE5qZCTs0CbrwL9M6R8VwqyGy2w==" }, "Microsoft.Build": { "type": "Transitive", @@ -214,62 +201,62 @@ }, "Microsoft.CodeAnalysis.Common": { "type": "Transitive", - "resolved": "3.6.0", - "contentHash": "jQxDeYyQbNZwx/9O8hiyApTqZ7+KR3xVA6Ogbb50qsODfjAKRWuH7z3lGkU/62PYUz4yiDtgXlRtntWNdhFPfQ==", + "resolved": "3.8.0", + "contentHash": "8YTZ7GpsbTdC08DITx7/kwV0k4SC6cbBAFqc13cOm5vKJZcEIAh51tNSyGSkWisMgYCr96B2wb5Zri1bsla3+g==", "dependencies": { "Microsoft.CodeAnalysis.Analyzers": "3.0.0", - "System.Collections.Immutable": "1.5.0", - "System.Memory": "4.5.3", - "System.Reflection.Metadata": "1.6.0", - "System.Runtime.CompilerServices.Unsafe": "4.7.0", + "System.Collections.Immutable": "5.0.0", + "System.Memory": "4.5.4", + "System.Reflection.Metadata": "5.0.0", + "System.Runtime.CompilerServices.Unsafe": "4.7.1", "System.Text.Encoding.CodePages": "4.5.1", - "System.Threading.Tasks.Extensions": "4.5.3" + "System.Threading.Tasks.Extensions": "4.5.4" } }, "Microsoft.CodeAnalysis.CSharp": { "type": "Transitive", - "resolved": "3.6.0", - "contentHash": "kflVAdezWxqIfKNvEi4cmWZchX0Cgm3bRk1asYSnAQWQPTMddecrHzb9D8+ZDfYUeyYKkF4DETwjmONeSChCqA==", + "resolved": "3.8.0", + "contentHash": "hKqFCUSk9TIMBDjiYMF8/ZfK9p9mzpU+slM73CaCHu4ctfkoqJGHLQhyT8wvrYsIg+ufrUWBF8hcJYmyr5rc5Q==", "dependencies": { - "Microsoft.CodeAnalysis.Common": "[3.6.0]" + "Microsoft.CodeAnalysis.Common": "[3.8.0]" } }, "Microsoft.CodeAnalysis.CSharp.Workspaces": { "type": "Transitive", - "resolved": "3.6.0", - "contentHash": "HpMIxUIaHOJ5Vmy5RFnq/itS563FXZdXlsSf8bHU3urrKnOdVkQZ5fktCIxGD5RG6kG/WbPEi0eW18jE2J5/zw==", + "resolved": "3.8.0", + "contentHash": "rdEBvPWqe/IIscsnp7OkZ4tQin8khxBcSLyV9tU+sHdw9uW9U0GKL+Dv2rD4voC1bZBaO18Hp+m4Vkyfmaz0OA==", "dependencies": { "Humanizer.Core": "2.2.0", - "Microsoft.CodeAnalysis.CSharp": "[3.6.0]", - "Microsoft.CodeAnalysis.Common": "[3.6.0]", - "Microsoft.CodeAnalysis.Workspaces.Common": "[3.6.0]" + "Microsoft.CodeAnalysis.CSharp": "[3.8.0]", + "Microsoft.CodeAnalysis.Common": "[3.8.0]", + "Microsoft.CodeAnalysis.Workspaces.Common": "[3.8.0]" } }, "Microsoft.CodeAnalysis.VisualBasic": { "type": "Transitive", - "resolved": "3.6.0", - "contentHash": "ZS9FhxIut643uKyf9gOjTdwJNENa4pqcbUSS4herYjp8lvYsXOa7QgazySHcNCAut4/SlYgvydpGZgwoasD7vw==", + "resolved": "3.8.0", + "contentHash": "G3/0o6sb9ZZQjBD+6bHj7GaxyeMZbBJXNtBC6YGmbSodMup9A1QPgCSrSn/ktbxWjKI8AMlJHP6CHCwfBXTmpg==", "dependencies": { - "Microsoft.CodeAnalysis.Common": "[3.6.0]" + "Microsoft.CodeAnalysis.Common": "[3.8.0]" } }, "Microsoft.CodeAnalysis.VisualBasic.Workspaces": { "type": "Transitive", - "resolved": "3.6.0", - "contentHash": "Evddkuon+vbcjApMg8+xt96/67nw/YSwg4c1tx4r7YYWzthz+IfgIamSdRi4P+3Du3LnIlsGo2MFxo36hIWFhg==", + "resolved": "3.8.0", + "contentHash": "qBkq9WB7NLdMf65FJ7HkoGlZbr8G7QYI5jtJsqBzHbF5RUclKHRmpQwLq2RgcyLQY8qGpBPDbJX9OMG3+VOlvA==", "dependencies": { - "Microsoft.CodeAnalysis.Common": "[3.6.0]", - "Microsoft.CodeAnalysis.VisualBasic": "[3.6.0]", - "Microsoft.CodeAnalysis.Workspaces.Common": "[3.6.0]" + "Microsoft.CodeAnalysis.Common": "[3.8.0]", + "Microsoft.CodeAnalysis.VisualBasic": "[3.8.0]", + "Microsoft.CodeAnalysis.Workspaces.Common": "[3.8.0]" } }, "Microsoft.CodeAnalysis.Workspaces.Common": { "type": "Transitive", - "resolved": "3.6.0", - "contentHash": "DmaIzcx9cpZMY97SH0IDfEsq/QujuvnC0nNDAskOO8zFKxKTaZJw8/jKV/nPUk3OgpOAP1ypaz9VborDfnSf+g==", + "resolved": "3.8.0", + "contentHash": "GPYVydsmOmScOWDJA1LFky7/MkoXpx1JI3lZJShxC+bvVUvL9zVKE8WDZMLsYJ5MAbry2xkZftdfeMpZ+kvLDQ==", "dependencies": { - "Microsoft.Bcl.AsyncInterfaces": "1.1.0", - "Microsoft.CodeAnalysis.Common": "[3.6.0]", + "Microsoft.Bcl.AsyncInterfaces": "1.1.1", + "Microsoft.CodeAnalysis.Common": "[3.8.0]", "System.Composition": "1.0.31" } }, @@ -497,8 +484,8 @@ }, "Namotion.Reflection": { "type": "Transitive", - "resolved": "1.0.14", - "contentHash": "wuJGiFvGfehH2w7jAhMbCJt0/rvUuHyqSZn0sMhNTviDfBZRyX8LFlR/ndQcofkGWulPDfH5nKYTeGXE8xBHPA==", + "resolved": "1.0.19", + "contentHash": "+eY1uabKkJEvjfHvr8uHLB1lvrb8S+akpXOe6fKMLTeZEMYIQywFL0/5+zrpNFklJIYzaEoApw2p3zFx357LjQ==", "dependencies": { "Microsoft.CSharp": "4.3.0" } @@ -554,56 +541,58 @@ "System.Xml.XDocument": "4.3.0" } }, + "Newtonsoft.Json": { + "type": "Transitive", + "resolved": "13.0.1", + "contentHash": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==" + }, "NJsonSchema": { "type": "Transitive", - "resolved": "10.3.1", - "contentHash": "k5ptrRSxMy1lZXxU7dXW2Gy9Q7uPufSGtb609tfuFdo+w45UMHdBolvbWeEq482BPXhYfoBZ2uNzjJgcny2o3g==", + "resolved": "10.4.1", + "contentHash": "XzOfrW2QRS7B6/Z4dVfXXta740oVXvonV2W3OXfhzW+g5tF5FXzwtgseR2vBOf0c6LvLNcR4Wj4vop8uqiSIJA==", "dependencies": { - "Namotion.Reflection": "1.0.14", + "Namotion.Reflection": "1.0.19", "Newtonsoft.Json": "9.0.1" } }, "NuGet.Common": { "type": "Transitive", - "resolved": "5.7.0", - "contentHash": "KJa+Bh4oWVUMe8AVvooCTCEX16C62BMoECK1qDRHKQMkaredcx1zXwcEwoJgsn9h7b/eq0GUk+UOXd/a+jj4TA==", + "resolved": "5.9.1", + "contentHash": "BRX0V8k8QXcEWL33V2HcBU1+eu/Qp5LDJlheYFSZ03hKjlHVHFfLquvUUYLgSNO7tiBxCFe7pTSgO4XanyzteQ==", "dependencies": { - "NuGet.Frameworks": "5.7.0", - "System.Diagnostics.Process": "4.3.0", - "System.Threading.Thread": "4.3.0" + "NuGet.Frameworks": "5.9.1" } }, "NuGet.Configuration": { "type": "Transitive", - "resolved": "5.7.0", - "contentHash": "vMENBdcf2fCy/om4jGYcEEwPDNYfOhHVIisl0uzVPEUVQav6NIu8su7x13YC3Ke2gpfw33iLY2J0gvulvDu0aw==", + "resolved": "5.9.1", + "contentHash": "dpjLDYEuhR1J8L3s9c1qVHEBaWqFI2/x3qRmhqVYDLB5B9ETVe1jVkxLkFQreQVgh+N5cVgtZWx1jGuArj7QaQ==", "dependencies": { - "NuGet.Common": "5.7.0", - "System.Security.Cryptography.ProtectedData": "4.3.0" + "NuGet.Common": "5.9.1", + "System.Security.Cryptography.ProtectedData": "4.4.0" } }, "NuGet.Frameworks": { "type": "Transitive", - "resolved": "5.7.0", - "contentHash": "7Q/wUoB3jCBcq9zoBOBGHFhe78C13jViPmvjvzTwthVV8DAjMfpXnqAYtgwdaRLJMkTXrtdLxfPBIFFhmlsnIQ==" + "resolved": "5.9.1", + "contentHash": "LuJA875MQpPMdik6KUsDUnEDSXWX+T/sExFikA0A5zGFkEW37weP5b6NxljWlrw4UNOWTgmTeumm802Jwz20sw==" }, "NuGet.Packaging": { "type": "Transitive", - "resolved": "5.7.0", - "contentHash": "sDGJDRDiuZPC0W7Z2mntNa/Ak1EZC13BPSk447iFVkhU4aJ1JF0jAhT9EKMixLbeDAyHTONrRXM6nSbTiV1WmQ==", + "resolved": "5.9.1", + "contentHash": "deaGBf7KGllJxXZ0u2gQkoQuvMhbJhntUwJZcmlA5fZdAhw6SsDgaRG0bW4x4dX4K09Bxqhh8pfow/0AP0ke7Q==", "dependencies": { "Newtonsoft.Json": "9.0.1", - "NuGet.Configuration": "5.7.0", - "NuGet.Versioning": "5.7.0", - "System.Dynamic.Runtime": "4.3.0", - "System.Security.Cryptography.Cng": "5.0.0-preview.3.20214.6", - "System.Security.Cryptography.Pkcs": "5.0.0-preview.3.20214.6" + "NuGet.Configuration": "5.9.1", + "NuGet.Versioning": "5.9.1", + "System.Security.Cryptography.Cng": "5.0.0", + "System.Security.Cryptography.Pkcs": "5.0.0" } }, "NuGet.Versioning": { "type": "Transitive", - "resolved": "5.7.0", - "contentHash": "wS84PkpHd7V+HWdNiehlWnQ5tnqtlJakXVXovskdrnTJVTUf/IU4tJ2vvVfwdLyES5Z1CxkMmkh7Qmx2Wp2zzQ==" + "resolved": "5.9.1", + "contentHash": "I/2Z/dAcV6tz8Bri9lYbcMoq6R9J1J8Vv23gDCAnWjwrIdwunhmnWgiZx/b7cmlEXaD1r0kxen18fXYoyqs4rg==" }, "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": { "type": "Transitive", @@ -766,8 +755,8 @@ }, "System.Collections.Immutable": { "type": "Transitive", - "resolved": "1.5.0", - "contentHash": "EXKiDFsChZW0RjrZ4FYHu9aW6+P4MCgEDCklsVseRfhoO0F+dXeMSsMRAlVXIo06kGJ/zv+2w1a2uc2+kxxSaQ==" + "resolved": "5.0.0", + "contentHash": "FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==" }, "System.Composition": { "type": "Transitive", @@ -892,34 +881,6 @@ "resolved": "5.0.0", "contentHash": "tCQTzPsGZh/A9LhhA6zrqCRV4hOHsK90/G7q3Khxmn6tnB1PuNU0cRaKANP2AWcF9bn0zsuOoZOSrHuJk6oNBA==" }, - "System.Diagnostics.Process": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "J0wOX07+QASQblsfxmIMFc9Iq7KTXYL3zs2G/Xc704Ylv3NpuVdo6gij6V3PGiptTxqsK0K7CdXenRvKUnkA2g==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.Win32.Primitives": "4.3.0", - "Microsoft.Win32.Registry": "4.3.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Thread": "4.3.0", - "System.Threading.ThreadPool": "4.3.0", - "runtime.native.System": "4.3.0" - } - }, "System.Diagnostics.Tools": { "type": "Transitive", "resolved": "4.3.0", @@ -977,6 +938,11 @@ "System.Threading": "4.3.0" } }, + "System.Formats.Asn1": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "MTvUIktmemNB+El0Fgw9egyqT9AYSIk6DTJeoDSpc3GIHxHCMo8COqkWT1mptX5tZ1SlQ6HJZ0OsSvMth1c12w==" + }, "System.Globalization": { "type": "Transitive", "resolved": "4.3.0", @@ -1139,8 +1105,8 @@ }, "System.Memory": { "type": "Transitive", - "resolved": "4.5.3", - "contentHash": "3oDzvc/zzetpTKWMShs1AADwZjQ/36HnsufHRPcOjyRAAMLDlu2iD33MBI2opxnezcVUtXyqDXXjoFMOU9c7SA==" + "resolved": "4.5.4", + "contentHash": "1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==" }, "System.Net.Http": { "type": "Transitive", @@ -1269,8 +1235,11 @@ }, "System.Reflection.Metadata": { "type": "Transitive", - "resolved": "1.6.0", - "contentHash": "COC1aiAJjCoA5GBF+QKL2uLqEBew4JsCkQmoHKbN3TlOZKa2fKLz5CpiRQKDz0RsAOEGsVKqOD5bomsXq/4STQ==" + "resolved": "5.0.0", + "contentHash": "5NecZgXktdGg34rh1OenY1rFNDCI8xSjFr+Z4OU4cU06AQHUdRnIIEeWENu3Wl4YowbzkymAIMvi3WyK9U53pQ==", + "dependencies": { + "System.Collections.Immutable": "5.0.0" + } }, "System.Reflection.Primitives": { "type": "Transitive", @@ -1328,8 +1297,8 @@ }, "System.Runtime.CompilerServices.Unsafe": { "type": "Transitive", - "resolved": "4.7.0", - "contentHash": "IpU1lcHz8/09yDr9N+Juc7SCgNUz+RohkCQI+KsWKR67XxpFr8Z6c8t1iENCXZuRuNCc4HBwme/MDHNVCwyAKg==" + "resolved": "4.7.1", + "contentHash": "zOHkQmzPCn5zm/BH+cxC1XbUS3P4Yoi3xzW7eRgVpDR2tPGSzyMZ17Ig1iRkfJuY0nhxkQQde8pgePNiA7z7TQ==" }, "System.Runtime.Extensions": { "type": "Transitive", @@ -1445,8 +1414,11 @@ }, "System.Security.Cryptography.Cng": { "type": "Transitive", - "resolved": "5.0.0-preview.3.20214.6", - "contentHash": "dqufaGuwo4a3yhe49TuH0ZCSCAktOAkbSMCpH2JcGHBxJzy8h1q4RVM5p2XzshduIRXn646ipkKg9qPIEnjr6g==" + "resolved": "5.0.0", + "contentHash": "jIMXsKn94T9JY7PvPq/tMfqa6GAaHpElRDpmG+SuL+D3+sTw2M8VhnibKnN8Tq+4JqbPJ/f+BwtLeDMEnzAvRg==", + "dependencies": { + "System.Formats.Asn1": "5.0.0" + } }, "System.Security.Cryptography.Csp": { "type": "Transitive", @@ -1509,10 +1481,11 @@ }, "System.Security.Cryptography.Pkcs": { "type": "Transitive", - "resolved": "5.0.0-preview.3.20214.6", - "contentHash": "wg02cS0DJRtdcYF0N0hRjY7WCFWFZXZyOXNvJeWD0SSFk6zrrp1t3iFVfRcHg2vIJ/q5NFcXVRvS6TLbSWxdzw==", + "resolved": "5.0.0", + "contentHash": "9TPLGjBCGKmNvG8pjwPeuYy0SMVmGZRwlTZvyPHDbYv/DRkoeumJdfumaaDNQzVGMEmbWtg07zUpSW9q70IlDQ==", "dependencies": { - "System.Security.Cryptography.Cng": "5.0.0-preview.3.20214.6" + "System.Formats.Asn1": "5.0.0", + "System.Security.Cryptography.Cng": "5.0.0" } }, "System.Security.Cryptography.Primitives": { @@ -1531,15 +1504,8 @@ }, "System.Security.Cryptography.ProtectedData": { "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "qBUHUk7IqrPHY96THHTa1akCxw0GsNFpsk3XFHbi0A0tMUDBpQprtY1Tbl6yaS1x4c96ilcXU8PocYtmSmkaQQ==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0" - } + "resolved": "4.4.0", + "contentHash": "cJV7ScGW7EhatRsjehfvvYVBvtiSMKgN8bOVI0bQhnF5bU7vnHVIsH49Kva7i7GWaWYvmEzkYVk1TC+gZYBEog==" }, "System.Security.Cryptography.X509Certificates": { "type": "Transitive", @@ -1671,24 +1637,15 @@ }, "System.Threading.Tasks.Extensions": { "type": "Transitive", - "resolved": "4.5.3", - "contentHash": "+MvhNtcvIbqmhANyKu91jQnvIRVSTiaOiFNfKWwXGHG48YAb4I/TyH8spsySiPYla7gKal5ZnF3teJqZAximyQ==" + "resolved": "4.5.4", + "contentHash": "zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==" }, "System.Threading.Thread": { "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "OHmbT+Zz065NKII/ZHcH9XO1dEuLGI1L2k7uYss+9C1jLxTC9kTZZuzUOyXHayRk+dft9CiDf3I/QZ0t8JKyBQ==", - "dependencies": { - "System.Runtime": "4.3.0" - } - }, - "System.Threading.ThreadPool": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "k/+g4b7vjdd4aix83sTgC9VG6oXYKAktSfNIJUNGxPEj7ryEOfzHHhfnmsZvjxawwcD9HyWXKCXmPjX8U4zeSw==", + "resolved": "4.0.0", + "contentHash": "gIdJqDXlOr5W9zeqFErLw3dsOsiShSCYtF9SEHitACycmvNvY8odf9kiKvp6V7aibc8C4HzzNBkWXjyfn7plbQ==", "dependencies": { - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" + "System.Runtime": "4.1.0" } }, "System.Threading.Timer": { @@ -1748,7 +1705,7 @@ "Microsoft.Extensions.Logging": "5.0.0", "Microsoft.Extensions.Logging.Abstractions": "5.0.0", "Microsoft.Extensions.Logging.Console": "5.0.0", - "NJsonSchema": "10.3.1" + "NJsonSchema": "10.4.1" } } } diff --git a/src/CTA.Rules.PortCore/CTA.Rules.PortCore.csproj b/src/CTA.Rules.PortCore/CTA.Rules.PortCore.csproj index 991e41dd..5cf0779c 100644 --- a/src/CTA.Rules.PortCore/CTA.Rules.PortCore.csproj +++ b/src/CTA.Rules.PortCore/CTA.Rules.PortCore.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/CTA.Rules.PortCore/Program.cs b/src/CTA.Rules.PortCore/Program.cs index 43e955ed..0e60ae52 100644 --- a/src/CTA.Rules.PortCore/Program.cs +++ b/src/CTA.Rules.PortCore/Program.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.IO; +using System.Linq; using CTA.Rules.Config; using CTA.Rules.Models; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.Extensions.Logging; namespace CTA.Rules.PortCore @@ -49,6 +52,8 @@ static void Main(string[] args) IsMockRun = cli.IsMockRun, UseDefaultRules = cli.DefaultRules, PackageReferences = packageReferences, + PortCode = false, + PortProject = true, TargetVersions = new List { cli.Version } }; @@ -63,6 +68,7 @@ static void Main(string[] args) Console.WriteLine(k.ProjectFile); Console.WriteLine(k.ProjectActions.ToString()); } + var portSolutionResult = solutionPort.Run(); } catch (Exception ex) diff --git a/src/CTA.Rules.PortCore/SolutionPort.cs b/src/CTA.Rules.PortCore/SolutionPort.cs index 69688db8..d25d751e 100644 --- a/src/CTA.Rules.PortCore/SolutionPort.cs +++ b/src/CTA.Rules.PortCore/SolutionPort.cs @@ -8,6 +8,7 @@ using System.Reflection; using System.Threading.Tasks; using Codelyzer.Analysis; +using Codelyzer.Analysis.Build; using CTA.FeatureDetection; using CTA.FeatureDetection.Common.Models; using CTA.FeatureDetection.ProjectType.Extensions; @@ -29,6 +30,8 @@ public class SolutionPort private readonly PortSolutionResult _portSolutionResult; private readonly MetricsContext _context; private Dictionary _projectTypeFeatureResults; + private readonly IDEProjectResult _projectResult; + /// /// Initializes a new instance of Solution Port, analyzing the solution path using the provided config. @@ -79,6 +82,12 @@ public SolutionPort(string solutionFilePath, List analyzerResult InitSolutionRewriter(analyzerResults, solutionConfiguration); } + public SolutionPort(string solutionFilePath, IDEProjectResult projectResult, List solutionConfiguration) + { + _solutionPath = solutionFilePath; + _projectResult = projectResult; + _solutionRewriter = new SolutionRewriter(projectResult, solutionConfiguration.ToList()); + } private void InitSolutionRewriter(List analyzerResults, List solutionConfiguration) { CheckCache(); @@ -179,6 +188,27 @@ public PortSolutionResult Run() return _portSolutionResult; } + /// + /// Runs an incremental actions analysis on files + /// + /// The rules list to be used + /// The files to be analyzed + /// + public List RunIncremental(RootNodes projectRules, List updatedFiles) + { + return _solutionRewriter.RunIncremental(projectRules, updatedFiles); + } + /// + /// Runs an incremental actions analysis on a file + /// + /// The rules list to be used + /// The file to be analyzed + /// + public List RunIncremental(RootNodes projectRules, string updatedFile) + { + return _solutionRewriter.RunIncremental(projectRules, new List { updatedFile }); + } + private void DownloadResources() { var executingPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); diff --git a/src/CTA.Rules.ProjectFile/CTA.Rules.ProjectFile.csproj b/src/CTA.Rules.ProjectFile/CTA.Rules.ProjectFile.csproj index d3978781..f6e6df76 100644 --- a/src/CTA.Rules.ProjectFile/CTA.Rules.ProjectFile.csproj +++ b/src/CTA.Rules.ProjectFile/CTA.Rules.ProjectFile.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/CTA.Rules.ProjectFile/ProjectFileCreator.cs b/src/CTA.Rules.ProjectFile/ProjectFileCreator.cs index 1bafd64d..737a573f 100644 --- a/src/CTA.Rules.ProjectFile/ProjectFileCreator.cs +++ b/src/CTA.Rules.ProjectFile/ProjectFileCreator.cs @@ -12,17 +12,20 @@ public class ProjectFileCreator { private readonly string _projectFile; private readonly List _targetVersions; + private readonly List _metaReferences; private Dictionary _packages; private IEnumerable _projectReferences; private ProjectType _projectType; + private XDocument _projectFileXml; - private readonly string _csCoreProjSyntaxWeb = + private readonly string _csCoreProjSyntaxWeb = @" {1} {2} {3} +{4} "; private readonly string _csCoreProjSyntaxWebClassLibrary = @@ -35,6 +38,7 @@ public class ProjectFileCreator {2} {3} +{4} "; private readonly string _csCoreProjSyntaxClassLibrary = @@ -44,11 +48,19 @@ public class ProjectFileCreator {2} {3} +{4} "; private readonly string _itemGroupTemplate = @" {0} +"; + + private readonly string _portingInfoItemGroupTemplate = +@" + "; private const string PackageReferenceTemplate = @""; @@ -56,14 +68,23 @@ public class ProjectFileCreator private const string IndentationPerLevel = " "; public ProjectFileCreator(string projectFile, List targetVersions, Dictionary packages, - List projectReferences, ProjectType projectType) + List projectReferences, ProjectType projectType, List metaReferences) { _projectFile = projectFile; _targetVersions = targetVersions; _packages = packages; _projectReferences = projectReferences; _projectType = projectType; - PopulateFromExistingFile(); + _metaReferences = metaReferences; + + try + { + _projectFileXml = XDocument.Load(projectFile); + } + catch (Exception ex) + { + LogHelper.LogError(ex, "Error initializing project file"); + } } private string GetTargetVersions() @@ -103,9 +124,18 @@ public bool Create() string packages = GetPackagesSection(); string projects = GetProjectReferencesSection(); + string metaReferences = GetMetaReferencesSection(); - string csProjContent = string.Format(csProj, sdkName, GetTargetVersions(), AddItemGroup(packages), AddItemGroup(projects)); - File.WriteAllText(_projectFile, csProjContent); + if (IsCoreProject() == true) + { + UpdateExistingFile(); + _projectFileXml.Save(_projectFile); + } + else + { + string csProjContent = string.Format(csProj, sdkName, GetTargetVersions(), AddItemGroup(packages), AddItemGroup(projects), AddItemGroup(metaReferences, _portingInfoItemGroupTemplate)); + File.WriteAllText(_projectFile, csProjContent); + } } catch (Exception ex) { @@ -115,14 +145,18 @@ public bool Create() return true; } - private string AddItemGroup(string content) + private string GetMetaReferencesSection() => String.Join(Environment.NewLine, _metaReferences); + + private string AddItemGroup(string content, string itemGroupTemplate = null) { - if (string.IsNullOrEmpty(content)) + if (string.IsNullOrEmpty(content?.Trim())) { return string.Empty; } - - var itemGroupContent = string.Format(_itemGroupTemplate, content); + + var currentGroupTemplate = itemGroupTemplate ?? _itemGroupTemplate; + + var itemGroupContent = string.Format(currentGroupTemplate, content); itemGroupContent = IndentAllLines(itemGroupContent); return itemGroupContent; @@ -143,7 +177,7 @@ private string GetPackagesSection() { LogChange(string.Format("Adding reference to packages {0}", string.Join(",", _packages.Select(p => p.Key)))); } - + var content = string.Join(Environment.NewLine, packages); content = IndentAllLines(content); return content; @@ -154,7 +188,7 @@ private string GetProjectReferencesSection() IEnumerable references = new List(); if (_projectReferences != null) { - references = _projectReferences.Select(projectReference => + references = _projectReferences.Select(projectReference => string.Format(ProjectReferenceTemplate, projectReference)); } @@ -169,62 +203,56 @@ private void LogChange(string message) LogHelper.LogInformation(message); } - private void PopulateFromExistingFile() + private bool? IsCoreProject() => + _projectType == ProjectType.CoreMvc + || _projectType == ProjectType.CoreWebApi + || _projectFileXml.Descendants().Any(d => d.Name?.LocalName == "TargetFramework" && (d.Value?.Equals("net5.0") == true || d.Value?.Equals("netcoreapp3.1") == true)) + || _projectFileXml.Descendants().Any(d => d.Name?.LocalName == "TargetFrameworks" && (d.Value?.Contains("net5.0") == true || d.Value?.Contains("netcoreapp3.1") == true)); + + + + private void UpdateExistingFile() { - var xDocument = XDocument.Load(_projectFile); + UpdateVersion(); + UpdatePackageReferences(); + } - try - { - var sdk = xDocument.Descendants()?.First()?.Attribute("Sdk")?.Value; - if (sdk == Constants.WebSdkName) - { - if (_projectType == ProjectType.ClassLibrary || _projectType == ProjectType.WebClassLibrary) - { - _projectType = ProjectType.Mvc; - } - } - } - catch (Exception) + private void UpdateVersion() + { + var currentVersionTag = _projectFileXml.Descendants().FirstOrDefault(d => d.Name == "TargetFramework"); + if(currentVersionTag == null) { - //If we're using a framework csproj, we will get an error. No need to catch since we're overwriting the csproj file + currentVersionTag = _projectFileXml.Descendants().FirstOrDefault(d => d.Name == "TargetFrameworks"); } - try + var currentVersion = currentVersionTag.Value; + var targetVersion = GetTargetVersions(); + if (!targetVersion.Equals(currentVersion)) { - var packages = xDocument.Descendants() - .Where(d => d.Name == "PackageReference") - .ToDictionary(p => p.Attributes("Include").First().Value, p => p.Attributes("Version").First().Value); - - _packages = packages.Union(_packages).ToDictionary(d => d.Key, d => d.Value); - } - catch (Exception) - { - //If we're using a framework csproj, we will get an error. No need to catch since we're overwriting the csproj file + currentVersionTag.Value = targetVersion; } + } - try - { - var projects = xDocument.Descendants() - .Where(d => d.Name == "ProjectReference") - .Select(p => p.Attributes("Include").First().Value).ToList(); + private void UpdatePackageReferences() + { + var existingPackages = _projectFileXml.Descendants() + .Where(d => d.Name == "PackageReference") + .ToDictionary(p => p.Attributes("Include").First().Value, p => p.Attributes("Version").First().Value); - _projectReferences = projects.Union(_projectReferences).Distinct().ToList(); - } - catch (Exception) - { - //If we're using a framework csproj, we will get an error. No need to catch since we're overwriting the csproj file - } + _packages = _packages.Where(p => existingPackages.Keys?.Contains(p.Key) == false).ToDictionary(d => d.Key, d => d.Value); - try + //No packages to add + if (_packages.Count == 0) return; + + var packages = GetPackagesSection(); + if (existingPackages.Count == 0) { - if (_projectType == ProjectType.ClassLibrary && xDocument.Descendants().Where(d => d.Name == "FrameworkReference").Any()) - { - _projectType = ProjectType.WebClassLibrary; - } + packages = AddItemGroup(packages); + _projectFileXml.Descendants().Last(d => d.Name == "ItemGroup").AddAfterSelf(XElement.Parse(packages)); } - catch (Exception) + else { - //If we're using a framework csproj, we will get an error. No need to catch since we're overwriting the csproj file + _projectFileXml.Descendants().Last(d => d.Name == "PackageReference").AddAfterSelf(XElement.Parse(packages)); } } diff --git a/src/CTA.Rules.RuleFiles/CTA.Rules.RuleFiles.csproj b/src/CTA.Rules.RuleFiles/CTA.Rules.RuleFiles.csproj index 8b684aef..f4296101 100644 --- a/src/CTA.Rules.RuleFiles/CTA.Rules.RuleFiles.csproj +++ b/src/CTA.Rules.RuleFiles/CTA.Rules.RuleFiles.csproj @@ -11,7 +11,7 @@ - + diff --git a/src/CTA.Rules.Update/ActionsRewriter.cs b/src/CTA.Rules.Update/ActionsRewriter.cs index 37611f79..e7fd6ac4 100644 --- a/src/CTA.Rules.Update/ActionsRewriter.cs +++ b/src/CTA.Rules.Update/ActionsRewriter.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Codelyzer.Analysis.CSharp; using CTA.Rules.Config; using CTA.Rules.Models; using Microsoft.CodeAnalysis; @@ -12,10 +13,14 @@ namespace CTA.Rules.Update.Rewriters { public class ActionsRewriter : CSharpSyntaxRewriter { - private readonly FileActions _fileActions; private readonly SemanticModel _semanticModel; + private readonly SemanticModel _preportSemanticModel; private readonly SyntaxGenerator _syntaxGenerator; - public List allActions { get; private set; } + + private readonly string _filePath; + private readonly List _allActions; + + public List allExecutedActions { get; private set; } private static readonly Type[] identifierNameTypes = new Type[] { typeof(MethodDeclarationSyntax), @@ -27,12 +32,24 @@ public class ActionsRewriter : CSharpSyntaxRewriter typeof(ParameterSyntax), typeof(ObjectCreationExpressionSyntax)}; - public ActionsRewriter(SemanticModel semanticModel, SyntaxGenerator syntaxGenerator, FileActions fileActions) + public ActionsRewriter(SemanticModel semanticModel, SemanticModel preportSemanticModel, SyntaxGenerator syntaxGenerator, string filePath, List allActions) + { + _semanticModel = semanticModel; + _preportSemanticModel = preportSemanticModel; + _syntaxGenerator = syntaxGenerator; + _filePath = filePath; + _allActions = allActions; + allExecutedActions = new List(); + } + + public ActionsRewriter(SemanticModel semanticModel, SemanticModel preportSemanticModel, SyntaxGenerator syntaxGenerator, string filePath, GenericAction runningAction) { _semanticModel = semanticModel; + _preportSemanticModel = preportSemanticModel; _syntaxGenerator = syntaxGenerator; - _fileActions = fileActions; - allActions = new List(); + _filePath = filePath; + _allActions = new List() { runningAction }; + allExecutedActions = new List(); } public override SyntaxNode VisitAttributeList(AttributeListSyntax node) @@ -41,13 +58,13 @@ public override SyntaxNode VisitAttributeList(AttributeListSyntax node) foreach (var attributeSyntax in attributeListSyntax.Attributes) { - foreach (var action in _fileActions.AttributeActions) + foreach (var action in _allActions.OfType()) { if (action.Key == attributeSyntax.Name.ToString()) { if (action.AttributeListActionFunc != null) { - var actionExecution = new GenericActionExecution(action, _fileActions.FilePath) + var actionExecution = new GenericActionExecution(action, _filePath) { TimesRun = 1 }; @@ -62,7 +79,7 @@ public override SyntaxNode VisitAttributeList(AttributeListSyntax node) actionExecution.InvalidExecutions = 1; LogHelper.LogError(actionExecutionException); } - allActions.Add(actionExecution); + allExecutedActions.Add(actionExecution); } } } @@ -72,16 +89,15 @@ public override SyntaxNode VisitAttributeList(AttributeListSyntax node) } public override SyntaxNode VisitAttribute(AttributeSyntax node) { - var attributeSymbol = _semanticModel.GetSymbolInfo(node); AttributeSyntax attributeSyntax = (AttributeSyntax)base.VisitAttribute(node); - foreach (var action in _fileActions.AttributeActions) + foreach (var action in _allActions.OfType()) { if (action.Key == node.Name.ToString()) { if (action.AttributeActionFunc != null) { - var actionExecution = new GenericActionExecution(action, _fileActions.FilePath) + var actionExecution = new GenericActionExecution(action, _filePath) { TimesRun = 1 }; @@ -96,7 +112,7 @@ public override SyntaxNode VisitAttribute(AttributeSyntax node) actionExecution.InvalidExecutions = 1; LogHelper.LogError(actionExecutionException); } - allActions.Add(actionExecution); + allExecutedActions.Add(actionExecution); } } } @@ -105,14 +121,14 @@ public override SyntaxNode VisitAttribute(AttributeSyntax node) } public override SyntaxNode VisitClassDeclaration(ClassDeclarationSyntax node) { - var classSymbol = _semanticModel.GetDeclaredSymbol(node); + var classSymbol = SemanticHelper.GetDeclaredSymbol(node, _semanticModel, _preportSemanticModel); ClassDeclarationSyntax newNode = (ClassDeclarationSyntax)base.VisitClassDeclaration(node); - foreach (var action in _fileActions.ClassDeclarationActions) + foreach (var action in _allActions.OfType()) { if (action.Key == node.Identifier.Text.Trim()) { - var actionExecution = new GenericActionExecution(action, _fileActions.FilePath) + var actionExecution = new GenericActionExecution(action, _filePath) { TimesRun = 1 }; @@ -127,21 +143,21 @@ public override SyntaxNode VisitClassDeclaration(ClassDeclarationSyntax node) actionExecution.InvalidExecutions = 1; LogHelper.LogError(actionExecutionException); } - allActions.Add(actionExecution); + allExecutedActions.Add(actionExecution); } } return newNode; } public override SyntaxNode VisitInterfaceDeclaration(InterfaceDeclarationSyntax node) { - var classSymbol = _semanticModel.GetDeclaredSymbol(node); + var classSymbol = SemanticHelper.GetDeclaredSymbol(node, _semanticModel, _preportSemanticModel); InterfaceDeclarationSyntax newNode = (InterfaceDeclarationSyntax)base.VisitInterfaceDeclaration(node); - foreach (var action in _fileActions.InterfaceDeclarationActions) + foreach (var action in _allActions.OfType()) { if (action.Key == node.Identifier.Text.Trim()) { - var actionExecution = new GenericActionExecution(action, _fileActions.FilePath) + var actionExecution = new GenericActionExecution(action, _filePath) { TimesRun = 1 }; @@ -156,23 +172,23 @@ public override SyntaxNode VisitInterfaceDeclaration(InterfaceDeclarationSyntax actionExecution.InvalidExecutions = 1; LogHelper.LogError(actionExecutionException); } - allActions.Add(actionExecution); + allExecutedActions.Add(actionExecution); } } return newNode; } public override SyntaxNode VisitIdentifierName(IdentifierNameSyntax node) { - var symbolInfo = _semanticModel.GetSymbolInfo(node); + var symbol = SemanticHelper.GetSemanticSymbol(node, _semanticModel, _preportSemanticModel); var identifierNameSyntax = (IdentifierNameSyntax)base.VisitIdentifierName(node); - if (symbolInfo.Symbol != null) + if (symbol != null) { - foreach (var action in _fileActions.IdentifierNameActions) + foreach (var action in _allActions.OfType()) { - if (symbolInfo.Symbol.ToString() == action.Key && identifierNameTypes.Contains(identifierNameSyntax.Parent?.GetType())) + if (symbol.ToString() == action.Key && identifierNameTypes.Contains(identifierNameSyntax.Parent?.GetType())) { - var actionExecution = new GenericActionExecution(action, _fileActions.FilePath) + var actionExecution = new GenericActionExecution(action, _filePath) { TimesRun = 1 }; @@ -187,7 +203,7 @@ public override SyntaxNode VisitIdentifierName(IdentifierNameSyntax node) actionExecution.InvalidExecutions = 1; LogHelper.LogError(actionExecutionException); } - allActions.Add(actionExecution); + allExecutedActions.Add(actionExecution); } } } @@ -195,10 +211,9 @@ public override SyntaxNode VisitIdentifierName(IdentifierNameSyntax node) } public override SyntaxNode VisitInvocationExpression(InvocationExpressionSyntax node) { - var symbols = _semanticModel.GetSymbolInfo(node); + var symbol = SemanticHelper.GetSemanticSymbol(node, _semanticModel, _preportSemanticModel); var newNode = (InvocationExpressionSyntax)base.VisitInvocationExpression(node); - var symbol = symbols.Symbol; if(symbol == null) { @@ -207,11 +222,11 @@ public override SyntaxNode VisitInvocationExpression(InvocationExpressionSyntax var nodeKey = symbol.OriginalDefinition.ToString(); - foreach (var action in _fileActions.InvocationExpressionActions) + foreach (var action in _allActions.OfType()) { if (nodeKey == action.Key) { - var actionExecution = new GenericActionExecution(action, _fileActions.FilePath) + var actionExecution = new GenericActionExecution(action, _filePath) { TimesRun = 1 }; @@ -226,7 +241,7 @@ public override SyntaxNode VisitInvocationExpression(InvocationExpressionSyntax actionExecution.InvalidExecutions = 1; LogHelper.LogError(actionExecutionException); } - allActions.Add(actionExecution); + allExecutedActions.Add(actionExecution); } } return newNode; @@ -234,20 +249,19 @@ public override SyntaxNode VisitInvocationExpression(InvocationExpressionSyntax public override SyntaxNode VisitElementAccessExpression(ElementAccessExpressionSyntax node) { - var symbols = _semanticModel.GetSymbolInfo(node); + var symbol = SemanticHelper.GetSemanticSymbol(node, _semanticModel, _preportSemanticModel); var newNode = (ElementAccessExpressionSyntax)base.VisitElementAccessExpression(node); - var symbol = symbols.Symbol; if (symbol != null) { var nodeKey = $"{symbol.ContainingType}.{node.Expression}"; - foreach (var action in _fileActions.ElementAccessActions) + foreach (var action in _allActions.OfType()) { if (nodeKey == action.Key) { - var actionExecution = new GenericActionExecution(action, _fileActions.FilePath) + var actionExecution = new GenericActionExecution(action, _filePath) { TimesRun = 1 }; @@ -262,7 +276,7 @@ public override SyntaxNode VisitElementAccessExpression(ElementAccessExpressionS actionExecution.InvalidExecutions = 1; LogHelper.LogError(actionExecutionException); } - allActions.Add(actionExecution); + allExecutedActions.Add(actionExecution); } } } @@ -271,19 +285,18 @@ public override SyntaxNode VisitElementAccessExpression(ElementAccessExpressionS public override SyntaxNode VisitMemberAccessExpression(MemberAccessExpressionSyntax node) { - var symbols = _semanticModel.GetSymbolInfo(node); + var symbol = SemanticHelper.GetSemanticSymbol(node, _semanticModel, _preportSemanticModel); var newNode = base.VisitMemberAccessExpression(node); - var symbol = symbols.Symbol; if (symbol != null) { var nodeKey = $"{symbol.ContainingType}.{node.Name}"; - foreach (var action in _fileActions.MemberAccessActions) + foreach (var action in _allActions.OfType()) { if (nodeKey == action.Key) { - var actionExecution = new GenericActionExecution(action, _fileActions.FilePath) + var actionExecution = new GenericActionExecution(action, _filePath) { TimesRun = 1 }; @@ -298,7 +311,7 @@ public override SyntaxNode VisitMemberAccessExpression(MemberAccessExpressionSyn actionExecution.InvalidExecutions = 1; LogHelper.LogError(actionExecutionException); } - allActions.Add(actionExecution); + allExecutedActions.Add(actionExecution); } } } @@ -309,9 +322,9 @@ public override SyntaxNode VisitCompilationUnit(CompilationUnitSyntax node) { CompilationUnitSyntax newNode = (CompilationUnitSyntax)base.VisitCompilationUnit(node); //Applying using actions - foreach (var action in _fileActions.Usingactions) + foreach (var action in _allActions.OfType()) { - var actionExecution = new GenericActionExecution(action, _fileActions.FilePath) + var actionExecution = new GenericActionExecution(action, _filePath) { TimesRun = 1 }; @@ -326,21 +339,21 @@ public override SyntaxNode VisitCompilationUnit(CompilationUnitSyntax node) actionExecution.InvalidExecutions = 1; LogHelper.LogError(actionExecutionException); } - allActions.Add(actionExecution); + allExecutedActions.Add(actionExecution); } return newNode; } public override SyntaxNode VisitObjectCreationExpression(ObjectCreationExpressionSyntax node) { - var symbols = _semanticModel.GetSymbolInfo(node); + var symbol = SemanticHelper.GetSemanticSymbol(node, _semanticModel, _preportSemanticModel); ExpressionSyntax newNode = node; bool skipChildren = false; // This is here to skip actions on children node when the main identifier was changed. Just use new expression for the subsequent children actions. - foreach (var action in _fileActions.ObjectCreationExpressionActions) + foreach (var action in _allActions.OfType()) { - if (newNode.ToString() == action.Key || symbols.Symbol?.OriginalDefinition.ToDisplayString() == action.Key) + if (newNode.ToString() == action.Key || symbol?.OriginalDefinition.ToDisplayString() == action.Key) { - var actionExecution = new GenericActionExecution(action, _fileActions.FilePath) + var actionExecution = new GenericActionExecution(action, _filePath) { TimesRun = 1 }; @@ -348,7 +361,7 @@ public override SyntaxNode VisitObjectCreationExpression(ObjectCreationExpressio { skipChildren = true; newNode = action.ObjectCreationExpressionGenericActionFunc(_syntaxGenerator, (ObjectCreationExpressionSyntax)newNode); - allActions.Add(actionExecution); + allExecutedActions.Add(actionExecution); LogHelper.LogInformation(string.Format("{0}", action.Description)); } catch (Exception ex) @@ -357,7 +370,7 @@ public override SyntaxNode VisitObjectCreationExpression(ObjectCreationExpressio actionExecution.InvalidExecutions = 1; LogHelper.LogError(actionExecutionException); } - allActions.Add(actionExecution); + allExecutedActions.Add(actionExecution); } } if (!skipChildren) @@ -369,11 +382,11 @@ public override SyntaxNode VisitObjectCreationExpression(ObjectCreationExpressio public override SyntaxNode VisitNamespaceDeclaration(NamespaceDeclarationSyntax node) { NamespaceDeclarationSyntax newNode = (NamespaceDeclarationSyntax)base.VisitNamespaceDeclaration(node); - foreach (var action in _fileActions.NamespaceActions) + foreach (var action in _allActions.OfType()) { if (action.Key == newNode.Name.ToString()) { - var actionExecution = new GenericActionExecution(action, _fileActions.FilePath) + var actionExecution = new GenericActionExecution(action, _filePath) { TimesRun = 1 }; @@ -388,7 +401,7 @@ public override SyntaxNode VisitNamespaceDeclaration(NamespaceDeclarationSyntax actionExecution.InvalidExecutions = 1; LogHelper.LogError(actionExecutionException); } - allActions.Add(actionExecution); + allExecutedActions.Add(actionExecution); } } return newNode; diff --git a/src/CTA.Rules.Update/CTA.Rules.Update.csproj b/src/CTA.Rules.Update/CTA.Rules.Update.csproj index f728ed36..74a5f335 100644 --- a/src/CTA.Rules.Update/CTA.Rules.Update.csproj +++ b/src/CTA.Rules.Update/CTA.Rules.Update.csproj @@ -5,10 +5,6 @@ netcoreapp3.1 - - - - @@ -20,7 +16,7 @@ - + diff --git a/src/CTA.Rules.Update/CodeReplacer.cs b/src/CTA.Rules.Update/CodeReplacer.cs index e9191549..5a1fb246 100644 --- a/src/CTA.Rules.Update/CodeReplacer.cs +++ b/src/CTA.Rules.Update/CodeReplacer.cs @@ -9,6 +9,9 @@ using CTA.Rules.Models; using CTA.Rules.Update.Rewriters; using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Text; +using TextChange = CTA.Rules.Models.TextChange; +using TextSpan = Codelyzer.Analysis.Model.TextSpan; namespace CTA.Rules.Update { @@ -16,11 +19,17 @@ public class CodeReplacer { private readonly ProjectConfiguration _projectConfiguration; private readonly IEnumerable _sourceFileBuildResults; + private readonly List _metadataReferences; - public CodeReplacer(List sourceFileBuildResults, ProjectConfiguration projectConfiguration) + public CodeReplacer(List sourceFileBuildResults, ProjectConfiguration projectConfiguration, List metadataReferences, List updatedFiles = null) { _sourceFileBuildResults = sourceFileBuildResults; + if(updatedFiles != null) + { + _sourceFileBuildResults = _sourceFileBuildResults.Where(s => updatedFiles.Contains(s.SourceFileFullPath)); + } _projectConfiguration = projectConfiguration; + _metadataReferences = metadataReferences; } public Dictionary> Run(ProjectActions projectActions, ProjectType projectType) @@ -30,6 +39,7 @@ public Dictionary> Run(ProjectActions proje ConcurrentDictionary> actionsPerProject = new ConcurrentDictionary>(); var parallelOptions = new ParallelOptions() { MaxDegreeOfParallelism = Constants.ThreadCount }; + var fileActionsCount = fileActions.Count(); Parallel.ForEach(_sourceFileBuildResults, parallelOptions, sourceFileBuildResult => { @@ -44,22 +54,13 @@ public Dictionary> Run(ProjectActions proje LogHelper.LogInformation("---------------------------------------------------------------------------"); LogHelper.LogInformation("Processing file " + sourceFileBuildResult.SourceFilePath); - ActionsRewriter oneRewriter = new ActionsRewriter(sourceFileBuildResult.SemanticModel, sourceFileBuildResult.SyntaxGenerator, currentFileActions); - root = oneRewriter.Visit(root); - - - var result = root.NormalizeWhitespace().ToFullString(); - //TODO : Can you send a result - if (!_projectConfiguration.IsMockRun) + if (_projectConfiguration.PortCode) { - File.WriteAllText(sourceFileBuildResult.SourceFileFullPath, result); - } - var processedActions = ValidateActions(oneRewriter.allActions, result); - processedActions = AddActionsWithoutExecutions(currentFileActions, oneRewriter.allActions); - - if (!actionsPerProject.TryAdd(sourceFileBuildResult.SourceFileFullPath, processedActions)) + RunCodeChanges(root, sourceFileBuildResult, currentFileActions, actionsPerProject); + } + else { - throw new FilePortingException(sourceFileBuildResult.SourceFilePath, new Exception("File already exists in collection")); + GenerateCodeChanges(root, sourceFileBuildResult, currentFileActions, fileActionsCount, actionsPerProject); } } } @@ -72,6 +73,74 @@ public Dictionary> Run(ProjectActions proje var projectRunActions = new List(); + if (_projectConfiguration.PortProject) + { + projectRunActions = ApplyProjectActions(projectActions, projectType); + + if (!actionsPerProject.TryAdd(Constants.Project, projectRunActions)) + { + LogHelper.LogError(new FilePortingException(Constants.Project, new Exception("Error adding project to actions collection"))); + } + } + return actionsPerProject.ToDictionary(a => a.Key, a => a.Value); + } + + private void RunCodeChanges(SyntaxNode root, SourceFileBuildResult sourceFileBuildResult, FileActions currentFileActions, ConcurrentDictionary> actionsPerProject) + { + ActionsRewriter oneRewriter = new ActionsRewriter(sourceFileBuildResult.SemanticModel, sourceFileBuildResult.PrePortSemanticModel, sourceFileBuildResult.SyntaxGenerator, currentFileActions.FilePath, currentFileActions.AllActions); + root = oneRewriter.Visit(root); + var result = root.NormalizeWhitespace().ToFullString(); + + if (!_projectConfiguration.IsMockRun) + { + File.WriteAllText(sourceFileBuildResult.SourceFileFullPath, result); + } + + var processedActions = ValidateActions(oneRewriter.allExecutedActions, result); + processedActions = AddActionsWithoutExecutions(currentFileActions, oneRewriter.allExecutedActions); + + if (!actionsPerProject.TryAdd(sourceFileBuildResult.SourceFileFullPath, processedActions)) + { + throw new FilePortingException(sourceFileBuildResult.SourceFilePath, new Exception("File already exists in collection")); + } + } + private void GenerateCodeChanges(SyntaxNode root, SourceFileBuildResult sourceFileBuildResult, FileActions currentFileActions, int fileActionsCount, ConcurrentDictionary> actionsPerProject) + { + if (currentFileActions != null) + { + var normalizedRoot = root.NormalizeWhitespace().ToFullString(); + //If true, and we are doing a full analysis, line endings and spaces need to be normalized: + //TODO change the condition to be a config value in ProjectConfiguration instead of file count + if (normalizedRoot != root.ToFullString() && fileActionsCount > 1) + { + File.WriteAllText(sourceFileBuildResult.SourceFileFullPath, normalizedRoot); + } + + currentFileActions.NodeTokens.ForEach(nodetoken => + { + nodetoken.AllActions.ForEach(nodeAction => { + ActionsRewriter oneRewriter = new ActionsRewriter(sourceFileBuildResult.SemanticModel, sourceFileBuildResult.PrePortSemanticModel, sourceFileBuildResult.SyntaxGenerator, currentFileActions.FilePath, nodeAction); + + var newRoot = oneRewriter.Visit(root); + var allChanges = newRoot.SyntaxTree.GetChanges(root.SyntaxTree); + + foreach (var textChange in allChanges) + { + var fileLinePositionSpan = root.SyntaxTree.GetMappedLineSpan(textChange.Span); + var newTextChange = new TextChange() { FileLinePositionSpan = fileLinePositionSpan, NewText = textChange.NewText }; + if (!nodetoken.TextChanges.Contains(newTextChange)) + { + nodetoken.TextChanges.Add(newTextChange); + } + } + }); + }); + } + } + + private List ApplyProjectActions(ProjectActions projectActions, ProjectType projectType) + { + var projectRunActions = new List(); //Project Level Actions foreach (var projectLevelAction in projectActions.ProjectLevelActions) { @@ -99,7 +168,12 @@ public Dictionary> Run(ProjectActions proje { try { - runResult = projectLevelAction.ProjectFileActionFunc(_projectConfiguration.ProjectPath, projectType, _projectConfiguration.TargetVersions, projectActions.PackageActions.Distinct().ToDictionary(p => p.Name, p => p.Version), projectActions.ProjectReferenceActions.ToList()); + runResult = projectLevelAction.ProjectFileActionFunc(_projectConfiguration.ProjectPath, + projectType, + _projectConfiguration.TargetVersions, + projectActions.PackageActions.Distinct().ToDictionary(p => p.Name, p => p.Version), + projectActions.ProjectReferenceActions.ToList(), + _metadataReferences); } catch (Exception ex) { @@ -116,13 +190,7 @@ public Dictionary> Run(ProjectActions proje LogHelper.LogInformation(projectLevelAction.Description); } } - - if (!actionsPerProject.TryAdd(Constants.Project, projectRunActions)) - { - LogHelper.LogError(new FilePortingException(Constants.Project, new Exception("Error adding project to actions collection"))); - } - - return actionsPerProject.ToDictionary(a => a.Key, a => a.Value); + return projectRunActions; } private List AddActionsWithoutExecutions(FileActions currentFileActions, List allActions) @@ -194,5 +262,6 @@ public List ValidateActions(List } return actions; } + } } diff --git a/src/CTA.Rules.Update/ProjectRewriter.cs b/src/CTA.Rules.Update/ProjectRewriter.cs index 86a36d43..97d080b9 100644 --- a/src/CTA.Rules.Update/ProjectRewriter.cs +++ b/src/CTA.Rules.Update/ProjectRewriter.cs @@ -9,6 +9,7 @@ using CTA.Rules.Config; using CTA.Rules.Models; using CTA.Rules.RuleFiles; +using Microsoft.CodeAnalysis; namespace CTA.Rules.Update { @@ -22,6 +23,7 @@ public class ProjectRewriter private readonly List _sourceFileBuildResults; private readonly List _projectReferences; private readonly ProjectResult _projectResult; + private readonly List _metaReferences; /// /// Initializes a new instance of ProjectRewriter using an existing analysis @@ -45,9 +47,28 @@ public ProjectRewriter(AnalyzerResult analyzerResult, ProjectConfiguration rules _sourceFileBuildResults = analyzerResult?.ProjectBuildResult?.SourceFileBuildResults; _sourceFileResults = analyzerResult?.ProjectResult?.SourceFileResults; _projectReferences = analyzerResult?.ProjectBuildResult?.ExternalReferences?.ProjectReferences.Select(p => p.AssemblyLocation).ToList(); + _metaReferences = analyzerResult.ProjectBuildResult.Project.MetadataReferences.Select(m => m.Display).ToList(); RulesEngineConfiguration = rulesEngineConfiguration; } + public ProjectRewriter(IDEProjectResult projectResult, ProjectConfiguration rulesEngineConfiguration) + { + _sourceFileResults = projectResult.RootNodes; + _sourceFileBuildResults = projectResult.SourceFileBuildResults; + RulesEngineConfiguration = rulesEngineConfiguration; + + _projectResult = new ProjectResult() + { + ProjectFile = rulesEngineConfiguration.ProjectPath, + TargetVersions = rulesEngineConfiguration.TargetVersions, + UpgradePackages = rulesEngineConfiguration.PackageReferences.Select(p => new PackageAction() + { + Name = p.Key, + OriginalVersion = p.Value.Item1, + Version = p.Value.Item2 + }).ToList() + }; + } /// /// Initializes the project rewriter by getting a list of actions that will be run @@ -60,9 +81,9 @@ public ProjectResult Initialize() { var allReferences = _sourceFileResults?.SelectMany(s => s.References).Distinct(); RulesFileLoader rulesFileLoader = new RulesFileLoader(allReferences, RulesEngineConfiguration.RulesDir, RulesEngineConfiguration.TargetVersions, string.Empty, RulesEngineConfiguration.AssemblyDir); - var result = rulesFileLoader.Load(); + var projectRules = rulesFileLoader.Load(); - RulesAnalysis walker = new RulesAnalysis(_sourceFileResults, result); + RulesAnalysis walker = new RulesAnalysis(_sourceFileResults, projectRules); projectActions = walker.Analyze(); _projectReferences.ForEach(p => { @@ -76,9 +97,9 @@ public ProjectResult Initialize() projectActions.PackageActions.Add(new PackageAction() { Name = p.Key, OriginalVersion = p.Value.Item1, Version = p.Value.Item2 }); } MergePackages(projectActions.PackageActions); - projectActions.ProjectLevelActions = result.ProjectTokens.SelectMany(p => p.ProjectLevelActions).Distinct().ToList(); - projectActions.ProjectLevelActions.AddRange(result.ProjectTokens.SelectMany(p => p.ProjectFileActions)); - + projectActions.ProjectLevelActions = projectRules.ProjectTokens.SelectMany(p => p.ProjectLevelActions).Distinct().ToList(); + projectActions.ProjectLevelActions.AddRange(projectRules.ProjectTokens.SelectMany(p => p.ProjectFileActions)); + projectActions.ProjectRules = projectRules; _projectResult.ProjectActions = projectActions; } catch (Exception ex) @@ -105,11 +126,32 @@ public ProjectResult Run() public ProjectResult Run(ProjectActions projectActions) { _projectResult.ProjectActions = projectActions; - CodeReplacer baseReplacer = new CodeReplacer(_sourceFileBuildResults, RulesEngineConfiguration); + CodeReplacer baseReplacer = new CodeReplacer(_sourceFileBuildResults, RulesEngineConfiguration, _metaReferences); _projectResult.ExecutedActions = baseReplacer.Run(projectActions, RulesEngineConfiguration.ProjectType); return _projectResult; } + public List RunIncremental(List updatedFiles, RootNodes projectRules) + { + var ideFileActions = new List(); + + var allReferences = _sourceFileResults?.SelectMany(s => s.References).Distinct(); + RulesFileLoader rulesFileLoader = new RulesFileLoader(allReferences, Constants.RulesDefaultPath, RulesEngineConfiguration.TargetVersions, string.Empty, RulesEngineConfiguration.AssemblyDir); + projectRules = rulesFileLoader.Load(); + + RulesAnalysis walker = new RulesAnalysis(_sourceFileResults, projectRules); + var projectActions = walker.Analyze(); + + CodeReplacer baseReplacer = new CodeReplacer(_sourceFileBuildResults, RulesEngineConfiguration, _metaReferences, updatedFiles); + _projectResult.ExecutedActions = baseReplacer.Run(projectActions, RulesEngineConfiguration.ProjectType); + + ideFileActions = projectActions + .FileActions + .SelectMany(f => f.NodeTokens.Select(n => new IDEFileActions() { TextSpan = n.TextSpan, Description = n.Description, FilePath = f.FilePath, TextChanges = n.TextChanges })) + .ToList(); + return ideFileActions; + } + /// /// Merges the packages from packageActions with the packages in the ProjectConfiguration diff --git a/src/CTA.Rules.Update/SolutionRewriter.cs b/src/CTA.Rules.Update/SolutionRewriter.cs index eae2662f..5ac463b5 100644 --- a/src/CTA.Rules.Update/SolutionRewriter.cs +++ b/src/CTA.Rules.Update/SolutionRewriter.cs @@ -1,7 +1,9 @@ -using System.Collections.Generic; +using System.Collections.Concurrent; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Codelyzer.Analysis; +using Codelyzer.Analysis.Build; using CTA.Rules.Config; using CTA.Rules.Models; @@ -59,6 +61,14 @@ public SolutionRewriter(List analyzerResults, List solutionConfiguration) + { + _rulesRewriters = new List() + { + new ProjectRewriter(projectResult, solutionConfiguration.FirstOrDefault(s => s.ProjectPath == projectResult.ProjectPath)) + }; + } + /// /// Initializes the SolutionRewriter /// @@ -85,6 +95,18 @@ public SolutionResult Run(Dictionary projectActions) return _solutionResult; } + public List RunIncremental(RootNodes projectRules, List updatedFiles) + { + var ideFileActions = new BlockingCollection(); + var options = new ParallelOptions() { MaxDegreeOfParallelism = Constants.ThreadCount }; + Parallel.ForEach(_rulesRewriters, options, rulesRewriter => + { + var result = rulesRewriter.RunIncremental(updatedFiles, projectRules); + result.ForEach(fileAction => ideFileActions.Add(fileAction)); + }); + return ideFileActions.ToList(); + } + /// /// Runs the solution rewriter after creating an analysis /// diff --git a/src/CTA.Rules.sln b/src/CTA.Rules.sln index ac312e1b..2f873cfc 100644 --- a/src/CTA.Rules.sln +++ b/src/CTA.Rules.sln @@ -40,7 +40,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CTA.FeatureDetection.AuthType", "CTA.FeatureDetection.AuthType\CTA.FeatureDetection.AuthType.csproj", "{7F508C93-ACD1-4322-BF40-454E386EE53C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CTA.Rules.Common", "CTA.Rules.Common\CTA.Rules.Common.csproj", "{F3A3E693-81B4-46AF-9457-B10B20C6B2C8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CTA.Rules.Common", "CTA.Rules.Common\CTA.Rules.Common.csproj", "{F3A3E693-81B4-46AF-9457-B10B20C6B2C8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/tst/CTA.Rules.Test/Actions/ProjectFileActionsTests.cs b/tst/CTA.Rules.Test/Actions/ProjectFileActionsTests.cs index fd547090..7202bb31 100644 --- a/tst/CTA.Rules.Test/Actions/ProjectFileActionsTests.cs +++ b/tst/CTA.Rules.Test/Actions/ProjectFileActionsTests.cs @@ -56,7 +56,11 @@ private string CreateNewFile(ProjectType projectType, List targetVersion { ResetProjectFile(); var migrationProjectFileAction = _projectFileActions.GetMigrateProjectFileAction(""); - var result = migrationProjectFileAction(_projectFile, projectType, targetVersions, packageReferences, projectReferences); + var metaRefs = new List + { + @"C:\\RandomFile.dll" + }; + var result = migrationProjectFileAction(_projectFile, projectType, targetVersions, packageReferences, projectReferences, metaRefs); return string.Concat(result, File.ReadAllText(_projectFile)); } diff --git a/tst/CTA.Rules.Test/ProjectFileCreatorTests.cs b/tst/CTA.Rules.Test/ProjectFileCreatorTests.cs index 2aed9e5d..54a71452 100644 --- a/tst/CTA.Rules.Test/ProjectFileCreatorTests.cs +++ b/tst/CTA.Rules.Test/ProjectFileCreatorTests.cs @@ -34,13 +34,17 @@ public void Setup() "TheMainProject", "TheDependency" }; + var metaRefs = new List + { + @"C:\\RandomFile.dll" + }; _mvcProjectFileCreator = new ProjectFileCreator(_mvcProjectFilePath, targetFramework, - packages, projectReferences, ProjectType.Mvc); + packages, projectReferences, ProjectType.Mvc, metaRefs); _classLibraryProjectFileCreator = new ProjectFileCreator(_classLibraryProjectFilePath, targetFramework, - packages, projectReferences, ProjectType.ClassLibrary); + packages, projectReferences, ProjectType.ClassLibrary, metaRefs); _webClassLibraryProjectFileCreator = new ProjectFileCreator(_webClassLibraryProjectFilePath, targetFramework, - packages, projectReferences, ProjectType.WebClassLibrary); + packages, projectReferences, ProjectType.WebClassLibrary, metaRefs); } [TearDown] @@ -71,6 +75,11 @@ public void Create_Produces_Formatted_Mvc_Project_File() + + + "; Assert.AreEqual(expectedProjectFileContents, projectFileContents); @@ -95,6 +104,11 @@ public void Create_Produces_Formatted_ClassLibrary_Project_File() + + + "; Assert.AreEqual(expectedProjectFileContents, projectFileContents); @@ -122,6 +136,11 @@ public void Create_Produces_Formatted_WebClassLibrary_Project_File() + + + "; Assert.AreEqual(expectedProjectFileContents, projectFileContents); diff --git a/tst/CTA.Rules.Test/TempRules/microsoft.owin.json b/tst/CTA.Rules.Test/TempRules/microsoft.owin.json index 5a684821..860cfc20 100644 --- a/tst/CTA.Rules.Test/TempRules/microsoft.owin.json +++ b/tst/CTA.Rules.Test/TempRules/microsoft.owin.json @@ -22,7 +22,55 @@ { "Name": "netcoreapp3.1", "TargetCPU": [ "x86", "x64", "ARM32", "ARM64" ] + } + ], + "Description": "Add a reference to Microsoft.AspNetCore.Owin and remove Microsoft.Owin and Owin.", + "Actions": [ + { + "Name": "AddPackage", + "Type": "Package", + "Value": { + "Name": "Microsoft.AspNetCore.Owin", + "Version": "3.1.14" + }, + "Description": "Add package Microsoft.AspNetCore.Owin" }, + { + "Name": "AddDirective", + "Type": "Using", + "Value": "Microsoft.AspNetCore.Owin", + "Description": "Add Microsoft.AspNetCore.Owin namespace", + "ActionValidation": { + "Contains": "usingMicrosoft.AspNetCore.Owin;", + "NotContains": "" + } + }, + { + "Name": "RemoveDirective", + "Type": "Using", + "Value": "Microsoft.Owin", + "Description": "Remove Microsoft.Owin namespace", + "ActionValidation": { + "Contains": "", + "NotContains": "usingMicrosoft.Owin;" + } + }, + { + "Name": "RemoveDirective", + "Type": "Using", + "Value": "Owin", + "Description": "Remove Owin namespace", + "ActionValidation": { + "Contains": "", + "NotContains": "usingOwin;" + } + } + ] + }, + { + "Source": "Amazon", + "Preferred": "Yes", + "TargetFrameworks": [ { "Name": "net5.0", "TargetCPU": [ "x86", "x64", "ARM32", "ARM64" ]