diff --git a/eng/Build.props b/eng/Build.props index dddc4194a9a..0a2ffbf2548 100644 --- a/eng/Build.props +++ b/eng/Build.props @@ -20,6 +20,11 @@ + + + + + @@ -54,6 +55,7 @@ + diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index 024cbdf8eb3..25f7a7629c7 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -98,81 +98,7 @@ function InitializeCustomToolset { } } -function Build-Extension { - $extensionDir = Join-Path $RepoRoot 'extension' - if (-not (Test-Path $extensionDir)) { - Write-Host "Extension directory not found at $extensionDir, skipping extension build" - return - } - - Write-Host "Building VS Code extension..." - - # Check if yarn is available - try { - $yarnVersion = & yarn --version 2>$null - if ($LASTEXITCODE -ne 0) { - throw "Yarn not found" - } - Write-Host "Found yarn version: $yarnVersion" - } - catch { - Write-Host "Warning: yarn is not installed or not available in PATH. Skipping extension build." - Write-Host "To build the extension, install yarn: https://yarnpkg.com/getting-started/install" - return - } - - Push-Location $extensionDir - try { - Write-Host "Running yarn install..." - & yarn install - if ($LASTEXITCODE -ne 0) { - throw "yarn install failed with exit code $LASTEXITCODE" - } - - Write-Host "Running yarn compile..." - & yarn compile - if ($LASTEXITCODE -ne 0) { - throw "yarn compile failed with exit code $LASTEXITCODE" - } - # Check if vsce is available and package the extension - try { - $vsceVersion = & vsce --version 2>$null - if ($LASTEXITCODE -eq 0) { - Write-Host "Found vsce version: $vsceVersion" - - # Read version from package.json - $packageJsonPath = Join-Path $extensionDir 'package.json' - if (Test-Path $packageJsonPath) { - Write-Host "Packaging extension" - & vsce package --pre-release - if ($LASTEXITCODE -ne 0) { - throw "vsce package failed with exit code $LASTEXITCODE" - } - - Write-Host "Extension packaged successfully" - } else { - Write-Host "Warning: package.json not found, skipping vsce package" - } - } else { - Write-Host "vsce not found, skipping package step" - } - } - catch { - Write-Host "Warning: Failed to package extension with vsce: $_" - # Don't throw here, just warn since this is optional - } - - Write-Host "VS Code extension build completed successfully" - } - catch { - Write-Host "Error building VS Code extension: $_" - throw - } - finally { - Pop-Location - } -} function Build { $toolsetBuildProj = InitializeToolset @@ -214,12 +140,8 @@ function Build { /p:Sign=$sign ` /p:Publish=$publish ` /p:RestoreStaticGraphEnableBinaryLogger=$binaryLog ` + /p:BuildExtension=$buildExtension ` @properties - - # Build VS Code extension if buildExtension parameter is specified - if ($buildExtension) { - Build-Extension - } } try { diff --git a/eng/common/build.sh b/eng/common/build.sh index be49c2401a9..7853291bbd2 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -226,67 +226,7 @@ function InitializeCustomToolset { fi } -function Build-Extension { - local extension_dir="$repo_root/extension" - if [[ ! -d "$extension_dir" ]]; then - echo "Extension directory not found at $extension_dir, skipping extension build" - return - fi - - echo "Building VS Code extension..." - - # Check if yarn is available - if ! command -v yarn &> /dev/null; then - echo "Warning: yarn is not installed or not available in PATH. Skipping extension build." - echo "To build the extension, install yarn: https://yarnpkg.com/getting-started/install" - return - fi - - local yarn_version - yarn_version=$(yarn --version 2>/dev/null) - echo "Found yarn version: $yarn_version" - - pushd "$extension_dir" > /dev/null - - echo "Running yarn install..." - if ! yarn install; then - echo "Error: yarn install failed" - popd > /dev/null - ExitWithExitCode 1 - fi - echo "Running yarn compile..." - if ! yarn compile; then - echo "Error: yarn compile failed" - popd > /dev/null - ExitWithExitCode 1 - fi - - # Check if vsce is available and package the extension - if command -v vsce &> /dev/null; then - local vsce_version - vsce_version=$(vsce --version 2>/dev/null) - echo "Found vsce version: $vsce_version" - - # Read version from package.json - local package_json_path="$extension_dir/package.json" - if [[ -f "$package_json_path" ]]; then - echo "Packaging extension" - if vsce package --pre-release; then - echo "Extension packaged successfully" - else - echo "Warning: vsce package failed" - fi - else - echo "Warning: package.json not found, skipping vsce package" - fi - else - echo "vsce not found, skipping package step" - fi - - echo "VS Code extension build completed successfully" - popd > /dev/null -} function Build { InitializeToolset @@ -324,13 +264,9 @@ function Build { /p:Sign=$sign \ /p:Publish=$publish \ /p:RestoreStaticGraphEnableBinaryLogger=$binary_log \ + /p:BuildExtension=$build_extension \ ${properties[@]+"${properties[@]}"} - # Build VS Code extension if build-extension parameter is specified - if [[ "$build_extension" == true ]]; then - Build-Extension - fi - ExitWithExitCode 0 } diff --git a/eng/pipelines/azure-pipelines.yml b/eng/pipelines/azure-pipelines.yml index c04534b1316..7e18669a05c 100644 --- a/eng/pipelines/azure-pipelines.yml +++ b/eng/pipelines/azure-pipelines.yml @@ -224,6 +224,29 @@ extends: script: | Get-ChildItem -Path "$(Build.SourcesDirectory)\artifacts\packages" -File -Recurse | Select-Object FullName, @{Name="Size(MB)";Expression={[math]::Round($_.Length/1MB,2)}} | Format-Table -AutoSize + - task: NodeTool@0 + displayName: 🟣Install node.js + inputs: + versionSpec: '20.x' + + - task: PowerShell@2 + displayName: 🟣Install yarn + inputs: + targetType: 'inline' + script: | + npm install -g yarn + yarn --version + workingDirectory: '$(Build.SourcesDirectory)' + + - task: PowerShell@2 + displayName: 🟣Install vsce + inputs: + targetType: 'inline' + script: | + npm install -g @vscode/vsce + vsce --version + workingDirectory: '$(Build.SourcesDirectory)' + - template: /eng/pipelines/templates/BuildAndTest.yml parameters: dotnetScript: $(Build.SourcesDirectory)/dotnet.cmd diff --git a/eng/pipelines/templates/BuildAndTest.yml b/eng/pipelines/templates/BuildAndTest.yml index 2ba3dfaaa87..72a7d68a6a0 100644 --- a/eng/pipelines/templates/BuildAndTest.yml +++ b/eng/pipelines/templates/BuildAndTest.yml @@ -36,6 +36,7 @@ steps: -restore -build -pack -sign $(_SignArgs) + -buildExtension -publish $(_PublishArgs) -configuration ${{ parameters.buildConfig }} /bl:${{ parameters.repoLogPath }}/build.binlog @@ -45,6 +46,13 @@ steps: /p:SkipTestProjects=true displayName: 🟣Build + - task: 1ES.PublishBuildArtifacts@1 + displayName: 🟣Publish vscode extension + condition: always() + inputs: + PathtoPublish: '${{ parameters.repoArtifactsPath }}/packages/Release/vscode' + ArtifactName: aspire-vscode-extension + - script: ${{ parameters.dotnetScript }} build tests/workloads.proj diff --git a/extension/Extension.proj b/extension/Extension.proj new file mode 100644 index 00000000000..51316758b5f --- /dev/null +++ b/extension/Extension.proj @@ -0,0 +1,58 @@ + + + $(DefaultTargetFramework) + $(MSBuildThisFileDirectory) + + + + + <_PackageJsonPath>$([MSBuild]::NormalizePath($(ExtensionSrcDir), 'package.json')) + <_VsixPath>$([MSBuild]::NormalizePath($(ArtifactsPackagesDir), 'aspire-vscode-$(Version).vsix')) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/extension/loc/.gitignore b/extension/loc/.gitignore deleted file mode 100644 index 23a9fedf565..00000000000 --- a/extension/loc/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/xliff/