Skip to content

Commit b7ecab4

Browse files
committed
Adding a build script
1 parent c299ae9 commit b7ecab4

File tree

2 files changed

+46
-3
lines changed

2 files changed

+46
-3
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,15 @@ Follow these steps to build, run, and test the repository:
3636

3737
#### Building
3838

39+
If you have the ability to run powershell, you can invoke "build.ps1" from the root of the repo. If not, the following steps will get build going for you as well:
40+
3941
1. Run `npm install -g vsts-npm-auth`, then run `vsts-npm-auth -config .npmrc` - This command will configure your credentials for the next command.
4042
a. If you have already authenticated before, but the token expired, you may need to run `vsts-npm-auth -config .npmrc -f` instead.
4143
2. Run `npm i` - This command installs the project dependencies.
4244
3. Run `npm i -g gulp` - This command installs Gulp globally.
4345
4. Run `gulp installDependencies` - This command downloads the various dependencies as specified by the version in the [package.json](package.json) file.
44-
5. Run `code .` - This command opens the project in Visual Studio Code.
46+
47+
You can now run `code .` - This command opens the project in Visual Studio Code.
4548

4649
#### Running
4750

@@ -168,7 +171,7 @@ To package this extension, we need to create VSIX Packages. The VSIX packages ca
168171

169172
## Updating the `Roslyn` Language Server Version
170173

171-
In order to pull in new packages from upstreams into the msft_consumption feed we use for restoring, you will need to be a member of the 'CSharp VS Code Extension contributors' group in the [Azure Devops instance](https://dev.azure.com/azure-public/vside/_settings/teams).
174+
In order to pull in new packages from upstreams into the msft_consumption feed we use for restoring, you will need to be a member of the 'CSharp VS Code Extension contributors' group in the [Azure Devops instance](https://dev.azure.com/azure-public/vside/_settings/teams).
172175

173176
To update the version of the roslyn server used by the extension do the following:
174177
1. Find the the Roslyn signed build you want from [here](https://dnceng.visualstudio.com/internal/_build?definitionId=327&_a=summary). Typically the latest successful build of main is fine.
@@ -195,5 +198,5 @@ The marketplace release is managed by an internal AzDo pipeline. On the pipelin
195198
1. The branch will **always** be main, no matter if release a build from prerelease or release.
196199
2. Uncheck the "test" option.
197200
3. In "Resources", choose "dotnet-vscode-csharp [officialBuildCI]", then check only the build that should be released, and then confirm with "Use selected run". Based on the selected build, it will automatically determine if it is prerelease or release. ![release pipeline image](./docs/release_pipeline.png)
198-
4. The pipeline parameters should then look something like the following image. Hit "Run". ![release pipeline parameters image](./docs/release_pipeline_params.png)
201+
4. The pipeline parameters should then look something like the following image. Hit "Run". ![release pipeline parameters image](./docs/release_pipeline_params.png)
199202
5. After a bit, the pipeline will request approval from an authorized approver before it actually uploads to the marketplace. Hit approve and it will continue.

build.ps1

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env pwsh
2+
3+
Write-Host "`nStarting project setup..." -ForegroundColor Cyan
4+
5+
function Run-Command($cmd, $errorMsg) {
6+
try {
7+
Write-Host "Running: $cmd" -ForegroundColor Yellow
8+
Invoke-Expression $cmd
9+
} catch {
10+
Write-Host "$errorMsg" -ForegroundColor Red
11+
exit 1
12+
}
13+
}
14+
15+
# 1. Install vsts-npm-auth globally
16+
Run-Command "npm install -g vsts-npm-auth" "Failed to install vsts-npm-auth."
17+
18+
# 2. Authenticate with vsts-npm-auth
19+
if (Test-Path ".npmrc") {
20+
try {
21+
Run-Command "vsts-npm-auth -config .npmrc" "Initial authentication failed."
22+
} catch {
23+
Write-Host "Trying with force (-f) flag..." -ForegroundColor DarkYellow
24+
Run-Command "vsts-npm-auth -config .npmrc -f" "Forced authentication failed."
25+
}
26+
} else {
27+
Write-Host ".npmrc file not found in the current directory." -ForegroundColor Red
28+
exit 1
29+
}
30+
31+
# 3. Install project dependencies
32+
Run-Command "npm install" "Failed to install project dependencies."
33+
34+
# 4. Install gulp globally
35+
Run-Command "npm install -g gulp" "Failed to install Gulp globally."
36+
37+
# 5. Run gulp task
38+
Run-Command "gulp installDependencies" "Failed to run 'gulp installDependencies'."
39+
40+
Write-Host "`n✅ Setup complete." -ForegroundColor Green

0 commit comments

Comments
 (0)