-
Notifications
You must be signed in to change notification settings - Fork 552
Support .NET SDK Container Build #3960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
3b319b0
Experimental Base Structure
alexyaang 794d867
register new task provider
alexyaang 127f053
added build options for DotnetSdk
alexyaang 09236a7
removed redundent fields in NetCoreSdkBuildOptions
alexyaang dbfc62a
added json schema
alexyaang b9b9607
basci working implementation of task provider
alexyaang d289b42
reversed unnecessary commits
alexyaang 6982df7
added dotnet specific util methods
alexyaang 4cd942e
fixed dotnet CLI flags
alexyaang 26058d3
made code more organized
alexyaang 9a148bc
organiized files into new folder
alexyaang 440cb49
added helper class
alexyaang ee21b06
combined build & run into one task
alexyaang 7d62777
adddded working version of run command
alexyaang 78f1374
added mounts to run arg
alexyaang 9832b7b
added ambient launch task
alexyaang b2712c8
working version of ambient launch task
alexyaang 86cc95f
added prompt for docker debugger on csharp languag
alexyaang 796c1ad
stored user image build choices
alexyaang 068fcc1
added auto .csproj selection & refactored code
alexyaang a054ac9
added debug helper
alexyaang b113ce7
small tweaks to handle null cases
alexyaang edf1338
add appOutput override to fix dotnet project name bug
alexyaang 8920a8f
fixed image not running if foldername has special chars
alexyaang def78b9
changed task name and altered schema
alexyaang 8b5fedd
determine helper from prelaunchtask instead of `platform`
alexyaang 132f252
move helper methods to taskhelper
alexyaang bcb9d9d
cleaned up unused comments & method
alexyaang 46df754
made NetTaskHelper more readable
alexyaang 0afe708
changed momento name to more detailed
alexyaang e29212c
changed targets to find SDK Container path
alexyaang 75f491d
added method to check for sdk container builds
alexyaang 00af811
set git ignore case to false
alexyaang d69f933
Delete netContainerBuild.ts
alexyaang aff5e9e
added error checking
alexyaang 17142be
added error checking
alexyaang 583a4d5
Changed const to pascal case & use pre-defined options
alexyaang 2d1defe
removed redundent duplication method
alexyaang f96921a
removed util class that is unnecessary
alexyaang b8a3755
Merge branch 'main' into yangalex/ambientSdkTask
alexyaang 3d02acd
added expose field inside RunContainerCommandOptions
alexyaang e9f4626
converted netSdkHelper class into methods only
alexyaang 63f86e8
minor change to make debugger mount more flexible
alexyaang f49d517
simplified logic for mounting debugger
alexyaang 2747b83
changed naming of expose ports
alexyaang 9d4e45e
updated if condition for checking for empty debug config
alexyaang fd4f75b
renamed helper methods in sdk task utils
alexyaang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,16 @@ | ||
| <Project> | ||
| <!-- All the relevant info is in root-level PropertyGroups, so there are no dependent targets to make this work --> | ||
| <Target Name="GetProjectProperties"> | ||
| <PropertyGroup> | ||
| <GetProjectPropertiesDependsOn Condition=" '$(SDKContainerSupportEnabled)' == 'true' ">$(GetProjectPropertiesDependsOn);ComputeContainerConfig;</GetProjectPropertiesDependsOn> | ||
bwateratmsft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </PropertyGroup> | ||
|
|
||
| <Target Name="GetProjectProperties" DependsOnTargets="$(GetProjectPropertiesDependsOn)"> | ||
| <WriteLinesToFile | ||
| File="$(InfoOutputPath)" | ||
| Lines="$(AssemblyName).dll | ||
| $(TargetFramework)$(TargetFrameworks.Split(';')[0]) | ||
| $(OutputPath)$(AssemblyName).dll" | ||
| $(OutputPath)$(AssemblyName).dll | ||
| $(ContainerWorkingDirectory)/$(AssemblyName).dll | ||
| $(SDKContainerSupportEnabled)" | ||
| Overwrite="True" /> | ||
| </Target> | ||
| </Project> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import { commands } from "vscode"; | ||
| import { NetChooseBuildTypeContext, netContainerBuild } from "../../scaffolding/wizard/net/NetContainerBuild"; | ||
| import { AllNetContainerBuildOptions } from "../../scaffolding/wizard/net/NetSdkChooseBuildStep"; | ||
| import { unresolveWorkspaceFolder } from "../../utils/resolveVariables"; | ||
| import { DockerDebugScaffoldContext } from "../DebugHelper"; | ||
| import { DockerDebugConfiguration } from "../DockerDebugConfigurationProvider"; | ||
| import { NetCoreDebugHelper, NetCoreDebugScaffoldingOptions } from "../netcore/NetCoreDebugHelper"; | ||
|
|
||
| const NetSdkTaskFullSymbol = 'dotnet-container-sdk: debug'; | ||
| export class NetSdkDebugHelper extends NetCoreDebugHelper { | ||
|
|
||
| public async provideDebugConfigurations(context: DockerDebugScaffoldContext, options?: NetCoreDebugScaffoldingOptions): Promise<DockerDebugConfiguration[]> { | ||
|
|
||
| const configurations: DockerDebugConfiguration[] = []; | ||
|
|
||
| const netCoreBuildContext: NetChooseBuildTypeContext = { | ||
| ...context.actionContext, | ||
| scaffoldType: 'debugging', | ||
| workspaceFolder: context.folder, | ||
| }; | ||
|
|
||
| await netContainerBuild(netCoreBuildContext); | ||
|
|
||
| if (netCoreBuildContext?.containerBuildOptions === AllNetContainerBuildOptions[1]) { | ||
| configurations.push({ | ||
| name: 'Docker .NET Container SDK Launch', | ||
| type: 'docker', | ||
| request: 'launch', | ||
| preLaunchTask: NetSdkTaskFullSymbol, | ||
| netCore: { | ||
| appProject: unresolveWorkspaceFolder(options.appProject, context.folder), | ||
| }, | ||
| }); | ||
| } else { | ||
| await commands.executeCommand('vscode-docker.configure'); | ||
| } | ||
|
|
||
| return configurations; | ||
| } | ||
|
|
||
| /** | ||
| * Checks if the launch task is using the .NET SDK Container build | ||
| * @param preLaunchTask | ||
| * @returns true if the launch task is using the .NET SDK Container build | ||
| * false otherwise | ||
| */ | ||
| public isDotNetSdkBuild(preLaunchTask: string): boolean { | ||
| return preLaunchTask === NetSdkTaskFullSymbol; | ||
| } | ||
| } | ||
|
|
||
| export const netSdkDebugHelper = new NetSdkDebugHelper(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/runtimes/docker/clients/DockerClientBase/withDockerExposePortsArg.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See LICENSE in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| import { withNamedArg } from "../../utils/commandLineBuilder"; | ||
|
|
||
| export function withDockerExposePortsArg(ports?: Array<number>) { | ||
| return withNamedArg('--expose', (ports || []).map(port => port.toString()), { shouldQuote: false }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See LICENSE.md in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| import { AzureWizard, AzureWizardPromptStep, UserCancelledError } from '@microsoft/vscode-azext-utils'; | ||
| import * as vscode from 'vscode'; | ||
| import { ScaffoldingWizardContext } from '../ScaffoldingWizardContext'; | ||
| import { NetContainerBuildOptions, NetSdkChooseBuildStep } from './NetSdkChooseBuildStep'; | ||
|
|
||
| export interface NetChooseBuildTypeContext extends ScaffoldingWizardContext { | ||
| containerBuildOptions?: NetContainerBuildOptions; | ||
| } | ||
|
|
||
| export async function netContainerBuild(wizardContext: Partial<NetChooseBuildTypeContext>, apiInput?: NetChooseBuildTypeContext): Promise<void> { | ||
| if (!vscode.workspace.isTrusted) { | ||
| throw new UserCancelledError('enforceTrust'); | ||
| } | ||
|
|
||
| const promptSteps: AzureWizardPromptStep<NetChooseBuildTypeContext>[] = [ | ||
| new NetSdkChooseBuildStep() | ||
| ]; | ||
|
|
||
| const wizard = new AzureWizard<NetChooseBuildTypeContext>(wizardContext as NetChooseBuildTypeContext, { | ||
| promptSteps: promptSteps, | ||
| title: vscode.l10n.t('Initialize for Debugging'), | ||
| }); | ||
|
|
||
| await wizard.prompt(); | ||
| await wizard.execute(); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.