├── .config ├── 1espt │ └── PipelineAutobaseliningConfig.yml ├── guardian │ └── .gdnbaselines └── tsaoptions.json ├── .editorconfig ├── .gitattributes ├── .gitignore ├── .vsts-ci.yml ├── .vsts-pr.yml ├── CODE-OF-CONDUCT.md ├── CONTRIBUTING.md ├── Directory.Build.props ├── Directory.Build.rsp ├── Directory.Build.targets ├── LICENSE.TXT ├── NuGet.config ├── README.md ├── SECURITY.md ├── build.cmd ├── build.sh ├── eng ├── Publishing.props ├── SignVerifyIgnore.txt ├── Signing.props ├── Version.Details.xml ├── Versions.props └── common │ ├── BuildConfiguration │ └── build-configuration.json │ ├── CIBuild.cmd │ ├── PSScriptAnalyzerSettings.psd1 │ ├── README.md │ ├── SetupNugetSources.ps1 │ ├── SetupNugetSources.sh │ ├── build.cmd │ ├── build.ps1 │ ├── build.sh │ ├── cibuild.sh │ ├── core-templates │ ├── job │ │ ├── job.yml │ │ ├── onelocbuild.yml │ │ ├── publish-build-assets.yml │ │ ├── source-build.yml │ │ └── source-index-stage1.yml │ ├── jobs │ │ ├── codeql-build.yml │ │ ├── jobs.yml │ │ └── source-build.yml │ ├── post-build │ │ ├── common-variables.yml │ │ ├── post-build.yml │ │ └── setup-maestro-vars.yml │ ├── steps │ │ ├── cleanup-microbuild.yml │ │ ├── component-governance.yml │ │ ├── enable-internal-runtimes.yml │ │ ├── enable-internal-sources.yml │ │ ├── generate-sbom.yml │ │ ├── get-delegation-sas.yml │ │ ├── get-federated-access-token.yml │ │ ├── install-microbuild.yml │ │ ├── publish-build-artifacts.yml │ │ ├── publish-logs.yml │ │ ├── publish-pipeline-artifacts.yml │ │ ├── retain-build.yml │ │ ├── send-to-helix.yml │ │ ├── source-build.yml │ │ └── source-index-stage1-publish.yml │ └── variables │ │ └── pool-providers.yml │ ├── cross │ ├── arm │ │ └── tizen │ │ │ └── tizen.patch │ ├── arm64 │ │ └── tizen │ │ │ └── tizen.patch │ ├── armel │ │ └── tizen │ │ │ └── tizen.patch │ ├── build-android-rootfs.sh │ ├── build-rootfs.sh │ ├── install-debs.py │ ├── riscv64 │ │ └── tizen │ │ │ └── tizen.patch │ ├── tizen-build-rootfs.sh │ ├── tizen-fetch.sh │ ├── toolchain.cmake │ └── x86 │ │ └── tizen │ │ └── tizen.patch │ ├── darc-init.ps1 │ ├── darc-init.sh │ ├── dotnet-install.cmd │ ├── dotnet-install.ps1 │ ├── dotnet-install.sh │ ├── enable-cross-org-publishing.ps1 │ ├── generate-locproject.ps1 │ ├── generate-sbom-prep.ps1 │ ├── generate-sbom-prep.sh │ ├── helixpublish.proj │ ├── init-tools-native.cmd │ ├── init-tools-native.ps1 │ ├── init-tools-native.sh │ ├── internal-feed-operations.ps1 │ ├── internal-feed-operations.sh │ ├── internal │ ├── Directory.Build.props │ ├── NuGet.config │ └── Tools.csproj │ ├── loc │ └── P22DotNetHtmlLocalization.lss │ ├── msbuild.ps1 │ ├── msbuild.sh │ ├── native │ ├── CommonLibrary.psm1 │ ├── common-library.sh │ ├── init-compiler.sh │ ├── init-distro-rid.sh │ ├── init-os-and-arch.sh │ ├── install-cmake-test.sh │ ├── install-cmake.sh │ ├── install-dependencies.sh │ └── install-tool.ps1 │ ├── pipeline-logging-functions.ps1 │ ├── pipeline-logging-functions.sh │ ├── post-build │ ├── check-channel-consistency.ps1 │ ├── nuget-validation.ps1 │ ├── nuget-verification.ps1 │ ├── publish-using-darc.ps1 │ ├── redact-logs.ps1 │ ├── sourcelink-validation.ps1 │ └── symbols-validation.ps1 │ ├── retain-build.ps1 │ ├── sdk-task.ps1 │ ├── sdk-task.sh │ ├── sdl │ ├── NuGet.config │ ├── configure-sdl-tool.ps1 │ ├── execute-all-sdl-tools.ps1 │ ├── extract-artifact-archives.ps1 │ ├── extract-artifact-packages.ps1 │ ├── init-sdl.ps1 │ ├── packages.config │ ├── run-sdl.ps1 │ ├── sdl.ps1 │ └── trim-assets-version.ps1 │ ├── template-guidance.md │ ├── templates-official │ ├── job │ │ ├── job.yml │ │ ├── onelocbuild.yml │ │ ├── publish-build-assets.yml │ │ ├── source-build.yml │ │ └── source-index-stage1.yml │ ├── jobs │ │ ├── codeql-build.yml │ │ ├── jobs.yml │ │ └── source-build.yml │ ├── post-build │ │ ├── common-variables.yml │ │ ├── post-build.yml │ │ └── setup-maestro-vars.yml │ ├── steps │ │ ├── component-governance.yml │ │ ├── enable-internal-runtimes.yml │ │ ├── enable-internal-sources.yml │ │ ├── generate-sbom.yml │ │ ├── get-delegation-sas.yml │ │ ├── get-federated-access-token.yml │ │ ├── publish-build-artifacts.yml │ │ ├── publish-logs.yml │ │ ├── publish-pipeline-artifacts.yml │ │ ├── retain-build.yml │ │ ├── send-to-helix.yml │ │ ├── source-build.yml │ │ └── source-index-stage1-publish.yml │ └── variables │ │ ├── pool-providers.yml │ │ └── sdl-variables.yml │ ├── templates │ ├── job │ │ ├── job.yml │ │ ├── onelocbuild.yml │ │ ├── publish-build-assets.yml │ │ ├── source-build.yml │ │ └── source-index-stage1.yml │ ├── jobs │ │ ├── codeql-build.yml │ │ ├── jobs.yml │ │ └── source-build.yml │ ├── post-build │ │ ├── common-variables.yml │ │ ├── post-build.yml │ │ └── setup-maestro-vars.yml │ ├── steps │ │ ├── component-governance.yml │ │ ├── enable-internal-runtimes.yml │ │ ├── enable-internal-sources.yml │ │ ├── generate-sbom.yml │ │ ├── get-delegation-sas.yml │ │ ├── get-federated-access-token.yml │ │ ├── publish-build-artifacts.yml │ │ ├── publish-logs.yml │ │ ├── publish-pipeline-artifacts.yml │ │ ├── retain-build.yml │ │ ├── send-to-helix.yml │ │ ├── source-build.yml │ │ └── source-index-stage1-publish.yml │ └── variables │ │ └── pool-providers.yml │ ├── tools.ps1 │ └── tools.sh ├── global.json ├── lab.sln ├── src ├── MSBuildBinLogQuery │ ├── Ast │ │ ├── AstNodeWithConstraints.cs │ │ ├── ComponentNode.cs │ │ ├── ConstraintNode.cs │ │ ├── ErrorNode.cs │ │ ├── IAstNode.cs │ │ ├── IFilterable.cs │ │ ├── IdNode.cs │ │ ├── LogNode.cs │ │ ├── LogNodeType.cs │ │ ├── MessageNode.cs │ │ ├── NameNode.cs │ │ ├── PathNode.cs │ │ ├── ProjectNode.cs │ │ ├── TargetNode.cs │ │ ├── TaskNode.cs │ │ └── WarningNode.cs │ ├── Construction │ │ ├── BinaryLogReader.cs │ │ └── GraphBuilder.cs │ ├── Graph │ │ ├── DirectedAcyclicGraph.cs │ │ ├── IDirectedAcyclicGraphNode.cs │ │ ├── IShallowCopyableGraphNode.cs │ │ ├── ProjectNode_BeforeThis.cs │ │ ├── TargetNode_AfterThis.cs │ │ └── TargetNode_BeforeThis.cs │ ├── Interpret │ │ └── Interpreter.cs │ ├── MSBuildBinLogQuery.csproj │ ├── Parse │ │ ├── ParseException.cs │ │ └── Parser.cs │ ├── Result │ │ ├── Build.cs │ │ ├── Component.cs │ │ ├── Error.cs │ │ ├── IQueryResult.cs │ │ ├── IResultWithId.cs │ │ ├── IResultWithName.cs │ │ ├── IResultWithPath.cs │ │ ├── Log.cs │ │ ├── Message.cs │ │ ├── Project.cs │ │ ├── Target.cs │ │ ├── Task.cs │ │ └── Warning.cs │ ├── Scan │ │ ├── ScanException.cs │ │ └── Scanner.cs │ ├── Token │ │ ├── CommaToken.cs │ │ ├── DoubleSlashToken.cs │ │ ├── EofToken.cs │ │ ├── EqualToken.cs │ │ ├── ErrorToken.cs │ │ ├── IdToken.cs │ │ ├── IntegerToken.cs │ │ ├── LeftBracketToken.cs │ │ ├── MessageToken.cs │ │ ├── NameToken.cs │ │ ├── PathToken.cs │ │ ├── ProjectToken.cs │ │ ├── RightBracketToken.cs │ │ ├── SingleSlashToken.cs │ │ ├── StringToken.cs │ │ ├── TargetToken.cs │ │ ├── TaskToken.cs │ │ ├── Token.cs │ │ └── WarningToken.cs │ └── Utility │ │ ├── ItemManager.cs │ │ └── PropertyManager.cs ├── core-sdk-tasks │ ├── AddMetadataIsPE.cs │ ├── AzurePublisher.cs │ ├── BuildFPMToolPreReqs.cs │ ├── Chmod.cs │ ├── Constants.cs │ ├── CopyBlobsToLatest.cs │ ├── Crossgen.cs │ ├── CurrentPlatform.cs │ ├── DotNetDebTool.cs │ ├── DotNetTool.cs │ ├── DownloadFile.cs │ ├── Enumerations │ │ └── BuildPlatform.cs │ ├── EnvironmentVariableFilter.cs │ ├── ExtractArchiveToDirectory.cs │ ├── GenerateChecksums.cs │ ├── GenerateMSBuildExtensionsSWR.cs │ ├── GenerateMsiVersion.cs │ ├── GetCurrentRuntimeInformation.cs │ ├── GetRuntimePackRids.cs │ ├── GetUseBundledVersionAsDefaultVersion.cs │ ├── ReplaceFileContents.cs │ ├── TarGzFileCreateFromDirectory.cs │ ├── Utils │ │ └── Version.cs │ ├── ZipFileCreateFromDirectory.cs │ └── core-sdk-tasks.csproj ├── dotnet-bootstrapper │ ├── BootstrapperCommandParser.cs │ ├── LocalizableStrings.resx │ ├── Program.cs │ ├── README.md │ ├── dotnet-bootstrapper.csproj │ └── xlf │ │ ├── LocalizableStrings.cs.xlf │ │ ├── LocalizableStrings.de.xlf │ │ ├── LocalizableStrings.es.xlf │ │ ├── LocalizableStrings.fr.xlf │ │ ├── LocalizableStrings.it.xlf │ │ ├── LocalizableStrings.ja.xlf │ │ ├── LocalizableStrings.ko.xlf │ │ ├── LocalizableStrings.pl.xlf │ │ ├── LocalizableStrings.pt-BR.xlf │ │ ├── LocalizableStrings.ru.xlf │ │ ├── LocalizableStrings.tr.xlf │ │ ├── LocalizableStrings.zh-Hans.xlf │ │ └── LocalizableStrings.zh-Hant.xlf ├── dotnet-core-uninstall │ ├── LocalizableStrings.Designer.cs │ ├── LocalizableStrings.resx │ ├── MacOs │ │ ├── FileSystemExplorer.cs │ │ └── SupportedBundleTypeConfigs.cs │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── README.md │ ├── Shared │ │ ├── BundleInfo │ │ │ ├── Bundle.cs │ │ │ ├── BundleArch.cs │ │ │ ├── BundleType.cs │ │ │ └── Versioning │ │ │ │ ├── AspNetRuntimeVersion.cs │ │ │ │ ├── BeforePatch.cs │ │ │ │ ├── BundleVersion.cs │ │ │ │ ├── HostingBundleVersion.cs │ │ │ │ ├── MajorMinorSdkMinorVersion.cs │ │ │ │ ├── MajorMinorVersion.cs │ │ │ │ ├── RuntimeVersion.cs │ │ │ │ └── SdkVersion.cs │ │ ├── Commands │ │ │ ├── CommandBundleFilter.cs │ │ │ ├── DryRunCommandExec.cs │ │ │ ├── ListCommandExec.cs │ │ │ ├── UninstallCommandExec.cs │ │ │ └── UninstallHelpBuilder.cs │ │ ├── Configs │ │ │ ├── BundleTypePrintInfo.cs │ │ │ ├── CommandLineConfigs.cs │ │ │ ├── OptionFilterers.cs │ │ │ ├── SupportedBundleTypeConfigs.cs │ │ │ └── Verbosity │ │ │ │ ├── VerbosityLevel.cs │ │ │ │ └── VerbosityLogger.cs │ │ ├── Exceptions │ │ │ ├── BundleTypeMissingException.cs │ │ │ ├── ConfirmationPromptInvalidException.cs │ │ │ ├── DotNetUninstallExceptions.cs │ │ │ ├── ExceptionHandler.cs │ │ │ ├── InvalidInputVersionException.cs │ │ │ ├── MoreThanOneVersionSpecifiedException.cs │ │ │ ├── MoreThanZeroVersionSpecifiedException.cs │ │ │ ├── NotAdminException.cs │ │ │ ├── OperatingSystemNotSupportedException.cs │ │ │ ├── OptionsConflictException.cs │ │ │ ├── RequiredArgMissingForUninstallCommandException.cs │ │ │ ├── SpecifiedVersionNotFoundException.cs │ │ │ ├── UninstallationFailedException.cs │ │ │ ├── UninstallationNotAllowedException.cs │ │ │ ├── VerbosityLevelInvalidException.cs │ │ │ └── VersionBeforeOptionException.cs │ │ ├── Filterers │ │ │ ├── AllBelowOptionFilterer.cs │ │ │ ├── AllButLatestOptionFilterer.cs │ │ │ ├── AllButOptionFilterer.cs │ │ │ ├── AllLowerPatchesOptionFilterer.cs │ │ │ ├── AllOptionFilterer.cs │ │ │ ├── AllPreviewsButLatestOptionFilterer.cs │ │ │ ├── AllPreviewsOptionFilterer.cs │ │ │ ├── Filterer.cs │ │ │ ├── MajorMinorOptionFilterer.cs │ │ │ └── NoOptionFilterer.cs │ │ ├── Utils │ │ │ ├── IBundleCollector.cs │ │ │ ├── Regexes.cs │ │ │ └── RuntimeInfo.cs │ │ └── VSVersioning │ │ │ └── VisualStudioSafeVersionsExtractor.cs │ ├── Windows │ │ ├── RegistryQuery.cs │ │ └── SupportedBundleTypeConfigs.cs │ ├── dotnet-core-uninstall.csproj │ └── xlf │ │ ├── LocalizableStrings.cs.xlf │ │ ├── LocalizableStrings.de.xlf │ │ ├── LocalizableStrings.es.xlf │ │ ├── LocalizableStrings.fr.xlf │ │ ├── LocalizableStrings.it.xlf │ │ ├── LocalizableStrings.ja.xlf │ │ ├── LocalizableStrings.ko.xlf │ │ ├── LocalizableStrings.pl.xlf │ │ ├── LocalizableStrings.pt-BR.xlf │ │ ├── LocalizableStrings.ru.xlf │ │ ├── LocalizableStrings.tr.xlf │ │ ├── LocalizableStrings.zh-Hans.xlf │ │ └── LocalizableStrings.zh-Hant.xlf └── redist │ ├── redist.csproj │ └── targets │ ├── BuildCoreSdkTasks.targets │ ├── FileExtensions.targets │ ├── GenerateLayout.targets │ ├── GenerateMSIs.targets │ ├── GetRuntimeInformation.targets │ ├── MacEntitlements │ ├── AddMacEntitlements.targets │ └── entitlements.plist │ ├── Versions.targets │ └── packaging │ └── windows │ └── dotnetCoreUninstall │ ├── Init.cmd │ ├── dotnet.wxs │ ├── generatemsi.ps1 │ ├── images │ ├── dotnetbackground.png │ └── dotnetbanner.png │ ├── provider.wxs │ └── variables.wxi └── test ├── MSBuildBinLogQuery.Tests ├── Interpret │ └── InterpreterTests.cs ├── MSBuildBinLogQuery.Tests.csproj ├── Parse │ └── ParserTests.cs └── Scan │ └── ScannerTests.cs ├── dotnet-bootstrapper.Tests ├── EndToEndTests.cs ├── TestUtilities.cs └── dotnet-bootstrapper.Tests.csproj └── dotnet-core-uninstall.Tests ├── Attributes ├── MacOsOnlyFact.cs ├── MacOsOnlyTheory.cs ├── WindowsOnlyFact.cs └── WindowsOnlyTheory.cs ├── Shared ├── BundleInfo │ ├── BundleTests.cs │ └── Versioning │ │ ├── AspNetRuntimeVersionTests.cs │ │ ├── HostingBundleVersionTests.cs │ │ ├── MajorMinorSdkMinorVersionTests.cs │ │ ├── MajorMinorVersionTests.cs │ │ ├── RuntimeVersionTests.cs │ │ └── SdkVersionTests.cs ├── Commands │ ├── CommandBundleFilterTests.cs │ ├── ListCommandExecTests.cs │ └── UninstallCommandExecTests.cs ├── Configs │ ├── CommandLineConfigsTests.cs │ └── Verbosity │ │ └── VerbosityLoggerTests.cs ├── Filterers │ ├── AllBelowOptionFiltererTests.cs │ ├── AllButLatestOptionFiltererTests.cs │ ├── AllButOptionFiltererTests.cs │ ├── AllLowerPatchesOptionFiltererTests.cs │ ├── AllOptionFiltererTests.cs │ ├── AllPreviewsButLatestOptionFiltererTests.cs │ ├── AllPreviewsOptionFiltererTests.cs │ ├── FiltererTests.cs │ ├── MajorMinorOptionFiltererTests.cs │ └── NoOptionFiltererTests.cs ├── Utils │ └── RegexesTests.cs └── VSVersioning │ └── VSVersionTests.cs ├── TestUtils └── EqualityComparisonTestUtils.cs ├── Windows └── RegistryQueryTests.cs └── dotnet-core-uninstall.Tests.csproj /.config/1espt/PipelineAutobaseliningConfig.yml: -------------------------------------------------------------------------------- 1 | ## DO NOT MODIFY THIS FILE MANUALLY. This is part of auto-baselining from 1ES Pipeline Templates. Go to [https://aka.ms/1espt-autobaselining] for more details. 2 | 3 | pipelines: 4 | 525: 5 | retail: 6 | source: 7 | credscan: 8 | lastModifiedDate: 2024-04-05 9 | eslint: 10 | lastModifiedDate: 2024-04-05 11 | psscriptanalyzer: 12 | lastModifiedDate: 2024-04-05 13 | armory: 14 | lastModifiedDate: 2024-04-05 15 | policheck: 16 | lastModifiedDate: 2024-09-17 17 | binary: 18 | credscan: 19 | lastModifiedDate: 2024-04-05 20 | binskim: 21 | lastModifiedDate: 2025-01-25 22 | spotbugs: 23 | lastModifiedDate: 2024-04-05 24 | -------------------------------------------------------------------------------- /.config/tsaoptions.json: -------------------------------------------------------------------------------- 1 | { 2 | "instanceUrl": "https://devdiv.visualstudio.com/", 3 | "template": "TFSDEVDIV", 4 | "projectName": "DEVDIV", 5 | "areaPath": "DevDiv\\NET Tools\\SDK", 6 | "iterationPath": "DevDiv", 7 | "notificationAliases": [ "dotnetdevexcli@microsoft.com" ], 8 | "repositoryName": "cli-lab", 9 | "codebaseName": "cli-lab" 10 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to: 3 | # automatically normalize line endings on check-in 4 | ############################################################################### 5 | * text=auto 6 | 7 | ############################################################################### 8 | # Set file behavior to: 9 | # treat as text 10 | ############################################################################### 11 | *.cmd text 12 | *.config text 13 | *.cs text 14 | *.csproj text 15 | *.groovy text 16 | *.json text 17 | *.md text 18 | *.proj text 19 | *.projitems text 20 | *.props text 21 | *.ps1 text 22 | *.resx text 23 | *.shproj text 24 | *.sln text 25 | *.targets text 26 | *.txt text 27 | *.xlf text 28 | *.xml text 29 | 30 | ############################################################################### 31 | # Set file behavior to: 32 | # treat as text 33 | # normalize to Windows-style line endings on check-in 34 | ############################################################################### 35 | *.sln text eol=crlf 36 | 37 | ############################################################################### 38 | # Set file behavior to: 39 | # treat as text 40 | # normalize to Unix-style line endings on check-in 41 | ############################################################################### 42 | *.sh text eol=lf 43 | 44 | ############################################################################### 45 | # Set file behavior to: 46 | # treat as binary 47 | ############################################################################### 48 | *.snk binary 49 | 50 | ############################################################################### 51 | # Set default behavior to: 52 | # collapse these files in PRs 53 | ############################################################################### 54 | *.xlf linguist-generated=true -------------------------------------------------------------------------------- /CODE-OF-CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | This project has adopted the code of conduct defined by the Contributor Covenant 4 | to clarify expected behavior in our community. 5 | 6 | For more information, see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct). 7 | -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | http://go.microsoft.com/fwlink/?LinkID=288859 8 | MIT 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Directory.Build.rsp: -------------------------------------------------------------------------------- 1 | # This file intentionally left blank to avoid accidental import during build. 2 | -------------------------------------------------------------------------------- /Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /LICENSE.TXT: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) .NET Foundation and Contributors 4 | 5 | All rights reserved. 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. -------------------------------------------------------------------------------- /NuGet.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | The .NET Core and ASP.NET Core support policy, including supported versions can be found at the [.NET Core Support Policy Page](https://dotnet.microsoft.com/platform/support/policy/dotnet-core). 6 | 7 | ## Reporting a Vulnerability 8 | 9 | Security issues and bugs should be reported privately to the Microsoft Security Response Center (MSRC), either by emailing secure@microsoft.com or via the portal at https://msrc.microsoft.com. 10 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your 11 | original message. Further information, including the MSRC PGP key, can be found in the [MSRC Report an Issue FAQ](https://www.microsoft.com/en-us/msrc/faqs-report-an-issue). 12 | 13 | Reports via MSRC may qualify for the .NET Core Bug Bounty. Details of the .NET Core Bug Bounty including terms and conditions are at [https://aka.ms/corebounty](https://aka.ms/corebounty). 14 | 15 | Please do not open issues for anything you think might have a security implication. -------------------------------------------------------------------------------- /build.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -restore -build %*" 3 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source="${BASH_SOURCE[0]}" 4 | 5 | # resolve $SOURCE until the file is no longer a symlink 6 | while [[ -h $source ]]; do 7 | scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" 8 | source="$(readlink "$source")" 9 | 10 | # if $source was a relative symlink, we need to resolve it relative to the path where the 11 | # symlink file was located 12 | [[ $source != /* ]] && source="$scriptroot/$source" 13 | done 14 | 15 | scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" 16 | "$scriptroot/eng/common/build.sh" --build --restore $@ 17 | -------------------------------------------------------------------------------- /eng/Publishing.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 3 6 | 7 | 8 | -------------------------------------------------------------------------------- /eng/SignVerifyIgnore.txt: -------------------------------------------------------------------------------- 1 | **\*.xml,ignore unsigned .xml 2 | **\cab*.cab.cab,ignore unsigned .cab -------------------------------------------------------------------------------- /eng/Signing.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | MicrosoftDotNet500 4 | true 5 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /eng/Version.Details.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | https://github.com/dotnet/arcade 8 | 235443a5c1136571cacdfd40576f263f26bf5b9b 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /eng/Versions.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 6 | 7 | 8 | 9 | 1 10 | 7 11 | 0 12 | $(VersionMajor).$(VersionMinor).$(VersionPatch) 13 | true 14 | release 15 | 13.0.1 16 | 3.2.2146 17 | 9.3.3 18 | 19 | 20 | -------------------------------------------------------------------------------- /eng/common/BuildConfiguration/build-configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "RetryCountLimit": 1, 3 | "RetryByAnyError": false 4 | } 5 | -------------------------------------------------------------------------------- /eng/common/CIBuild.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0Build.ps1""" -restore -build -test -sign -pack -publish -ci %*" 3 | -------------------------------------------------------------------------------- /eng/common/PSScriptAnalyzerSettings.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | IncludeRules=@('PSAvoidUsingCmdletAliases', 3 | 'PSAvoidUsingWMICmdlet', 4 | 'PSAvoidUsingPositionalParameters', 5 | 'PSAvoidUsingInvokeExpression', 6 | 'PSUseDeclaredVarsMoreThanAssignments', 7 | 'PSUseCmdletCorrectly', 8 | 'PSStandardDSCFunctionsInResource', 9 | 'PSUseIdenticalMandatoryParametersForDSC', 10 | 'PSUseIdenticalParametersForDSC') 11 | } -------------------------------------------------------------------------------- /eng/common/README.md: -------------------------------------------------------------------------------- 1 | # Don't touch this folder 2 | 3 | uuuuuuuuuuuuuuuuuuuu 4 | u" uuuuuuuuuuuuuuuuuu "u 5 | u" u$$$$$$$$$$$$$$$$$$$$u "u 6 | u" u$$$$$$$$$$$$$$$$$$$$$$$$u "u 7 | u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u 8 | u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u 9 | u" u$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$u "u 10 | $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $ 11 | $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $ 12 | $ $$$" ... "$... ...$" ... "$$$ ... "$$$ $ 13 | $ $$$u `"$$$$$$$ $$$ $$$$$ $$ $$$ $$$ $ 14 | $ $$$$$$uu "$$$$ $$$ $$$$$ $$ """ u$$$ $ 15 | $ $$$""$$$ $$$$ $$$u "$$$" u$$ $$$$$$$$ $ 16 | $ $$$$....,$$$$$..$$$$$....,$$$$..$$$$$$$$ $ 17 | $ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $ 18 | "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u" 19 | "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u" 20 | "u "$$$$$$$$$$$$$$$$$$$$$$$$$$$$" u" 21 | "u "$$$$$$$$$$$$$$$$$$$$$$$$" u" 22 | "u "$$$$$$$$$$$$$$$$$$$$" u" 23 | "u """""""""""""""""" u" 24 | """""""""""""""""""" 25 | 26 | !!! Changes made in this directory are subject to being overwritten by automation !!! 27 | 28 | The files in this directory are shared by all Arcade repos and managed by automation. If you need to make changes to these files, open an issue or submit a pull request to https://github.com/dotnet/arcade first. 29 | -------------------------------------------------------------------------------- /eng/common/build.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0build.ps1""" %*" 3 | exit /b %ErrorLevel% 4 | -------------------------------------------------------------------------------- /eng/common/cibuild.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source="${BASH_SOURCE[0]}" 4 | 5 | # resolve $SOURCE until the file is no longer a symlink 6 | while [[ -h $source ]]; do 7 | scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" 8 | source="$(readlink "$source")" 9 | 10 | # if $source was a relative symlink, we need to resolve it relative to the path where 11 | # the symlink file was located 12 | [[ $source != /* ]] && source="$scriptroot/$source" 13 | done 14 | scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" 15 | 16 | . "$scriptroot/build.sh" --restore --build --test --pack --publish --ci $@ 17 | -------------------------------------------------------------------------------- /eng/common/core-templates/job/source-index-stage1.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | runAsPublic: false 3 | sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci" 4 | preSteps: [] 5 | binlogPath: artifacts/log/Debug/Build.binlog 6 | condition: '' 7 | dependsOn: '' 8 | pool: '' 9 | is1ESPipeline: '' 10 | 11 | jobs: 12 | - job: SourceIndexStage1 13 | dependsOn: ${{ parameters.dependsOn }} 14 | condition: ${{ parameters.condition }} 15 | variables: 16 | - name: BinlogPath 17 | value: ${{ parameters.binlogPath }} 18 | - template: /eng/common/core-templates/variables/pool-providers.yml 19 | parameters: 20 | is1ESPipeline: ${{ parameters.is1ESPipeline }} 21 | 22 | ${{ if ne(parameters.pool, '') }}: 23 | pool: ${{ parameters.pool }} 24 | ${{ if eq(parameters.pool, '') }}: 25 | pool: 26 | ${{ if eq(variables['System.TeamProject'], 'public') }}: 27 | name: $(DncEngPublicBuildPool) 28 | image: windows.vs2022.amd64.open 29 | ${{ if eq(variables['System.TeamProject'], 'internal') }}: 30 | name: $(DncEngInternalBuildPool) 31 | image: windows.vs2022.amd64 32 | 33 | steps: 34 | - ${{ if eq(parameters.is1ESPipeline, '') }}: 35 | - 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error 36 | 37 | - ${{ each preStep in parameters.preSteps }}: 38 | - ${{ preStep }} 39 | - script: ${{ parameters.sourceIndexBuildCommand }} 40 | displayName: Build Repository 41 | 42 | - template: /eng/common/core-templates/steps/source-index-stage1-publish.yml 43 | parameters: 44 | binLogPath: ${{ parameters.binLogPath }} -------------------------------------------------------------------------------- /eng/common/core-templates/jobs/codeql-build.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md 3 | continueOnError: false 4 | # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job 5 | jobs: [] 6 | # Optional: if specified, restore and use this version of Guardian instead of the default. 7 | overrideGuardianVersion: '' 8 | is1ESPipeline: '' 9 | 10 | jobs: 11 | - template: /eng/common/core-templates/jobs/jobs.yml 12 | parameters: 13 | is1ESPipeline: ${{ parameters.is1ESPipeline }} 14 | enableMicrobuild: false 15 | enablePublishBuildArtifacts: false 16 | enablePublishTestResults: false 17 | enablePublishBuildAssets: false 18 | enableTelemetry: true 19 | 20 | variables: 21 | - group: Publish-Build-Assets 22 | # The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in 23 | # sync with the packages.config file. 24 | - name: DefaultGuardianVersion 25 | value: 0.109.0 26 | - name: GuardianPackagesConfigFile 27 | value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config 28 | - name: GuardianVersion 29 | value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }} 30 | 31 | jobs: ${{ parameters.jobs }} 32 | 33 | -------------------------------------------------------------------------------- /eng/common/core-templates/post-build/common-variables.yml: -------------------------------------------------------------------------------- 1 | variables: 2 | - group: Publish-Build-Assets 3 | 4 | # Whether the build is internal or not 5 | - name: IsInternalBuild 6 | value: ${{ and(ne(variables['System.TeamProject'], 'public'), contains(variables['Build.SourceBranch'], 'internal')) }} 7 | 8 | # Default Maestro++ API Endpoint and API Version 9 | - name: MaestroApiEndPoint 10 | value: "https://maestro.dot.net" 11 | - name: MaestroApiVersion 12 | value: "2020-02-20" 13 | 14 | - name: SourceLinkCLIVersion 15 | value: 3.0.0 16 | - name: SymbolToolVersion 17 | value: 1.0.1 18 | - name: BinlogToolVersion 19 | value: 1.0.11 20 | 21 | - name: runCodesignValidationInjection 22 | value: false 23 | -------------------------------------------------------------------------------- /eng/common/core-templates/steps/cleanup-microbuild.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | # Enable cleanup tasks for MicroBuild 3 | enableMicrobuild: false 4 | # Enable cleanup tasks for MicroBuild on Mac and Linux 5 | # Will be ignored if 'enableMicrobuild' is false or 'Agent.Os' is 'Windows_NT' 6 | enableMicrobuildForMacAndLinux: false 7 | continueOnError: false 8 | 9 | steps: 10 | - ${{ if eq(parameters.enableMicrobuild, 'true') }}: 11 | - task: MicroBuildCleanup@1 12 | displayName: Execute Microbuild cleanup tasks 13 | condition: and( 14 | always(), 15 | or( 16 | and( 17 | eq(variables['Agent.Os'], 'Windows_NT'), 18 | in(variables['_SignType'], 'real', 'test') 19 | ), 20 | and( 21 | ${{ eq(parameters.enableMicrobuildForMacAndLinux, true) }}, 22 | ne(variables['Agent.Os'], 'Windows_NT'), 23 | eq(variables['_SignType'], 'real') 24 | ) 25 | )) 26 | continueOnError: ${{ parameters.continueOnError }} 27 | env: 28 | TeamName: $(_TeamName) 29 | -------------------------------------------------------------------------------- /eng/common/core-templates/steps/component-governance.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | disableComponentGovernance: false 3 | componentGovernanceIgnoreDirectories: '' 4 | is1ESPipeline: false 5 | displayName: 'Component Detection' 6 | 7 | steps: 8 | - ${{ if eq(parameters.disableComponentGovernance, 'true') }}: 9 | - script: echo "##vso[task.setvariable variable=skipComponentGovernanceDetection]true" 10 | displayName: Set skipComponentGovernanceDetection variable 11 | - ${{ if ne(parameters.disableComponentGovernance, 'true') }}: 12 | - task: ComponentGovernanceComponentDetection@0 13 | continueOnError: true 14 | displayName: ${{ parameters.displayName }} 15 | inputs: 16 | ignoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} 17 | -------------------------------------------------------------------------------- /eng/common/core-templates/steps/enable-internal-runtimes.yml: -------------------------------------------------------------------------------- 1 | # Obtains internal runtime download credentials and populates the 'dotnetbuilds-internal-container-read-token-base64' 2 | # variable with the base64-encoded SAS token, by default 3 | 4 | parameters: 5 | - name: federatedServiceConnection 6 | type: string 7 | default: 'dotnetbuilds-internal-read' 8 | - name: outputVariableName 9 | type: string 10 | default: 'dotnetbuilds-internal-container-read-token-base64' 11 | - name: expiryInHours 12 | type: number 13 | default: 1 14 | - name: base64Encode 15 | type: boolean 16 | default: true 17 | - name: is1ESPipeline 18 | type: boolean 19 | default: false 20 | 21 | steps: 22 | - ${{ if ne(variables['System.TeamProject'], 'public') }}: 23 | - template: /eng/common/core-templates/steps/get-delegation-sas.yml 24 | parameters: 25 | federatedServiceConnection: ${{ parameters.federatedServiceConnection }} 26 | outputVariableName: ${{ parameters.outputVariableName }} 27 | expiryInHours: ${{ parameters.expiryInHours }} 28 | base64Encode: ${{ parameters.base64Encode }} 29 | storageAccount: dotnetbuilds 30 | container: internal 31 | permissions: rl 32 | is1ESPipeline: ${{ parameters.is1ESPipeline }} -------------------------------------------------------------------------------- /eng/common/core-templates/steps/get-delegation-sas.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: federatedServiceConnection 3 | type: string 4 | - name: outputVariableName 5 | type: string 6 | - name: expiryInHours 7 | type: number 8 | default: 1 9 | - name: base64Encode 10 | type: boolean 11 | default: false 12 | - name: storageAccount 13 | type: string 14 | - name: container 15 | type: string 16 | - name: permissions 17 | type: string 18 | default: 'rl' 19 | - name: is1ESPipeline 20 | type: boolean 21 | default: false 22 | 23 | steps: 24 | - task: AzureCLI@2 25 | displayName: 'Generate delegation SAS Token for ${{ parameters.storageAccount }}/${{ parameters.container }}' 26 | inputs: 27 | azureSubscription: ${{ parameters.federatedServiceConnection }} 28 | scriptType: 'pscore' 29 | scriptLocation: 'inlineScript' 30 | inlineScript: | 31 | # Calculate the expiration of the SAS token and convert to UTC 32 | $expiry = (Get-Date).AddHours(${{ parameters.expiryInHours }}).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ") 33 | 34 | $sas = az storage container generate-sas --account-name ${{ parameters.storageAccount }} --name ${{ parameters.container }} --permissions ${{ parameters.permissions }} --expiry $expiry --auth-mode login --as-user -o tsv 35 | 36 | if ($LASTEXITCODE -ne 0) { 37 | Write-Error "Failed to generate SAS token." 38 | exit 1 39 | } 40 | 41 | if ('${{ parameters.base64Encode }}' -eq 'true') { 42 | $sas = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($sas)) 43 | } 44 | 45 | Write-Host "Setting '${{ parameters.outputVariableName }}' with the access token value" 46 | Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true]$sas" 47 | -------------------------------------------------------------------------------- /eng/common/core-templates/steps/get-federated-access-token.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: federatedServiceConnection 3 | type: string 4 | - name: outputVariableName 5 | type: string 6 | - name: is1ESPipeline 7 | type: boolean 8 | - name: stepName 9 | type: string 10 | default: 'getFederatedAccessToken' 11 | - name: condition 12 | type: string 13 | default: '' 14 | # Resource to get a token for. Common values include: 15 | # - '499b84ac-1321-427f-aa17-267ca6975798' for Azure DevOps 16 | # - 'https://storage.azure.com/' for storage 17 | # Defaults to Azure DevOps 18 | - name: resource 19 | type: string 20 | default: '499b84ac-1321-427f-aa17-267ca6975798' 21 | - name: isStepOutputVariable 22 | type: boolean 23 | default: false 24 | 25 | steps: 26 | - task: AzureCLI@2 27 | displayName: 'Getting federated access token for feeds' 28 | name: ${{ parameters.stepName }} 29 | ${{ if ne(parameters.condition, '') }}: 30 | condition: ${{ parameters.condition }} 31 | inputs: 32 | azureSubscription: ${{ parameters.federatedServiceConnection }} 33 | scriptType: 'pscore' 34 | scriptLocation: 'inlineScript' 35 | inlineScript: | 36 | $accessToken = az account get-access-token --query accessToken --resource ${{ parameters.resource }} --output tsv 37 | if ($LASTEXITCODE -ne 0) { 38 | Write-Error "Failed to get access token for resource '${{ parameters.resource }}'" 39 | exit 1 40 | } 41 | Write-Host "Setting '${{ parameters.outputVariableName }}' with the access token value" 42 | Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true;isOutput=${{ parameters.isStepOutputVariable }}]$accessToken" -------------------------------------------------------------------------------- /eng/common/core-templates/steps/publish-build-artifacts.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: is1ESPipeline 3 | type: boolean 4 | default: false 5 | - name: args 6 | type: object 7 | default: {} 8 | steps: 9 | - ${{ if ne(parameters.is1ESPipeline, true) }}: 10 | - template: /eng/common/templates/steps/publish-build-artifacts.yml 11 | parameters: 12 | is1ESPipeline: ${{ parameters.is1ESPipeline }} 13 | ${{ each parameter in parameters.args }}: 14 | ${{ parameter.key }}: ${{ parameter.value }} 15 | - ${{ else }}: 16 | - template: /eng/common/templates-official/steps/publish-build-artifacts.yml 17 | parameters: 18 | is1ESPipeline: ${{ parameters.is1ESPipeline }} 19 | ${{ each parameter in parameters.args }}: 20 | ${{ parameter.key }}: ${{ parameter.value }} -------------------------------------------------------------------------------- /eng/common/core-templates/steps/publish-pipeline-artifacts.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: is1ESPipeline 3 | type: boolean 4 | default: false 5 | 6 | - name: args 7 | type: object 8 | default: {} 9 | 10 | steps: 11 | - ${{ if ne(parameters.is1ESPipeline, true) }}: 12 | - template: /eng/common/templates/steps/publish-pipeline-artifacts.yml 13 | parameters: 14 | ${{ each parameter in parameters }}: 15 | ${{ parameter.key }}: ${{ parameter.value }} 16 | - ${{ else }}: 17 | - template: /eng/common/templates-official/steps/publish-pipeline-artifacts.yml 18 | parameters: 19 | ${{ each parameter in parameters }}: 20 | ${{ parameter.key }}: ${{ parameter.value }} 21 | -------------------------------------------------------------------------------- /eng/common/core-templates/steps/retain-build.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | # Optional azure devops PAT with build execute permissions for the build's organization, 3 | # only needed if the build that should be retained ran on a different organization than 4 | # the pipeline where this template is executing from 5 | Token: '' 6 | # Optional BuildId to retain, defaults to the current running build 7 | BuildId: '' 8 | # Azure devops Organization URI for the build in the https://dev.azure.com/ format. 9 | # Defaults to the organization the current pipeline is running on 10 | AzdoOrgUri: '$(System.CollectionUri)' 11 | # Azure devops project for the build. Defaults to the project the current pipeline is running on 12 | AzdoProject: '$(System.TeamProject)' 13 | 14 | steps: 15 | - task: powershell@2 16 | inputs: 17 | targetType: 'filePath' 18 | filePath: eng/common/retain-build.ps1 19 | pwsh: true 20 | arguments: > 21 | -AzdoOrgUri: ${{parameters.AzdoOrgUri}} 22 | -AzdoProject ${{parameters.AzdoProject}} 23 | -Token ${{coalesce(parameters.Token, '$env:SYSTEM_ACCESSTOKEN') }} 24 | -BuildId ${{coalesce(parameters.BuildId, '$env:BUILD_ID')}} 25 | displayName: Enable permanent build retention 26 | env: 27 | SYSTEM_ACCESSTOKEN: $(System.AccessToken) 28 | BUILD_ID: $(Build.BuildId) -------------------------------------------------------------------------------- /eng/common/core-templates/variables/pool-providers.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | is1ESPipeline: false 3 | 4 | variables: 5 | - ${{ if eq(parameters.is1ESPipeline, 'true') }}: 6 | - template: /eng/common/templates-official/variables/pool-providers.yml 7 | - ${{ else }}: 8 | - template: /eng/common/templates/variables/pool-providers.yml -------------------------------------------------------------------------------- /eng/common/cross/arm/tizen/tizen.patch: -------------------------------------------------------------------------------- 1 | diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so 2 | --- a/usr/lib/libc.so 2016-12-30 23:00:08.284951863 +0900 3 | +++ b/usr/lib/libc.so 2016-12-30 23:00:32.140951815 +0900 4 | @@ -2,4 +2,4 @@ 5 | Use the shared library, but some functions are only in 6 | the static library, so try that secondarily. */ 7 | OUTPUT_FORMAT(elf32-littlearm) 8 | -GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux-armhf.so.3 ) ) 9 | +GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux-armhf.so.3 ) ) 10 | -------------------------------------------------------------------------------- /eng/common/cross/arm64/tizen/tizen.patch: -------------------------------------------------------------------------------- 1 | diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so 2 | --- a/usr/lib64/libc.so 2016-12-30 23:00:08.284951863 +0900 3 | +++ b/usr/lib64/libc.so 2016-12-30 23:00:32.140951815 +0900 4 | @@ -2,4 +2,4 @@ 5 | Use the shared library, but some functions are only in 6 | the static library, so try that secondarily. */ 7 | OUTPUT_FORMAT(elf64-littleaarch64) 8 | -GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a AS_NEEDED ( /lib/ld-linux-aarch64.so.1 ) ) 9 | +GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux-aarch64.so.1 ) ) 10 | -------------------------------------------------------------------------------- /eng/common/cross/armel/tizen/tizen.patch: -------------------------------------------------------------------------------- 1 | diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so 2 | --- a/usr/lib/libc.so 2016-12-30 23:00:08.284951863 +0900 3 | +++ b/usr/lib/libc.so 2016-12-30 23:00:32.140951815 +0900 4 | @@ -2,4 +2,4 @@ 5 | Use the shared library, but some functions are only in 6 | the static library, so try that secondarily. */ 7 | OUTPUT_FORMAT(elf32-littlearm) 8 | -GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux.so.3 ) ) 9 | +GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux.so.3 ) ) 10 | -------------------------------------------------------------------------------- /eng/common/cross/riscv64/tizen/tizen.patch: -------------------------------------------------------------------------------- 1 | diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so 2 | --- a/usr/lib64/libc.so 2016-12-30 23:00:08.284951863 +0900 3 | +++ b/usr/lib64/libc.so 2016-12-30 23:00:32.140951815 +0900 4 | @@ -2,4 +2,4 @@ 5 | Use the shared library, but some functions are only in 6 | the static library, so try that secondarily. */ 7 | OUTPUT_FORMAT(elf64-littleriscv) 8 | -GROUP ( /lib64/libc.so.6 /usr/lib64/libc_nonshared.a AS_NEEDED ( /lib64/ld-linux-riscv64-lp64d.so.1 ) ) 9 | +GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux-riscv64-lp64d.so.1 ) ) 10 | -------------------------------------------------------------------------------- /eng/common/cross/x86/tizen/tizen.patch: -------------------------------------------------------------------------------- 1 | diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so 2 | --- a/usr/lib/libc.so 2016-12-30 23:00:08.284951863 +0900 3 | +++ b/usr/lib/libc.so 2016-12-30 23:00:32.140951815 +0900 4 | @@ -2,4 +2,4 @@ 5 | Use the shared library, but some functions are only in 6 | the static library, so try that secondarily. */ 7 | OUTPUT_FORMAT(elf32-i386) 8 | -GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux.so.2 ) ) 9 | +GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux.so.2 ) ) 10 | -------------------------------------------------------------------------------- /eng/common/darc-init.ps1: -------------------------------------------------------------------------------- 1 | param ( 2 | $darcVersion = $null, 3 | $versionEndpoint = 'https://maestro.dot.net/api/assets/darc-version?api-version=2020-02-20', 4 | $verbosity = 'minimal', 5 | $toolpath = $null 6 | ) 7 | 8 | . $PSScriptRoot\tools.ps1 9 | 10 | function InstallDarcCli ($darcVersion, $toolpath) { 11 | $darcCliPackageName = 'microsoft.dotnet.darc' 12 | 13 | $dotnetRoot = InitializeDotNetCli -install:$true 14 | $dotnet = "$dotnetRoot\dotnet.exe" 15 | $toolList = & "$dotnet" tool list -g 16 | 17 | if ($toolList -like "*$darcCliPackageName*") { 18 | & "$dotnet" tool uninstall $darcCliPackageName -g 19 | } 20 | 21 | # If the user didn't explicitly specify the darc version, 22 | # query the Maestro API for the correct version of darc to install. 23 | if (-not $darcVersion) { 24 | $darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content 25 | } 26 | 27 | $arcadeServicesSource = 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json' 28 | 29 | Write-Host "Installing Darc CLI version $darcVersion..." 30 | Write-Host 'You may need to restart your command window if this is the first dotnet tool you have installed.' 31 | if (-not $toolpath) { 32 | Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity -g" 33 | & "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g 34 | }else { 35 | Write-Host "'$dotnet' tool install $darcCliPackageName --version $darcVersion --add-source '$arcadeServicesSource' -v $verbosity --tool-path '$toolpath'" 36 | & "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity --tool-path "$toolpath" 37 | } 38 | } 39 | 40 | try { 41 | InstallDarcCli $darcVersion $toolpath 42 | } 43 | catch { 44 | Write-Host $_.ScriptStackTrace 45 | Write-PipelineTelemetryError -Category 'Darc' -Message $_ 46 | ExitWithExitCode 1 47 | } -------------------------------------------------------------------------------- /eng/common/dotnet-install.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0dotnet-install.ps1""" %*" -------------------------------------------------------------------------------- /eng/common/dotnet-install.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding(PositionalBinding=$false)] 2 | Param( 3 | [string] $verbosity = 'minimal', 4 | [string] $architecture = '', 5 | [string] $version = 'Latest', 6 | [string] $runtime = 'dotnet', 7 | [string] $RuntimeSourceFeed = '', 8 | [string] $RuntimeSourceFeedKey = '' 9 | ) 10 | 11 | . $PSScriptRoot\tools.ps1 12 | 13 | $dotnetRoot = Join-Path $RepoRoot '.dotnet' 14 | 15 | $installdir = $dotnetRoot 16 | try { 17 | if ($architecture -and $architecture.Trim() -eq 'x86') { 18 | $installdir = Join-Path $installdir 'x86' 19 | } 20 | InstallDotNet $installdir $version $architecture $runtime $true -RuntimeSourceFeed $RuntimeSourceFeed -RuntimeSourceFeedKey $RuntimeSourceFeedKey 21 | } 22 | catch { 23 | Write-Host $_.ScriptStackTrace 24 | Write-PipelineTelemetryError -Category 'InitializeToolset' -Message $_ 25 | ExitWithExitCode 1 26 | } 27 | 28 | ExitWithExitCode 0 29 | -------------------------------------------------------------------------------- /eng/common/enable-cross-org-publishing.ps1: -------------------------------------------------------------------------------- 1 | param( 2 | [string] $token 3 | ) 4 | 5 | 6 | . $PSScriptRoot\pipeline-logging-functions.ps1 7 | 8 | # Write-PipelineSetVariable will no-op if a variable named $ci is not defined 9 | # Since this script is only ever called in AzDO builds, just universally set it 10 | $ci = $true 11 | 12 | Write-PipelineSetVariable -Name 'VSS_NUGET_ACCESSTOKEN' -Value $token -IsMultiJobVariable $false 13 | Write-PipelineSetVariable -Name 'VSS_NUGET_URI_PREFIXES' -Value 'https://dnceng.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/dnceng/;https://devdiv.pkgs.visualstudio.com/;https://pkgs.dev.azure.com/devdiv/' -IsMultiJobVariable $false 14 | -------------------------------------------------------------------------------- /eng/common/generate-sbom-prep.ps1: -------------------------------------------------------------------------------- 1 | Param( 2 | [Parameter(Mandatory=$true)][string] $ManifestDirPath # Manifest directory where sbom will be placed 3 | ) 4 | 5 | . $PSScriptRoot\pipeline-logging-functions.ps1 6 | 7 | # Normally - we'd listen to the manifest path given, but 1ES templates will overwrite if this level gets uploaded directly 8 | # with their own overwriting ours. So we create it as a sub directory of the requested manifest path. 9 | $ArtifactName = "${env:SYSTEM_STAGENAME}_${env:AGENT_JOBNAME}_SBOM" 10 | $SafeArtifactName = $ArtifactName -replace '["/:<>\\|?@*"() ]', '_' 11 | $SbomGenerationDir = Join-Path $ManifestDirPath $SafeArtifactName 12 | 13 | Write-Host "Artifact name before : $ArtifactName" 14 | Write-Host "Artifact name after : $SafeArtifactName" 15 | 16 | Write-Host "Creating dir $ManifestDirPath" 17 | 18 | # create directory for sbom manifest to be placed 19 | if (!(Test-Path -path $SbomGenerationDir)) 20 | { 21 | New-Item -ItemType Directory -path $SbomGenerationDir 22 | Write-Host "Successfully created directory $SbomGenerationDir" 23 | } 24 | else{ 25 | Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder." 26 | } 27 | 28 | Write-Host "Updating artifact name" 29 | Write-Host "##vso[task.setvariable variable=ARTIFACT_NAME]$SafeArtifactName" 30 | -------------------------------------------------------------------------------- /eng/common/generate-sbom-prep.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source="${BASH_SOURCE[0]}" 4 | 5 | # resolve $SOURCE until the file is no longer a symlink 6 | while [[ -h $source ]]; do 7 | scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" 8 | source="$(readlink "$source")" 9 | 10 | # if $source was a relative symlink, we need to resolve it relative to the path where the 11 | # symlink file was located 12 | [[ $source != /* ]] && source="$scriptroot/$source" 13 | done 14 | scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" 15 | . $scriptroot/pipeline-logging-functions.sh 16 | 17 | 18 | # replace all special characters with _, some builds use special characters like : in Agent.Jobname, that is not a permissible name while uploading artifacts. 19 | artifact_name=$SYSTEM_STAGENAME"_"$AGENT_JOBNAME"_SBOM" 20 | safe_artifact_name="${artifact_name//["/:<>\\|?@*$" ]/_}" 21 | manifest_dir=$1 22 | 23 | # Normally - we'd listen to the manifest path given, but 1ES templates will overwrite if this level gets uploaded directly 24 | # with their own overwriting ours. So we create it as a sub directory of the requested manifest path. 25 | sbom_generation_dir="$manifest_dir/$safe_artifact_name" 26 | 27 | if [ ! -d "$sbom_generation_dir" ] ; then 28 | mkdir -p "$sbom_generation_dir" 29 | echo "Sbom directory created." $sbom_generation_dir 30 | else 31 | Write-PipelineTelemetryError -category 'Build' "Unable to create sbom folder." 32 | fi 33 | 34 | echo "Artifact name before : "$artifact_name 35 | echo "Artifact name after : "$safe_artifact_name 36 | export ARTIFACT_NAME=$safe_artifact_name 37 | echo "##vso[task.setvariable variable=ARTIFACT_NAME]$safe_artifact_name" 38 | 39 | exit 0 40 | -------------------------------------------------------------------------------- /eng/common/helixpublish.proj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | msbuild 6 | 7 | 8 | 9 | 10 | %(Identity) 11 | 12 | 13 | 14 | 15 | 16 | $(WorkItemDirectory) 17 | $(WorkItemCommand) 18 | $(WorkItemTimeout) 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /eng/common/init-tools-native.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | powershell -NoProfile -NoLogo -ExecutionPolicy ByPass -command "& """%~dp0init-tools-native.ps1""" %*" 3 | exit /b %ErrorLevel% -------------------------------------------------------------------------------- /eng/common/internal/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | false 6 | false 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /eng/common/internal/NuGet.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /eng/common/internal/Tools.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | net472 6 | false 7 | false 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /eng/common/loc/P22DotNetHtmlLocalization.lss: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /eng/common/msbuild.ps1: -------------------------------------------------------------------------------- 1 | [CmdletBinding(PositionalBinding=$false)] 2 | Param( 3 | [string] $verbosity = 'minimal', 4 | [bool] $warnAsError = $true, 5 | [bool] $nodeReuse = $true, 6 | [switch] $ci, 7 | [switch] $prepareMachine, 8 | [switch] $excludePrereleaseVS, 9 | [string] $msbuildEngine = $null, 10 | [Parameter(ValueFromRemainingArguments=$true)][String[]]$extraArgs 11 | ) 12 | 13 | . $PSScriptRoot\tools.ps1 14 | 15 | try { 16 | if ($ci) { 17 | $nodeReuse = $false 18 | } 19 | 20 | MSBuild @extraArgs 21 | } 22 | catch { 23 | Write-Host $_.ScriptStackTrace 24 | Write-PipelineTelemetryError -Category 'Build' -Message $_ 25 | ExitWithExitCode 1 26 | } 27 | 28 | ExitWithExitCode 0 -------------------------------------------------------------------------------- /eng/common/msbuild.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source="${BASH_SOURCE[0]}" 4 | 5 | # resolve $source until the file is no longer a symlink 6 | while [[ -h "$source" ]]; do 7 | scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" 8 | source="$(readlink "$source")" 9 | # if $source was a relative symlink, we need to resolve it relative to the path where the 10 | # symlink file was located 11 | [[ $source != /* ]] && source="$scriptroot/$source" 12 | done 13 | scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" 14 | 15 | verbosity='minimal' 16 | warn_as_error=true 17 | node_reuse=true 18 | prepare_machine=false 19 | extra_args='' 20 | 21 | while (($# > 0)); do 22 | lowerI="$(echo $1 | tr "[:upper:]" "[:lower:]")" 23 | case $lowerI in 24 | --verbosity) 25 | verbosity=$2 26 | shift 2 27 | ;; 28 | --warnaserror) 29 | warn_as_error=$2 30 | shift 2 31 | ;; 32 | --nodereuse) 33 | node_reuse=$2 34 | shift 2 35 | ;; 36 | --ci) 37 | ci=true 38 | shift 1 39 | ;; 40 | --preparemachine) 41 | prepare_machine=true 42 | shift 1 43 | ;; 44 | *) 45 | extra_args="$extra_args $1" 46 | shift 1 47 | ;; 48 | esac 49 | done 50 | 51 | . "$scriptroot/tools.sh" 52 | 53 | if [[ "$ci" == true ]]; then 54 | node_reuse=false 55 | fi 56 | 57 | MSBuild $extra_args 58 | ExitWithExitCode 0 59 | -------------------------------------------------------------------------------- /eng/common/post-build/nuget-validation.ps1: -------------------------------------------------------------------------------- 1 | # This script validates NuGet package metadata information using this 2 | # tool: https://github.com/NuGet/NuGetGallery/tree/jver-verify/src/VerifyMicrosoftPackage 3 | 4 | param( 5 | [Parameter(Mandatory=$true)][string] $PackagesPath # Path to where the packages to be validated are 6 | ) 7 | 8 | # `tools.ps1` checks $ci to perform some actions. Since the post-build 9 | # scripts don't necessarily execute in the same agent that run the 10 | # build.ps1/sh script this variable isn't automatically set. 11 | $ci = $true 12 | $disableConfigureToolsetImport = $true 13 | . $PSScriptRoot\..\tools.ps1 14 | 15 | try { 16 | & $PSScriptRoot\nuget-verification.ps1 ${PackagesPath}\*.nupkg 17 | } 18 | catch { 19 | Write-Host $_.ScriptStackTrace 20 | Write-PipelineTelemetryError -Category 'NuGetValidation' -Message $_ 21 | ExitWithExitCode 1 22 | } 23 | -------------------------------------------------------------------------------- /eng/common/retain-build.ps1: -------------------------------------------------------------------------------- 1 | 2 | Param( 3 | [Parameter(Mandatory=$true)][int] $buildId, 4 | [Parameter(Mandatory=$true)][string] $azdoOrgUri, 5 | [Parameter(Mandatory=$true)][string] $azdoProject, 6 | [Parameter(Mandatory=$true)][string] $token 7 | ) 8 | 9 | $ErrorActionPreference = 'Stop' 10 | Set-StrictMode -Version 2.0 11 | 12 | function Get-AzDOHeaders( 13 | [string] $token) 14 | { 15 | $base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":${token}")) 16 | $headers = @{"Authorization"="Basic $base64AuthInfo"} 17 | return $headers 18 | } 19 | 20 | function Update-BuildRetention( 21 | [string] $azdoOrgUri, 22 | [string] $azdoProject, 23 | [int] $buildId, 24 | [string] $token) 25 | { 26 | $headers = Get-AzDOHeaders -token $token 27 | $requestBody = "{ 28 | `"keepForever`": `"true`" 29 | }" 30 | 31 | $requestUri = "${azdoOrgUri}/${azdoProject}/_apis/build/builds/${buildId}?api-version=6.0" 32 | write-Host "Attempting to retain build using the following URI: ${requestUri} ..." 33 | 34 | try { 35 | Invoke-RestMethod -Uri $requestUri -Method Patch -Body $requestBody -Header $headers -contentType "application/json" 36 | Write-Host "Updated retention settings for build ${buildId}." 37 | } 38 | catch { 39 | Write-Error "Failed to update retention settings for build: $_.Exception.Response.StatusDescription" 40 | exit 1 41 | } 42 | } 43 | 44 | Update-BuildRetention -azdoOrgUri $azdoOrgUri -azdoProject $azdoProject -buildId $buildId -token $token 45 | exit 0 46 | -------------------------------------------------------------------------------- /eng/common/sdl/NuGet.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /eng/common/sdl/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /eng/common/sdl/run-sdl.ps1: -------------------------------------------------------------------------------- 1 | Param( 2 | [string] $GuardianCliLocation, 3 | [string] $WorkingDirectory, 4 | [string] $GdnFolder, 5 | [string] $UpdateBaseline, 6 | [string] $GuardianLoggerLevel='Standard' 7 | ) 8 | 9 | $ErrorActionPreference = 'Stop' 10 | Set-StrictMode -Version 2.0 11 | $disableConfigureToolsetImport = $true 12 | $global:LASTEXITCODE = 0 13 | 14 | try { 15 | # `tools.ps1` checks $ci to perform some actions. Since the SDL 16 | # scripts don't necessarily execute in the same agent that run the 17 | # build.ps1/sh script this variable isn't automatically set. 18 | $ci = $true 19 | . $PSScriptRoot\..\tools.ps1 20 | 21 | # We store config files in the r directory of .gdn 22 | $gdnConfigPath = Join-Path $GdnFolder 'r' 23 | $ValidPath = Test-Path $GuardianCliLocation 24 | 25 | if ($ValidPath -eq $False) 26 | { 27 | Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "Invalid Guardian CLI Location." 28 | ExitWithExitCode 1 29 | } 30 | 31 | $gdnConfigFiles = Get-ChildItem $gdnConfigPath -Recurse -Include '*.gdnconfig' 32 | Write-Host "Discovered Guardian config files:" 33 | $gdnConfigFiles | Out-String | Write-Host 34 | 35 | Exec-BlockVerbosely { 36 | & $GuardianCliLocation run ` 37 | --working-directory $WorkingDirectory ` 38 | --baseline mainbaseline ` 39 | --update-baseline $UpdateBaseline ` 40 | --logger-level $GuardianLoggerLevel ` 41 | --config @gdnConfigFiles 42 | Exit-IfNZEC "Sdl" 43 | } 44 | } 45 | catch { 46 | Write-Host $_.ScriptStackTrace 47 | Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_ 48 | ExitWithExitCode 1 49 | } 50 | -------------------------------------------------------------------------------- /eng/common/sdl/sdl.ps1: -------------------------------------------------------------------------------- 1 | 2 | function Install-Gdn { 3 | param( 4 | [Parameter(Mandatory=$true)] 5 | [string]$Path, 6 | 7 | # If omitted, install the latest version of Guardian, otherwise install that specific version. 8 | [string]$Version 9 | ) 10 | 11 | $ErrorActionPreference = 'Stop' 12 | Set-StrictMode -Version 2.0 13 | $disableConfigureToolsetImport = $true 14 | $global:LASTEXITCODE = 0 15 | 16 | # `tools.ps1` checks $ci to perform some actions. Since the SDL 17 | # scripts don't necessarily execute in the same agent that run the 18 | # build.ps1/sh script this variable isn't automatically set. 19 | $ci = $true 20 | . $PSScriptRoot\..\tools.ps1 21 | 22 | $argumentList = @("install", "Microsoft.Guardian.Cli", "-Source https://securitytools.pkgs.visualstudio.com/_packaging/Guardian/nuget/v3/index.json", "-OutputDirectory $Path", "-NonInteractive", "-NoCache") 23 | 24 | if ($Version) { 25 | $argumentList += "-Version $Version" 26 | } 27 | 28 | Start-Process nuget -Verbose -ArgumentList $argumentList -NoNewWindow -Wait 29 | 30 | $gdnCliPath = Get-ChildItem -Filter guardian.cmd -Recurse -Path $Path 31 | 32 | if (!$gdnCliPath) 33 | { 34 | Write-PipelineTelemetryError -Category 'Sdl' -Message 'Failure installing Guardian' 35 | } 36 | 37 | return $gdnCliPath.FullName 38 | } -------------------------------------------------------------------------------- /eng/common/templates-official/job/onelocbuild.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - template: /eng/common/core-templates/job/onelocbuild.yml 3 | parameters: 4 | is1ESPipeline: true 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates-official/job/publish-build-assets.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - template: /eng/common/core-templates/job/publish-build-assets.yml 3 | parameters: 4 | is1ESPipeline: true 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates-official/job/source-build.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - template: /eng/common/core-templates/job/source-build.yml 3 | parameters: 4 | is1ESPipeline: true 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates-official/job/source-index-stage1.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - template: /eng/common/core-templates/job/source-index-stage1.yml 3 | parameters: 4 | is1ESPipeline: true 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates-official/jobs/codeql-build.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - template: /eng/common/core-templates/jobs/codeql-build.yml 3 | parameters: 4 | is1ESPipeline: true 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates-official/jobs/jobs.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - template: /eng/common/core-templates/jobs/jobs.yml 3 | parameters: 4 | is1ESPipeline: true 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates-official/jobs/source-build.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - template: /eng/common/core-templates/jobs/source-build.yml 3 | parameters: 4 | is1ESPipeline: true 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} -------------------------------------------------------------------------------- /eng/common/templates-official/post-build/common-variables.yml: -------------------------------------------------------------------------------- 1 | variables: 2 | - template: /eng/common/core-templates/post-build/common-variables.yml 3 | parameters: 4 | # Specifies whether to use 1ES 5 | is1ESPipeline: true 6 | 7 | ${{ each parameter in parameters }}: 8 | ${{ parameter.key }}: ${{ parameter.value }} -------------------------------------------------------------------------------- /eng/common/templates-official/post-build/post-build.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - template: /eng/common/core-templates/post-build/post-build.yml 3 | parameters: 4 | # Specifies whether to use 1ES 5 | is1ESPipeline: true 6 | 7 | ${{ each parameter in parameters }}: 8 | ${{ parameter.key }}: ${{ parameter.value }} 9 | -------------------------------------------------------------------------------- /eng/common/templates-official/post-build/setup-maestro-vars.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml 3 | parameters: 4 | # Specifies whether to use 1ES 5 | is1ESPipeline: true 6 | 7 | ${{ each parameter in parameters }}: 8 | ${{ parameter.key }}: ${{ parameter.value }} -------------------------------------------------------------------------------- /eng/common/templates-official/steps/component-governance.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/steps/component-governance.yml 3 | parameters: 4 | is1ESPipeline: true 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates-official/steps/enable-internal-runtimes.yml: -------------------------------------------------------------------------------- 1 | # Obtains internal runtime download credentials and populates the 'dotnetbuilds-internal-container-read-token-base64' 2 | # variable with the base64-encoded SAS token, by default 3 | steps: 4 | - template: /eng/common/core-templates/steps/enable-internal-runtimes.yml 5 | parameters: 6 | is1ESPipeline: true 7 | 8 | ${{ each parameter in parameters }}: 9 | ${{ parameter.key }}: ${{ parameter.value }} 10 | -------------------------------------------------------------------------------- /eng/common/templates-official/steps/enable-internal-sources.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/steps/enable-internal-sources.yml 3 | parameters: 4 | is1ESPipeline: true 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} -------------------------------------------------------------------------------- /eng/common/templates-official/steps/generate-sbom.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/steps/generate-sbom.yml 3 | parameters: 4 | is1ESPipeline: true 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates-official/steps/get-delegation-sas.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/steps/get-delegation-sas.yml 3 | parameters: 4 | is1ESPipeline: true 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates-official/steps/get-federated-access-token.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/steps/get-federated-access-token.yml 3 | parameters: 4 | is1ESPipeline: true 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} -------------------------------------------------------------------------------- /eng/common/templates-official/steps/publish-build-artifacts.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: displayName 3 | type: string 4 | default: 'Publish to Build Artifact' 5 | 6 | - name: condition 7 | type: string 8 | default: succeeded() 9 | 10 | - name: artifactName 11 | type: string 12 | 13 | - name: pathToPublish 14 | type: string 15 | 16 | - name: continueOnError 17 | type: boolean 18 | default: false 19 | 20 | - name: publishLocation 21 | type: string 22 | default: 'Container' 23 | 24 | - name: is1ESPipeline 25 | type: boolean 26 | default: true 27 | 28 | - name: retryCountOnTaskFailure 29 | type: string 30 | default: 10 31 | 32 | steps: 33 | - ${{ if ne(parameters.is1ESPipeline, true) }}: 34 | - 'eng/common/templates-official cannot be referenced from a non-1ES managed template': error 35 | - task: 1ES.PublishBuildArtifacts@1 36 | displayName: ${{ parameters.displayName }} 37 | condition: ${{ parameters.condition }} 38 | ${{ if parameters.continueOnError }}: 39 | continueOnError: ${{ parameters.continueOnError }} 40 | inputs: 41 | PublishLocation: ${{ parameters.publishLocation }} 42 | PathtoPublish: ${{ parameters.pathToPublish }} 43 | ${{ if parameters.artifactName }}: 44 | ArtifactName: ${{ parameters.artifactName }} 45 | ${{ if parameters.retryCountOnTaskFailure }}: 46 | retryCountOnTaskFailure: ${{ parameters.retryCountOnTaskFailure }} 47 | -------------------------------------------------------------------------------- /eng/common/templates-official/steps/publish-logs.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/steps/publish-logs.yml 3 | parameters: 4 | is1ESPipeline: true 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates-official/steps/publish-pipeline-artifacts.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: is1ESPipeline 3 | type: boolean 4 | default: true 5 | 6 | - name: args 7 | type: object 8 | default: {} 9 | 10 | steps: 11 | - ${{ if ne(parameters.is1ESPipeline, true) }}: 12 | - 'eng/common/templates-official cannot be referenced from a non-1ES managed template': error 13 | - task: 1ES.PublishPipelineArtifact@1 14 | displayName: ${{ coalesce(parameters.args.displayName, 'Publish to Build Artifact') }} 15 | ${{ if parameters.args.condition }}: 16 | condition: ${{ parameters.args.condition }} 17 | ${{ else }}: 18 | condition: succeeded() 19 | ${{ if parameters.args.continueOnError }}: 20 | continueOnError: ${{ parameters.args.continueOnError }} 21 | inputs: 22 | targetPath: ${{ parameters.args.targetPath }} 23 | ${{ if parameters.args.artifactName }}: 24 | artifactName: ${{ parameters.args.artifactName }} 25 | ${{ if parameters.args.properties }}: 26 | properties: ${{ parameters.args.properties }} 27 | ${{ if parameters.args.sbomEnabled }}: 28 | sbomEnabled: ${{ parameters.args.sbomEnabled }} 29 | -------------------------------------------------------------------------------- /eng/common/templates-official/steps/retain-build.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/steps/retain-build.yml 3 | parameters: 4 | is1ESPipeline: true 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates-official/steps/send-to-helix.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/steps/send-to-helix.yml 3 | parameters: 4 | is1ESPipeline: true 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates-official/steps/source-build.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/steps/source-build.yml 3 | parameters: 4 | is1ESPipeline: true 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates-official/steps/source-index-stage1-publish.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/steps/source-index-stage1-publish.yml 3 | parameters: 4 | is1ESPipeline: true 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates-official/variables/sdl-variables.yml: -------------------------------------------------------------------------------- 1 | variables: 2 | # The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in 3 | # sync with the packages.config file. 4 | - name: DefaultGuardianVersion 5 | value: 0.109.0 6 | - name: GuardianPackagesConfigFile 7 | value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config -------------------------------------------------------------------------------- /eng/common/templates/job/onelocbuild.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - template: /eng/common/core-templates/job/onelocbuild.yml 3 | parameters: 4 | is1ESPipeline: false 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates/job/publish-build-assets.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - template: /eng/common/core-templates/job/publish-build-assets.yml 3 | parameters: 4 | is1ESPipeline: false 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates/job/source-build.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - template: /eng/common/core-templates/job/source-build.yml 3 | parameters: 4 | is1ESPipeline: false 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates/job/source-index-stage1.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - template: /eng/common/core-templates/job/source-index-stage1.yml 3 | parameters: 4 | is1ESPipeline: false 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates/jobs/codeql-build.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - template: /eng/common/core-templates/jobs/codeql-build.yml 3 | parameters: 4 | is1ESPipeline: false 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates/jobs/jobs.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - template: /eng/common/core-templates/jobs/jobs.yml 3 | parameters: 4 | is1ESPipeline: false 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates/jobs/source-build.yml: -------------------------------------------------------------------------------- 1 | jobs: 2 | - template: /eng/common/core-templates/jobs/source-build.yml 3 | parameters: 4 | is1ESPipeline: false 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} -------------------------------------------------------------------------------- /eng/common/templates/post-build/common-variables.yml: -------------------------------------------------------------------------------- 1 | variables: 2 | - template: /eng/common/core-templates/post-build/common-variables.yml 3 | parameters: 4 | # Specifies whether to use 1ES 5 | is1ESPipeline: false 6 | 7 | ${{ each parameter in parameters }}: 8 | ${{ parameter.key }}: ${{ parameter.value }} -------------------------------------------------------------------------------- /eng/common/templates/post-build/post-build.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - template: /eng/common/core-templates/post-build/post-build.yml 3 | parameters: 4 | # Specifies whether to use 1ES 5 | is1ESPipeline: false 6 | 7 | ${{ each parameter in parameters }}: 8 | ${{ parameter.key }}: ${{ parameter.value }} -------------------------------------------------------------------------------- /eng/common/templates/post-build/setup-maestro-vars.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/post-build/setup-maestro-vars.yml 3 | parameters: 4 | # Specifies whether to use 1ES 5 | is1ESPipeline: false 6 | 7 | ${{ each parameter in parameters }}: 8 | ${{ parameter.key }}: ${{ parameter.value }} -------------------------------------------------------------------------------- /eng/common/templates/steps/component-governance.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/steps/component-governance.yml 3 | parameters: 4 | is1ESPipeline: false 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates/steps/enable-internal-runtimes.yml: -------------------------------------------------------------------------------- 1 | # Obtains internal runtime download credentials and populates the 'dotnetbuilds-internal-container-read-token-base64' 2 | # variable with the base64-encoded SAS token, by default 3 | 4 | steps: 5 | - template: /eng/common/core-templates/steps/enable-internal-runtimes.yml 6 | parameters: 7 | is1ESPipeline: false 8 | 9 | ${{ each parameter in parameters }}: 10 | ${{ parameter.key }}: ${{ parameter.value }} 11 | -------------------------------------------------------------------------------- /eng/common/templates/steps/enable-internal-sources.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/steps/enable-internal-sources.yml 3 | parameters: 4 | is1ESPipeline: false 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} -------------------------------------------------------------------------------- /eng/common/templates/steps/generate-sbom.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/steps/generate-sbom.yml 3 | parameters: 4 | is1ESPipeline: false 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates/steps/get-delegation-sas.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/steps/get-delegation-sas.yml 3 | parameters: 4 | is1ESPipeline: false 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates/steps/get-federated-access-token.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/steps/get-federated-access-token.yml 3 | parameters: 4 | is1ESPipeline: false 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} -------------------------------------------------------------------------------- /eng/common/templates/steps/publish-build-artifacts.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: is1ESPipeline 3 | type: boolean 4 | default: false 5 | 6 | - name: displayName 7 | type: string 8 | default: 'Publish to Build Artifact' 9 | 10 | - name: condition 11 | type: string 12 | default: succeeded() 13 | 14 | - name: artifactName 15 | type: string 16 | 17 | - name: pathToPublish 18 | type: string 19 | 20 | - name: continueOnError 21 | type: boolean 22 | default: false 23 | 24 | - name: publishLocation 25 | type: string 26 | default: 'Container' 27 | 28 | - name: retryCountOnTaskFailure 29 | type: string 30 | default: 10 31 | 32 | steps: 33 | - ${{ if eq(parameters.is1ESPipeline, true) }}: 34 | - 'eng/common/templates cannot be referenced from a 1ES managed template': error 35 | - task: PublishBuildArtifacts@1 36 | displayName: ${{ parameters.displayName }} 37 | condition: ${{ parameters.condition }} 38 | ${{ if parameters.continueOnError }}: 39 | continueOnError: ${{ parameters.continueOnError }} 40 | inputs: 41 | PublishLocation: ${{ parameters.publishLocation }} 42 | PathtoPublish: ${{ parameters.pathToPublish }} 43 | ${{ if parameters.artifactName }}: 44 | ArtifactName: ${{ parameters.artifactName }} 45 | ${{ if parameters.retryCountOnTaskFailure }}: 46 | retryCountOnTaskFailure: ${{ parameters.retryCountOnTaskFailure }} 47 | -------------------------------------------------------------------------------- /eng/common/templates/steps/publish-logs.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/steps/publish-logs.yml 3 | parameters: 4 | is1ESPipeline: false 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates/steps/publish-pipeline-artifacts.yml: -------------------------------------------------------------------------------- 1 | parameters: 2 | - name: is1ESPipeline 3 | type: boolean 4 | default: false 5 | 6 | - name: args 7 | type: object 8 | default: {} 9 | 10 | steps: 11 | - ${{ if eq(parameters.is1ESPipeline, true) }}: 12 | - 'eng/common/templates cannot be referenced from a 1ES managed template': error 13 | - task: PublishPipelineArtifact@1 14 | displayName: ${{ coalesce(parameters.args.displayName, 'Publish to Build Artifact') }} 15 | ${{ if parameters.args.condition }}: 16 | condition: ${{ parameters.args.condition }} 17 | ${{ else }}: 18 | condition: succeeded() 19 | ${{ if parameters.args.continueOnError }}: 20 | continueOnError: ${{ parameters.args.continueOnError }} 21 | inputs: 22 | targetPath: ${{ parameters.args.targetPath }} 23 | ${{ if parameters.args.artifactName }}: 24 | artifactName: ${{ parameters.args.artifactName }} 25 | ${{ if parameters.args.publishLocation }}: 26 | publishLocation: ${{ parameters.args.publishLocation }} 27 | ${{ if parameters.args.fileSharePath }}: 28 | fileSharePath: ${{ parameters.args.fileSharePath }} 29 | ${{ if parameters.args.Parallel }}: 30 | parallel: ${{ parameters.args.Parallel }} 31 | ${{ if parameters.args.parallelCount }}: 32 | parallelCount: ${{ parameters.args.parallelCount }} 33 | ${{ if parameters.args.properties }}: 34 | properties: ${{ parameters.args.properties }} -------------------------------------------------------------------------------- /eng/common/templates/steps/retain-build.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/steps/retain-build.yml 3 | parameters: 4 | is1ESPipeline: false 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates/steps/send-to-helix.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/steps/send-to-helix.yml 3 | parameters: 4 | is1ESPipeline: false 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates/steps/source-build.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/steps/source-build.yml 3 | parameters: 4 | is1ESPipeline: false 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /eng/common/templates/steps/source-index-stage1-publish.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - template: /eng/common/core-templates/steps/source-index-stage1-publish.yml 3 | parameters: 4 | is1ESPipeline: false 5 | 6 | ${{ each parameter in parameters }}: 7 | ${{ parameter.key }}: ${{ parameter.value }} 8 | -------------------------------------------------------------------------------- /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "tools": { 3 | "dotnet": "10.0.100-preview.3.25167.3", 4 | "runtimes": { 5 | "dotnet": [ 6 | "8.0.0" 7 | ] 8 | } 9 | }, 10 | "msbuild-sdks": { 11 | "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25171.1" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Ast/AstNodeWithConstraints.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Microsoft.Build.Logging.Query.Result; 5 | 6 | namespace Microsoft.Build.Logging.Query.Ast 7 | { 8 | public abstract class AstNodeWithConstraints : 9 | IAstNode 10 | where TThis : class, IQueryResult 11 | where TBefore : class, IQueryResult 12 | { 13 | public IReadOnlyList> Constraints => _constraints; 14 | 15 | private readonly List> _constraints; 16 | 17 | public AstNodeWithConstraints(List> constraints = null) : base() 18 | { 19 | _constraints = constraints ?? new List>(); 20 | } 21 | 22 | protected bool Equals(AstNodeWithConstraints other) 23 | { 24 | return other != null && 25 | Constraints.SequenceEqual(other.Constraints); 26 | ; } 27 | 28 | protected int GetConstraintHashCode() 29 | { 30 | var hashCode = new HashCode(); 31 | 32 | foreach (var constraint in Constraints) 33 | { 34 | hashCode.Add(constraint); 35 | } 36 | 37 | return hashCode.ToHashCode(); 38 | } 39 | 40 | protected IEnumerable FilterByConstraints(IEnumerable components) 41 | { 42 | foreach (var constraint in Constraints) 43 | { 44 | components = constraint.Filter(components); 45 | } 46 | 47 | return components; 48 | } 49 | 50 | public abstract IEnumerable Filter(IEnumerable components); 51 | } 52 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Ast/ComponentNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Microsoft.Build.Logging.Query.Result; 4 | 5 | namespace Microsoft.Build.Logging.Query.Ast 6 | { 7 | public abstract class ComponentNode : AstNodeWithConstraints 8 | where TThis : Component 9 | where TBefore : Component 10 | { 11 | public IAstNode Next { get; } 12 | 13 | public ComponentNode(IAstNode next, List> constraints = null) : 14 | base(constraints) 15 | { 16 | Next = next; 17 | } 18 | 19 | protected bool Equals(ComponentNode other) 20 | { 21 | return base.Equals(other) && 22 | EqualityComparer>.Default.Equals(Next, other.Next); 23 | ; } 24 | 25 | public override int GetHashCode() 26 | { 27 | return HashCode.Combine(GetConstraintHashCode(), Next); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Ast/ConstraintNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Microsoft.Build.Logging.Query.Result; 4 | 5 | namespace Microsoft.Build.Logging.Query.Ast 6 | { 7 | public abstract class ConstraintNode : IAstNode, IFilterable 8 | where TParent : class, IQueryResult 9 | { 10 | public ConstraintNode() : base() 11 | { 12 | } 13 | 14 | public abstract IEnumerable Filter(IEnumerable components); 15 | } 16 | 17 | public abstract class ConstraintNode : ConstraintNode 18 | where TParent : class, IQueryResult 19 | { 20 | public TValue Value { get; } 21 | 22 | public ConstraintNode(TValue value) : base() 23 | { 24 | Value = value; 25 | } 26 | 27 | protected bool Equals(ConstraintNode other) 28 | { 29 | return other != null && 30 | EqualityComparer.Default.Equals(Value, other.Value); 31 | } 32 | 33 | public override int GetHashCode() 34 | { 35 | return HashCode.Combine(Value); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Ast/IAstNode.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Build.Logging.Query.Result; 2 | 3 | namespace Microsoft.Build.Logging.Query.Ast 4 | { 5 | public interface IAstNode 6 | { 7 | } 8 | 9 | public interface IAstNode : IAstNode, IFilterable 10 | where TBefore : class, IQueryResult 11 | { 12 | } 13 | 14 | public interface IAstNode : IAstNode 15 | where TThis : class, IQueryResult 16 | where TBefore : class, IQueryResult 17 | { 18 | } 19 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Ast/IFilterable.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.Build.Logging.Query.Result; 3 | 4 | namespace Microsoft.Build.Logging.Query.Ast 5 | { 6 | public interface IFilterable 7 | where TIn : IQueryResult 8 | where TOut : IQueryResult 9 | { 10 | IEnumerable Filter(IEnumerable components); 11 | } 12 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Ast/IdNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics.CodeAnalysis; 4 | using System.Linq; 5 | using Microsoft.Build.Logging.Query.Result; 6 | 7 | namespace Microsoft.Build.Logging.Query.Ast 8 | { 9 | public sealed class IdNode : ConstraintNode, IEquatable> 10 | where TParent : class, IQueryResult, IResultWithId 11 | { 12 | public IdNode(int value) : base(value) 13 | { 14 | } 15 | 16 | public override bool Equals(object obj) 17 | { 18 | return Equals(obj as IdNode); 19 | } 20 | 21 | public bool Equals([AllowNull] IdNode other) 22 | { 23 | return base.Equals(other); 24 | } 25 | 26 | public override int GetHashCode() 27 | { 28 | return base.GetHashCode(); 29 | } 30 | 31 | public override IEnumerable Filter(IEnumerable components) 32 | { 33 | return components 34 | .Where(component => component.Id == Value); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Ast/LogNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Microsoft.Build.Logging.Query.Result; 4 | 5 | namespace Microsoft.Build.Logging.Query.Ast 6 | { 7 | public abstract class LogNode : 8 | IAstNode, 9 | IAstNode, 10 | IAstNode, 11 | IAstNode 12 | { 13 | public LogNode() 14 | { 15 | } 16 | 17 | public abstract IEnumerable Filter(IEnumerable components); 18 | public abstract IEnumerable Filter(IEnumerable components); 19 | public abstract IEnumerable Filter(IEnumerable components); 20 | public abstract IEnumerable Filter(IEnumerable components); 21 | } 22 | 23 | public abstract class LogNode : LogNode, IAstNode where TThis : Log 24 | { 25 | public LogNodeType Type { get; } 26 | 27 | public LogNode(LogNodeType type) : base() 28 | { 29 | Type = type; 30 | } 31 | 32 | protected bool Equals(LogNode other) 33 | { 34 | return other != null && 35 | Type == other.Type; 36 | } 37 | 38 | public override int GetHashCode() 39 | { 40 | return HashCode.Combine(Type); 41 | } 42 | 43 | public abstract IEnumerable Filter(IEnumerable components); 44 | } 45 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Ast/LogNodeType.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Ast 2 | { 3 | public enum LogNodeType 4 | { 5 | Direct, 6 | All 7 | } 8 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Ast/NameNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics.CodeAnalysis; 4 | using System.Linq; 5 | using Microsoft.Build.Logging.Query.Result; 6 | 7 | namespace Microsoft.Build.Logging.Query.Ast 8 | { 9 | public sealed class NameNode : ConstraintNode, IEquatable> 10 | where TParent : class, IQueryResult, IResultWithName 11 | { 12 | public NameNode(string value) : base(value) 13 | { 14 | } 15 | 16 | public override bool Equals(object obj) 17 | { 18 | return Equals(obj as NameNode); 19 | } 20 | 21 | public bool Equals([AllowNull] NameNode other) 22 | { 23 | return base.Equals(other); 24 | } 25 | 26 | public override int GetHashCode() 27 | { 28 | return base.GetHashCode(); 29 | } 30 | 31 | public override IEnumerable Filter(IEnumerable components) 32 | { 33 | return components 34 | .Where(component => component.Name == Value); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Ast/PathNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics.CodeAnalysis; 4 | using System.Linq; 5 | using Microsoft.Build.Logging.Query.Result; 6 | 7 | namespace Microsoft.Build.Logging.Query.Ast 8 | { 9 | public sealed class PathNode : ConstraintNode, IEquatable> 10 | where TParent : class, IQueryResult, IResultWithPath 11 | { 12 | public PathNode(string value) : base(value) 13 | { 14 | } 15 | 16 | public override bool Equals(object obj) 17 | { 18 | return Equals(obj as PathNode); 19 | } 20 | 21 | public bool Equals([AllowNull] PathNode other) 22 | { 23 | return base.Equals(other); 24 | } 25 | 26 | public override int GetHashCode() 27 | { 28 | return base.GetHashCode(); 29 | } 30 | 31 | public override IEnumerable Filter(IEnumerable components) 32 | { 33 | return components 34 | .Where(component => component.Path == Value); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Ast/ProjectNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics.CodeAnalysis; 4 | using System.Linq; 5 | using Microsoft.Build.Logging.Query.Result; 6 | 7 | namespace Microsoft.Build.Logging.Query.Ast 8 | { 9 | public sealed class ProjectNode : 10 | ComponentNode, 11 | IEquatable 12 | { 13 | public ProjectNode(List> constraints = null) : base(null, constraints) 14 | { 15 | } 16 | 17 | public ProjectNode(IAstNode next, List> constraints = null) : 18 | base(next ?? throw new ArgumentNullException(), constraints) 19 | { 20 | } 21 | 22 | public override bool Equals(object obj) 23 | { 24 | return Equals(obj as ProjectNode); 25 | } 26 | 27 | public bool Equals([AllowNull] ProjectNode other) 28 | { 29 | return base.Equals(other); 30 | } 31 | 32 | public override int GetHashCode() 33 | { 34 | return base.GetHashCode(); 35 | } 36 | 37 | public override IEnumerable Filter(IEnumerable components) 38 | { 39 | var projects = components 40 | .SelectMany(build => build.ProjectsById.Values); 41 | 42 | var filteredProjects = FilterByConstraints(projects); 43 | 44 | return Next?.Filter(filteredProjects) ?? filteredProjects; 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Ast/TargetNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics.CodeAnalysis; 4 | using System.Linq; 5 | using Microsoft.Build.Logging.Query.Result; 6 | 7 | namespace Microsoft.Build.Logging.Query.Ast 8 | { 9 | public sealed class TargetNode : ComponentNode, IEquatable 10 | { 11 | public TargetNode(List> constraints = null) : base(null, constraints) 12 | { 13 | } 14 | 15 | public TargetNode(IAstNode next, List> constraints = null) : 16 | base(next ?? throw new ArgumentNullException(), constraints) 17 | { 18 | } 19 | 20 | public override bool Equals(object obj) 21 | { 22 | return Equals(obj as TargetNode); 23 | } 24 | 25 | public bool Equals([AllowNull] TargetNode other) 26 | { 27 | return base.Equals(other); 28 | } 29 | 30 | public override int GetHashCode() 31 | { 32 | return base.GetHashCode(); 33 | } 34 | 35 | public override IEnumerable Filter(IEnumerable components) 36 | { 37 | var targets = components 38 | .SelectMany(project => project.OrderedTargets); 39 | 40 | var filteredTargets = FilterByConstraints(targets); 41 | 42 | return Next?.Filter(filteredTargets) ?? filteredTargets; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Ast/TaskNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics.CodeAnalysis; 4 | using System.Linq; 5 | using Microsoft.Build.Logging.Query.Result; 6 | 7 | namespace Microsoft.Build.Logging.Query.Ast 8 | { 9 | public sealed class TaskNode : ComponentNode, IEquatable 10 | { 11 | public TaskNode(List> constraints = null) : base(null, constraints) 12 | { 13 | } 14 | 15 | public TaskNode(IAstNode next, List> constraints = null) : 16 | base(next ?? throw new ArgumentNullException(), constraints) 17 | { 18 | } 19 | 20 | public override bool Equals(object obj) 21 | { 22 | return Equals(obj as TaskNode); 23 | } 24 | 25 | public bool Equals([AllowNull] TaskNode other) 26 | { 27 | return base.Equals(other); 28 | } 29 | 30 | public override int GetHashCode() 31 | { 32 | return base.GetHashCode(); 33 | } 34 | 35 | public override IEnumerable Filter(IEnumerable components) 36 | { 37 | var tasks = components 38 | .SelectMany(target => target.OrderedTasks); 39 | 40 | var filteredTasks = FilterByConstraints(tasks); 41 | 42 | return Next?.Filter(filteredTasks) ?? filteredTasks; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Construction/BinaryLogReader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.IO.Compression; 5 | using Microsoft.Build.Framework; 6 | 7 | namespace Microsoft.Build.Logging.Query.Construction 8 | { 9 | public class BinaryLogReader : IDisposable 10 | { 11 | private readonly FileStream _fileStream; 12 | private readonly GZipStream _gZipStream; 13 | private readonly BinaryReader _binaryReader; 14 | private readonly int _fileFormatVersion; 15 | private IEnumerable _buildEvents; 16 | 17 | public BinaryLogReader(string path) 18 | { 19 | _fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read); 20 | _gZipStream = new GZipStream(_fileStream, CompressionMode.Decompress, leaveOpen: true); 21 | _binaryReader = new BinaryReader(_gZipStream); 22 | _fileFormatVersion = _binaryReader.ReadInt32(); 23 | } 24 | 25 | public void Dispose() 26 | { 27 | _fileStream.Dispose(); 28 | _gZipStream.Dispose(); 29 | _binaryReader.Dispose(); 30 | } 31 | 32 | public IEnumerable ReadEvents() 33 | { 34 | if (_buildEvents != null) 35 | { 36 | return _buildEvents; 37 | } 38 | 39 | var buildEventArgsReader = new BuildEventArgsReader(_binaryReader, _fileFormatVersion); 40 | var buildEvents = new List(); 41 | 42 | while (true) 43 | { 44 | var buildEventArgs = buildEventArgsReader.Read(); 45 | 46 | if (buildEventArgs == null) 47 | { 48 | break; 49 | } 50 | 51 | buildEvents.Add(buildEventArgs); 52 | } 53 | 54 | _buildEvents = buildEvents; 55 | return _buildEvents; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Graph/IDirectedAcyclicGraphNode.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Microsoft.Build.Logging.Query.Graph 4 | { 5 | public interface IDirectedAcyclicGraphNode 6 | { 7 | } 8 | 9 | public interface IDirectedAcyclicGraphNode : IDirectedAcyclicGraphNode where T : IDirectedAcyclicGraphNode 10 | { 11 | ISet AdjacentNodes { get; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Graph/IShallowCopyableGraphNode.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Graph 2 | { 3 | public interface IShallowCopyableGraphNode where T : IDirectedAcyclicGraphNode 4 | { 5 | T ShallowCopyAndClearEdges(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Graph/ProjectNode_BeforeThis.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics.CodeAnalysis; 4 | using Microsoft.Build.Logging.Query.Result; 5 | 6 | namespace Microsoft.Build.Logging.Query.Graph 7 | { 8 | public class ProjectNode_BeforeThis : 9 | IDirectedAcyclicGraphNode, 10 | IShallowCopyableGraphNode, 11 | IEquatable 12 | { 13 | public Project ProjectInfo { get; } 14 | 15 | public ISet AdjacentNodes { get; private set; } 16 | 17 | public ProjectNode_BeforeThis(Project projectInfo) 18 | { 19 | ProjectInfo = projectInfo; 20 | AdjacentNodes = new HashSet(); 21 | } 22 | 23 | public ProjectNode_BeforeThis ShallowCopyAndClearEdges() 24 | { 25 | var copy = MemberwiseClone() as ProjectNode_BeforeThis; 26 | copy.AdjacentNodes = new HashSet(); 27 | return copy; 28 | } 29 | 30 | public bool Equals([AllowNull] ProjectNode_BeforeThis other) 31 | { 32 | return other != null && 33 | EqualityComparer.Default.Equals(ProjectInfo, other.ProjectInfo); 34 | } 35 | 36 | public override int GetHashCode() 37 | { 38 | return HashCode.Combine(ProjectInfo); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Graph/TargetNode_AfterThis.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics.CodeAnalysis; 4 | using Microsoft.Build.Logging.Query.Result; 5 | 6 | namespace Microsoft.Build.Logging.Query.Graph 7 | { 8 | public class TargetNode_AfterThis : 9 | IDirectedAcyclicGraphNode, 10 | IShallowCopyableGraphNode, 11 | IEquatable 12 | { 13 | public Target TargetInfo { get; } 14 | public ISet AdjacentNodes { get; private set; } 15 | 16 | public TargetNode_AfterThis(Target targetInfo) 17 | { 18 | TargetInfo = targetInfo; 19 | AdjacentNodes = new HashSet(); 20 | } 21 | 22 | public TargetNode_AfterThis ShallowCopyAndClearEdges() 23 | { 24 | var copy = MemberwiseClone() as TargetNode_AfterThis; 25 | copy.AdjacentNodes = new HashSet(); 26 | return copy; 27 | } 28 | 29 | public bool Equals([AllowNull] TargetNode_AfterThis other) 30 | { 31 | return other != null && 32 | EqualityComparer.Default.Equals(TargetInfo, other.TargetInfo); 33 | } 34 | 35 | public override int GetHashCode() 36 | { 37 | return HashCode.Combine(TargetInfo); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Graph/TargetNode_BeforeThis.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics.CodeAnalysis; 4 | using Microsoft.Build.Logging.Query.Result; 5 | 6 | namespace Microsoft.Build.Logging.Query.Graph 7 | { 8 | public class TargetNode_BeforeThis : 9 | IDirectedAcyclicGraphNode, 10 | IShallowCopyableGraphNode, 11 | IEquatable 12 | { 13 | public Target TargetInfo { get; } 14 | public ISet AdjacentNodes { get; private set; } 15 | 16 | public TargetNode_BeforeThis(Target targetInfo) 17 | { 18 | TargetInfo = targetInfo; 19 | AdjacentNodes = new HashSet(); 20 | } 21 | 22 | public TargetNode_BeforeThis ShallowCopyAndClearEdges() 23 | { 24 | var copy = MemberwiseClone() as TargetNode_BeforeThis; 25 | copy.AdjacentNodes = new HashSet(); 26 | return copy; 27 | } 28 | 29 | public bool Equals([AllowNull] TargetNode_BeforeThis other) 30 | { 31 | return other != null && 32 | EqualityComparer.Default.Equals(TargetInfo, other.TargetInfo); 33 | } 34 | 35 | public override int GetHashCode() 36 | { 37 | return HashCode.Combine(TargetInfo); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Interpret/Interpreter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Microsoft.Build.Logging.Query.Ast; 3 | using Microsoft.Build.Logging.Query.Parse; 4 | using Microsoft.Build.Logging.Query.Result; 5 | 6 | namespace Microsoft.Build.Logging.Query.Interpret 7 | { 8 | public class Interpreter 9 | { 10 | private readonly IAstNode _ast; 11 | 12 | public Interpreter(IAstNode ast) 13 | { 14 | _ast = ast; 15 | } 16 | 17 | public Interpreter(string expression) 18 | { 19 | _ast = Parser.Parse(expression); 20 | } 21 | 22 | public IEnumerable Filter(Result.Build build) 23 | { 24 | return _ast.Filter(new[] { build }); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/MSBuildBinLogQuery.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | Microsoft.Build.Logging.Query 6 | preview 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Parse/ParseException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Microsoft.Build.Logging.Query.Parse 4 | { 5 | public class ParseException : Exception 6 | { 7 | public ParseException(string expression) : base(expression) 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Result/Build.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using Microsoft.Build.Framework; 4 | 5 | namespace Microsoft.Build.Logging.Query.Result 6 | { 7 | public class Build : Component 8 | { 9 | public IReadOnlyDictionary ProjectsById => _projectsById; 10 | public override Component Parent => null; 11 | 12 | private readonly Dictionary _projectsById; 13 | 14 | public Build() : base() 15 | { 16 | _projectsById = new Dictionary(); 17 | } 18 | 19 | public Project AddProject( 20 | int id, 21 | string projectFile, 22 | IEnumerable items, 23 | IEnumerable properties, 24 | IDictionary globalProperties) 25 | { 26 | var project = new Project( 27 | id, 28 | projectFile, 29 | items, 30 | properties, 31 | globalProperties, 32 | this); 33 | 34 | if (id != BuildEventContext.InvalidProjectInstanceId) 35 | { 36 | _projectsById[id] = project; 37 | } 38 | 39 | return project; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Result/Error.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Result 2 | { 3 | public class Error : Log 4 | { 5 | public Error(string text, Component parent) : base(text, parent) 6 | { 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Result/IQueryResult.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Result 2 | { 3 | public interface IQueryResult 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Result/IResultWithId.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Result 2 | { 3 | public interface IResultWithId : IQueryResult 4 | { 5 | int Id { get; } 6 | } 7 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Result/IResultWithName.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Result 2 | { 3 | public interface IResultWithName : IQueryResult 4 | { 5 | string Name { get; } 6 | } 7 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Result/IResultWithPath.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Result 2 | { 3 | public interface IResultWithPath : IQueryResult 4 | { 5 | string Path { get; } 6 | } 7 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Result/Log.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Result 2 | { 3 | public abstract class Log : IQueryResult 4 | { 5 | public string Text { get; } 6 | public Component Parent { get; } 7 | 8 | public Log(string text, Component parent) 9 | { 10 | Text = text; 11 | Parent = parent; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Result/Message.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Build.Framework; 2 | 3 | namespace Microsoft.Build.Logging.Query.Result 4 | { 5 | public class Message : Log 6 | { 7 | public MessageImportance Importance { get; } 8 | 9 | public Message(string text, Component parent, MessageImportance importance) : base(text, parent) 10 | { 11 | Importance = importance; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Result/Task.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics.CodeAnalysis; 4 | using Microsoft.Build.Logging.Query.Utility; 5 | 6 | namespace Microsoft.Build.Logging.Query.Result 7 | { 8 | public class Task : Component, IEquatable, IResultWithId, IResultWithName 9 | { 10 | public int Id { get; } 11 | public string Name { get; } 12 | public string TaskFile { get; } 13 | public Target ParentTarget { get; } 14 | public PropertyManager Parameters { get; } 15 | public override Component Parent => ParentTarget; 16 | 17 | public Task(int id, string name, string taskFile, Target parentTarget) : base() 18 | { 19 | Id = id; 20 | Name = name; 21 | TaskFile = taskFile; 22 | ParentTarget = parentTarget; 23 | Parameters = new PropertyManager(); 24 | } 25 | 26 | public bool Equals([AllowNull] Task other) 27 | { 28 | return other != null && 29 | Id == other.Id && 30 | EqualityComparer.Default.Equals(ParentTarget, other.ParentTarget); 31 | } 32 | 33 | public override int GetHashCode() 34 | { 35 | return HashCode.Combine(Id); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Result/Warning.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Result 2 | { 3 | public class Warning : Log 4 | { 5 | public Warning(string text, Component parent) : base(text, parent) 6 | { 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Scan/ScanException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Microsoft.Build.Logging.Query.Scan 4 | { 5 | public class ScanException : Exception 6 | { 7 | public ScanException(string expression) : base(expression) 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Token/CommaToken.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Token 2 | { 3 | public class CommaToken : Token 4 | { 5 | public static CommaToken Instance { get; } = new CommaToken(); 6 | 7 | private CommaToken() : base() 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Token/DoubleSlashToken.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Token 2 | { 3 | public class DoubleSlashToken : Token 4 | { 5 | public static DoubleSlashToken Instance { get; } = new DoubleSlashToken(); 6 | 7 | private DoubleSlashToken() : base() 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Token/EofToken.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Token 2 | { 3 | public class EofToken : Token 4 | { 5 | public static EofToken Instance { get; } = new EofToken(); 6 | 7 | private EofToken() : base() 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Token/EqualToken.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Token 2 | { 3 | public class EqualToken : Token 4 | { 5 | public static EqualToken Instance { get; } = new EqualToken(); 6 | 7 | private EqualToken() : base() 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Token/ErrorToken.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Token 2 | { 3 | public class ErrorToken : Token 4 | { 5 | public static ErrorToken Instance { get; } = new ErrorToken(); 6 | 7 | private ErrorToken() : base() 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Token/IdToken.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Token 2 | { 3 | public class IdToken : Token 4 | { 5 | public static IdToken Instance { get; } = new IdToken(); 6 | 7 | private IdToken() : base() 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Token/IntegerToken.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.CodeAnalysis; 3 | 4 | namespace Microsoft.Build.Logging.Query.Token 5 | { 6 | public sealed class IntegerToken : Token, IEquatable 7 | { 8 | public int Value { get; } 9 | 10 | public IntegerToken(int value) : base() 11 | { 12 | Value = value; 13 | } 14 | 15 | public override bool Equals(object obj) 16 | { 17 | return Equals(obj as IntegerToken); 18 | } 19 | 20 | public bool Equals([AllowNull] IntegerToken other) 21 | { 22 | return other != null && 23 | Value == other.Value; 24 | } 25 | 26 | public override int GetHashCode() 27 | { 28 | return HashCode.Combine(Value); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Token/LeftBracketToken.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Token 2 | { 3 | public class LeftBracketToken : Token 4 | { 5 | public static LeftBracketToken Instance { get; } = new LeftBracketToken(); 6 | 7 | private LeftBracketToken() : base() 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Token/MessageToken.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Token 2 | { 3 | public class MessageToken : Token 4 | { 5 | public static MessageToken Instance { get; } = new MessageToken(); 6 | 7 | private MessageToken() : base() 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Token/NameToken.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Token 2 | { 3 | public class NameToken : Token 4 | { 5 | public static NameToken Instance { get; } = new NameToken(); 6 | 7 | private NameToken() : base() 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Token/PathToken.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Token 2 | { 3 | public class PathToken : Token 4 | { 5 | public static PathToken Instance { get; } = new PathToken(); 6 | 7 | private PathToken() : base() 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Token/ProjectToken.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Token 2 | { 3 | public class ProjectToken : Token 4 | { 5 | public static ProjectToken Instance { get; } = new ProjectToken(); 6 | 7 | private ProjectToken() : base() 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Token/RightBracketToken.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Token 2 | { 3 | public class RightBracketToken : Token 4 | { 5 | public static RightBracketToken Instance { get; } = new RightBracketToken(); 6 | 7 | private RightBracketToken() : base() 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Token/SingleSlashToken.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Token 2 | { 3 | public class SingleSlashToken : Token 4 | { 5 | public static SingleSlashToken Instance { get; } = new SingleSlashToken(); 6 | 7 | private SingleSlashToken() : base() 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Token/StringToken.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.CodeAnalysis; 3 | 4 | namespace Microsoft.Build.Logging.Query.Token 5 | { 6 | public sealed class StringToken : Token, IEquatable 7 | { 8 | public string Value { get; } 9 | 10 | public StringToken(string value) : base() 11 | { 12 | Value = value; 13 | } 14 | 15 | public override bool Equals(object obj) 16 | { 17 | return Equals(obj as StringToken); 18 | } 19 | 20 | public bool Equals([AllowNull] StringToken other) 21 | { 22 | return other != null && 23 | Value == other.Value; 24 | } 25 | 26 | public override int GetHashCode() 27 | { 28 | return HashCode.Combine(Value); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Token/TargetToken.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Token 2 | { 3 | public class TargetToken : Token 4 | { 5 | public static TargetToken Instance { get; } = new TargetToken(); 6 | 7 | private TargetToken() : base() 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Token/TaskToken.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Token 2 | { 3 | public class TaskToken : Token 4 | { 5 | public static TaskToken Instance { get; } = new TaskToken(); 6 | 7 | private TaskToken() : base() 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Token/Token.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Token 2 | { 3 | public abstract class Token 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Token/WarningToken.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.Build.Logging.Query.Token 2 | { 3 | public class WarningToken : Token 4 | { 5 | public static WarningToken Instance { get; } = new WarningToken(); 6 | 7 | private WarningToken() : base() 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Utility/ItemManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Concurrent; 2 | using Microsoft.Build.Framework; 3 | 4 | namespace Microsoft.Build.Logging.Query.Utility 5 | { 6 | public class ItemManager 7 | { 8 | private readonly ConcurrentDictionary> _items; 9 | 10 | public ItemManager() 11 | { 12 | _items = new ConcurrentDictionary>(); 13 | } 14 | 15 | public void Add(string name, ITaskItem taskItem) 16 | { 17 | var item = _items.GetOrAdd(name, new ConcurrentBag()); 18 | item.Add(taskItem); 19 | } 20 | 21 | public bool TryGet(string name, out ConcurrentBag elements) 22 | { 23 | return _items.TryGetValue(name, out elements); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/MSBuildBinLogQuery/Utility/PropertyManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Concurrent; 2 | 3 | namespace Microsoft.Build.Logging.Query.Utility 4 | { 5 | public class PropertyManager 6 | { 7 | private readonly ConcurrentDictionary _properties; 8 | 9 | public PropertyManager() 10 | { 11 | _properties = new ConcurrentDictionary(); 12 | } 13 | 14 | public void Set(string key, string value) 15 | { 16 | _properties.AddOrUpdate(key, k => value, (k, v) => value); 17 | } 18 | 19 | public bool TryGet(string key, out string value) 20 | { 21 | return _properties.TryGetValue(key, out value); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/core-sdk-tasks/Chmod.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using Microsoft.Build.Framework; 5 | using Microsoft.Build.Utilities; 6 | 7 | namespace Microsoft.DotNet.Cli.Build 8 | { 9 | public class Chmod : ToolTask 10 | { 11 | [Required] 12 | public string Glob { get; set; } 13 | 14 | [Required] 15 | public string Mode { get; set; } 16 | 17 | public bool Recursive { get; set; } 18 | 19 | protected override string ToolName 20 | { 21 | get { return "chmod"; } 22 | } 23 | 24 | protected override MessageImportance StandardOutputLoggingImportance 25 | { 26 | get { return MessageImportance.High; } // or else the output doesn't get logged by default 27 | } 28 | 29 | protected override string GenerateFullPathToTool() 30 | { 31 | return "chmod"; 32 | } 33 | 34 | protected override string GenerateCommandLineCommands() 35 | { 36 | return $"{GetRecursive()} {GetMode()} {GetGlob()}"; 37 | } 38 | 39 | private string GetGlob() 40 | { 41 | return Glob; 42 | } 43 | 44 | private string GetMode() 45 | { 46 | return Mode; 47 | } 48 | 49 | private string GetRecursive() 50 | { 51 | if(Recursive) 52 | { 53 | return "--recursive"; 54 | } 55 | 56 | return null; 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/core-sdk-tasks/Constants.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System.Runtime.InteropServices; 5 | 6 | namespace Microsoft.DotNet.Cli.Build.Framework 7 | { 8 | public static class Constants 9 | { 10 | //public static readonly string ProjectFileName = "project.json"; 11 | public static readonly string ExeSuffix = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? ".exe" : string.Empty; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/core-sdk-tasks/DotNetDebTool.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using Microsoft.Build.Framework; 5 | using Microsoft.Build.Utilities; 6 | 7 | namespace Microsoft.DotNet.Cli.Build 8 | { 9 | public class DotNetDebTool : DotNetTool 10 | { 11 | protected override string Command 12 | { 13 | get { return "deb-tool"; } 14 | } 15 | 16 | protected override string Args 17 | { 18 | get { return $"{GetInputDir()} {GetOutputFile()} {GetPackageName()} {GetPackageVersion()}"; } 19 | } 20 | 21 | [Required] 22 | public string InputDirectory { get; set; } 23 | 24 | [Required] 25 | public string OutputDirectory { get; set; } 26 | 27 | [Required] 28 | public string PackageName { get; set; } 29 | 30 | [Required] 31 | public string PackageVersion { get; set; } 32 | 33 | private string GetInputDir() 34 | { 35 | return $"-i {InputDirectory}"; 36 | } 37 | 38 | private string GetOutputFile() 39 | { 40 | return $"-o {OutputDirectory}"; 41 | } 42 | 43 | private string GetPackageName() 44 | { 45 | return $"-n {PackageName}"; 46 | } 47 | 48 | private string GetPackageVersion() 49 | { 50 | return $"-v {PackageVersion}"; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/core-sdk-tasks/Enumerations/BuildPlatform.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | namespace Microsoft.DotNet.Cli.Build.Framework 5 | { 6 | public enum BuildPlatform 7 | { 8 | Windows = 1, 9 | Unix = 2, 10 | Linux = 3, 11 | OSX = 4, 12 | Ubuntu = 5, 13 | CentOS = 6, 14 | RHEL = 7, 15 | Debian = 8, 16 | Fedora = 9, 17 | OpenSuse = 10, 18 | FreeBSD = 11 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/core-sdk-tasks/GenerateMsiVersion.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using Microsoft.Build.Framework; 5 | using Microsoft.Build.Utilities; 6 | 7 | namespace Microsoft.DotNet.Cli.Build 8 | { 9 | public class GenerateMsiVersion : Task 10 | { 11 | [Required] 12 | public int CommitCount { get; set; } 13 | 14 | [Required] 15 | public int VersionMajor { get; set; } 16 | 17 | [Required] 18 | public int VersionMinor { get; set; } 19 | 20 | [Required] 21 | public int VersionPatch { get; set; } 22 | 23 | [Output] 24 | public string MsiVersion { get; set; } 25 | 26 | public override bool Execute() 27 | { 28 | var buildVersion = new Version() 29 | { 30 | Major = VersionMajor, 31 | Minor = VersionMinor, 32 | Patch = VersionPatch, 33 | CommitCount = CommitCount 34 | }; 35 | 36 | MsiVersion = buildVersion.GenerateMsiVersion(); 37 | 38 | return true; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/core-sdk-tasks/GetCurrentRuntimeInformation.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using Microsoft.Build.Framework; 5 | using Microsoft.Build.Utilities; 6 | using Microsoft.DotNet.Cli.Build.Framework; 7 | using Microsoft.DotNet.PlatformAbstractions; 8 | 9 | namespace Microsoft.DotNet.Cli.Build 10 | { 11 | public class GetCurrentRuntimeInformation : Task 12 | { 13 | [Output] 14 | public string Rid { get; set; } 15 | 16 | [Output] 17 | public string OSName { get; set; } 18 | 19 | [Output] 20 | public string OSPlatform { get; set; } 21 | 22 | public override bool Execute() 23 | { 24 | Rid = RuntimeEnvironment.GetRuntimeIdentifier(); 25 | OSName = GetOSShortName(); 26 | OSPlatform = RuntimeEnvironment.OperatingSystemPlatform.ToString().ToLower(); 27 | 28 | return true; 29 | } 30 | 31 | private static string GetOSShortName() 32 | { 33 | string osname = ""; 34 | switch (CurrentPlatform.Current) 35 | { 36 | case BuildPlatform.Windows: 37 | osname = "win"; 38 | break; 39 | default: 40 | osname = CurrentPlatform.Current.ToString().ToLower(); 41 | break; 42 | } 43 | 44 | return osname; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/core-sdk-tasks/GetRuntimePackRids.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using Microsoft.Build.Framework; 7 | using Microsoft.Build.Utilities; 8 | using Newtonsoft.Json.Linq; 9 | 10 | namespace Microsoft.DotNet.Cli.Build 11 | { 12 | public class GetRuntimePackRids : Task 13 | { 14 | [Required] 15 | public string MetapackagePath { get; set; } 16 | 17 | [Output] 18 | public ITaskItem[] AvailableRuntimePackRuntimeIdentifiers { get; set; } 19 | 20 | public override bool Execute() 21 | { 22 | string runtimeJsonPath = Path.Combine(MetapackagePath, "runtime.json"); 23 | string runtimeJsonContents = File.ReadAllText(runtimeJsonPath); 24 | var runtimeJsonRoot = JObject.Parse(runtimeJsonContents); 25 | string [] runtimeIdentifiers = ((JObject)runtimeJsonRoot["runtimes"]).Properties().Select(p => p.Name).ToArray(); 26 | AvailableRuntimePackRuntimeIdentifiers = runtimeIdentifiers.Select(rid => new TaskItem(rid)).ToArray(); 27 | return true; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/core-sdk-tasks/GetUseBundledVersionAsDefaultVersion.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | using System.IO; 6 | using Microsoft.Build.Utilities; 7 | using Microsoft.Build.Framework; 8 | using Microsoft.DotNet.Cli.Build.Framework; 9 | using NuGet.Versioning; 10 | 11 | namespace Microsoft.DotNet.Cli.Build 12 | { 13 | public class GetUseBundledNETCoreAppPackageVersionAsDefaultNetCorePatchVersion : Task 14 | { 15 | [Required] 16 | public string BundledNETCoreAppPackageVersion { get; set; } 17 | 18 | [Output] 19 | public string UseBundledNETCoreAppPackageVersionAsDefaultNetCorePatchVersion { get; set; } 20 | 21 | public override bool Execute() 22 | { 23 | var parsedVersion = NuGetVersion.Parse(BundledNETCoreAppPackageVersion); 24 | UseBundledNETCoreAppPackageVersionAsDefaultNetCorePatchVersion = 25 | (parsedVersion.Patch == 0) && parsedVersion.IsPrerelease ? "true" : "false"; 26 | 27 | return true; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/core-sdk-tasks/Utils/Version.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | namespace Microsoft.DotNet.Cli.Build 5 | { 6 | public class Version 7 | { 8 | public virtual int Major { get; set; } 9 | public virtual int Minor { get; set; } 10 | public virtual int Patch { get; set; } 11 | public virtual int CommitCount { get; set; } 12 | 13 | public string GenerateMsiVersion() 14 | { 15 | // MSI versioning 16 | // Encode the CLI version to fit into the MSI versioning scheme - https://msdn.microsoft.com/en-us/library/windows/desktop/aa370859(v=vs.85).aspx 17 | // MSI versions are 3 part 18 | // major.minor.build 19 | // Size(bits) of each part 8 8 16 20 | // So we have 32 bits to encode the CLI version 21 | // Starting with most significant bit this how the CLI version is going to be encoded as MSI Version 22 | // CLI major -> 6 bits 23 | // CLI minor -> 6 bits 24 | // CLI patch -> 6 bits 25 | // CLI commitcount -> 14 bits 26 | var major = Major << 26; 27 | var minor = Minor << 20; 28 | var patch = Patch << 14; 29 | var msiVersionNumber = major | minor | patch | CommitCount; 30 | 31 | var msiMajor = (msiVersionNumber >> 24) & 0xFF; 32 | var msiMinor = (msiVersionNumber >> 16) & 0xFF; 33 | var msiBuild = msiVersionNumber & 0xFFFF; 34 | 35 | return $"{msiMajor}.{msiMinor}.{msiBuild}"; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/core-sdk-tasks/core-sdk-tasks.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | netcoreapp3.1 4 | true 5 | Microsoft.DotNet.Cli.Build 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/dotnet-bootstrapper/BootstrapperCommandParser.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | using System.CommandLine; 6 | using System.CommandLine.Builder; 7 | using System.CommandLine.Invocation; 8 | using System.CommandLine.Parsing; 9 | using System.Reflection; 10 | 11 | namespace Microsoft.DotNet.Tools.Bootstrapper 12 | { 13 | internal static class BootstrapperCommandParser 14 | { 15 | public static Parser BootstrapParser; 16 | 17 | public static RootCommand BootstrapperRootCommand = new RootCommand("dotnet bootstrapper"); 18 | 19 | public static readonly Command VersionCommand = new Command("--version"); 20 | 21 | private static readonly Lazy _assemblyVersion = 22 | new Lazy(() => 23 | { 24 | var assembly = Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly(); 25 | var assemblyVersionAttribute = assembly.GetCustomAttribute(); 26 | if (assemblyVersionAttribute == null) 27 | { 28 | return assembly.GetName().Version.ToString(); 29 | } 30 | else 31 | { 32 | return assemblyVersionAttribute.InformationalVersion; 33 | } 34 | }); 35 | 36 | static BootstrapperCommandParser() 37 | { 38 | BootstrapperRootCommand.AddCommand(VersionCommand); 39 | VersionCommand.Handler = CommandHandler.Create(() => 40 | { 41 | Console.WriteLine(_assemblyVersion.Value); 42 | }); 43 | 44 | BootstrapParser = new CommandLineBuilder(BootstrapperRootCommand) 45 | .UseDefaults() 46 | // .UseHelpBuilder(context => new UninstallHelpBuilder(context.Console)) 47 | .Build(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/dotnet-bootstrapper/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System.CommandLine; 5 | using System.CommandLine.Builder; 6 | using System.CommandLine.Parsing; 7 | using System.IO; 8 | using System.Threading.Tasks; 9 | namespace Microsoft.DotNet.Tools.Bootstrapper; 10 | 11 | class Program 12 | { 13 | static int Main(string[] args) 14 | { 15 | return BootstrapperCommandParser.BootstrapParser.InvokeAsync(args).Result; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/dotnet-bootstrapper/README.md: -------------------------------------------------------------------------------- 1 | # dotnet-bootstrapper 2 | 3 | This project is a placeholder for a standalone tool that manages and installs .NET versions. -------------------------------------------------------------------------------- /src/dotnet-bootstrapper/dotnet-bootstrapper.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | dotnet-bootstrapper 4 | Exe 5 | true 6 | true 7 | net8.0 8 | true 9 | true 10 | false 11 | true 12 | true 13 | true 14 | LatestMajor 15 | 16 | 17 | 18 | preview 19 | Microsoft.DotNet.Tools.Bootstrapper 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | True 33 | True 34 | LocalizableStrings.resx 35 | 36 | 37 | 38 | 39 | 40 | ResXFileCodeGenerator 41 | LocalizableStrings.Designer.cs 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/dotnet-bootstrapper/xlf/LocalizableStrings.cs.xlf: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/dotnet-bootstrapper/xlf/LocalizableStrings.de.xlf: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/dotnet-bootstrapper/xlf/LocalizableStrings.es.xlf: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/dotnet-bootstrapper/xlf/LocalizableStrings.fr.xlf: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/dotnet-bootstrapper/xlf/LocalizableStrings.it.xlf: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/dotnet-bootstrapper/xlf/LocalizableStrings.ja.xlf: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/dotnet-bootstrapper/xlf/LocalizableStrings.ko.xlf: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/dotnet-bootstrapper/xlf/LocalizableStrings.pl.xlf: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/dotnet-bootstrapper/xlf/LocalizableStrings.pt-BR.xlf: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/dotnet-bootstrapper/xlf/LocalizableStrings.ru.xlf: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/dotnet-bootstrapper/xlf/LocalizableStrings.tr.xlf: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/dotnet-bootstrapper/xlf/LocalizableStrings.zh-Hans.xlf: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/dotnet-bootstrapper/xlf/LocalizableStrings.zh-Hant.xlf: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System.CommandLine.Parsing; 5 | using Microsoft.DotNet.Tools.Uninstall.Shared.Configs; 6 | using Microsoft.DotNet.Tools.Uninstall.Shared.Exceptions; 7 | using Microsoft.DotNet.Tools.Uninstall.Shared.Utils; 8 | 9 | namespace Microsoft.DotNet.Tools.Uninstall 10 | { 11 | internal class Program 12 | { 13 | internal static int Main(string[] args) 14 | { 15 | if (!(RuntimeInfo.RunningOnOSX || RuntimeInfo.RunningOnWindows)) 16 | { 17 | throw new OperatingSystemNotSupportedException(); 18 | } 19 | return CommandLineConfigs.UninstallCommandParser.InvokeAsync(args).Result; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System.Reflection; 5 | using System.Runtime.CompilerServices; 6 | 7 | [assembly: AssemblyMetadataAttribute("Serviceable", "True")] 8 | [assembly: InternalsVisibleTo("dotnet-core-uninstall.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] 9 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/README.md: -------------------------------------------------------------------------------- 1 | # dotnet-core-uninstall 2 | 3 | This project is a standalone uninstaller for Windows and MacOS. It exists partially to ensure that a) it's easy to uninstall the SDK and b) SDKs that are required by various VS versions aren't also uninstalled. 4 | 5 | # Releasing the tool 6 | 7 | To release the tool, you need to do the following: 8 | 9 | * bump the version of the tool in eng/Versions.props 10 | * send a PR with this change and get it merged 11 | * wait for the associated build pipeline in VSTS to complete 12 | * get the version generated from the build pipeline and use it to create a tag in git 13 | * use that tag to create a github release. Add release notes with 14 | * A list of changes from the last release 15 | * The install instructions, which are included below 16 | * The 4 primary assets for the repo: 17 | * Windows MSI from VSTS pipeline 18 | * macOS tar.gz from VSTS pipeline 19 | * Source code (zip) generated by GitHub at time of release creation 20 | * Source code (tar.gz) generated by GitHub at time of release creation 21 | 22 | ## Release notes template 23 | 24 | # Changes 25 | 26 | 27 | # Installation Instructions: 28 | 29 | ## On Windows: 30 | 31 | 1. Download the msi file below. 32 | 2. Double click the msi file to install. 33 | 3. Open a new command prompt. 34 | 4. Check out the docs at https://aka.ms/dotnet-core-uninstall-docs 35 | 5. Run the tool by using dotnet-core-uninstall. 36 | 6. If you accidentally mess up your Visual Studio installation, use "Repair" in the Visual Studio installer. 37 | 38 | ## On macOS: 39 | 40 | Download the tar.gz file below. 41 | Open terminal and change working directory to the directory with dotnet-core-uninstall.tar.gz. 42 | Use the following commands to install the tool and show help: 43 | 44 | ```shell 45 | mkdir -p ~/dotnet-core-uninstall 46 | tar -zxf dotnet-core-uninstall.tar.gz -C ~/dotnet-core-uninstall 47 | cd ~/dotnet-core-uninstall 48 | ./dotnet-core-uninstall -h 49 | ``` 50 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/BundleInfo/BundleArch.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.BundleInfo 7 | { 8 | [Flags] 9 | internal enum BundleArch 10 | { 11 | X86 = 0x1, 12 | X64 = 0x2, 13 | Arm64 = 0x4 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/BundleInfo/BundleType.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.BundleInfo 7 | { 8 | [Flags] 9 | internal enum BundleType 10 | { 11 | Sdk = 0x1, 12 | Runtime = 0x2, 13 | AspNetRuntime = 0x4, 14 | HostingBundle = 0x8 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/BundleInfo/Versioning/AspNetRuntimeVersion.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.BundleInfo.Versioning 7 | { 8 | internal class AspNetRuntimeVersion : BundleVersion, IComparable, IComparable, IEquatable 9 | { 10 | public override BundleType Type => BundleType.AspNetRuntime; 11 | public override BeforePatch BeforePatch => new MajorMinorVersion(Major, Minor); 12 | 13 | public AspNetRuntimeVersion() { } 14 | 15 | public AspNetRuntimeVersion(string value) : base(value) { } 16 | 17 | public int CompareTo(object obj) 18 | { 19 | return CompareTo(obj as AspNetRuntimeVersion); 20 | } 21 | 22 | public int CompareTo(AspNetRuntimeVersion other) 23 | { 24 | return other == null ? 1 : SemVer.CompareTo(other.SemVer); 25 | } 26 | 27 | public override bool Equals(object obj) 28 | { 29 | return Equals(obj as AspNetRuntimeVersion); 30 | } 31 | 32 | public bool Equals(AspNetRuntimeVersion other) 33 | { 34 | return other != null && 35 | base.Equals(other); 36 | } 37 | 38 | public override int GetHashCode() 39 | { 40 | return HashCode.Combine(base.GetHashCode()); 41 | } 42 | 43 | public override Bundle ToBundle(BundleArch arch, string uninstallCommand, string displayName) 44 | { 45 | return new Bundle(this, arch, uninstallCommand, displayName); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/BundleInfo/Versioning/BeforePatch.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.BundleInfo.Versioning 8 | { 9 | internal abstract class BeforePatch : IEquatable 10 | { 11 | protected internal readonly Version _version; 12 | 13 | public int Major => _version.Major; 14 | public int Minor => _version.Minor; 15 | 16 | public BeforePatch(int major, int minor) 17 | { 18 | if (major < 0 || minor < 0) 19 | { 20 | throw new ArgumentOutOfRangeException(); 21 | } 22 | 23 | _version = new Version(major, minor); 24 | } 25 | 26 | public override bool Equals(object obj) 27 | { 28 | return Equals(obj as BeforePatch); 29 | } 30 | 31 | public bool Equals(BeforePatch other) 32 | { 33 | return other != null && 34 | EqualityComparer.Default.Equals(_version, other._version); 35 | } 36 | 37 | public override int GetHashCode() 38 | { 39 | return HashCode.Combine(_version); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/BundleInfo/Versioning/HostingBundleVersion.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.BundleInfo.Versioning 7 | { 8 | internal class HostingBundleVersion : BundleVersion, IComparable, IComparable, IEquatable 9 | { 10 | public override BundleType Type => BundleType.HostingBundle; 11 | public override BeforePatch BeforePatch => new MajorMinorVersion(Major, Minor); 12 | 13 | public HostingBundleVersion() { } 14 | 15 | public HostingBundleVersion(string value, string footnote = null) : base(value, footnote) { } 16 | 17 | public int CompareTo(object obj) 18 | { 19 | return CompareTo(obj as HostingBundleVersion); 20 | } 21 | 22 | public int CompareTo(HostingBundleVersion other) 23 | { 24 | return other == null ? 1 : SemVer.CompareTo(other.SemVer); 25 | } 26 | 27 | public override bool Equals(object obj) 28 | { 29 | return Equals(obj as HostingBundleVersion); 30 | } 31 | 32 | public bool Equals(HostingBundleVersion other) 33 | { 34 | return other != null && 35 | base.Equals(other); 36 | } 37 | 38 | public override int GetHashCode() 39 | { 40 | return HashCode.Combine(base.GetHashCode()); 41 | } 42 | 43 | public override Bundle ToBundle(BundleArch arch, string uninstallCommand, string displayName) 44 | { 45 | return new Bundle(this, arch, uninstallCommand, displayName); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/BundleInfo/Versioning/MajorMinorSdkMinorVersion.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.BundleInfo.Versioning 7 | { 8 | internal class MajorMinorSdkMinorVersion : BeforePatch, IEquatable, IComparable, IComparable 9 | { 10 | public int SdkMinor { get; } 11 | 12 | public MajorMinorSdkMinorVersion(int major, int minor, int sdkMinor) : base(major, minor) 13 | { 14 | if (sdkMinor < 0) 15 | { 16 | throw new ArgumentOutOfRangeException(); 17 | } 18 | 19 | SdkMinor = sdkMinor; 20 | } 21 | 22 | public override bool Equals(object obj) 23 | { 24 | return Equals(obj as MajorMinorSdkMinorVersion); 25 | } 26 | 27 | public bool Equals(MajorMinorSdkMinorVersion other) 28 | { 29 | return other != null && 30 | base.Equals(other) && 31 | SdkMinor == other.SdkMinor; 32 | } 33 | 34 | public override int GetHashCode() 35 | { 36 | return HashCode.Combine(base.GetHashCode(), SdkMinor); 37 | } 38 | 39 | public int CompareTo(object obj) 40 | { 41 | return CompareTo(obj as MajorMinorSdkMinorVersion); 42 | } 43 | 44 | public int CompareTo(MajorMinorSdkMinorVersion other) 45 | { 46 | if (other == null) 47 | { 48 | return 1; 49 | } 50 | 51 | return base.Equals(other) ? 52 | SdkMinor.CompareTo(other.SdkMinor) : 53 | _version.CompareTo(other._version); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/BundleInfo/Versioning/RuntimeVersion.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.BundleInfo.Versioning 7 | { 8 | internal class RuntimeVersion : BundleVersion, IComparable, IComparable, IEquatable 9 | { 10 | public override BundleType Type => BundleType.Runtime; 11 | public override BeforePatch BeforePatch => new MajorMinorVersion(Major, Minor); 12 | 13 | public RuntimeVersion() { } 14 | 15 | public RuntimeVersion(string value) : base(value) { } 16 | 17 | public int CompareTo(object obj) 18 | { 19 | return CompareTo(obj as RuntimeVersion); 20 | } 21 | 22 | public int CompareTo(RuntimeVersion other) 23 | { 24 | return other == null ? 1 : SemVer.CompareTo(other.SemVer); 25 | } 26 | 27 | public override bool Equals(object obj) 28 | { 29 | return Equals(obj as RuntimeVersion); 30 | } 31 | 32 | public bool Equals(RuntimeVersion other) 33 | { 34 | return other != null && 35 | base.Equals(other); 36 | } 37 | 38 | public override int GetHashCode() 39 | { 40 | return HashCode.Combine(base.GetHashCode()); 41 | } 42 | 43 | public override Bundle ToBundle(BundleArch arch, string uninstallCommand, string displayName) 44 | { 45 | return new Bundle(this, arch, uninstallCommand, displayName); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/BundleInfo/Versioning/SdkVersion.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.BundleInfo.Versioning 7 | { 8 | internal class SdkVersion : BundleVersion, IComparable, IComparable, IEquatable 9 | { 10 | public int SdkMinor => SemVer.Patch / 100; 11 | public override int Patch => SemVer.Patch % 100; 12 | public override BeforePatch BeforePatch => new MajorMinorSdkMinorVersion(Major, Minor, SdkMinor); 13 | 14 | public override BundleType Type => BundleType.Sdk; 15 | 16 | public SdkVersion() { } 17 | 18 | public SdkVersion(string value) : base(value) { } 19 | 20 | public int CompareTo(object obj) 21 | { 22 | return CompareTo(obj as SdkVersion); 23 | } 24 | 25 | public int CompareTo(SdkVersion other) 26 | { 27 | return other == null ? 1 : SemVer.CompareTo(other.SemVer); 28 | } 29 | 30 | public override bool Equals(object obj) 31 | { 32 | return Equals(obj as SdkVersion); 33 | } 34 | 35 | public bool Equals(SdkVersion other) 36 | { 37 | return other != null && 38 | base.Equals(other); 39 | } 40 | 41 | public override int GetHashCode() 42 | { 43 | return HashCode.Combine(base.GetHashCode()); 44 | } 45 | 46 | public override Bundle ToBundle(BundleArch arch, string uninstallCommand, string displayName) 47 | { 48 | return new Bundle(this, arch, uninstallCommand, displayName); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/Commands/DryRunCommandExec.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using Microsoft.DotNet.Tools.Uninstall.Shared.BundleInfo; 7 | using System.Linq; 8 | using Microsoft.DotNet.Tools.Uninstall.Shared.Utils; 9 | using Microsoft.DotNet.Tools.Uninstall.MacOs; 10 | using System.CommandLine.Parsing; 11 | 12 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.Commands 13 | { 14 | internal static class DryRunCommandExec 15 | { 16 | public static void Execute(IBundleCollector bundleCollector, ParseResult parseResult) 17 | { 18 | var filtered = CommandBundleFilter.GetFilteredWithRequirementStrings(bundleCollector, parseResult); 19 | TryIt(filtered); 20 | } 21 | 22 | private static void TryIt(IDictionary bundles) 23 | { 24 | var displayNames = string.Join("\n", bundles.Select(bundle => $" {bundle.Key.DisplayName}")); 25 | Console.WriteLine(string.Format(RuntimeInfo.RunningOnWindows ? 26 | LocalizableStrings.WindowsDryRunOutputFormat : LocalizableStrings.MacDryRunOutputFormat, displayNames)); 27 | 28 | foreach (var pair in bundles.Where(b => !b.Value.Equals(string.Empty))) 29 | { 30 | Console.ForegroundColor = ConsoleColor.Red; 31 | Console.Write(string.Format(RuntimeInfo.RunningOnWindows ? LocalizableStrings.WindowsRequiredBundleConfirmationPromptWarningFormat : 32 | LocalizableStrings.MacRequiredBundleConfirmationPromptWarningFormat, pair.Key.DisplayName, pair.Value)); 33 | Console.ResetColor(); 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/Commands/UninstallHelpBuilder.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | using System; 4 | using System.CommandLine; 5 | using System.CommandLine.Help; 6 | using Microsoft.DotNet.Tools.Uninstall.Shared.Utils; 7 | 8 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.Commands 9 | { 10 | public class UninstallHelpBuilder : HelpBuilder 11 | { 12 | public UninstallHelpBuilder(IConsole console) : base(console) { } 13 | 14 | public override void Write(ICommand command) 15 | { 16 | base.Write(command); 17 | if (command.Name.Equals("dry-run") || command.Name.Equals("remove")) 18 | { 19 | Console.Out.Write(RuntimeInfo.RunningOnWindows ? LocalizableStrings.HelpExplanationParagraphWindows : 20 | LocalizableStrings.HelpExplanationParagraphMac); 21 | Console.Out.Write(Environment.NewLine); 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/Configs/BundleTypePrintInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.CommandLine.Rendering.Views; 7 | using Microsoft.DotNet.Tools.Uninstall.Shared.BundleInfo; 8 | using Microsoft.DotNet.Tools.Uninstall.Shared.BundleInfo.Versioning; 9 | 10 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.Configs 11 | { 12 | internal abstract class BundleTypePrintInfo 13 | { 14 | public abstract BundleType Type { get; } 15 | 16 | public string Header { get; } 17 | public Func, bool, GridView> GridViewGenerator { get; } 18 | public string OptionName { get; } 19 | 20 | protected BundleTypePrintInfo(string header, Func, bool, GridView> gridViewGenerator, string optionName) 21 | { 22 | Header = header ?? throw new ArgumentNullException(); 23 | GridViewGenerator = gridViewGenerator ?? throw new ArgumentNullException(); 24 | OptionName = optionName ?? throw new ArgumentNullException(); 25 | } 26 | 27 | public abstract IEnumerable Filter(IEnumerable bundles); 28 | } 29 | 30 | internal class BundleTypePrintInfo : BundleTypePrintInfo 31 | where TBundleVersion : BundleVersion, IComparable, new() 32 | { 33 | public override BundleType Type => new TBundleVersion().Type; 34 | 35 | public BundleTypePrintInfo(string header, Func, bool, GridView> gridViewGenerator, string optionName) : 36 | base(header, gridViewGenerator, optionName) 37 | { } 38 | 39 | public override IEnumerable Filter(IEnumerable bundles) 40 | { 41 | return Bundle.FilterWithSameBundleType(bundles); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/Configs/SupportedBundleTypeConfigs.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System.Collections.Generic; 5 | using Microsoft.DotNet.Tools.Uninstall.Shared.Exceptions; 6 | using Microsoft.DotNet.Tools.Uninstall.Shared.Utils; 7 | 8 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.Configs 9 | { 10 | internal class SupportedBundleTypeConfigs 11 | { 12 | public static IEnumerable GetSupportedBundleTypes() 13 | { 14 | if (RuntimeInfo.RunningOnWindows) 15 | { 16 | return Windows.SupportedBundleTypeConfigs.SupportedBundleTypes; 17 | } 18 | else if (RuntimeInfo.RunningOnOSX) 19 | { 20 | return MacOs.SupportedBundleTypeConfigs.SupportedBundleTypes; 21 | } 22 | else 23 | { 24 | throw new OperatingSystemNotSupportedException(); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/Configs/Verbosity/VerbosityLevel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.Configs.Verbosity 5 | { 6 | internal enum VerbosityLevel 7 | { 8 | Quiet, 9 | Minimal, 10 | Normal, 11 | Detailed, 12 | Diagnostic 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/Configs/Verbosity/VerbosityLogger.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.Configs.Verbosity 7 | { 8 | internal class VerbosityLogger 9 | { 10 | public VerbosityLevel Level { get; set; } 11 | 12 | public VerbosityLogger(VerbosityLevel level) 13 | { 14 | if (IsOutOfRange(level)) 15 | { 16 | throw new ArgumentOutOfRangeException(); 17 | } 18 | 19 | Level = level; 20 | } 21 | 22 | public void Log(VerbosityLevel logLevel, string message) 23 | { 24 | if (logLevel == VerbosityLevel.Quiet || IsOutOfRange(logLevel)) 25 | { 26 | throw new ArgumentOutOfRangeException(); 27 | } 28 | 29 | if (Level >= logLevel) 30 | { 31 | Console.WriteLine(message); 32 | } 33 | } 34 | 35 | private bool IsOutOfRange(VerbosityLevel level) 36 | { 37 | return (int)level >= Enum.GetValues(typeof(VerbosityLevel)).Length; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/Exceptions/BundleTypeMissingException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System.Collections.Generic; 5 | 6 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.Exceptions 7 | { 8 | internal class BundleTypeMissingException : DotNetUninstallException 9 | { 10 | public BundleTypeMissingException(IEnumerable options) : 11 | base(string.Format( 12 | LocalizableStrings.BundleTypeMissingExceptionMessage, 13 | string.Join(", ", options))) 14 | { } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/Exceptions/ConfirmationPromptInvalidException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.Exceptions 5 | { 6 | internal class ConfirmationPromptInvalidException : DotNetUninstallException 7 | { 8 | public ConfirmationPromptInvalidException() : 9 | base(LocalizableStrings.ConfirmationPromptInvalidExceptionMessage) 10 | { } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/Exceptions/DotNetUninstallExceptions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.Exceptions 7 | { 8 | internal abstract class DotNetUninstallException : Exception 9 | { 10 | public DotNetUninstallException(string message) : base(message) { } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/Exceptions/ExceptionHandler.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.Exceptions 7 | { 8 | internal static class ExceptionHandler 9 | { 10 | public static Action HandleException(Action action) 11 | { 12 | return (x) => 13 | { 14 | try 15 | { 16 | action.Invoke(x); 17 | } 18 | catch (DotNetUninstallException e) 19 | { 20 | PrintExceptionMessage(e.Message); 21 | Environment.Exit(1); 22 | } 23 | }; 24 | } 25 | 26 | public static void PrintExceptionMessage(string message) 27 | { 28 | Console.ForegroundColor = ConsoleColor.Red; 29 | Console.WriteLine(message); 30 | Console.ResetColor(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/Exceptions/InvalidInputVersionException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.Exceptions 5 | { 6 | internal class InvalidInputVersionException : DotNetUninstallException 7 | { 8 | public InvalidInputVersionException(string versionString) : 9 | base(string.Format(LocalizableStrings.InvalidInputVersionExceptionMessageFormat, versionString)) 10 | { } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/Exceptions/MoreThanOneVersionSpecifiedException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.Exceptions 5 | { 6 | internal class MoreThanOneVersionSpecifiedException : DotNetUninstallException 7 | { 8 | public MoreThanOneVersionSpecifiedException(string option) : 9 | base(string.Format(LocalizableStrings.MoreThanOneVersionSpecifiedExceptionMessageFormat, option)) 10 | { } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/Exceptions/MoreThanZeroVersionSpecifiedException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.Exceptions 5 | { 6 | internal class MoreThanZeroVersionSpecifiedException : DotNetUninstallException 7 | { 8 | public MoreThanZeroVersionSpecifiedException(string option) : 9 | base(string.Format(LocalizableStrings.MoreThanZeroVersionSpecifiedExceptionMessageFormat, option)) 10 | { } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/Exceptions/NotAdminException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.Exceptions 5 | { 6 | internal class NotAdminException : DotNetUninstallException 7 | { 8 | public NotAdminException() : 9 | base(LocalizableStrings.NotAdminExceptionMessage) 10 | { } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/Exceptions/OperatingSystemNotSupportedException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.Exceptions 5 | { 6 | internal class OperatingSystemNotSupportedException : DotNetUninstallException 7 | { 8 | public OperatingSystemNotSupportedException() : 9 | base(LocalizableStrings.OperatingSystemNotSupportedExceptionMessage) 10 | { } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/dotnet-core-uninstall/Shared/Exceptions/OptionsConflictException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. 2 | // Licensed under the MIT license. See LICENSE file in the project root for full license information. 3 | 4 | using System.Collections.Generic; 5 | using System.CommandLine; 6 | using System.Linq; 7 | 8 | namespace Microsoft.DotNet.Tools.Uninstall.Shared.Exceptions 9 | { 10 | internal class OptionsConflictException : DotNetUninstallException 11 | { 12 | public OptionsConflictException(IEnumerable