├── .editorconfig
├── .gitattributes
├── .gitignore
├── Build.cmd
├── CODE-OF-CONDUCT.md
├── InteractiveWindow.sln
├── License.txt
├── NuGet.config
├── README.md
├── Restore.cmd
├── Test.cmd
├── azure-pipelines-codeql.yml
├── azure-pipelines-pr.yml
├── azure-pipelines.yml
├── build.sh
├── eng
├── TSAConfig.gdntsa
├── Version.Details.xml
├── Versions.props
├── build-utils.ps1
├── 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
│ │ │ ├── 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
│ │ └── variables
│ │ │ └── pool-providers.yml
│ ├── cross
│ │ ├── arm
│ │ │ └── tizen
│ │ │ │ └── tizen.patch
│ │ ├── arm64
│ │ │ └── tizen
│ │ │ │ └── tizen.patch
│ │ ├── armel
│ │ │ ├── armel.jessie.patch
│ │ │ └── tizen
│ │ │ │ └── tizen.patch
│ │ ├── build-android-rootfs.sh
│ │ ├── build-rootfs.sh
│ │ ├── riscv64
│ │ │ └── tizen
│ │ │ │ └── tizen.patch
│ │ ├── tizen-build-rootfs.sh
│ │ ├── tizen-fetch.sh
│ │ ├── toolchain.cmake
│ │ ├── x64
│ │ │ └── tizen
│ │ │ │ └── tizen.patch
│ │ └── 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-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
│ ├── 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
│ │ └── 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
│ │ └── variables
│ │ │ └── pool-providers.yml
│ ├── tools.ps1
│ └── tools.sh
├── config
│ └── PublishData.json
└── publish-assets.ps1
├── global.json
└── src
├── Directory.Build.props
├── Directory.Build.targets
├── Microsoft.VisualStudio.InteractiveWindow.Tests
├── EventListenerGuard.cs
├── HistoryTests.cs
├── InteractiveClipboardFormatTests.cs
├── InteractiveWindowEditorsFactoryService.cs
├── InteractiveWindowHistoryTests.cs
├── InteractiveWindowTestHost.cs
├── InteractiveWindowTests.cs
├── InteractiveWindowTests_ClipboardTests.cs
├── JoinableTaskContextMefHost.cs
├── Microsoft.VisualStudio.InteractiveWindow.UnitTests.csproj
├── SortedSpansTests.cs
├── TestClipboard.cs
├── TestContentTypeDefinition.cs
├── TestInteractiveEngine.cs
├── TestSmartIndent.cs
├── TestUtilities
│ ├── Assert
│ │ ├── AssertEx.cs
│ │ ├── ConditionalFactAttribute.cs
│ │ ├── DiffUtil.cs
│ │ ├── EqualityTesting.cs
│ │ ├── EqualityUnit.cs
│ │ ├── EqualityUnit`1.cs
│ │ ├── EqualityUtil.cs
│ │ ├── EqualityUtil`1.cs
│ │ ├── TestExceptionUtilities.cs
│ │ └── WorkItemAttribute.cs
│ ├── Async
│ │ ├── AsynchronousOperationBlocker.cs
│ │ ├── Checkpoint.cs
│ │ └── WaitHelper.cs
│ ├── Contract.cs
│ ├── Threading
│ │ ├── ConditionalWpfFactAttribute.cs
│ │ ├── ForegroundThreadAffinitizedObject.cs
│ │ ├── ForegroundThreadDataKind.cs
│ │ ├── NativeMethods.cs
│ │ ├── SemaphoreSlimExtensions.cs
│ │ ├── SpecializedTasks.cs
│ │ ├── StaTaskScheduler.cs
│ │ ├── SynchronizationContextTaskScheduler.cs
│ │ ├── TaskExtensions.cs
│ │ ├── TaskFactoryExtensions.cs
│ │ ├── WpfFactAttribute.cs
│ │ ├── WpfFactDiscoverer.cs
│ │ └── WpfTestCase.cs
│ └── ThrowingTraceListener.cs
└── app.config
├── Microsoft.VisualStudio.InteractiveWindow
├── BufferBlock.cs
├── Commands
│ ├── CancelExecutionCommand.cs
│ ├── ClearScreenCommand.cs
│ ├── CommandClassifier.cs
│ ├── CommandClassifierProvider.cs
│ ├── HelpCommand.cs
│ ├── IInteractiveWindowCommand.cs
│ ├── IInteractiveWindowCommands.cs
│ ├── IInteractiveWindowCommandsFactory.cs
│ ├── InteractiveCommandsFactory.cs
│ ├── InteractiveWindowCommand.cs
│ ├── InteractiveWindowCommandExtensions.cs
│ ├── InteractiveWindowCommands.cs
│ ├── PredefinedInteractiveCommandsContentTypes.cs
│ └── ResetCommand.cs
├── ContentTypeMetadata.cs
├── CustomTrackingSpan.cs
├── ExecutionResult.cs
├── History.cs
├── IInteractiveEvaluator.cs
├── IInteractiveWindow.cs
├── IInteractiveWindow2.cs
├── IInteractiveWindowEditorFactoryService.cs
├── IInteractiveWindowFactoryService.cs
├── IInteractiveWindowOperations.cs
├── IInteractiveWindowOperations2.cs
├── InteractiveClipboardFormat.cs
├── InteractiveContentTypeDefinitions.cs
├── InteractiveWindow.EditResolver.cs
├── InteractiveWindow.PendingSubmission.cs
├── InteractiveWindow.ReplSpanKind.cs
├── InteractiveWindow.SpanRangeEdit.cs
├── InteractiveWindow.State.cs
├── InteractiveWindow.SystemClipboard.cs
├── InteractiveWindow.UIThreadOnly.cs
├── InteractiveWindow.cs
├── InteractiveWindowClipboard.cs
├── InteractiveWindowExtensions.cs
├── InteractiveWindowOptions.cs
├── InteractiveWindowProvider.cs
├── InteractiveWindowResources.resx
├── InternalUtilities
│ ├── ExceptionUtilities.cs
│ └── FatalError.cs
├── Microsoft.VisualStudio.InteractiveWindow.csproj
├── Output
│ ├── InlineAdornmentProvider.cs
│ ├── OutputBuffer.cs
│ ├── OutputClassifierProvider.cs
│ ├── OutputWriter.cs
│ ├── ResizingAdorner.cs
│ ├── SortedSpans.cs
│ └── ZoomableInlineAdornment.cs
├── PredefinedInteractiveContentTypes.cs
├── PredefinedInteractiveTextViewRoles.cs
├── ProjectionBufferExtensions.cs
├── PublicAPI.Shipped.txt
├── PublicAPI.Unshipped.txt
├── SmartIndent
│ ├── InteractiveSmartIndenter.cs
│ └── InteractiveSmartIndenterProvider.cs
├── SmartUpDownOption.cs
├── SubmissionBufferAddedEventArgs.cs
├── TextTransactionMergePolicy.cs
├── Utils
│ ├── Contract.cs
│ └── EditorExtensions.cs
└── xlf
│ ├── InteractiveWindowResources.cs.xlf
│ ├── InteractiveWindowResources.de.xlf
│ ├── InteractiveWindowResources.es.xlf
│ ├── InteractiveWindowResources.fr.xlf
│ ├── InteractiveWindowResources.it.xlf
│ ├── InteractiveWindowResources.ja.xlf
│ ├── InteractiveWindowResources.ko.xlf
│ ├── InteractiveWindowResources.pl.xlf
│ ├── InteractiveWindowResources.pt-BR.xlf
│ ├── InteractiveWindowResources.ru.xlf
│ ├── InteractiveWindowResources.tr.xlf
│ ├── InteractiveWindowResources.zh-Hans.xlf
│ └── InteractiveWindowResources.zh-Hant.xlf
└── Microsoft.VisualStudio.VsInteractiveWindow
├── AssemblyRedirects.cs
├── CommandIds.cs
├── ContentTypeMetadata.cs
├── Guids.cs
├── IVsInteractiveWindow.cs
├── IVsInteractiveWindowFactory.cs
├── IVsInteractiveWindowFactory2.cs
├── IVsInteractiveWindowOleCommandTargetProvider.cs
├── InteractiveWindow.vsct
├── InteractiveWindowPackage.cs
├── MenuIds.cs
├── Microsoft.VisualStudio.VsInteractiveWindow.csproj
├── ProvideBindingRedirection.cs
├── ProvideInteractiveWindowAttribute.cs
├── PublicAPI.Shipped.txt
├── PublicAPI.Unshipped.txt
├── VSInteractiveWindowResources.resx
├── VSInteractiveWindowRules.ruleset
├── VSPackage.resx
├── VsInteractiveWindow.cs
├── VsInteractiveWindowCommandFilter.cs
├── VsInteractiveWindowEditorFactoryService.cs
├── VsInteractiveWindowExtensions.cs
├── VsInteractiveWindowFactory.cs
├── source.extension.vsixmanifest
└── xlf
├── InteractiveWindow.vsct.cs.xlf
├── InteractiveWindow.vsct.de.xlf
├── InteractiveWindow.vsct.es.xlf
├── InteractiveWindow.vsct.fr.xlf
├── InteractiveWindow.vsct.it.xlf
├── InteractiveWindow.vsct.ja.xlf
├── InteractiveWindow.vsct.ko.xlf
├── InteractiveWindow.vsct.pl.xlf
├── InteractiveWindow.vsct.pt-BR.xlf
├── InteractiveWindow.vsct.ru.xlf
├── InteractiveWindow.vsct.tr.xlf
├── InteractiveWindow.vsct.zh-Hans.xlf
├── InteractiveWindow.vsct.zh-Hant.xlf
├── VSInteractiveWindowResources.cs.xlf
├── VSInteractiveWindowResources.de.xlf
├── VSInteractiveWindowResources.es.xlf
├── VSInteractiveWindowResources.fr.xlf
├── VSInteractiveWindowResources.it.xlf
├── VSInteractiveWindowResources.ja.xlf
├── VSInteractiveWindowResources.ko.xlf
├── VSInteractiveWindowResources.pl.xlf
├── VSInteractiveWindowResources.pt-BR.xlf
├── VSInteractiveWindowResources.ru.xlf
├── VSInteractiveWindowResources.tr.xlf
├── VSInteractiveWindowResources.zh-Hans.xlf
├── VSInteractiveWindowResources.zh-Hant.xlf
├── VSPackage.cs.xlf
├── VSPackage.de.xlf
├── VSPackage.es.xlf
├── VSPackage.fr.xlf
├── VSPackage.it.xlf
├── VSPackage.ja.xlf
├── VSPackage.ko.xlf
├── VSPackage.pl.xlf
├── VSPackage.pt-BR.xlf
├── VSPackage.ru.xlf
├── VSPackage.tr.xlf
├── VSPackage.zh-Hans.xlf
└── VSPackage.zh-Hant.xlf
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig is awesome:
2 | http://EditorConfig.org
3 |
4 | # top-most EditorConfig file
5 | root = true
6 |
7 | # Don't use tabs for indentation.
8 | [*]
9 | indent_style = space
10 | # (Please don't specify an indent_size here; that has too many unintended consequences.)
11 |
12 | # VSTHRD001: Avoid legacy thread switching APIs (deferred: https://github.com/dotnet/interactive-window/issues/179)
13 | dotnet_diagnostic.VSTHRD001.severity = none
14 |
15 | # VSTHRD002: Avoid problematic synchronous waits (deferred: https://github.com/dotnet/interactive-window/issues/180)
16 | dotnet_diagnostic.VSTHRD002.severity = none
17 |
18 | # VSTHRD003: Avoid awaiting foreign Tasks (deferred: https://github.com/dotnet/interactive-window/issues/181)
19 | dotnet_diagnostic.VSTHRD003.severity = none
20 |
21 | # VSTHRD103: Call async methods when in an async method (deferred: https://github.com/dotnet/interactive-window/issues/182)
22 | dotnet_diagnostic.VSTHRD103.severity = none
23 |
24 | # VSTHRD110: Observe result of async calls (deferred: https://github.com/dotnet/interactive-window/issues/183)
25 | dotnet_diagnostic.VSTHRD110.severity = none
26 |
27 | # VSTHRD114: Avoid returning a null Task (deferred: https://github.com/dotnet/interactive-window/issues/184)
28 | dotnet_diagnostic.VSTHRD114.severity = none
29 |
30 | # VSTHRD200: Use "Async" suffix for async methods (deferred: https://github.com/dotnet/interactive-window/issues/185)
31 | dotnet_diagnostic.VSTHRD200.severity = none
32 |
33 | [*.{sh}]
34 | end_of_line = lf
35 | indent_size = 2
36 |
37 | [*.{ps1}]
38 | indent_size = 2
39 |
40 | # Code files
41 | [*.cs,*.csx,*.vb,*.vbx]
42 | indent_size = 4
43 |
44 | # Xml project files
45 | [*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
46 | indent_size = 2
47 |
48 | # Xml config files
49 | [*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
50 | indent_size = 2
51 |
52 | # JSON files
53 | [*.json]
54 | indent_size = 2
55 |
56 | [*.{cs}]
57 | file_header_template = Licensed to the.NET Foundation under one or more agreements.\nThe.NET Foundation licenses this file to you under the MIT license.\nSee the License.txt file in the project root for more information.
58 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to:
3 | # automatically normalize line endings on check-in, and
4 | # convert to Windows-style line endings on check-out
5 | ###############################################################################
6 | * text=auto encoding=UTF-8
7 | *.sh text eol=lf
8 |
9 | ###############################################################################
10 | # Set file behavior to:
11 | # treat as text, and
12 | # diff as C# source code
13 | ###############################################################################
14 | *.cs text diff=csharp
15 |
16 | ###############################################################################
17 | # Set file behavior to:
18 | # treat as text
19 | ###############################################################################
20 | *.cmd text
21 | *.config text
22 | *.csproj text
23 | *.groovy text
24 | *.json text
25 | *.md text
26 | *.nuspec text
27 | *.pkgdef text
28 | *.proj text
29 | *.projitems text
30 | *.props text
31 | *.ps1 text
32 | *.resx text
33 | *.ruleset text
34 | *.shproj text
35 | *.sln text
36 | *.targets text
37 | *.vb text
38 | *.vbproj text
39 | *.vcxproj text
40 | *.vcxproj.filters text
41 | *.vsct text
42 | *.vsixmanifest text
43 |
44 | ###############################################################################
45 | # Set file behavior to:
46 | # treat as binary
47 | ###############################################################################
48 | *.png binary
49 | *.snk binary
50 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | .vs/
8 | .vscode/
9 |
10 | # Build results
11 | artifacts/
12 | Debug/
13 | Release/
14 | bin/
15 | obj/
16 | .dotnet/
17 | .tools/
18 | .packages/
19 |
20 | # Per-user project properties
21 | launchSettings.json
22 |
23 | # Visual Studio profiler
24 | *.psess
25 | *.vsp
26 | *.vspx
27 |
28 | # ReSharper is a .NET coding add-in
29 | _ReSharper*/
30 | *.[Rr]e[Ss]harper
31 |
32 | # DotCover is a Code Coverage Tool
33 | *.dotCover
34 |
35 | # NCrunch
36 | *.ncrunch*
37 | .*crunch*.local.xml
38 |
--------------------------------------------------------------------------------
/Build.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 | powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -restore -build %*"
3 | exit /b %ErrorLevel%
4 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
17 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Microsoft.VisualStudio.InteractiveWindow
2 |
3 | Implementation of Visual Studio Interactive Window.
4 |
5 | [](https://dev.azure.com/dnceng/public/_build/latest?definitionId=300&branchName=main)
6 |
--------------------------------------------------------------------------------
/Restore.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 | powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -restore %*"
3 | exit /b %ErrorLevel%
4 |
--------------------------------------------------------------------------------
/Test.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 | powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -test %*"
3 | exit /b %ErrorLevel%
--------------------------------------------------------------------------------
/azure-pipelines-codeql.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | # Optionally do not publish to TSA. Useful for e.g. verifying fixes before PR.
3 | - name: TSAEnabled
4 | displayName: Publish results to TSA
5 | type: boolean
6 | default: true
7 |
8 | variables:
9 | - template: eng/common/templates/variables/pool-providers.yml
10 | # CG is handled in the primary CI pipeline
11 | - name: skipComponentGovernanceDetection
12 | value: true
13 | # Force CodeQL enabled so it may be run on any branch
14 | - name: Codeql.Enabled
15 | value: true
16 | # Do not let CodeQL 3000 Extension gate scan frequency
17 | - name: Codeql.Cadence
18 | value: 0
19 | # CodeQL needs this plumbed along as a variable to enable TSA
20 | - name: Codeql.TSAEnabled
21 | value: ${{ parameters.TSAEnabled }}
22 |
23 | # Build variables
24 | - name: _BuildConfig
25 | value: Release
26 |
27 | trigger: none
28 |
29 | schedules:
30 | - cron: 0 12 * * 1
31 | displayName: Weekly Monday CodeQL run
32 | branches:
33 | include:
34 | - main
35 | always: true
36 |
37 | jobs:
38 | - job: codeql
39 | displayName: CodeQL
40 | pool:
41 | name: $(DncEngInternalBuildPool)
42 | demands: ImageOverride -equals 1es-windows-2022
43 | timeoutInMinutes: 90
44 |
45 | steps:
46 |
47 | - task: UseDotNet@2
48 | inputs:
49 | useGlobalJson: true
50 |
51 | - task: CodeQL3000Init@0
52 | displayName: CodeQL Initialize
53 |
54 | - script: eng\common\cibuild.cmd
55 | -configuration $(_BuildConfig)
56 | -prepareMachine
57 | /p:Test=false
58 | displayName: Windows Build
59 |
60 | - task: CodeQL3000Finalize@0
61 | displayName: CodeQL Finalize
62 |
--------------------------------------------------------------------------------
/azure-pipelines-pr.yml:
--------------------------------------------------------------------------------
1 | # Branches that trigger builds on PR
2 | pr:
3 | branches:
4 | include:
5 | - main
6 | - release/*
7 | paths:
8 | exclude:
9 | - README.md
10 | - docs/*
11 |
12 | variables:
13 | - template: eng/common/templates/variables/pool-providers.yml
14 | - name: _PublishUsingPipelines
15 | value: true
16 |
17 | stages:
18 | - stage: build
19 | displayName: Build
20 | jobs:
21 | - template: /eng/common/templates/jobs/jobs.yml
22 | parameters:
23 | enableMicrobuild: true
24 | enablePublishBuildArtifacts: true
25 | enablePublishTestResults: true
26 | enablePublishBuildAssets: true
27 | enablePublishUsingPipelines: $(_PublishUsingPipelines)
28 | enableTelemetry: true
29 | enableSourceBuild: false
30 | helixRepo: dotnet/interactive-window
31 | jobs:
32 | - job: Windows
33 | pool:
34 | name: $(DncEngPublicBuildPool)
35 | demands: ImageOverride -equals windows.vs2022.amd64.open
36 | strategy:
37 | matrix:
38 | # PRs or external builds are not signed.
39 | Debug:
40 | _BuildConfig: Debug
41 | _SignType: test
42 | _DotNetPublishToBlobFeed: false
43 | _BuildArgs: ''
44 | Release:
45 | _BuildConfig: Release
46 | _SignType: test
47 | _DotNetPublishToBlobFeed: false
48 | _BuildArgs: ''
49 | steps:
50 | - checkout: self
51 | clean: true
52 |
53 | - task: UseDotNet@2
54 | displayName: 'Install .NET SDK'
55 | inputs:
56 | useGlobalJson: true
57 |
58 | - script: eng\common\cibuild.cmd -configuration $(_BuildConfig) -prepareMachine $(_BuildArgs)
59 | displayName: Build and Test
--------------------------------------------------------------------------------
/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 $@
--------------------------------------------------------------------------------
/eng/TSAConfig.gdntsa:
--------------------------------------------------------------------------------
1 | {
2 | "codebaseName": "Interactive-Window-GitHub",
3 | "notificationAliases": [
4 | "mlinfraswat@microsoft.com"
5 | ],
6 | "codebaseAdmins": [
7 | "REDMOND\\tmat",
8 | "REDMOND\\phillipa"
9 | ],
10 | "instanceUrl": "https://devdiv.visualstudio.com",
11 | "projectName": "DevDiv",
12 | "areaPath": "DevDiv\\NET Developer Experience\\Debugger and Interactive",
13 | "iterationPath": "DevDiv",
14 | "allTools": true
15 | }
16 |
--------------------------------------------------------------------------------
/eng/Version.Details.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | https://github.com/dotnet/arcade
8 | 5ba9ca776c1d0bb72b2791591e54cf51fc52dfee
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/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 %*"
--------------------------------------------------------------------------------
/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 $@
--------------------------------------------------------------------------------
/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 | enablePublishUsingPipelines: false
19 | enableTelemetry: true
20 |
21 | variables:
22 | - group: Publish-Build-Assets
23 | # The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in
24 | # sync with the packages.config file.
25 | - name: DefaultGuardianVersion
26 | value: 0.109.0
27 | - name: GuardianPackagesConfigFile
28 | value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config
29 | - name: GuardianVersion
30 | value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }}
31 |
32 | jobs: ${{ parameters.jobs }}
33 |
34 |
--------------------------------------------------------------------------------
/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/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/enable-internal-sources.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | # This is the Azure federated service connection that we log into to get an access token.
3 | - name: nugetFederatedServiceConnection
4 | type: string
5 | default: 'dnceng-artifacts-feeds-read'
6 | - name: is1ESPipeline
7 | type: boolean
8 | default: false
9 | # Legacy parameters to allow for PAT usage
10 | - name: legacyCredential
11 | type: string
12 | default: ''
13 |
14 | steps:
15 | - ${{ if ne(variables['System.TeamProject'], 'public') }}:
16 | - ${{ if ne(parameters.legacyCredential, '') }}:
17 | - task: PowerShell@2
18 | displayName: Setup Internal Feeds
19 | inputs:
20 | filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1
21 | arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token
22 | env:
23 | Token: ${{ parameters.legacyCredential }}
24 | # If running on dnceng (internal project), just use the default behavior for NuGetAuthenticate.
25 | # If running on DevDiv, NuGetAuthenticate is not really an option. It's scoped to a single feed, and we have many feeds that
26 | # may be added. Instead, we'll use the traditional approach (add cred to nuget.config), but use an account token.
27 | - ${{ else }}:
28 | - ${{ if eq(variables['System.TeamProject'], 'internal') }}:
29 | - task: PowerShell@2
30 | displayName: Setup Internal Feeds
31 | inputs:
32 | filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1
33 | arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config
34 | - ${{ else }}:
35 | - template: /eng/common/templates/steps/get-federated-access-token.yml
36 | parameters:
37 | federatedServiceConnection: ${{ parameters.nugetFederatedServiceConnection }}
38 | outputVariableName: 'dnceng-artifacts-feeds-read-access-token'
39 | - task: PowerShell@2
40 | displayName: Setup Internal Feeds
41 | inputs:
42 | filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1
43 | arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $(dnceng-artifacts-feeds-read-access-token)
44 | # This is required in certain scenarios to install the ADO credential provider.
45 | # It installed by default in some msbuild invocations (e.g. VS msbuild), but needs to be installed for others
46 | # (e.g. dotnet msbuild).
47 | - task: NuGetAuthenticate@1
48 |
--------------------------------------------------------------------------------
/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 | # Temporarily work around a helix issue where SAS tokens with / in them will cause incorrect downloads
35 | # of correlation payloads. https://github.com/dotnet/dnceng/issues/3484
36 | $sas = ""
37 | do {
38 | $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
39 | if ($LASTEXITCODE -ne 0) {
40 | Write-Error "Failed to generate SAS token."
41 | exit 1
42 | }
43 | } while($sas.IndexOf('/') -ne -1)
44 |
45 | if ($LASTEXITCODE -ne 0) {
46 | Write-Error "Failed to generate SAS token."
47 | exit 1
48 | }
49 |
50 | if ('${{ parameters.base64Encode }}' -eq 'true') {
51 | $sas = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($sas))
52 | }
53 |
54 | Write-Host "Setting '${{ parameters.outputVariableName }}' with the access token value"
55 | Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true]$sas"
56 |
--------------------------------------------------------------------------------
/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/armel.jessie.patch:
--------------------------------------------------------------------------------
1 | diff -u -r a/usr/include/urcu/uatomic/generic.h b/usr/include/urcu/uatomic/generic.h
2 | --- a/usr/include/urcu/uatomic/generic.h 2014-10-22 15:00:58.000000000 -0700
3 | +++ b/usr/include/urcu/uatomic/generic.h 2020-10-30 21:38:28.550000000 -0700
4 | @@ -69,10 +69,10 @@
5 | #endif
6 | #ifdef UATOMIC_HAS_ATOMIC_SHORT
7 | case 2:
8 | - return __sync_val_compare_and_swap_2(addr, old, _new);
9 | + return __sync_val_compare_and_swap_2((uint16_t*) addr, old, _new);
10 | #endif
11 | case 4:
12 | - return __sync_val_compare_and_swap_4(addr, old, _new);
13 | + return __sync_val_compare_and_swap_4((uint32_t*) addr, old, _new);
14 | #if (CAA_BITS_PER_LONG == 64)
15 | case 8:
16 | return __sync_val_compare_and_swap_8(addr, old, _new);
17 | @@ -109,7 +109,7 @@
18 | return;
19 | #endif
20 | case 4:
21 | - __sync_and_and_fetch_4(addr, val);
22 | + __sync_and_and_fetch_4((uint32_t*) addr, val);
23 | return;
24 | #if (CAA_BITS_PER_LONG == 64)
25 | case 8:
26 | @@ -148,7 +148,7 @@
27 | return;
28 | #endif
29 | case 4:
30 | - __sync_or_and_fetch_4(addr, val);
31 | + __sync_or_and_fetch_4((uint32_t*) addr, val);
32 | return;
33 | #if (CAA_BITS_PER_LONG == 64)
34 | case 8:
35 | @@ -187,7 +187,7 @@
36 | return __sync_add_and_fetch_2(addr, val);
37 | #endif
38 | case 4:
39 | - return __sync_add_and_fetch_4(addr, val);
40 | + return __sync_add_and_fetch_4((uint32_t*) addr, val);
41 | #if (CAA_BITS_PER_LONG == 64)
42 | case 8:
43 | return __sync_add_and_fetch_8(addr, val);
44 |
--------------------------------------------------------------------------------
/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/tizen-build-rootfs.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 |
4 | ARCH=$1
5 | LINK_ARCH=$ARCH
6 |
7 | case "$ARCH" in
8 | arm)
9 | TIZEN_ARCH="armv7hl"
10 | ;;
11 | armel)
12 | TIZEN_ARCH="armv7l"
13 | LINK_ARCH="arm"
14 | ;;
15 | arm64)
16 | TIZEN_ARCH="aarch64"
17 | ;;
18 | x86)
19 | TIZEN_ARCH="i686"
20 | ;;
21 | x64)
22 | TIZEN_ARCH="x86_64"
23 | LINK_ARCH="x86"
24 | ;;
25 | riscv64)
26 | TIZEN_ARCH="riscv64"
27 | LINK_ARCH="riscv"
28 | ;;
29 | *)
30 | echo "Unsupported architecture for tizen: $ARCH"
31 | exit 1
32 | esac
33 |
34 | __CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
35 | __TIZEN_CROSSDIR="$__CrossDir/${ARCH}/tizen"
36 |
37 | if [[ -z "$ROOTFS_DIR" ]]; then
38 | echo "ROOTFS_DIR is not defined."
39 | exit 1;
40 | fi
41 |
42 | TIZEN_TMP_DIR=$ROOTFS_DIR/tizen_tmp
43 | mkdir -p $TIZEN_TMP_DIR
44 |
45 | # Download files
46 | echo ">>Start downloading files"
47 | VERBOSE=1 $__CrossDir/tizen-fetch.sh $TIZEN_TMP_DIR $TIZEN_ARCH
48 | echo "<>Start constructing Tizen rootfs"
51 | TIZEN_RPM_FILES=`ls $TIZEN_TMP_DIR/*.rpm`
52 | cd $ROOTFS_DIR
53 | for f in $TIZEN_RPM_FILES; do
54 | rpm2cpio $f | cpio -idm --quiet
55 | done
56 | echo "<>Start configuring Tizen rootfs"
63 | ln -sfn asm-${LINK_ARCH} ./usr/include/asm
64 | patch -p1 < $__TIZEN_CROSSDIR/tizen.patch
65 | if [[ "$TIZEN_ARCH" == "riscv64" ]]; then
66 | echo "Fixing broken symlinks in $PWD"
67 | rm ./usr/lib64/libresolv.so
68 | ln -s ../../lib64/libresolv.so.2 ./usr/lib64/libresolv.so
69 | rm ./usr/lib64/libpthread.so
70 | ln -s ../../lib64/libpthread.so.0 ./usr/lib64/libpthread.so
71 | rm ./usr/lib64/libdl.so
72 | ln -s ../../lib64/libdl.so.2 ./usr/lib64/libdl.so
73 | rm ./usr/lib64/libutil.so
74 | ln -s ../../lib64/libutil.so.1 ./usr/lib64/libutil.so
75 | rm ./usr/lib64/libm.so
76 | ln -s ../../lib64/libm.so.6 ./usr/lib64/libm.so
77 | rm ./usr/lib64/librt.so
78 | ln -s ../../lib64/librt.so.1 ./usr/lib64/librt.so
79 | rm ./lib/ld-linux-riscv64-lp64d.so.1
80 | ln -s ../lib64/ld-linux-riscv64-lp64d.so.1 ./lib/ld-linux-riscv64-lp64d.so.1
81 | fi
82 | echo "<\\|?@*"() ]', '_'
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/native/init-os-and-arch.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Use uname to determine what the OS is.
4 | OSName=$(uname -s | tr '[:upper:]' '[:lower:]')
5 |
6 | if command -v getprop && getprop ro.product.system.model 2>&1 | grep -qi android; then
7 | OSName="android"
8 | fi
9 |
10 | case "$OSName" in
11 | freebsd|linux|netbsd|openbsd|sunos|android|haiku)
12 | os="$OSName" ;;
13 | darwin)
14 | os=osx ;;
15 | *)
16 | echo "Unsupported OS $OSName detected!"
17 | exit 1 ;;
18 | esac
19 |
20 | # On Solaris, `uname -m` is discouraged, see https://docs.oracle.com/cd/E36784_01/html/E36870/uname-1.html
21 | # and `uname -p` returns processor type (e.g. i386 on amd64).
22 | # The appropriate tool to determine CPU is isainfo(1) https://docs.oracle.com/cd/E36784_01/html/E36870/isainfo-1.html.
23 | if [ "$os" = "sunos" ]; then
24 | if uname -o 2>&1 | grep -q illumos; then
25 | os="illumos"
26 | else
27 | os="solaris"
28 | fi
29 | CPUName=$(isainfo -n)
30 | else
31 | # For the rest of the operating systems, use uname(1) to determine what the CPU is.
32 | CPUName=$(uname -m)
33 | fi
34 |
35 | case "$CPUName" in
36 | arm64|aarch64)
37 | arch=arm64
38 | if [ "$(getconf LONG_BIT)" -lt 64 ]; then
39 | # This is 32-bit OS running on 64-bit CPU (for example Raspberry Pi OS)
40 | arch=arm
41 | fi
42 | ;;
43 |
44 | loongarch64)
45 | arch=loongarch64
46 | ;;
47 |
48 | riscv64)
49 | arch=riscv64
50 | ;;
51 |
52 | amd64|x86_64)
53 | arch=x64
54 | ;;
55 |
56 | armv7l|armv8l)
57 | # shellcheck disable=SC1091
58 | if (NAME=""; . /etc/os-release; test "$NAME" = "Tizen"); then
59 | arch=armel
60 | else
61 | arch=arm
62 | fi
63 | ;;
64 |
65 | armv6l)
66 | arch=armv6
67 | ;;
68 |
69 | i[3-6]86)
70 | echo "Unsupported CPU $CPUName detected, build might not succeed!"
71 | arch=x86
72 | ;;
73 |
74 | s390x)
75 | arch=s390x
76 | ;;
77 |
78 | ppc64le)
79 | arch=ppc64le
80 | ;;
81 | *)
82 | echo "Unknown CPU $CPUName detected!"
83 | exit 1
84 | ;;
85 | esac
86 |
--------------------------------------------------------------------------------
/eng/common/post-build/check-channel-consistency.ps1:
--------------------------------------------------------------------------------
1 | param(
2 | [Parameter(Mandatory=$true)][string] $PromoteToChannels, # List of channels that the build should be promoted to
3 | [Parameter(Mandatory=$true)][array] $AvailableChannelIds # List of channel IDs available in the YAML implementation
4 | )
5 |
6 | try {
7 | $ErrorActionPreference = 'Stop'
8 | Set-StrictMode -Version 2.0
9 |
10 | # `tools.ps1` checks $ci to perform some actions. Since the post-build
11 | # scripts don't necessarily execute in the same agent that run the
12 | # build.ps1/sh script this variable isn't automatically set.
13 | $ci = $true
14 | $disableConfigureToolsetImport = $true
15 | . $PSScriptRoot\..\tools.ps1
16 |
17 | if ($PromoteToChannels -eq "") {
18 | Write-PipelineTaskError -Type 'warning' -Message "This build won't publish assets as it's not configured to any Maestro channel. If that wasn't intended use Darc to configure a default channel using add-default-channel for this branch or to promote it to a channel using add-build-to-channel. See https://github.com/dotnet/arcade/blob/main/Documentation/Darc.md#assigning-an-individual-build-to-a-channel for more info."
19 | ExitWithExitCode 0
20 | }
21 |
22 | # Check that every channel that Maestro told to promote the build to
23 | # is available in YAML
24 | $PromoteToChannelsIds = $PromoteToChannels -split "\D" | Where-Object { $_ }
25 |
26 | $hasErrors = $false
27 |
28 | foreach ($id in $PromoteToChannelsIds) {
29 | if (($id -ne 0) -and ($id -notin $AvailableChannelIds)) {
30 | Write-PipelineTaskError -Message "Channel $id is not present in the post-build YAML configuration! This is an error scenario. Please contact @dnceng."
31 | $hasErrors = $true
32 | }
33 | }
34 |
35 | # The `Write-PipelineTaskError` doesn't error the script and we might report several errors
36 | # in the previous lines. The check below makes sure that we return an error state from the
37 | # script if we reported any validation error
38 | if ($hasErrors) {
39 | ExitWithExitCode 1
40 | }
41 |
42 | Write-Host 'done.'
43 | }
44 | catch {
45 | Write-Host $_
46 | Write-PipelineTelemetryError -Category 'CheckChannelConsistency' -Message "There was an error while trying to check consistency of Maestro default channels for the build and post-build YAML configuration."
47 | ExitWithExitCode 1
48 | }
49 |
--------------------------------------------------------------------------------
/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/post-build/publish-using-darc.ps1:
--------------------------------------------------------------------------------
1 | param(
2 | [Parameter(Mandatory=$true)][int] $BuildId,
3 | [Parameter(Mandatory=$true)][int] $PublishingInfraVersion,
4 | [Parameter(Mandatory=$true)][string] $AzdoToken,
5 | [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro.dot.net',
6 | [Parameter(Mandatory=$true)][string] $WaitPublishingFinish,
7 | [Parameter(Mandatory=$false)][string] $ArtifactsPublishingAdditionalParameters,
8 | [Parameter(Mandatory=$false)][string] $SymbolPublishingAdditionalParameters
9 | )
10 |
11 | try {
12 | # `tools.ps1` checks $ci to perform some actions. Since the post-build
13 | # scripts don't necessarily execute in the same agent that run the
14 | # build.ps1/sh script this variable isn't automatically set.
15 | $ci = $true
16 | $disableConfigureToolsetImport = $true
17 | . $PSScriptRoot\..\tools.ps1
18 |
19 | $darc = Get-Darc
20 |
21 | $optionalParams = [System.Collections.ArrayList]::new()
22 |
23 | if ("" -ne $ArtifactsPublishingAdditionalParameters) {
24 | $optionalParams.Add("--artifact-publishing-parameters") | Out-Null
25 | $optionalParams.Add($ArtifactsPublishingAdditionalParameters) | Out-Null
26 | }
27 |
28 | if ("" -ne $SymbolPublishingAdditionalParameters) {
29 | $optionalParams.Add("--symbol-publishing-parameters") | Out-Null
30 | $optionalParams.Add($SymbolPublishingAdditionalParameters) | Out-Null
31 | }
32 |
33 | if ("false" -eq $WaitPublishingFinish) {
34 | $optionalParams.Add("--no-wait") | Out-Null
35 | }
36 |
37 | & $darc add-build-to-channel `
38 | --id $buildId `
39 | --publishing-infra-version $PublishingInfraVersion `
40 | --default-channels `
41 | --source-branch main `
42 | --azdev-pat "$AzdoToken" `
43 | --bar-uri "$MaestroApiEndPoint" `
44 | --ci `
45 | --verbose `
46 | @optionalParams
47 |
48 | if ($LastExitCode -ne 0) {
49 | Write-Host "Problems using Darc to promote build ${buildId} to default channels. Stopping execution..."
50 | exit 1
51 | }
52 |
53 | Write-Host 'done.'
54 | }
55 | catch {
56 | Write-Host $_
57 | Write-PipelineTelemetryError -Category 'PromoteBuild' -Message "There was an error while trying to publish build '$BuildId' to default channels."
58 | ExitWithExitCode 1
59 | }
60 |
--------------------------------------------------------------------------------
/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/sdl/trim-assets-version.ps1:
--------------------------------------------------------------------------------
1 | <#
2 | .SYNOPSIS
3 | Install and run the 'Microsoft.DotNet.VersionTools.Cli' tool with the 'trim-artifacts-version' command to trim the version from the NuGet assets file name.
4 |
5 | .PARAMETER InputPath
6 | Full path to directory where artifact packages are stored
7 |
8 | .PARAMETER Recursive
9 | Search for NuGet packages recursively
10 |
11 | #>
12 |
13 | Param(
14 | [string] $InputPath,
15 | [bool] $Recursive = $true
16 | )
17 |
18 | $CliToolName = "Microsoft.DotNet.VersionTools.Cli"
19 |
20 | function Install-VersionTools-Cli {
21 | param(
22 | [Parameter(Mandatory=$true)][string]$Version
23 | )
24 |
25 | Write-Host "Installing the package '$CliToolName' with a version of '$version' ..."
26 | $feed = "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json"
27 |
28 | $argumentList = @("tool", "install", "--local", "$CliToolName", "--add-source $feed", "--no-cache", "--version $Version", "--create-manifest-if-needed")
29 | Start-Process "$dotnet" -Verbose -ArgumentList $argumentList -NoNewWindow -Wait
30 | }
31 |
32 | # -------------------------------------------------------------------
33 |
34 | if (!(Test-Path $InputPath)) {
35 | Write-Host "Input Path '$InputPath' does not exist"
36 | ExitWithExitCode 1
37 | }
38 |
39 | $ErrorActionPreference = 'Stop'
40 | Set-StrictMode -Version 2.0
41 |
42 | $disableConfigureToolsetImport = $true
43 | $global:LASTEXITCODE = 0
44 |
45 | # `tools.ps1` checks $ci to perform some actions. Since the SDL
46 | # scripts don't necessarily execute in the same agent that run the
47 | # build.ps1/sh script this variable isn't automatically set.
48 | $ci = $true
49 | . $PSScriptRoot\..\tools.ps1
50 |
51 | try {
52 | $dotnetRoot = InitializeDotNetCli -install:$true
53 | $dotnet = "$dotnetRoot\dotnet.exe"
54 |
55 | $toolsetVersion = Read-ArcadeSdkVersion
56 | Install-VersionTools-Cli -Version $toolsetVersion
57 |
58 | $cliToolFound = (& "$dotnet" tool list --local | Where-Object {$_.Split(' ')[0] -eq $CliToolName})
59 | if ($null -eq $cliToolFound) {
60 | Write-PipelineTelemetryError -Force -Category 'Sdl' -Message "The '$CliToolName' tool is not installed."
61 | ExitWithExitCode 1
62 | }
63 |
64 | Exec-BlockVerbosely {
65 | & "$dotnet" $CliToolName trim-assets-version `
66 | --assets-path $InputPath `
67 | --recursive $Recursive
68 | Exit-IfNZEC "Sdl"
69 | }
70 | }
71 | catch {
72 | Write-Host $_
73 | Write-PipelineTelemetryError -Force -Category 'Sdl' -Message $_
74 | ExitWithExitCode 1
75 | }
76 |
--------------------------------------------------------------------------------
/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 | steps:
29 | - ${{ if ne(parameters.is1ESPipeline, true) }}:
30 | - 'eng/common/templates-official cannot be referenced from a non-1ES managed template': error
31 | - task: 1ES.PublishBuildArtifacts@1
32 | displayName: ${{ parameters.displayName }}
33 | condition: ${{ parameters.condition }}
34 | ${{ if parameters.continueOnError }}:
35 | continueOnError: ${{ parameters.continueOnError }}
36 | inputs:
37 | PublishLocation: ${{ parameters.publishLocation }}
38 | PathtoPublish: ${{ parameters.pathToPublish }}
39 | ${{ if parameters.artifactName }}:
40 | ArtifactName: ${{ parameters.artifactName }}
41 |
42 |
--------------------------------------------------------------------------------
/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/variables/pool-providers.yml:
--------------------------------------------------------------------------------
1 | # Select a pool provider based off branch name. Anything with branch name containing 'release' must go into an -Svc pool,
2 | # otherwise it should go into the "normal" pools. This separates out the queueing and billing of released branches.
3 |
4 | # Motivation:
5 | # Once a given branch of a repository's output has been officially "shipped" once, it is then considered to be COGS
6 | # (Cost of goods sold) and should be moved to a servicing pool provider. This allows both separation of queueing
7 | # (allowing release builds and main PR builds to not intefere with each other) and billing (required for COGS.
8 | # Additionally, the pool provider name itself may be subject to change when the .NET Core Engineering Services
9 | # team needs to move resources around and create new and potentially differently-named pools. Using this template
10 | # file from an Arcade-ified repo helps guard against both having to update one's release/* branches and renaming.
11 |
12 | # How to use:
13 | # This yaml assumes your shipped product branches use the naming convention "release/..." (which many do).
14 | # If we find alternate naming conventions in broad usage it can be added to the condition below.
15 | #
16 | # First, import the template in an arcade-ified repo to pick up the variables, e.g.:
17 | #
18 | # variables:
19 | # - template: /eng/common/templates-official/variables/pool-providers.yml
20 | #
21 | # ... then anywhere specifying the pool provider use the runtime variables,
22 | # $(DncEngInternalBuildPool)
23 | #
24 | # pool:
25 | # name: $(DncEngInternalBuildPool)
26 | # image: 1es-windows-2022
27 |
28 | variables:
29 | # Coalesce the target and source branches so we know when a PR targets a release branch
30 | # If these variables are somehow missing, fall back to main (tends to have more capacity)
31 |
32 | # Any new -Svc alternative pools should have variables added here to allow for splitting work
33 |
34 | - name: DncEngInternalBuildPool
35 | value: $[
36 | replace(
37 | replace(
38 | eq(contains(coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranch'], 'refs/heads/main'), 'release'), 'true'),
39 | True,
40 | 'NetCore1ESPool-Svc-Internal'
41 | ),
42 | False,
43 | 'NetCore1ESPool-Internal'
44 | )
45 | ]
--------------------------------------------------------------------------------
/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 | steps:
29 | - ${{ if eq(parameters.is1ESPipeline, true) }}:
30 | - 'eng/common/templates cannot be referenced from a 1ES managed template': error
31 | - task: PublishBuildArtifacts@1
32 | displayName: ${{ parameters.displayName }}
33 | condition: ${{ parameters.condition }}
34 | ${{ if parameters.continueOnError }}:
35 | continueOnError: ${{ parameters.continueOnError }}
36 | inputs:
37 | PublishLocation: ${{ parameters.publishLocation }}
38 | PathtoPublish: ${{ parameters.pathToPublish }}
39 | ${{ if parameters.artifactName }}:
40 | ArtifactName: ${{ parameters.artifactName }}
--------------------------------------------------------------------------------
/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/config/PublishData.json:
--------------------------------------------------------------------------------
1 | {
2 | "feeds": {
3 | "vssdk": "https://pkgs.dev.azure.com/azure-public/vside/_packaging/vssdk/nuget/v3/index.json"
4 | },
5 | "packages": {
6 | "default": {
7 | "Microsoft.VisualStudio.InteractiveWindow": "vssdk",
8 | "Microsoft.VisualStudio.VsInteractiveWindow": "vssdk"
9 | }
10 | },
11 | "branches": {
12 | "main": {
13 | "nugetKind": "Shipping",
14 | "version": "4.0.*",
15 | "packageFeeds": "default",
16 | "vsBranch": "feature/d17initial"
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "tools": {
3 | "dotnet": "9.0.104",
4 | "vs": {
5 | "version": "17.8.0"
6 | }
7 | },
8 | "sdk": {
9 | "version": "9.0.104",
10 | "rollForward": "latestFeature"
11 | },
12 | "msbuild-sdks": {
13 | "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.25164.2"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Latest
7 | IW
8 | MIT
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/Directory.Build.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/Microsoft.VisualStudio.InteractiveWindow.Tests/InteractiveWindowEditorsFactoryService.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the License.txt file in the project root for more information.
4 |
5 | using System.ComponentModel.Composition;
6 | using Microsoft.VisualStudio.Text;
7 | using Microsoft.VisualStudio.Text.Editor;
8 | using Microsoft.VisualStudio.Utilities;
9 | using Roslyn.Test.Utilities;
10 |
11 | namespace Microsoft.VisualStudio.InteractiveWindow.UnitTests
12 | {
13 | [Export(typeof(IInteractiveWindowEditorFactoryService))]
14 | internal class InteractiveWindowEditorsFactoryService : IInteractiveWindowEditorFactoryService
15 | {
16 | public const string ContentType = "text";
17 |
18 | private readonly ITextBufferFactoryService _textBufferFactoryService;
19 | private readonly ITextEditorFactoryService _textEditorFactoryService;
20 | private readonly IContentTypeRegistryService _contentTypeRegistry;
21 |
22 | [ImportingConstructor]
23 | public InteractiveWindowEditorsFactoryService(ITextBufferFactoryService textBufferFactoryService, ITextEditorFactoryService textEditorFactoryService, IContentTypeRegistryService contentTypeRegistry)
24 | {
25 | _textBufferFactoryService = textBufferFactoryService;
26 | _textEditorFactoryService = textEditorFactoryService;
27 | _contentTypeRegistry = contentTypeRegistry;
28 | }
29 |
30 | IWpfTextView IInteractiveWindowEditorFactoryService.CreateTextView(IInteractiveWindow window, ITextBuffer buffer, ITextViewRoleSet roles)
31 | {
32 | WpfTestCase.RequireWpfFact($"Creates an IWpfTextView in {nameof(InteractiveWindowEditorsFactoryService)}");
33 |
34 | var textView = _textEditorFactoryService.CreateTextView(buffer, roles);
35 | return _textEditorFactoryService.CreateTextViewHost(textView, false).TextView;
36 | }
37 |
38 | ITextBuffer IInteractiveWindowEditorFactoryService.CreateAndActivateBuffer(IInteractiveWindow window)
39 | {
40 | IContentType contentType;
41 | if (!window.Properties.TryGetProperty(typeof(IContentType), out contentType))
42 | {
43 | contentType = _contentTypeRegistry.GetContentType(ContentType);
44 | }
45 |
46 | return _textBufferFactoryService.CreateTextBuffer(contentType);
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/Microsoft.VisualStudio.InteractiveWindow.Tests/JoinableTaskContextMefHost.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the License.txt file in the project root for more information.
4 |
5 | using System.ComponentModel.Composition;
6 | using Microsoft.VisualStudio.Threading;
7 |
8 | namespace Microsoft.VisualStudio.InteractiveWindow.UnitTests
9 | {
10 | internal class JoinableTaskContextMefHost
11 | {
12 | ///
13 | /// Gets the singleton instance of joinable task context for directly working with async tasks on managed code
14 | ///
15 | [Export]
16 | internal readonly JoinableTaskContext JoinableTaskContext = new JoinableTaskContext();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Microsoft.VisualStudio.InteractiveWindow.Tests/Microsoft.VisualStudio.InteractiveWindow.UnitTests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net472
5 | true
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/Microsoft.VisualStudio.InteractiveWindow.Tests/TestClipboard.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the License.txt file in the project root for more information.
4 |
5 | using System;
6 | using System.Windows;
7 |
8 | namespace Microsoft.VisualStudio.InteractiveWindow.UnitTests
9 | {
10 | internal sealed class TestClipboard : InteractiveWindowClipboard
11 | {
12 | private DataObject _data = null;
13 |
14 | internal void Clear() => _data = null;
15 |
16 | internal override bool ContainsData(string format) => _data?.GetData(format) != null;
17 |
18 | internal override object GetData(string format) => _data?.GetData(format);
19 |
20 | internal override bool ContainsText() => _data != null ? _data.ContainsText() : false;
21 |
22 | internal override string GetText() => _data?.GetText();
23 |
24 | internal override void SetDataObject(object data, bool copy) => _data = (DataObject)data;
25 |
26 | internal override IDataObject GetDataObject() => _data;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Microsoft.VisualStudio.InteractiveWindow.Tests/TestContentTypeDefinition.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the License.txt file in the project root for more information.
4 |
5 | using System.ComponentModel.Composition;
6 | using Microsoft.VisualStudio.Utilities;
7 |
8 | namespace Microsoft.VisualStudio.InteractiveWindow.UnitTests
9 | {
10 | public sealed class TestContentTypeDefinition
11 | {
12 | public const string ContentTypeName = "InteractiveWindowTest";
13 |
14 | [Export]
15 | [Name(ContentTypeName)]
16 | [BaseDefinition("code")]
17 | public static readonly ContentTypeDefinition Definition;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Microsoft.VisualStudio.InteractiveWindow.Tests/TestInteractiveEngine.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the License.txt file in the project root for more information.
4 |
5 | using System;
6 | using System.Threading.Tasks;
7 | using Microsoft.VisualStudio.Utilities;
8 |
9 | namespace Microsoft.VisualStudio.InteractiveWindow.UnitTests
10 | {
11 | public sealed class TestInteractiveEngine : IInteractiveEvaluator
12 | {
13 | internal event EventHandler OnExecute;
14 |
15 | public TestInteractiveEngine()
16 | {
17 | }
18 |
19 | public IInteractiveWindow CurrentWindow { get; set; }
20 |
21 | public void Dispose()
22 | {
23 | }
24 |
25 | public Task InitializeAsync()
26 | {
27 | return Task.FromResult(ExecutionResult.Success);
28 | }
29 |
30 | public Task ResetAsync(bool initialize = true)
31 | {
32 | return Task.FromResult(ExecutionResult.Success);
33 | }
34 |
35 | public bool CanExecuteCode(string text)
36 | {
37 | return true;
38 | }
39 |
40 | public Task ExecuteCodeAsync(string text)
41 | {
42 | OnExecute?.Invoke(this, text);
43 | return Task.FromResult(ExecutionResult.Success);
44 | }
45 |
46 | public string FormatClipboard()
47 | {
48 | return null;
49 | }
50 |
51 | public void AbortExecution()
52 | {
53 | }
54 |
55 | public string GetConfiguration()
56 | {
57 | return "config";
58 | }
59 |
60 | public string GetPrompt()
61 | {
62 | return "> ";
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/Microsoft.VisualStudio.InteractiveWindow.Tests/TestSmartIndent.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the License.txt file in the project root for more information.
4 |
5 | using System;
6 | using System.ComponentModel.Composition;
7 | using Microsoft.VisualStudio.Text;
8 | using Microsoft.VisualStudio.Text.Editor;
9 | using Microsoft.VisualStudio.Utilities;
10 |
11 | namespace Microsoft.VisualStudio.InteractiveWindow.UnitTests
12 | {
13 | internal class TestSmartIndent : ISmartIndent
14 | {
15 | private readonly int[] _lineToIndentMap;
16 |
17 | public TestSmartIndent(params int[] lineToIndentMap)
18 | {
19 | _lineToIndentMap = lineToIndentMap;
20 | }
21 |
22 | int? ISmartIndent.GetDesiredIndentation(ITextSnapshotLine line)
23 | {
24 | return _lineToIndentMap[line.LineNumber];
25 | }
26 |
27 | void IDisposable.Dispose()
28 | {
29 | }
30 | }
31 |
32 | internal class DummySmartIndent : ISmartIndent
33 | {
34 | public static readonly ISmartIndent Instance = new DummySmartIndent();
35 |
36 | private DummySmartIndent()
37 | {
38 | }
39 |
40 | int? ISmartIndent.GetDesiredIndentation(ITextSnapshotLine line)
41 | {
42 | return null;
43 | }
44 |
45 | void IDisposable.Dispose()
46 | {
47 | }
48 | }
49 |
50 | [Export(typeof(TestSmartIndentProvider))]
51 | [Export(typeof(ISmartIndentProvider))]
52 | [ContentType(InteractiveWindowEditorsFactoryService.ContentType)]
53 | internal class TestSmartIndentProvider : ISmartIndentProvider
54 | {
55 | public ISmartIndent SmartIndent;
56 |
57 | ISmartIndent ISmartIndentProvider.CreateSmartIndent(ITextView textView) => SmartIndent ?? DummySmartIndent.Instance;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/Microsoft.VisualStudio.InteractiveWindow.Tests/TestUtilities/Assert/ConditionalFactAttribute.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the License.txt file in the project root for more information.
4 |
5 | using System;
6 | using System.Globalization;
7 | using System.Text;
8 | using Xunit;
9 |
10 | namespace Roslyn.Test.Utilities
11 | {
12 | public class ConditionalFactAttribute : FactAttribute
13 | {
14 | public ConditionalFactAttribute(params Type[] skipConditions)
15 | {
16 | foreach (var skipCondition in skipConditions)
17 | {
18 | ExecutionCondition condition = (ExecutionCondition)Activator.CreateInstance(skipCondition);
19 | if (condition.ShouldSkip)
20 | {
21 | Skip = condition.SkipReason;
22 | break;
23 | }
24 | }
25 | }
26 | }
27 |
28 | public abstract class ExecutionCondition
29 | {
30 | public abstract bool ShouldSkip { get; }
31 | public abstract string SkipReason { get; }
32 | }
33 |
34 | public class x86 : ExecutionCondition
35 | {
36 | public override bool ShouldSkip => IntPtr.Size != 4;
37 |
38 | public override string SkipReason => "Target platform is not x86";
39 | }
40 |
41 | public class HasShiftJisDefaultEncoding : ExecutionCondition
42 | {
43 | public override bool ShouldSkip => Encoding.GetEncoding(0)?.CodePage != 932;
44 |
45 | public override string SkipReason => "OS default codepage is not Shift-JIS (932).";
46 | }
47 |
48 | public class IsEnglishLocal : ExecutionCondition
49 | {
50 | public override bool ShouldSkip =>
51 | !CultureInfo.CurrentUICulture.Name.StartsWith("en", StringComparison.OrdinalIgnoreCase) ||
52 | !CultureInfo.CurrentCulture.Name.StartsWith("en", StringComparison.OrdinalIgnoreCase);
53 |
54 | public override string SkipReason => "Current culture is not en";
55 | }
56 |
57 | public class IsRelease : ExecutionCondition
58 | {
59 | #if DEBUG
60 | public override bool ShouldSkip => true;
61 | #else
62 | public override bool ShouldSkip => false;
63 | #endif
64 |
65 | public override string SkipReason => "Not in release mode.";
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/Microsoft.VisualStudio.InteractiveWindow.Tests/TestUtilities/Assert/EqualityTesting.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the License.txt file in the project root for more information.
4 |
5 | using System;
6 | using Xunit;
7 |
8 | namespace Microsoft.CodeAnalysis.Test.Utilities
9 | {
10 | ///
11 | /// Helpers for testing equality APIs.
12 | /// Gives us more control than calling Assert.Equals.
13 | ///
14 | public static class EqualityTesting
15 | {
16 | public static void AssertEqual(IEquatable x, IEquatable y)
17 | {
18 | Assert.True(x.Equals(y));
19 | Assert.True(((object)x).Equals(y));
20 | Assert.Equal(x.GetHashCode(), y.GetHashCode());
21 | }
22 |
23 | public static void AssertNotEqual(IEquatable x, IEquatable y)
24 | {
25 | Assert.False(x.Equals(y));
26 | Assert.False(((object)x).Equals(y));
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Microsoft.VisualStudio.InteractiveWindow.Tests/TestUtilities/Assert/EqualityUnit.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the License.txt file in the project root for more information.
4 |
5 | namespace Roslyn.Test.Utilities
6 | {
7 | public static class EqualityUnit
8 | {
9 | public static EqualityUnit Create(T value)
10 | {
11 | return new EqualityUnit(value);
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Microsoft.VisualStudio.InteractiveWindow.Tests/TestUtilities/Assert/EqualityUnit`1.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the License.txt file in the project root for more information.
4 |
5 | using System.Collections.Generic;
6 | using System.Collections.ObjectModel;
7 | using System.Linq;
8 |
9 | namespace Roslyn.Test.Utilities
10 | {
11 | public sealed class EqualityUnit
12 | {
13 | private static readonly ReadOnlyCollection s_emptyCollection = new ReadOnlyCollection(new T[] { });
14 |
15 | public readonly T Value;
16 | public readonly ReadOnlyCollection EqualValues;
17 | public readonly ReadOnlyCollection NotEqualValues;
18 | public IEnumerable AllValues
19 | {
20 | get { return Enumerable.Repeat(Value, 1).Concat(EqualValues).Concat(NotEqualValues); }
21 | }
22 |
23 | public EqualityUnit(T value)
24 | {
25 | Value = value;
26 | EqualValues = s_emptyCollection;
27 | NotEqualValues = s_emptyCollection;
28 | }
29 |
30 | public EqualityUnit(
31 | T value,
32 | ReadOnlyCollection equalValues,
33 | ReadOnlyCollection notEqualValues)
34 | {
35 | Value = value;
36 | EqualValues = equalValues;
37 | NotEqualValues = notEqualValues;
38 | }
39 |
40 | public EqualityUnit WithEqualValues(params T[] equalValues)
41 | {
42 | return new EqualityUnit(
43 | Value,
44 | EqualValues.Concat(equalValues).ToList().AsReadOnly(),
45 | NotEqualValues);
46 | }
47 |
48 | public EqualityUnit WithNotEqualValues(params T[] notEqualValues)
49 | {
50 | return new EqualityUnit(
51 | Value,
52 | EqualValues,
53 | NotEqualValues.Concat(notEqualValues).ToList().AsReadOnly());
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/Microsoft.VisualStudio.InteractiveWindow.Tests/TestUtilities/Assert/EqualityUtil.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the License.txt file in the project root for more information.
4 |
5 | using System;
6 |
7 | namespace Roslyn.Test.Utilities
8 | {
9 | public static class EqualityUtil
10 | {
11 | public static void RunAll(
12 | Func compEqualsOperator,
13 | Func compNotEqualsOperator,
14 | params EqualityUnit[] values)
15 | {
16 | var util = new EqualityUtil(values, compEqualsOperator, compNotEqualsOperator);
17 | util.RunAll();
18 | }
19 |
20 | public static void RunAll(EqualityUnit unit, bool checkIEquatable = true)
21 | {
22 | RunAll(checkIEquatable, new[] { unit });
23 | }
24 |
25 | public static void RunAll(params EqualityUnit[] values)
26 | {
27 | RunAll(checkIEquatable: true, values: values);
28 | }
29 |
30 | public static void RunAll(bool checkIEquatable, params EqualityUnit[] values)
31 | {
32 | var util = new EqualityUtil(values);
33 | util.RunAll(checkIEquatable);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Microsoft.VisualStudio.InteractiveWindow.Tests/TestUtilities/Assert/TestExceptionUtilities.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the License.txt file in the project root for more information.
4 |
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 |
11 | namespace Microsoft.CodeAnalysis.Test.Utilities
12 | {
13 | public static class TestExceptionUtilities
14 | {
15 | public static InvalidOperationException UnexpectedValue(object o)
16 | {
17 | string output = String.Format("Unexpected value '{0}' of type '{1}'", o, (o != null) ? o.GetType().FullName : "");
18 | System.Diagnostics.Debug.Fail(output);
19 | return new InvalidOperationException(output);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Microsoft.VisualStudio.InteractiveWindow.Tests/TestUtilities/Assert/WorkItemAttribute.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the License.txt file in the project root for more information.
4 |
5 | using System;
6 |
7 | namespace Roslyn.Test.Utilities
8 | {
9 | ///
10 | /// Used to tag test methods or types which are created for a given WorkItem
11 | ///
12 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
13 | public sealed class WorkItemAttribute : Attribute
14 | {
15 | private readonly int _id;
16 | private readonly string _description;
17 |
18 | public int Id
19 | {
20 | get { return _id; }
21 | }
22 |
23 | public string Description
24 | {
25 | get { return _description; }
26 | }
27 |
28 | public WorkItemAttribute(int id, string description)
29 | {
30 | _id = id;
31 | _description = description;
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Microsoft.VisualStudio.InteractiveWindow.Tests/TestUtilities/Async/Checkpoint.cs:
--------------------------------------------------------------------------------
1 | // Licensed to the .NET Foundation under one or more agreements.
2 | // The .NET Foundation licenses this file to you under the MIT license.
3 | // See the License.txt file in the project root for more information.
4 |
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 |
11 | namespace Roslyn.Test.Utilities
12 | {
13 | public class Checkpoint
14 | {
15 | private readonly TaskCompletionSource