Skip to content

Commit

Permalink
Improve vscode dotnet support (#8384)
Browse files Browse the repository at this point in the history
* Run make ensure on devcontainer creation

Added an ensure target to the dotnet makefile to run `dotnet restore`.

* Add dotnet test explorer and set default vscode settings for it

* Ensure PULUMI_LOCAL_NUGET exists

* Add missing mkdirs
  • Loading branch information
Frassle committed Nov 11, 2021
1 parent 0343a6d commit c6240cf
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 6 deletions.
5 changes: 2 additions & 3 deletions .devcontainer/devcontainer.json
Expand Up @@ -16,10 +16,9 @@

"remoteUser": "user",

"extensions": ["golang.go", "ms-dotnettools.csharp", "ms-python.python"],
"extensions": ["golang.go", "ms-dotnettools.csharp", "ms-python.python", "formulahendry.dotnet-test-explorer"],

// We want to dotnet restore all projects on startup so that omnisharp doesn't complain about lots of missing types on startup.
"postCreateCommand": "find -name \"*.??proj\" | xargs -L1 dotnet restore",
"postCreateCommand": "make ensure",

"settings": {
"extensions.ignoreRecommendations": true
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/master.yml
Expand Up @@ -160,6 +160,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
Expand Down Expand Up @@ -229,6 +230,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
Expand Down Expand Up @@ -303,6 +305,9 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Create Local Nuget
run: mkdir -p "${{ env.PULUMI_LOCAL_NUGET }}"
shell: bash
- run: dotnet nuget add source ${{ env.PULUMI_LOCAL_NUGET }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/prerelease.yml
Expand Up @@ -143,6 +143,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
Expand Down Expand Up @@ -206,6 +207,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
Expand Down Expand Up @@ -280,6 +282,9 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Create Local Nuget
run: mkdir -p "${{ env.PULUMI_LOCAL_NUGET }}"
shell: bash
- run: dotnet nuget add source ${{ env.PULUMI_LOCAL_NUGET }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
Expand All @@ -295,9 +300,6 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Clean
run: dotnet nuget locals all --clear
- name: Create Local Nuget
run: mkdir -p "D:\\Pulumi\\nuget"
shell: bash
- name: Install Python Deps
run: |
pip3 install pyenv-win
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Expand Up @@ -236,6 +236,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
Expand Down Expand Up @@ -305,6 +306,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
Expand Down Expand Up @@ -386,6 +388,9 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Create Local Nuget
run: mkdir -p "${{ env.PULUMI_LOCAL_NUGET }}"
shell: bash
- run: dotnet nuget add source ${{ env.PULUMI_LOCAL_NUGET }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/run-build-and-acceptance-tests.yml
Expand Up @@ -82,6 +82,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
Expand Down Expand Up @@ -170,6 +171,7 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet-version }}
- run: mkdir -p ${{ runner.temp }}/opt/pulumi/nuget
- run: dotnet nuget add source ${{ runner.temp }}/opt/pulumi/nuget
- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v1
Expand Down Expand Up @@ -279,6 +281,9 @@ jobs:
run: |
pip3 install pyenv-win
pip3 install pipenv
- name: Create Local Nuget
run: mkdir -p "${{ env.PULUMI_LOCAL_NUGET }}"
shell: bash
- run: dotnet nuget add source ${{ env.PULUMI_LOCAL_NUGET }}
- name: Set Build Env Vars
shell: bash
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Expand Up @@ -11,4 +11,7 @@
// Experimental but seems to work and means we don't need a vscode instance per go.mod file.
"experimentalWorkspaceModule": true,
},

"omnisharp.defaultLaunchSolution": "sdk/dotnet/dotnet.sln",
"dotnet-test-explorer.testProjectPath": "sdk/dotnet",
}
4 changes: 4 additions & 0 deletions sdk/dotnet/Makefile
Expand Up @@ -14,6 +14,10 @@ include ../../build/common.mk
# `test_all` without the dependencies.
TEST_ALL_DEPS = install

ensure::
# We want to dotnet restore all projects on startup so that omnisharp doesn't complain about lots of missing types on startup.
dotnet restore dotnet.sln

build::
# From the nuget docs:
#
Expand Down

0 comments on commit c6240cf

Please sign in to comment.