diff --git a/.github/actions/create-vsix-feed/action.yml b/.github/actions/create-vsix-feed/action.yml
new file mode 100644
index 00000000..7127c952
--- /dev/null
+++ b/.github/actions/create-vsix-feed/action.yml
@@ -0,0 +1,30 @@
+name: 'VSIX gallery feed creator'
+description: 'Create VSIX private gallery ATOM feed'
+inputs:
+ vsix-directory:
+ description: 'Directory where all VSIX files to include in gallery are located'
+ required: true
+ feed-file:
+ description: 'Path to output feed file and assets'
+ required: false
+ default: './feed.xml'
+ source-path:
+ description: 'Download source path used in the feed file'
+ required: false
+ default: '.'
+ gallery-name:
+ description: 'Custom gallery name'
+ required: false
+ default: 'VSIX gallery'
+runs:
+ using: "composite"
+ steps:
+ - name: Cache PrivateGalleryCreator
+ uses: actions/cache@v4
+ with:
+ path: ${{ github.workspace }}/PrivateGalleryCreator
+ key: ${{ runner.os }}-PrivateGalleryCreator-1.0.64
+
+ - name: Generate gallery feed
+ shell: pwsh
+ run: ${{github.action_path}}/privateGalleryCreator.ps1 -vsixDirectory "${{ inputs.vsix-directory }}" -feedFile "${{ inputs.feed-file }}" -sourcePath "${{ inputs.source-path }}" -galleryName "${{ inputs.gallery-name }}"
\ No newline at end of file
diff --git a/.github/actions/create-vsix-feed/privateGalleryCreator.ps1 b/.github/actions/create-vsix-feed/privateGalleryCreator.ps1
new file mode 100644
index 00000000..00799ffd
--- /dev/null
+++ b/.github/actions/create-vsix-feed/privateGalleryCreator.ps1
@@ -0,0 +1,22 @@
+param(
+ $vsixDirectory,
+ $feedFile,
+ $sourcePath,
+ $galleryName
+)
+
+$downloadUrl = "https://github.com/madskristensen/PrivateGalleryCreator/releases/download/1.0.64/PrivateGalleryCreator.zip"
+$creatorFolder = Join-Path $env:GITHUB_WORKSPACE "PrivateGalleryCreator"
+$zipFile = Join-Path $creatorFolder "PrivateGalleryCreator.zip"
+$exePath = Join-Path $creatorFolder "PrivateGalleryCreator.exe"
+
+if (!(Test-Path -Path $exePath -PathType Leaf)) {
+ md -Force $creatorFolder | Out-Null
+ Invoke-WebRequest $downloadUrl -OutFile $zipFile
+ Expand-Archive $zipFile -DestinationPath $creatorFolder
+ Remove-Item $zipFile
+}
+
+$prm = "--input=""$vsixDirectory"" --output=""$feedFile"" --source=""$sourcePath"" --name=""$galleryName"" --terminate"
+
+Start-Process -FilePath $exePath -ArgumentList $prm -Wait -NoNewWindow
\ No newline at end of file
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 00000000..c9c2081a
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,81 @@
+name: Build and test extension
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+ branches: [main]
+
+# concurrency prevents multiple instances of the workflow from running at the same time,
+# using `cancel-in-progress` to cancel any existing runs.
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ build:
+ runs-on: 16gb_16_core_large_window_runner
+ # do we want to run this on forks?
+ if: github.repository_owner == 'sourcegraph'
+ env:
+ NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
+ Configuration: Debug
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Add msbuild
+ uses: microsoft/setup-msbuild@v2
+
+ - name: Cache nuget
+ uses: actions/cache@v4
+ with:
+ path: ${{ github.workspace }}/.nuget/packages
+ key: ${{ runner.os }}-nuget-${{ github.sha }}
+ restore-keys: ${{ runner.os }}-nuget-
+
+ - name: Cache agent
+ id: cache-agent
+ uses: actions/cache@v4
+ with:
+ path: src/Cody.VisualStudio/Agent
+ key: ${{ runner.os }}-agent-${{ hashFiles('agent/agent.version') }}
+
+ - name: Build agent if needed
+ if: ${{ steps.cache-agent.outputs.cache-hit != 'true' }}
+ shell: pwsh
+ run: ./agent/runBuildAgent.ps1
+
+ - name: Build extension (${{ env.Configuration }})
+ run: msbuild src/Cody.sln -t:Build -restore -verbosity:minimal -property:Configuration=${{ env.Configuration }}
+
+ - name: Upload Cody.VisualStudio.vsix artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: Cody.VisualStudio.vsix
+ path: src/Cody.VisualStudio/bin/${{ env.Configuration }}/Cody.VisualStudio.vsix
+
+ #Running tests
+
+ - name: Change Screen Resolution
+ shell: pwsh
+ run: Set-DisplayResolution -Width 1920 -Height 1080 -Force
+
+ - name: Run tests
+ env:
+ Access_Token_UI_Tests: ${{ secrets.SRC_ACCESS_TOKEN_DOTCOM }}
+ run: dotnet test src/*Tests/bin/${{ env.Configuration }}/*.Tests.dll --logger:trx --verbosity detailed
+
+ - name: Upload screenshots for UI tests
+ uses: actions/upload-artifact@v4
+ if: always()
+ with:
+ name: UI Tests Screenshots
+ path: src/Cody.VisualStudio.Tests/bin/${{ env.Configuration }}/Screenshots
+ retention-days: 20
+
+ - name: Publish Test Results
+ uses: EnricoMi/publish-unit-test-result-action/windows@v2
+ if: always()
+ with:
+ files: TestResults/**/*.trx
diff --git a/.github/workflows/cake-build.yml b/.github/workflows/cake-build.yml
deleted file mode 100644
index 66a73b38..00000000
--- a/.github/workflows/cake-build.yml
+++ /dev/null
@@ -1,91 +0,0 @@
-name: Cake Build
-
-on:
- push:
- branches: [main]
- pull_request:
- branches: [main]
- workflow_dispatch:
-
-# concurrency prevents multiple instances of the workflow from running at the same time,
-# using `cancel-in-progress` to cancel any existing runs.
-concurrency:
- group: ${{ github.workflow }}-${{ github.ref }}
- cancel-in-progress: true
-
-jobs:
- build:
- # this now uses a dedicated large runner from GitHub running the following specs:
- # 8-core, 32GB RAM, 300GB SSD
- # https://github.com/organizations/sourcegraph/settings/actions/runner-groups/6
- runs-on: 16gb_16_core_large_window_runner
- # do we want to run this on forks?
- if: github.repository_owner == 'sourcegraph'
-
- steps:
- - uses: actions/checkout@v3
-
- - name: Add msbuild to PATH
- uses: microsoft/setup-msbuild@v1.3
-
- - name: Change Screen Resolution
- shell: pwsh
- run: Set-DisplayResolution -Width 1920 -Height 1080 -Force
-
- - name: ⚙️ Prepare Visual Studio
- run: '&"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\devenv.exe" /RootSuffix Exp /ResetSettings General.vssettings'
-
- - name: Install Cake.Tool
- run: dotnet tool install --global Cake.Tool
-
- - name: Restore NuGet packages
- run: nuget restore src\Cody.Core\Cody.Core.csproj -PackagesDirectory src\packages
-
- - name: Common Build Setup
- run: |
- cd src
- dotnet tool restore
- corepack enable
-
- - name: Build Cody Agent if needed
- run: |
- cd src
- corepack install --global pnpm@8.6.7
- dotnet cake --target=BuildCodyAgentIfNeeded
-
- - name: Cache cody-dist
- uses: actions/cache@v3
- with:
- path: cody-dist/agent
- key: ${{ runner.os }}-cody-dist-${{ github.sha }}
- restore-keys: |
- ${{ runner.os }}-cody-dist-
-
- - name: Build Extension (Debug)
- run: |
- cd src
- dotnet cake --target=BuildDebug
-
- - name: Tests
- env:
- Access_Token_UI_Tests: ${{ secrets.SRC_ACCESS_TOKEN_DOTCOM }}
- run: |
- cd src
- dotnet test .\Cody.Core.Tests\bin\Debug\Cody.Core.Tests.dll .\Cody.VisualStudio.Tests\bin\Debug\Cody.VisualStudio.Tests.dll -v detailed -l:trx
-
- - name: Upload screenshots for UI tests
- uses: actions/upload-artifact@v4
- if: always()
- with:
- name: UI Tests Screenshots
- path: src/Cody.VisualStudio.Tests/bin/Debug/Screenshots
- retention-days: 20
-
- - name: Publish Test Results
- uses: EnricoMi/publish-unit-test-result-action/windows@v2
- if: always()
- with:
- files: |
- src\TestResults/**/*.xml
- src\TestResults/**/*.trx
- src\TestResults/**/*.json
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index c20c856b..e10ed5cc 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -3,7 +3,7 @@ name: Nightly Build
on:
schedule:
- cron: "0 2 * * *" # Runs at 2 AM UTC every day
- workflow_dispatch: # Allows manual triggering
+ workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -13,63 +13,79 @@ jobs:
build:
runs-on: 16gb_16_core_large_window_runner
if: github.repository_owner == 'sourcegraph'
+ env:
+ NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
+ Configuration: Debug
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- - name: Add msbuild to PATH
- uses: microsoft/setup-msbuild@v1.3
+ - name: Add msbuild
+ uses: microsoft/setup-msbuild@v2
+
+ - name: Cache nuget
+ uses: actions/cache@v4
+ with:
+ path: ${{ github.workspace }}/.nuget/packages
+ key: ${{ runner.os }}-nuget-${{ github.sha }}
+ restore-keys: ${{ runner.os }}-nuget-
+
+ - name: Find the latest tag in Cody repository
+ uses: oprypin/find-latest-tag@v1.1.2
+ id: cody
+ with:
+ repository: sourcegraph/cody
+ prefix: vscode-
+
+ - name: Hash tag name
+ uses: pplanel/hash-calculator-action@v1.3.2
+ id: cody-hash
+ with:
+ input: ${{ steps.cody.outputs.tag }}
+
+ - name: Cache agent
+ id: cache-agent
+ uses: actions/cache@v4
+ with:
+ path: src/Cody.VisualStudio/Agent
+ key: ${{ runner.os }}-agent-${{ steps.cody-hash.outputs.digest }}
+
+ - name: Build agent if needed (tag ${{ steps.cody.outputs.tag }})
+ if: ${{ steps.cache-agent.outputs.cache-hit != 'true' }}
+ shell: pwsh
+ run: ./agent/buildAgent.ps1 -version ${{ steps.cody.outputs.tag }}
+
+ - name: Build extension (${{ env.Configuration }})
+ run: msbuild src/Cody.sln -t:Build -restore -verbosity:minimal -property:Configuration=${{ env.Configuration }}
+
+ - name: Upload Cody.VisualStudio.vsix artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: Cody.VisualStudio.vsix
+ path: src/Cody.VisualStudio/bin/${{ env.Configuration }}/Cody.VisualStudio.vsix
+ retention-days: 20
+
+ #Running tests
- name: Change Screen Resolution
shell: pwsh
run: Set-DisplayResolution -Width 1920 -Height 1080 -Force
-
- - name: ⚙️ Prepare Visual Studio
- run: '&"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\devenv.exe" /RootSuffix Exp /ResetSettings General.vssettings'
-
- - name: Install Cake.Tool
- run: dotnet tool install --global Cake.Tool
-
- - name: Restore NuGet packages
- run: nuget restore src\Cody.Core\Cody.Core.csproj -PackagesDirectory src\packages
-
- - name: Common Build Setup
- run: |
- cd src
- dotnet tool restore
- corepack enable
-
- - name: Build Cody Agent (main branch)
- run: |
- cd src
- corepack install --global pnpm@8.6.7
- dotnet cake --target=BuildCodyAgent --cody-branch=main
-
- - name: Build Extension (Debug)
- run: |
- cd src
- dotnet cake --target=BuildDebug
-
- - name: Tests
+
+ - name: Run tests
env:
Access_Token_UI_Tests: ${{ secrets.SRC_ACCESS_TOKEN_DOTCOM }}
- run: |
- cd src
- dotnet test .\Cody.VisualStudio.Tests\bin\Debug\Cody.VisualStudio.Tests.dll -v detailed -l:trx
-
+ run: dotnet test src/*Tests/bin/${{ env.Configuration }}/*.Tests.dll --logger:trx --verbosity detailed
+
- name: Upload screenshots for UI tests
uses: actions/upload-artifact@v4
if: always()
with:
name: UI Tests Screenshots
- path: src/Cody.VisualStudio.Tests/bin/Debug/Screenshots
- retention-days: 5
+ path: src/Cody.VisualStudio.Tests/bin/${{ env.Configuration }}/Screenshots
+ retention-days: 20
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/windows@v2
if: always()
with:
- files: |
- src\TestResults/**/*.xml
- src\TestResults/**/*.trx
- src\TestResults/**/*.json
+ files: TestResults/**/*.trx
\ No newline at end of file
diff --git a/.github/workflows/publish-preview.yml b/.github/workflows/publish-preview.yml
new file mode 100644
index 00000000..8436d29f
--- /dev/null
+++ b/.github/workflows/publish-preview.yml
@@ -0,0 +1,135 @@
+name: Publish preview
+
+on:
+ push:
+ tags:
+ - preview-v*.*.*
+
+# concurrency prevents multiple instances of the workflow from running at the same time,
+# using `cancel-in-progress` to cancel any existing runs.
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ build:
+ runs-on: 16gb_16_core_large_window_runner
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
+ permissions:
+ contents: write
+ pages: write
+ id-token: write
+ checks: write
+ pull-requests: write
+ # do we want to run this on forks?
+ if: github.repository_owner == 'sourcegraph'
+ env:
+ NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
+ Configuration: Release
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Extract version from tag
+ uses: nowsprinting/check-version-format-action@v4.0.3
+ id: version
+ with:
+ prefix: preview-v
+
+ - name: Add msbuild
+ uses: microsoft/setup-msbuild@v2
+
+ - name: Cache nuget
+ uses: actions/cache@v4
+ with:
+ path: ${{ github.workspace }}/.nuget/packages
+ key: ${{ runner.os }}-nuget-${{ github.sha }}
+ restore-keys: ${{ runner.os }}-nuget-
+
+ - name: Cache agent
+ id: cache-agent
+ uses: actions/cache@v4
+ with:
+ path: src/Cody.VisualStudio/Agent
+ key: ${{ runner.os }}-agent-${{ hashFiles('agent/agent.version') }}
+
+ - name: Build agent if needed
+ if: ${{ steps.cache-agent.outputs.cache-hit != 'true' }}
+ shell: pwsh
+ run: ./agent/runBuildAgent.ps1
+
+ - name: Set version on AssemblyInfo.cs files
+ uses: dannevesdantas/set-version-assemblyinfo@v.1.0.0
+ with:
+ version: ${{ steps.version.outputs.full_without_prefix }}
+ path: src/
+
+ - name: Set version for .vsixmanifest file
+ uses: cezarypiatek/VsixVersionAction@1.2
+ with:
+ version: ${{ steps.version.outputs.full_without_prefix }}
+ vsix-manifest-file: src\Cody.VisualStudio\source.extension.vsixmanifest
+
+ - name: Build extension (${{ env.Configuration }})
+ run: msbuild src/Cody.sln -t:Build -restore -verbosity:minimal -property:Configuration=${{ env.Configuration }}
+
+ - name: Upload Cody.VisualStudio.vsix artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: Cody.VisualStudio.vsix
+ path: src/Cody.VisualStudio/bin/${{ env.Configuration }}/Cody.VisualStudio.vsix
+
+ #Running tests
+
+ - name: Change Screen Resolution
+ shell: pwsh
+ run: Set-DisplayResolution -Width 1920 -Height 1080 -Force
+
+ - name: Run tests
+ env:
+ Access_Token_UI_Tests: ${{ secrets.SRC_ACCESS_TOKEN_DOTCOM }}
+ WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS: '--remote-debugging-port=9222'
+ run: dotnet test src/*Tests/bin/${{ env.Configuration }}/*.Tests.dll --logger:trx --verbosity detailed
+
+ - name: Upload screenshots for UI tests
+ uses: actions/upload-artifact@v4
+ if: always()
+ with:
+ name: UI Tests Screenshots
+ path: src/Cody.VisualStudio.Tests/bin/${{ env.Configuration }}/Screenshots
+ retention-days: 10
+
+ - name: Publish Test Results
+ uses: EnricoMi/publish-unit-test-result-action/windows@v2
+ if: always()
+ with:
+ files: TestResults/**/*.trx
+
+ #Publish
+
+ - name: Create GitHub release
+ uses: ncipollo/release-action@v1.14.0
+ with:
+ tag: ${{ steps.version.outputs.full }}
+ name: Cody for Visual Studio ${{ steps.version.outputs.full_without_prefix }}
+ prerelease: true
+ artifacts: src/Cody.VisualStudio/bin/${{ env.Configuration }}/Cody.VisualStudio.vsix
+
+ - name: Create custom VSIX feed
+ uses: ./.github/actions/create-vsix-feed
+ with:
+ vsix-directory: src/Cody.VisualStudio/bin/${{ env.Configuration }}
+ feed-file: feed/feed.xml
+ source-path: https://github.com/sourcegraph/cody-vs/releases/download/${{ steps.version.outputs.full }}/
+ gallery-name: "Sourcegraph preview gallery"
+
+ - name: Upload feed files as artifact
+ uses: actions/upload-pages-artifact@v3
+ with:
+ name: vsix-gallery-feed
+ path: feed/
+
+ - name: Deploy feed to GitHub Pages
+ uses: actions/deploy-pages@v4
+ with:
+ artifact_name: vsix-gallery-feed
\ No newline at end of file
diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml
new file mode 100644
index 00000000..61be43cf
--- /dev/null
+++ b/.github/workflows/publish-release.yml
@@ -0,0 +1,116 @@
+name: Publish release
+
+on:
+ push:
+ tags:
+ - release-v*.*.*
+
+# concurrency prevents multiple instances of the workflow from running at the same time,
+# using `cancel-in-progress` to cancel any existing runs.
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ build:
+ runs-on: 16gb_16_core_large_window_runner
+ # do we want to run this on forks?
+ if: github.repository_owner == 'sourcegraph'
+ env:
+ NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
+ Configuration: Release
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Extract version from tag
+ uses: nowsprinting/check-version-format-action@v4.0.3
+ id: version
+ with:
+ prefix: release-v
+
+ - name: Add msbuild
+ uses: microsoft/setup-msbuild@v2
+
+ - name: Cache nuget
+ uses: actions/cache@v4
+ with:
+ path: ${{ github.workspace }}/.nuget/packages
+ key: ${{ runner.os }}-nuget-${{ github.sha }}
+ restore-keys: ${{ runner.os }}-nuget-
+
+ - name: Cache agent
+ id: cache-agent
+ uses: actions/cache@v4
+ with:
+ path: src/Cody.VisualStudio/Agent
+ key: ${{ runner.os }}-agent-${{ hashFiles('agent/agent.version') }}
+
+ - name: Build agent if needed
+ if: ${{ steps.cache-agent.outputs.cache-hit != 'true' }}
+ shell: pwsh
+ run: ./agent/runBuildAgent.ps1
+
+ - name: Set version on AssemblyInfo.cs files
+ uses: dannevesdantas/set-version-assemblyinfo@v.1.0.0
+ with:
+ version: ${{ steps.version.outputs.full_without_prefix }}
+ path: src/
+
+ - name: Set version for .vsixmanifest file
+ uses: cezarypiatek/VsixVersionAction@1.2
+ with:
+ version: ${{ steps.version.outputs.full_without_prefix }}
+ vsix-manifest-file: src\Cody.VisualStudio\source.extension.vsixmanifest
+
+ - name: Build extension (${{ env.Configuration }})
+ run: msbuild src/Cody.sln -t:Build -restore -verbosity:minimal -property:Configuration=${{ env.Configuration }}
+
+ - name: Upload Cody.VisualStudio.vsix artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: Cody.VisualStudio.vsix
+ path: src/Cody.VisualStudio/bin/${{ env.Configuration }}/Cody.VisualStudio.vsix
+
+ #Running tests
+
+ - name: Change Screen Resolution
+ shell: pwsh
+ run: Set-DisplayResolution -Width 1920 -Height 1080 -Force
+
+ - name: Run tests
+ env:
+ Access_Token_UI_Tests: ${{ secrets.SRC_ACCESS_TOKEN_DOTCOM }}
+ WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS: '--remote-debugging-port=9222'
+ run: dotnet test src/*Tests/bin/${{ env.Configuration }}/*.Tests.dll --logger:trx --verbosity detailed
+
+ - name: Upload screenshots for UI tests
+ uses: actions/upload-artifact@v4
+ if: always()
+ with:
+ name: UI Tests Screenshots
+ path: src/Cody.VisualStudio.Tests/bin/${{ env.Configuration }}/Screenshots
+ retention-days: 20
+
+ - name: Publish Test Results
+ uses: EnricoMi/publish-unit-test-result-action/windows@v2
+ if: always()
+ with:
+ files: TestResults/**/*.trx
+
+ #Publish
+
+ - name: Create GitHub release
+ uses: ncipollo/release-action@v1.14.0
+ with:
+ tag: ${{ steps.version.outputs.full }}
+ name: Cody for Visual Studio ${{ steps.version.outputs.full_without_prefix }}
+ prerelease: false
+ artifacts: src/Cody.VisualStudio/bin/${{ env.Configuration }}/Cody.VisualStudio.vsix
+
+ - name: Publish to Visual Studio Marketplace
+ uses: cezarypiatek/VsixPublisherAction@1.1
+ with:
+ extension-file: src/Cody.VisualStudio/bin/${{ env.Configuration }}/Cody.VisualStudio.vsix
+ publish-manifest-file: src\Cody.VisualStudio\publishManifest.json
+ personal-access-code: ${{ secrets.CODY_VS_MARKETPLACE_RELEASE_TOKEN }}
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
deleted file mode 100644
index 576fb7ac..00000000
--- a/.github/workflows/publish.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-name: Publish
-
-on:
- push:
- tags:
- - v*
-
-jobs:
- release:
- if: github.repository == 'sourcegraph/cody-vs'
- runs-on: windows-latest
- permissions:
- contents: write
- steps:
- - uses: actions/checkout@v4
-
- - name: Add msbuild to PATH
- uses: microsoft/setup-msbuild@v1.3
-
- - name: Install Cake.Tool
- run: dotnet tool install --global Cake.Tool
-
- - name: Restore NuGet packages
- run: nuget restore src\Cody.Core\Cody.Core.csproj -PackagesDirectory src\packages
-
- - name: Run Cake script
- env:
- CODY_VS_MARKETPLACE_RELEASE_TOKEN: ${{ secrets.CODY_VS_MARKETPLACE_RELEASE_TOKEN }}
- run: |
- cd src
- dotnet tool restore
- corepack enable
- corepack install --global pnpm@8.6.7
-
- - name: Publish to marketplace
- env:
- CODY_VS_MARKETPLACE_RELEASE_TOKEN: ${{ secrets.CODY_VS_MARKETPLACE_RELEASE_TOKEN }}
- run: dotnet cake --target Publish
diff --git a/.github/workflows/release-preview.yml b/.github/workflows/release-preview.yml
deleted file mode 100644
index 205cec81..00000000
--- a/.github/workflows/release-preview.yml
+++ /dev/null
@@ -1,56 +0,0 @@
-name: GitHub Release
-
-on:
- push:
- tags:
- - v*
-
-jobs:
- release:
- if: github.repository == 'sourcegraph/cody-vs'
- runs-on: windows-latest
- permissions:
- contents: write
- steps:
- - uses: actions/checkout@v4
-
- - name: Add msbuild to PATH
- uses: microsoft/setup-msbuild@v1.3
-
- - name: Install Cake.Tool
- run: dotnet tool install --global Cake.Tool
-
- - name: Restore NuGet packages
- run: nuget restore src\Cody.Core\Cody.Core.csproj -PackagesDirectory src\packages
-
- - name: Run Cake script
- env:
- CODY_VS_MARKETPLACE_RELEASE_TOKEN: ${{ secrets.CODY_VS_MARKETPLACE_RELEASE_TOKEN }}
- run: |
- cd src
- dotnet tool restore
- corepack enable
- corepack install --global pnpm@8.6.7
- dotnet cake
-
- - name: Create GitHub Release
- id: create_release
- uses: actions/create-release@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- tag_name: ${{ github.ref }}
- release_name: Release ${{ github.ref }}
- draft: false
- prerelease: true
-
- - name: Upload Release Asset
- id: upload-release-asset
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- upload_url: ${{ steps.create_release.outputs.upload_url }}
- asset_path: src\Cody.VisualStudio\bin\Release\Cody.VisualStudio.vsix
- asset_name: Cody.VisualStudio.vsix
- asset_content_type: application/zip
diff --git a/.gitignore b/.gitignore
index 653e2430..99b54483 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,8 +2,8 @@
src/Cody.VisualStudio/Agent/
src/Tools/Addins/
src/tools
-node-binaries/
-cody-dist/
+agent/node/
+agent/cody/
diff --git a/agent/agent.version b/agent/agent.version
new file mode 100644
index 00000000..e535b337
--- /dev/null
+++ b/agent/agent.version
@@ -0,0 +1 @@
+vscode-v1.42.x
\ No newline at end of file
diff --git a/agent/buildAgent.ps1 b/agent/buildAgent.ps1
new file mode 100644
index 00000000..e8329a85
--- /dev/null
+++ b/agent/buildAgent.ps1
@@ -0,0 +1,120 @@
+param(
+ $agentDir = "$PSScriptRoot",
+ $outputDir = "$PSScriptRoot\..\src\Cody.VisualStudio\Agent",
+ $version = "main",
+ [bool] $skipGit = $false
+)
+
+$codyDir = Join-Path $agentDir "\cody"
+$nodeDir = Join-Path $agentDir "\node"
+
+$codyAgentDir = Join-Path $codyDir "\agent"
+$codyAgentDistDir = Join-Path $codyAgentDir "\dist"
+
+$codyRepo = "https://github.com/sourcegraph/cody.git"
+
+$nodeBinFile = Join-Path $nodeDir "node-win-x64.exe"
+$nodeArmBinFile = Join-Path $nodeDir "node-win-arm64.exe"
+$nodeUrl = "https://github.com/sourcegraph/node-binaries/raw/main/v20.12.2/node-win-x64.exe"
+$nodeArmUrl = "https://github.com/sourcegraph/node-binaries/raw/main/v20.12.2/node-win-arm64.exe"
+
+$exclude = @(
+ "src",
+ "scripts",
+ "*.map",
+ "tree-sitter-bash.wasm",
+ "tree-sitter-dart.wasm",
+ "tree-sitter-elisp.wasm",
+ "tree-sitter-elixir.wasm",
+ "tree-sitter-elm.wasm",
+ "tree-sitter-go.wasm",
+ "tree-sitter-java.wasm",
+ "tree-sitter-kotlin.wasm",
+ "tree-sitter-lua.wasm",
+ "tree-sitter-objc.wasm",
+ "tree-sitter-ocaml.wasm",
+ "tree-sitter-rescript.wasm",
+ "tree-sitter-ruby.wasm",
+ "tree-sitter-rust.wasm",
+ "tree-sitter-scala.wasm",
+ "tree-sitter-swift.wasm",
+ "tree-sitter-php.wasm"
+)
+
+
+if (!(Test-Path -Path $agentDir -PathType Container)) {
+ New-Item -Path $agentDir -ItemType Directory
+ Write-Host "Created $agentDir directory"
+}
+
+if (!(Test-Path -Path $codyDir -PathType Container)) {
+ New-Item -Path $codyDir -ItemType Directory
+ Write-Host "Created $codyDir directory"
+
+}
+
+if($skipGit -eq $false) {
+ $gitDir = Join-Path $codyDir "\.git"
+ if(!(Test-Path -Path $gitDir -PathType Container)) {
+ Write-Host "Cloning repository: $codyRepo"
+ git clone $codyRepo $codyDir 2>&1 | Write-Host
+ }
+
+ git -C $codyDir fetch
+ git -C $codyDir checkout $version
+
+ $isBranch = [string](git -C $codyDir show-ref --verify refs/heads/$version 2>&1)
+ if($isBranch -notlike 'fatal:*') {
+ git -C $codyDir pull
+ Write-Host "Pull branch $version"
+ }
+}
+
+Write-Host "Installing pnpm"
+npm install -g pnpm@8.6.7 2>&1 | Write-Host
+
+
+# Downloading Node executables
+if (!(Test-Path -Path $nodeDir -PathType Container)) {
+ New-Item -Path $nodeDir -ItemType Directory
+ Write-Host "Created $nodeDir directory"
+}
+
+if (!(Test-Path -Path $nodeBinFile -PathType Leaf)) {
+ Write-Host "Downloading $nodeUrl"
+ Invoke-WebRequest -Uri $nodeUrl -OutFile $nodeBinFile
+}
+
+if (!(Test-Path -Path $nodeArmBinFile -PathType Leaf)) {
+ Write-Host "Downloading $nodeArmUrl"
+ Invoke-WebRequest -Uri $nodeArmUrl -OutFile $nodeArmBinFile
+}
+
+#Clear agent\dist
+Write-Host "Clearing $codyAgentDistDir"
+Get-ChildItem -Path $codyAgentDistDir -Recurse | Remove-Item -Recurse
+
+#pnpm install and build
+Push-Location -Path $codyAgentDir
+Write-Host "pnpm install"
+pnpm install 2>&1 | Write-Host
+Write-Host "pnpm build"
+pnpm build 2>&1 | Write-Host
+Pop-Location
+
+if (!(Test-Path -Path $outputDir -PathType Container)) {
+ New-Item -Path $outputDir -ItemType Directory
+ Write-Host "Created $outputDir directory"
+}
+
+# Clear out directory
+Write-Host "Clearing $outputDir"
+Get-ChildItem -Path $outputDir -Recurse | Remove-Item -Recurse
+
+# Coping artifacts
+Write-Host "Coping artifacts to $outputDir directory"
+Copy-Item "$codyAgentDistDir\*" -Destination $outputDir -Recurse -Exclude $exclude
+Copy-Item $nodeBinFile -Destination $outputDir
+Copy-Item $nodeArmBinFile -Destination $outputDir
+
+
diff --git a/agent/runBuildAgent.ps1 b/agent/runBuildAgent.ps1
new file mode 100644
index 00000000..398c80d2
--- /dev/null
+++ b/agent/runBuildAgent.ps1
@@ -0,0 +1,2 @@
+$version = Get-Content -Path "$PSScriptRoot\agent.version"
+& "$PSScriptRoot\buildAgent.ps1" -version $version -agentDir $PSScriptRoot -outputDir "$PSScriptRoot\..\src\Cody.VisualStudio\Agent"
\ No newline at end of file
diff --git a/src/.config/dotnet-tools.json b/src/.config/dotnet-tools.json
deleted file mode 100644
index faad67b5..00000000
--- a/src/.config/dotnet-tools.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "version": 1,
- "isRoot": true,
- "tools": {
- "cake.tool": {
- "version": "4.0.0",
- "commands": [
- "dotnet-cake"
- ],
- "rollForward": false
- }
- }
-}
\ No newline at end of file
diff --git a/src/Cody.Core.Tests/Cody.Core.Tests.csproj b/src/Cody.Core.Tests/Cody.Core.Tests.csproj
index 7a345af3..619969c6 100644
--- a/src/Cody.Core.Tests/Cody.Core.Tests.csproj
+++ b/src/Cody.Core.Tests/Cody.Core.Tests.csproj
@@ -45,9 +45,6 @@
-
- Properties\AssemblyVersion.cs
-
diff --git a/src/Cody.Core.Tests/Properties/AssemblyInfo.cs b/src/Cody.Core.Tests/Properties/AssemblyInfo.cs
index 94b3cfd9..de2da6fe 100644
--- a/src/Cody.Core.Tests/Properties/AssemblyInfo.cs
+++ b/src/Cody.Core.Tests/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
@@ -29,4 +28,4 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.*")]
diff --git a/src/Cody.Core/Cody.Core.csproj b/src/Cody.Core/Cody.Core.csproj
index 7a84f3e8..ecb21544 100644
--- a/src/Cody.Core/Cody.Core.csproj
+++ b/src/Cody.Core/Cody.Core.csproj
@@ -46,9 +46,6 @@
-
- Properties\AssemblyVersion.cs
-
diff --git a/src/Cody.Core/Properties/AssemblyInfo.cs b/src/Cody.Core/Properties/AssemblyInfo.cs
index 3d7f08d4..1dea546d 100644
--- a/src/Cody.Core/Properties/AssemblyInfo.cs
+++ b/src/Cody.Core/Properties/AssemblyInfo.cs
@@ -29,5 +29,9 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.*")]
+
+[assembly: AssemblyCopyright("Copyright © 2024-present Sourcegraph Inc.")]
+[assembly: AssemblyCompany("Sourcegraph Inc.")]
+
[assembly: InternalsVisibleTo("Cody.Core.Tests")]
diff --git a/src/Cody.UI/Cody.UI.csproj b/src/Cody.UI/Cody.UI.csproj
index d6dd0e5d..a77ccaa3 100644
--- a/src/Cody.UI/Cody.UI.csproj
+++ b/src/Cody.UI/Cody.UI.csproj
@@ -46,9 +46,6 @@
-
- Properties\AssemblyVersion.cs
-
GeneralOptionsControl.xaml
diff --git a/src/Cody.UI/Properties/AssemblyInfo.cs b/src/Cody.UI/Properties/AssemblyInfo.cs
index 6bf0390c..bd5ef7ce 100644
--- a/src/Cody.UI/Properties/AssemblyInfo.cs
+++ b/src/Cody.UI/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
@@ -29,4 +28,7 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.*")]
+
+[assembly: AssemblyCopyright("Copyright © 2024-present Sourcegraph Inc.")]
+[assembly: AssemblyCompany("Sourcegraph Inc.")]
diff --git a/src/Cody.VisualStudio.Tests/Cody.VisualStudio.Tests.csproj b/src/Cody.VisualStudio.Tests/Cody.VisualStudio.Tests.csproj
index d0976726..7a2c4fef 100644
--- a/src/Cody.VisualStudio.Tests/Cody.VisualStudio.Tests.csproj
+++ b/src/Cody.VisualStudio.Tests/Cody.VisualStudio.Tests.csproj
@@ -48,9 +48,6 @@
-
- Properties\AssemblyVersion.cs
-
diff --git a/src/Cody.VisualStudio.Tests/Properties/AssemblyInfo.cs b/src/Cody.VisualStudio.Tests/Properties/AssemblyInfo.cs
index 684744d2..23f8e01b 100644
--- a/src/Cody.VisualStudio.Tests/Properties/AssemblyInfo.cs
+++ b/src/Cody.VisualStudio.Tests/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Xunit;
@@ -30,7 +29,8 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.*")]
+
[assembly: TestFramework("Xunit.VsTestFramework", "VsixTesting.Xunit")]
[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly, DisableTestParallelization = true, MaxParallelThreads = 1)]
[assembly: VsTestSettings(TakeScreenshotOnFailure = true)]
diff --git a/src/Cody.VisualStudio/Cody.VisualStudio.csproj b/src/Cody.VisualStudio/Cody.VisualStudio.csproj
index f919e046..ec021569 100644
--- a/src/Cody.VisualStudio/Cody.VisualStudio.csproj
+++ b/src/Cody.VisualStudio/Cody.VisualStudio.csproj
@@ -64,7 +64,6 @@
-
@@ -88,9 +87,7 @@
Always
true
-
- PreserveNewest
-
+
PreserveNewest
diff --git a/src/Cody.VisualStudio/Infrastructure/LoggerFactory.cs b/src/Cody.VisualStudio/Infrastructure/LoggerFactory.cs
index 24f0fff0..eb157d70 100644
--- a/src/Cody.VisualStudio/Infrastructure/LoggerFactory.cs
+++ b/src/Cody.VisualStudio/Infrastructure/LoggerFactory.cs
@@ -47,9 +47,8 @@ public ILog Create(string outputName = null)
_versionService.AddBuildMetadata(build, isDebug);
var version = _versionService.Full;
- var buildDate = _versionService.BuildDate;
var debugOrRelease = _versionService.IsDebug ? "Debug" : "Release";
- logger.Info($"Version: {version} {debugOrRelease} build (compiled: {buildDate:G})");
+ logger.Info($"Version: {version} {debugOrRelease} build");
}
else
{
diff --git a/src/Cody.VisualStudio/Properties/AssemblyInfo.cs b/src/Cody.VisualStudio/Properties/AssemblyInfo.cs
index de58f611..78887b4e 100644
--- a/src/Cody.VisualStudio/Properties/AssemblyInfo.cs
+++ b/src/Cody.VisualStudio/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
using System.Reflection;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
@@ -26,4 +25,7 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.*")]
+
+[assembly: AssemblyCopyright("Copyright © 2024-present Sourcegraph Inc.")]
+[assembly: AssemblyCompany("Sourcegraph Inc.")]
diff --git a/src/Cody.VisualStudio/Properties/AssemblyVersion.cs b/src/Cody.VisualStudio/Properties/AssemblyVersion.cs
deleted file mode 100644
index cd073392..00000000
--- a/src/Cody.VisualStudio/Properties/AssemblyVersion.cs
+++ /dev/null
@@ -1,5 +0,0 @@
-using System.Reflection;
-
-[assembly: AssemblyVersion("0.1.*")]
-[assembly: AssemblyCopyright("Copyright © 2024-present Sourcegraph Inc.")]
-[assembly: AssemblyCompany("Sourcegraph Inc.")]
diff --git a/src/Cody.VisualStudio/Marketplace/manifest.json b/src/Cody.VisualStudio/publishManifest.json
similarity index 100%
rename from src/Cody.VisualStudio/Marketplace/manifest.json
rename to src/Cody.VisualStudio/publishManifest.json
diff --git a/src/Cody.sln b/src/Cody.sln
index 7f70471f..731601e0 100644
--- a/src/Cody.sln
+++ b/src/Cody.sln
@@ -21,12 +21,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cody.AgentTester", "Cody.Ag
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D606EDCF-C31F-4C52-B8E7-68F87CCF91CF}"
ProjectSection(SolutionItems) = preProject
- build.cake = build.cake
- ..\.github\workflows\cake-build.yml = ..\.github\workflows\cake-build.yml
+ ..\.github\workflows\build.yml = ..\.github\workflows\build.yml
..\.github\workflows\code-style.yml = ..\.github\workflows\code-style.yml
..\.github\workflows\nightly.yml = ..\.github\workflows\nightly.yml
- ..\.github\workflows\publish.yml = ..\.github\workflows\publish.yml
- ..\.github\workflows\release-preview.yml = ..\.github\workflows\release-preview.yml
+ ..\.github\workflows\publish-preview.yml = ..\.github\workflows\publish-preview.yml
+ ..\.github\workflows\publish-release.yml = ..\.github\workflows\publish-release.yml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cody.Core.Tests", "Cody.Core.Tests\Cody.Core.Tests.csproj", "{9B46B477-E57A-4F19-A240-56D5D3C7EE8F}"
diff --git a/src/build.cake b/src/build.cake
deleted file mode 100644
index ec4524b8..00000000
--- a/src/build.cake
+++ /dev/null
@@ -1,269 +0,0 @@
-#addin nuget:?package=Cake.Git&version=4.0.0
-#addin nuget:?package=Cake.Pnpm&version=1.0.0
-#tool nuget:?package=vswhere&version=3.1.7
-
-var target = Argument("target", "Build");
-var configuration = Argument("configuration", "Release");
-
-var agentDir = Directory("./Cody.VisualStudio/Agent");
-var agentWebViewDir = agentDir + Directory("webviews");
-var codyDevDir = Directory("../../cody");
-var codyDir = Directory("../cody-dist");
-var nodeBinariesDir = Directory("../node-binaries");
-var nodeExeFile = nodeBinariesDir + File("node-win-x64.exe");
-var nodeArmExeFile = nodeBinariesDir + File("node-win-arm64.exe");
-var solutionDir = MakeAbsolute(Context.Environment.WorkingDirectory);
-var buildDir = solutionDir + Directory($"Cody.VisualStudio/bin/{configuration}");
-var buildExtensionFile = buildDir + File("Cody.VisualStudio.vsix");
-var publishManifestFile = buildDir + File("Marketplace/manifest.json");
-
-var vsixPublisherFile = VSWhereLatest() + File("/VSSDK/VisualStudioIntegration/Tools/Bin/VsixPublisher.exe");
-
-var notIncludeFiles = new string[]
-{
- "tree-sitter-bash.wasm",
- "tree-sitter-dart.wasm",
- "tree-sitter-elisp.wasm",
- "tree-sitter-elixir.wasm",
- "tree-sitter-elm.wasm",
- "tree-sitter-go.wasm",
- "tree-sitter-java.wasm",
- "tree-sitter-kotlin.wasm",
- "tree-sitter-lua.wasm",
- "tree-sitter-objc.wasm",
- "tree-sitter-ocaml.wasm",
- "tree-sitter-rescript.wasm",
- "tree-sitter-ruby.wasm",
- "tree-sitter-rust.wasm",
- "tree-sitter-scala.wasm",
- "tree-sitter-swift.wasm",
- "tree-sitter-php.wasm"
-};
-
-
-var codyRepo = "https://github.com/sourcegraph/cody.git";
-var nodeBinaryUrl = "https://github.com/sourcegraph/node-binaries/raw/main/v20.12.2/node-win-x64.exe";
-var nodeArmBinaryUrl = "https://github.com/sourcegraph/node-binaries/raw/main/v20.12.2/node-win-arm64.exe";
-
-// The latest tag of the stable release from the cody repository https://github.com/sourcegraph/cody/tags
-var codyStableReleaseTag = "vscode-v1.38.3";
-var codyBranch = Argument("cody-branch", codyStableReleaseTag);
-
-var marketplaceToken = EnvironmentVariable("CODY_VS_MARKETPLACE_RELEASE_TOKEN");
-
-//////////////////////////////////////////////////////////////////////
-// TASKS
-//////////////////////////////////////////////////////////////////////
-
-Task("BuildCodyAgent")
- .Does(() =>
-{
-
- // Check for the env var to see if we should use the local cody directory.
- // This is used to build the agent from the local cody directory instead of cloning from github.
- var isDevMode = EnvironmentVariable("CODY_VS_DEV_PORT") == "3113";
- if (isDevMode && DirectoryExists(codyDevDir))
- {
- Information($"--> Running in DevMode using:'{codyDir}'");
- codyDir = codyDevDir;
- }
-
- var codyAgentDir = MakeAbsolute(codyDir + Directory("agent"));
- var codyAgentDistDir = codyAgentDir + Directory("dist");
- var branchName = "main";
-
- if (!DirectoryExists(codyDir) || !GitIsValidRepository(codyDir))
- {
- Information($"--> Cloning repository:'{codyRepo}'");
- GitClone(codyRepo, codyDir, new GitCloneSettings { BranchName = branchName });
- }
-
- if (!isDevMode)
- {
-
- if (DirectoryExists(codyDir))
- {
- Information($"--> Switching to branch {branchName} ...");
- GitCheckout(codyDir, branchName);
- }
-
- Information($"--> git pull ...");
- GitPull(codyDir, "cake", "cake@cake.com", "", "", "origin");
-
- Information($"--> Checkout '{branchName}' ...");
- GitCheckout(codyDir, branchName);
-
- Information($"--> Fetching all tags...");
- GitFetchTags(codyDir, "origin");
-
- Information($"--> Checkout specified branch or tag: {codyBranch} ...");
- GitCheckout(codyDir, codyBranch);
- }
-
- Information($"--> Cleaning '{codyAgentDistDir}' ...");
- CleanDirectory(codyAgentDistDir);
-
- Context.Environment.WorkingDirectory = codyAgentDir;
-
- Information($"--> pnpm install ...");
- PnpmInstall();
-
- Information($"--> pnpm build ...");
- PnpmRun("build");
-
- Context.Environment.WorkingDirectory = solutionDir;
-
- var deleteSettings = new DeleteDirectorySettings
- {
- Recursive = true,
- Force = true
- };
- Information($"--> Cleaning '{agentDir}' ...");
- CleanDirectory(agentDir);
-
- Information($"--> Copying the agent to '{agentDir}'");
- CreateDirectory(agentDir);
- CopyDirectory(codyAgentDistDir, agentDir);
-
- foreach(var fileToRemove in notIncludeFiles)
- DeleteFile(agentDir + File(fileToRemove));
-
- var codyWebviewsFolder = MakeAbsolute(codyDir + Directory("agent/dist/webviews"));
- Information($"--> Cleaning '{agentWebViewDir}' ...");
- CreateDirectory(agentWebViewDir);
-
- Information($"--> Copying the webviews from '{codyWebviewsFolder}' to '{agentWebViewDir}' ...");
- CopyDirectory(codyWebviewsFolder, agentWebViewDir);
-
-
- // removing pnpm build:root artefacts (/src and /scripts folders)
-
- var srcFolder = @$"{agentDir}/src";
- var scriptsFolder = @$"{agentDir}/scripts";
- if (DirectoryExists(srcFolder))
- DeleteDirectory(srcFolder, deleteSettings);
-
- if (DirectoryExists(scriptsFolder))
- DeleteDirectory(scriptsFolder, deleteSettings);
-
-});
-
-Task("BuildCodyAgentIfNeeded")
- .Does(() =>
-{
- if (!DirectoryExists(codyDir) || !DirectoryExists(agentDir))
- {
- Information("Cody Agent dist directory not found. Building Cody Agent...");
- RunTarget("BuildCodyAgent");
- }
- else
- {
- Information("Cody Agent dist directory already exists. Skipping build.");
- }
-});
-
-Task("DownloadNode")
- .Does(() =>
-{
- if (!FileExists(nodeExeFile))
- {
- CreateDirectory(nodeBinariesDir);
- DownloadFile(nodeBinaryUrl, nodeExeFile);
- }
-
- if (!FileExists(nodeArmExeFile))
- {
- CreateDirectory(nodeBinariesDir);
- DownloadFile(nodeArmBinaryUrl, nodeArmExeFile);
- }
-
- CopyFileToDirectory(nodeExeFile, agentDir);
- CopyFileToDirectory(nodeArmExeFile, agentDir);
-});
-
-Task("Build")
- .IsDependentOn("BuildCodyAgent")
- .IsDependentOn("DownloadNode")
- .IsDependentOn("Restore")
- .Does(() =>
-{
- MSBuild("./Cody.sln", new MSBuildSettings
- {
- Configuration = configuration,
- PlatformTarget = PlatformTarget.MSIL,
- Verbosity = Verbosity.Minimal
- });
-});
-
-Task("BuildDebug")
- .IsDependentOn("DownloadNode")
- .IsDependentOn("Restore")
- .Does(() =>
-{
- MSBuild("./Cody.sln", new MSBuildSettings
- {
- Configuration = "Debug",
- PlatformTarget = PlatformTarget.MSIL,
- Verbosity = Verbosity.Minimal
- });
-});
-
-Task("Tests")
- //.IsDependentOn("Build")
- .Does(() =>
-{
- MSBuild("./Cody.sln", new MSBuildSettings
- {
- Configuration = "Debug",
- PlatformTarget = PlatformTarget.MSIL,
- Verbosity = Verbosity.Minimal
- });
-
-// DotNetTest("./Cody.VisualStudio.Tests/bin/Debug/Cody.VisualStudio.Tests.dll", new DotNetTestSettings
-// {
-// NoBuild = true,
-// NoRestore = true
-// });
-});
-
-Task("Restore")
- .Does(() =>
-{
- Information($"Restore ...");
- MSBuild("./Cody.sln", new MSBuildSettings {
- Targets = { "Restore" },
- Verbosity = Verbosity.Minimal
- });
-});
-
-Task("Publish")
- .IsDependentOn("Build")
- .Does(() =>
-{
- var args = new ProcessSettings().WithArguments(x => x
- .Append("publish")
- .AppendSwitchQuoted("-payload", buildExtensionFile)
- .AppendSwitchQuoted("-publishManifest", publishManifestFile)
- .AppendSwitchQuoted("-personalAccessToken", marketplaceToken)
- );
-
- var returnCode = StartProcess(vsixPublisherFile, args);
- if (returnCode != 0) throw new Exception("Publishing error");
-
-
- //StartProcess(vsixPublisherFile, $"publish -payload \"{buildExtensionFile}\" -publishManifest \"{publishManifestFile}\" -personalAccessToken \"{marketplaceToken}\"");
-
-});
-
-Task("Clean")
- //.WithCriteria(c => HasArgument("rebuild"))
- .Does(() =>
-{
- //todo
-});
-
-//////////////////////////////////////////////////////////////////////
-// EXECUTION
-//////////////////////////////////////////////////////////////////////
-
-RunTarget(target);