From 959a0fc72a9dbff456c686a493af0c203c0909a4 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Wed, 5 Oct 2022 15:54:17 -0700 Subject: [PATCH 01/36] use stages --- build/azure-pipelines/sql-product-build.yml | 155 ++++++++++---------- 1 file changed, 80 insertions(+), 75 deletions(-) diff --git a/build/azure-pipelines/sql-product-build.yml b/build/azure-pipelines/sql-product-build.yml index a289d9b10ade..ac11958c608a 100644 --- a/build/azure-pipelines/sql-product-build.yml +++ b/build/azure-pipelines/sql-product-build.yml @@ -4,87 +4,92 @@ resources: image: sqltoolscontainers.azurecr.io/linux-build-agent:6 endpoint: SqlToolsContainers -jobs: -- job: Compile - pool: - vmImage: 'Ubuntu-20.04' - container: linux-x64 - steps: - - script: | - set -e - echo "##vso[build.addbuildtag]$(VSCODE_QUALITY)" - displayName: Add Quality Build Tag - - template: sql-product-compile.yml - timeoutInMinutes: 120 +stages: + - stage: Compile + jobs: + - job: Compile + pool: + vmImage: 'Ubuntu-20.04' + container: linux-x64 + steps: + - script: | + set -e + echo "##vso[build.addbuildtag]$(VSCODE_QUALITY)" + displayName: Add Quality Build Tag + - template: sql-product-compile.yml + timeoutInMinutes: 120 -- job: macOS - condition: and(succeeded(), eq(variables['VSCODE_BUILD_MACOS'], 'true'), ne(variables['VSCODE_QUALITY'], 'saw')) - pool: - vmImage: 'macos-latest' - dependsOn: - - Compile - steps: - - template: darwin/sql-product-build-darwin.yml - timeoutInMinutes: 90 + - ${{ if and(eq(variables['VSCODE_BUILD_MACOS'], true), ne(variables['VSCODE_QUALITY'], 'saw')) }}: + - stage: macOS + pool: + vmImage: 'macos-latest' + dependsOn: + - Compile + jobs: + - job: macOS + steps: + - template: darwin/sql-product-build-darwin.yml + timeoutInMinutes: 90 -- job: macOS_Signing - condition: and(succeeded(), eq(variables['VSCODE_BUILD_MACOS'], 'true'), eq(variables['signed'], true), ne(variables['VSCODE_QUALITY'], 'saw')) - pool: - vmImage: 'macos-latest' - dependsOn: - - macOS - steps: - - template: darwin/sql-product-build-darwin-signing.yml - timeoutInMinutes: 60 + - job: macOS_Signing + condition: eq(variables['signed'], true)) + dependsOn: + - macOS + steps: + - template: darwin/sql-product-build-darwin-signing.yml + timeoutInMinutes: 60 -- job: Linux - condition: and(succeeded(), eq(variables['VSCODE_BUILD_LINUX'], 'true')) - pool: - vmImage: 'Ubuntu-20.04' - container: linux-x64 - dependsOn: - - Compile - steps: - - template: linux/sql-product-build-linux.yml - parameters: - extensionsToUnitTest: ["admin-tool-ext-win", "agent", "azcli", "azurecore", "cms", "dacpac", "data-workspace", "import", "machine-learning", "notebook", "resource-deployment", "schema-compare", "sql-bindings", "sql-database-projects"] - timeoutInMinutes: 90 + - stage: Linux + - job: Linux + condition: and(succeeded(), eq(variables['VSCODE_BUILD_LINUX'], 'true')) + pool: + vmImage: 'Ubuntu-20.04' + container: linux-x64 + dependsOn: + - Compile + steps: + - template: linux/sql-product-build-linux.yml + parameters: + extensionsToUnitTest: ["admin-tool-ext-win", "agent", "azcli", "azurecore", "cms", "dacpac", "data-workspace", "import", "machine-learning", "notebook", "resource-deployment", "schema-compare", "sql-bindings", "sql-database-projects"] + timeoutInMinutes: 90 -- job: Windows - condition: and(succeeded(), eq(variables['VSCODE_BUILD_WIN32'], 'true')) - pool: - vmImage: 'windows-2019' - dependsOn: - - Compile - steps: - - template: win32/sql-product-build-win32.yml - timeoutInMinutes: 90 + - stage: Windows + - job: Windows + condition: and(succeeded(), eq(variables['VSCODE_BUILD_WIN32'], 'true')) + pool: + vmImage: 'windows-2019' + dependsOn: + - Compile + steps: + - template: win32/sql-product-build-win32.yml + timeoutInMinutes: 90 -# disable due to invalid machine pool (karlb 3/9/2022) -# - job: Windows_Test -# condition: and(succeeded(), eq(variables['VSCODE_BUILD_WIN32'], 'true')) -# pool: -# name: mssqltools -# dependsOn: -# - Linux -# - Windows -# steps: -# - template: win32/sql-product-test-win32.yml -# timeoutInMinutes: 90 + # disable due to invalid machine pool (karlb 3/9/2022) + # - job: Windows_Test + # condition: and(succeeded(), eq(variables['VSCODE_BUILD_WIN32'], 'true')) + # pool: + # name: mssqltools + # dependsOn: + # - Linux + # - Windows + # steps: + # - template: win32/sql-product-test-win32.yml + # timeoutInMinutes: 90 -- job: Release - condition: and(succeeded(), or(eq(variables['VSCODE_RELEASE'], 'true'), and(eq(variables['VSCODE_QUALITY'], 'insider'), eq(variables['Build.Reason'], 'Schedule')))) - pool: - vmImage: 'Ubuntu-20.04' - dependsOn: - - macOS - - Linux - - Windows -# disable due to invalid machine pool (karlb 3/9/2022) -# - Windows_Test - - macOS_Signing - steps: - - template: sql-release.yml + - stage: Release + - job: Release + condition: and(succeeded(), or(eq(variables['VSCODE_RELEASE'], 'true'), and(eq(variables['VSCODE_QUALITY'], 'insider'), eq(variables['Build.Reason'], 'Schedule')))) + pool: + vmImage: 'Ubuntu-20.04' + dependsOn: + - macOS + - Linux + - Windows + # disable due to invalid machine pool (karlb 3/9/2022) + # - Windows_Test + - macOS_Signing + steps: + - template: sql-release.yml trigger: none pr: none From 4ba6e243402a8b085fd081cf95505a5653fb7517 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Wed, 5 Oct 2022 16:00:46 -0700 Subject: [PATCH 02/36] fix indention --- build/azure-pipelines/sql-product-build.yml | 62 ++++++++++----------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/build/azure-pipelines/sql-product-build.yml b/build/azure-pipelines/sql-product-build.yml index ac11958c608a..27c6f284eb84 100644 --- a/build/azure-pipelines/sql-product-build.yml +++ b/build/azure-pipelines/sql-product-build.yml @@ -41,28 +41,28 @@ stages: - stage: Linux - job: Linux - condition: and(succeeded(), eq(variables['VSCODE_BUILD_LINUX'], 'true')) - pool: - vmImage: 'Ubuntu-20.04' - container: linux-x64 - dependsOn: - - Compile - steps: - - template: linux/sql-product-build-linux.yml - parameters: - extensionsToUnitTest: ["admin-tool-ext-win", "agent", "azcli", "azurecore", "cms", "dacpac", "data-workspace", "import", "machine-learning", "notebook", "resource-deployment", "schema-compare", "sql-bindings", "sql-database-projects"] - timeoutInMinutes: 90 + condition: and(succeeded(), eq(variables['VSCODE_BUILD_LINUX'], 'true')) + pool: + vmImage: 'Ubuntu-20.04' + container: linux-x64 + dependsOn: + - Compile + steps: + - template: linux/sql-product-build-linux.yml + parameters: + extensionsToUnitTest: ["admin-tool-ext-win", "agent", "azcli", "azurecore", "cms", "dacpac", "data-workspace", "import", "machine-learning", "notebook", "resource-deployment", "schema-compare", "sql-bindings", "sql-database-projects"] + timeoutInMinutes: 90 - stage: Windows - job: Windows - condition: and(succeeded(), eq(variables['VSCODE_BUILD_WIN32'], 'true')) - pool: - vmImage: 'windows-2019' - dependsOn: - - Compile - steps: - - template: win32/sql-product-build-win32.yml - timeoutInMinutes: 90 + condition: and(succeeded(), eq(variables['VSCODE_BUILD_WIN32'], 'true')) + pool: + vmImage: 'windows-2019' + dependsOn: + - Compile + steps: + - template: win32/sql-product-build-win32.yml + timeoutInMinutes: 90 # disable due to invalid machine pool (karlb 3/9/2022) # - job: Windows_Test @@ -78,18 +78,18 @@ stages: - stage: Release - job: Release - condition: and(succeeded(), or(eq(variables['VSCODE_RELEASE'], 'true'), and(eq(variables['VSCODE_QUALITY'], 'insider'), eq(variables['Build.Reason'], 'Schedule')))) - pool: - vmImage: 'Ubuntu-20.04' - dependsOn: - - macOS - - Linux - - Windows - # disable due to invalid machine pool (karlb 3/9/2022) - # - Windows_Test - - macOS_Signing - steps: - - template: sql-release.yml + condition: and(succeeded(), or(eq(variables['VSCODE_RELEASE'], 'true'), and(eq(variables['VSCODE_QUALITY'], 'insider'), eq(variables['Build.Reason'], 'Schedule')))) + pool: + vmImage: 'Ubuntu-20.04' + dependsOn: + - macOS + - Linux + - Windows + # disable due to invalid machine pool (karlb 3/9/2022) + # - Windows_Test + - macOS_Signing + steps: + - template: sql-release.yml trigger: none pr: none From c2c657cac69c02e638ba695cdf45bfd7358dc0ba Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Wed, 5 Oct 2022 16:04:26 -0700 Subject: [PATCH 03/36] add jobs section --- build/azure-pipelines/sql-product-build.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/build/azure-pipelines/sql-product-build.yml b/build/azure-pipelines/sql-product-build.yml index 27c6f284eb84..c58732cd1a93 100644 --- a/build/azure-pipelines/sql-product-build.yml +++ b/build/azure-pipelines/sql-product-build.yml @@ -40,7 +40,8 @@ stages: timeoutInMinutes: 60 - stage: Linux - - job: Linux + jobs: + - job: Linux condition: and(succeeded(), eq(variables['VSCODE_BUILD_LINUX'], 'true')) pool: vmImage: 'Ubuntu-20.04' @@ -54,7 +55,8 @@ stages: timeoutInMinutes: 90 - stage: Windows - - job: Windows + jobs: + - job: Windows condition: and(succeeded(), eq(variables['VSCODE_BUILD_WIN32'], 'true')) pool: vmImage: 'windows-2019' @@ -77,7 +79,8 @@ stages: # timeoutInMinutes: 90 - stage: Release - - job: Release + jobs: + - job: Release condition: and(succeeded(), or(eq(variables['VSCODE_RELEASE'], 'true'), and(eq(variables['VSCODE_QUALITY'], 'insider'), eq(variables['Build.Reason'], 'Schedule')))) pool: vmImage: 'Ubuntu-20.04' From 3306a2e37a84663088d73539898c3fd3d9eb9641 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Wed, 5 Oct 2022 16:16:36 -0700 Subject: [PATCH 04/36] fix error --- build/azure-pipelines/sql-product-build.yml | 60 ++++++++++----------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/build/azure-pipelines/sql-product-build.yml b/build/azure-pipelines/sql-product-build.yml index c58732cd1a93..fa07679727f5 100644 --- a/build/azure-pipelines/sql-product-build.yml +++ b/build/azure-pipelines/sql-product-build.yml @@ -39,32 +39,32 @@ stages: - template: darwin/sql-product-build-darwin-signing.yml timeoutInMinutes: 60 - - stage: Linux - jobs: - - job: Linux - condition: and(succeeded(), eq(variables['VSCODE_BUILD_LINUX'], 'true')) + - ${{ if eq(variables['VSCODE_BUILD_LINUX'], true) }}: + - stage: Linux pool: vmImage: 'Ubuntu-20.04' container: linux-x64 dependsOn: - - Compile - steps: - - template: linux/sql-product-build-linux.yml - parameters: - extensionsToUnitTest: ["admin-tool-ext-win", "agent", "azcli", "azurecore", "cms", "dacpac", "data-workspace", "import", "machine-learning", "notebook", "resource-deployment", "schema-compare", "sql-bindings", "sql-database-projects"] - timeoutInMinutes: 90 + - Compile + jobs: + - job: Linux + steps: + - template: linux/sql-product-build-linux.yml + parameters: + extensionsToUnitTest: ["admin-tool-ext-win", "agent", "azcli", "azurecore", "cms", "dacpac", "data-workspace", "import", "machine-learning", "notebook", "resource-deployment", "schema-compare", "sql-bindings", "sql-database-projects"] + timeoutInMinutes: 90 - - stage: Windows - jobs: - - job: Windows - condition: and(succeeded(), eq(variables['VSCODE_BUILD_WIN32'], 'true')) + - ${{ if eq(variables['VSCODE_BUILD_WIN32'], true) }}: + - stage: Windows pool: vmImage: 'windows-2019' dependsOn: - - Compile - steps: - - template: win32/sql-product-build-win32.yml - timeoutInMinutes: 90 + - Compile + jobs: + - job: Windows + steps: + - template: win32/sql-product-build-win32.yml + timeoutInMinutes: 90 # disable due to invalid machine pool (karlb 3/9/2022) # - job: Windows_Test @@ -78,21 +78,21 @@ stages: # - template: win32/sql-product-test-win32.yml # timeoutInMinutes: 90 - - stage: Release - jobs: - - job: Release - condition: and(succeeded(), or(eq(variables['VSCODE_RELEASE'], 'true'), and(eq(variables['VSCODE_QUALITY'], 'insider'), eq(variables['Build.Reason'], 'Schedule')))) + - ${{ if or(eq(variables['VSCODE_RELEASE'], 'true'), and(eq(variables['VSCODE_QUALITY'], 'insider'), eq(variables['Build.Reason'], 'Schedule'))) }}: + - stage: Release pool: vmImage: 'Ubuntu-20.04' dependsOn: - - macOS - - Linux - - Windows - # disable due to invalid machine pool (karlb 3/9/2022) - # - Windows_Test - - macOS_Signing - steps: - - template: sql-release.yml + - macOS + - Linux + - Windows + # disable due to invalid machine pool (karlb 3/9/2022) + # - Windows_Test + - macOS_Signing + jobs: + - job: Release + steps: + - template: sql-release.yml trigger: none pr: none From c92513d97651abe7144d860394c41a2ddecbc22a Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Wed, 5 Oct 2022 16:18:11 -0700 Subject: [PATCH 05/36] indention --- build/azure-pipelines/sql-product-build.yml | 32 ++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/build/azure-pipelines/sql-product-build.yml b/build/azure-pipelines/sql-product-build.yml index fa07679727f5..15fac66216f0 100644 --- a/build/azure-pipelines/sql-product-build.yml +++ b/build/azure-pipelines/sql-product-build.yml @@ -41,11 +41,11 @@ stages: - ${{ if eq(variables['VSCODE_BUILD_LINUX'], true) }}: - stage: Linux - pool: - vmImage: 'Ubuntu-20.04' - container: linux-x64 - dependsOn: - - Compile + pool: + vmImage: 'Ubuntu-20.04' + container: linux-x64 + dependsOn: + - Compile jobs: - job: Linux steps: @@ -56,10 +56,10 @@ stages: - ${{ if eq(variables['VSCODE_BUILD_WIN32'], true) }}: - stage: Windows - pool: - vmImage: 'windows-2019' - dependsOn: - - Compile + pool: + vmImage: 'windows-2019' + dependsOn: + - Compile jobs: - job: Windows steps: @@ -80,15 +80,15 @@ stages: - ${{ if or(eq(variables['VSCODE_RELEASE'], 'true'), and(eq(variables['VSCODE_QUALITY'], 'insider'), eq(variables['Build.Reason'], 'Schedule'))) }}: - stage: Release - pool: - vmImage: 'Ubuntu-20.04' - dependsOn: - - macOS - - Linux - - Windows + pool: + vmImage: 'Ubuntu-20.04' + dependsOn: + - macOS + - Linux + - Windows # disable due to invalid machine pool (karlb 3/9/2022) # - Windows_Test - - macOS_Signing + - macOS_Signing jobs: - job: Release steps: From f1137f3d491ed016d89c418f7daa853e4c944f69 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Wed, 5 Oct 2022 17:06:01 -0700 Subject: [PATCH 06/36] arm64 for macos --- .../sql-product-build-darwin-signing.yml | 10 ++++----- .../darwin/sql-product-build-darwin.yml | 21 ++++++++++--------- build/azure-pipelines/sql-product-build.yml | 21 +++++++++++++++++++ extensions/mssql/config.json | 1 + 4 files changed, 38 insertions(+), 15 deletions(-) diff --git a/build/azure-pipelines/darwin/sql-product-build-darwin-signing.yml b/build/azure-pipelines/darwin/sql-product-build-darwin-signing.yml index 2f85b31c8c45..ed6dc3043c8e 100644 --- a/build/azure-pipelines/darwin/sql-product-build-darwin-signing.yml +++ b/build/azure-pipelines/darwin/sql-product-build-darwin-signing.yml @@ -9,12 +9,12 @@ steps: displayName: 'Download Build Artifacts' inputs: downloadType: specific - itemPattern: 'drop/darwin/archive/azuredatastudio-darwin-unsigned.zip' + itemPattern: 'drop/darwin/archive/azuredatastudio-darwin-$(VSCODE_ARCH)-unsigned.zip' downloadPath: '$(Build.SourcesDirectory)/.build/' - script: | pushd $(Build.SourcesDirectory)/.build/drop/darwin/archive - mv azuredatastudio-darwin-unsigned.zip azuredatastudio-darwin.zip + mv azuredatastudio-darwin-$(VSCODE_ARCH)-unsigned.zip azuredatastudio-$(VSCODE_ARCH)-darwin.zip displayName: 'Rename the file' - task: UseDotNet@2 @@ -29,7 +29,7 @@ steps: inputs: ConnectedServiceName: 'Code Signing' FolderPath: '$(Build.SourcesDirectory)/.build/drop/darwin/archive' - Pattern: 'azuredatastudio-darwin.zip' + Pattern: 'azuredatastudio-darwin-$(VSCODE_ARCH).zip' signConfigType: inlineSignParams inlineOperation: | [ @@ -47,7 +47,7 @@ steps: condition: and(succeeded(), eq(variables['signed'], true)) - script: | - zip -d $(Build.SourcesDirectory)/.build/drop/darwin/archive/azuredatastudio-darwin.zip "*.pkg" + zip -d $(Build.SourcesDirectory)/.build/drop/darwin/archive/azuredatastudio-darwin-$(VSCODE_ARCH).zip "*.pkg" displayName: Clean Archive condition: and(succeeded(), eq(variables['signed'], true)) @@ -56,7 +56,7 @@ steps: inputs: ConnectedServiceName: 'Code Signing' FolderPath: '$(Build.SourcesDirectory)/.build/drop/darwin/archive' - Pattern: 'azuredatastudio-darwin.zip' + Pattern: 'azuredatastudio-darwin-$(VSCODE_ARCH).zip' signConfigType: inlineSignParams inlineOperation: | [ diff --git a/build/azure-pipelines/darwin/sql-product-build-darwin.yml b/build/azure-pipelines/darwin/sql-product-build-darwin.yml index d6c5a65dabc4..641fb78f06c4 100644 --- a/build/azure-pipelines/darwin/sql-product-build-darwin.yml +++ b/build/azure-pipelines/darwin/sql-product-build-darwin.yml @@ -52,7 +52,7 @@ steps: - script: | mkdir -p .build - node build/azure-pipelines/common/sql-computeNodeModulesCacheKey.js > .build/yarnlockhash + node build/azure-pipelines/common/sql-computeNodeModulesCacheKey.js $VSCODE_ARCH > .build/yarnlockhash displayName: Prepare yarn cache key - task: Cache@2 @@ -71,6 +71,7 @@ steps: - script: | set -e + export npm_config_arch=$(VSCODE_ARCH) CHILD_CONCURRENCY=1 yarn --frozen-lockfile displayName: Install dependencies env: @@ -99,7 +100,7 @@ steps: - script: | set -e yarn gulp package-rebuild-extensions - yarn gulp vscode-darwin-x64-min-ci + yarn gulp vscode-darwin-$(VSCODE_ARCH)-min-ci displayName: Build env: VSCODE_MIXIN_PASSWORD: $(github-distro-mixin-password) @@ -115,7 +116,7 @@ steps: # including the remote server and configure the integration tests # to run with these builds instead of running out of sources. set -e - APP_ROOT=$(agent.builddirectory)/azuredatastudio-darwin-x64 + APP_ROOT=$(agent.builddirectory)/azuredatastudio-darwin-$(VSCODE_ARCH) APP_NAME="`ls $APP_ROOT | head -n 1`" INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME/Contents/MacOS/Electron" \ VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/azuredatastudio-reh-darwin" \ @@ -132,7 +133,7 @@ steps: # in continueOnError directly so instead make two copies of the task and only run one or the other based on the SMOKE_FAIL_ON_ERROR value - script: | set -e - APP_ROOT=$(agent.builddirectory)/azuredatastudio-darwin-x64 + APP_ROOT=$(agent.builddirectory)/azuredatastudio-darwin-$(VSCODE_ARCH) APP_NAME="`ls $APP_ROOT | head -n 1`" yarn smoketest --build "$APP_ROOT/$APP_NAME" --screenshots "$(build.artifactstagingdirectory)/smokeshots" --log "$(build.artifactstagingdirectory)/logs/darwin/smoke.log" --extensionsDir "$(build.sourcesdirectory)/extensions" displayName: Run smoke tests (Electron) (Continue on Error) @@ -141,7 +142,7 @@ steps: - script: | set -e - APP_ROOT=$(agent.builddirectory)/azuredatastudio-darwin-x64 + APP_ROOT=$(agent.builddirectory)/azuredatastudio-darwin-$(VSCODE_ARCH) APP_NAME="`ls $APP_ROOT | head -n 1`" yarn smoketest --build "$APP_ROOT/$APP_NAME" --screenshots "$(build.artifactstagingdirectory)/smokeshots" --log "$(build.artifactstagingdirectory)/logs/darwin/smoke.log" --extensionsDir "$(build.sourcesdirectory)/extensions" displayName: Run smoke tests (Electron) (Fail on Error) @@ -158,7 +159,7 @@ steps: - script: | set -e - pushd ../azuredatastudio-darwin-x64 + pushd ../azuredatastudio-darwin-$(VSCODE_ARCH) ls echo "Cleaning the application" @@ -188,8 +189,8 @@ steps: - script: | set -e mkdir -p .build/darwin/archive - pushd ../azuredatastudio-darwin-x64 - ditto -c -k --keepParent *.app $(Build.SourcesDirectory)/.build/darwin/archive/azuredatastudio-darwin.zip + pushd ../azuredatastudio-darwin-$(VSCODE_ARCH) + ditto -c -k --keepParent *.app $(Build.SourcesDirectory)/.build/darwin/archive/azuredatastudio-darwin-$(VSCODE_ARCH).zip popd displayName: 'Archive (no signing)' condition: and(succeeded(), eq(variables['signed'], false)) @@ -197,8 +198,8 @@ steps: - script: | set -e mkdir -p .build/darwin/archive - pushd ../azuredatastudio-darwin-x64 - ditto -c -k --keepParent *.app $(Build.SourcesDirectory)/.build/darwin/archive/azuredatastudio-darwin-unsigned.zip + pushd ../azuredatastudio-darwin-$(VSCODE_ARCH) + ditto -c -k --keepParent *.app $(Build.SourcesDirectory)/.build/darwin/archive/azuredatastudio-darwin-$(VSCODE_ARCH)-unsigned.zip popd displayName: 'Archive' condition: and(succeeded(), eq(variables['signed'], true)) diff --git a/build/azure-pipelines/sql-product-build.yml b/build/azure-pipelines/sql-product-build.yml index 15fac66216f0..25327e68d45c 100644 --- a/build/azure-pipelines/sql-product-build.yml +++ b/build/azure-pipelines/sql-product-build.yml @@ -27,11 +27,32 @@ stages: - Compile jobs: - job: macOS + variables: + VSCODE_ARCH: x64 steps: - template: darwin/sql-product-build-darwin.yml timeoutInMinutes: 90 - job: macOS_Signing + variables: + VSCODE_ARCH: x64 + condition: eq(variables['signed'], true)) + dependsOn: + - macOS + steps: + - template: darwin/sql-product-build-darwin-signing.yml + timeoutInMinutes: 60 + + - job: macOS_ARM64 + variables: + VSCODE_ARCH: arm64 + steps: + - template: darwin/sql-product-build-darwin.yml + timeoutInMinutes: 90 + + - job: macOS_Signing_ARM64 + variables: + VSCODE_ARCH: arm64 condition: eq(variables['signed'], true)) dependsOn: - macOS diff --git a/extensions/mssql/config.json b/extensions/mssql/config.json index 013b247f579b..cf180f8f3f4e 100644 --- a/extensions/mssql/config.json +++ b/extensions/mssql/config.json @@ -5,6 +5,7 @@ "Windows_86": "win-x86-net6.0.zip", "Windows_64": "win-x64-net6.0.zip", "OSX": "osx-x64-net6.0.tar.gz", + "OSX_ARM64": "osx-arm64-net6.0.tar.gz", "Linux": "rhel-x64-net6.0.tar.gz" }, "installDirectory": "./sqltoolsservice/{#platform#}/{#version#}", From f994d8ba6debde7d3e2dbec894791f76e0ccf827 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Wed, 5 Oct 2022 19:17:58 -0700 Subject: [PATCH 07/36] other stages not run --- build/azure-pipelines/sql-product-build.yml | 162 ++++++++++---------- 1 file changed, 82 insertions(+), 80 deletions(-) diff --git a/build/azure-pipelines/sql-product-build.yml b/build/azure-pipelines/sql-product-build.yml index 25327e68d45c..5ee25e0a5317 100644 --- a/build/azure-pipelines/sql-product-build.yml +++ b/build/azure-pipelines/sql-product-build.yml @@ -6,11 +6,11 @@ resources: stages: - stage: Compile + pool: + vmImage: 'Ubuntu-20.04' + container: linux-x64 jobs: - job: Compile - pool: - vmImage: 'Ubuntu-20.04' - container: linux-x64 steps: - script: | set -e @@ -19,73 +19,73 @@ stages: - template: sql-product-compile.yml timeoutInMinutes: 120 - - ${{ if and(eq(variables['VSCODE_BUILD_MACOS'], true), ne(variables['VSCODE_QUALITY'], 'saw')) }}: - - stage: macOS - pool: - vmImage: 'macos-latest' - dependsOn: - - Compile - jobs: - - job: macOS - variables: - VSCODE_ARCH: x64 - steps: - - template: darwin/sql-product-build-darwin.yml - timeoutInMinutes: 90 + - stage: macOS + condition: and(succeeded(), eq(variables['VSCODE_BUILD_MACOS'], 'true'), ne(variables['VSCODE_QUALITY'], 'saw')) + pool: + vmImage: 'macos-latest' + dependsOn: + - Compile + jobs: + - job: macOS + variables: + VSCODE_ARCH: x64 + steps: + - template: darwin/sql-product-build-darwin.yml + timeoutInMinutes: 90 - - job: macOS_Signing - variables: - VSCODE_ARCH: x64 - condition: eq(variables['signed'], true)) - dependsOn: - - macOS - steps: - - template: darwin/sql-product-build-darwin-signing.yml - timeoutInMinutes: 60 + - job: macOS_Signing + variables: + VSCODE_ARCH: x64 + condition: eq(variables['signed'], true)) + dependsOn: + - macOS + steps: + - template: darwin/sql-product-build-darwin-signing.yml + timeoutInMinutes: 60 - - job: macOS_ARM64 - variables: - VSCODE_ARCH: arm64 - steps: - - template: darwin/sql-product-build-darwin.yml - timeoutInMinutes: 90 + - job: macOS_ARM64 + variables: + VSCODE_ARCH: arm64 + steps: + - template: darwin/sql-product-build-darwin.yml + timeoutInMinutes: 90 - - job: macOS_Signing_ARM64 - variables: - VSCODE_ARCH: arm64 - condition: eq(variables['signed'], true)) - dependsOn: - - macOS - steps: - - template: darwin/sql-product-build-darwin-signing.yml - timeoutInMinutes: 60 + - job: macOS_Signing_ARM64 + variables: + VSCODE_ARCH: arm64 + condition: eq(variables['signed'], true)) + dependsOn: + - macOS + steps: + - template: darwin/sql-product-build-darwin-signing.yml + timeoutInMinutes: 60 - - ${{ if eq(variables['VSCODE_BUILD_LINUX'], true) }}: - - stage: Linux - pool: - vmImage: 'Ubuntu-20.04' - container: linux-x64 - dependsOn: - - Compile - jobs: - - job: Linux - steps: - - template: linux/sql-product-build-linux.yml - parameters: - extensionsToUnitTest: ["admin-tool-ext-win", "agent", "azcli", "azurecore", "cms", "dacpac", "data-workspace", "import", "machine-learning", "notebook", "resource-deployment", "schema-compare", "sql-bindings", "sql-database-projects"] - timeoutInMinutes: 90 + - stage: Linux + condition: and(succeeded(), eq(variables['VSCODE_BUILD_LINUX'], true)) + pool: + vmImage: 'Ubuntu-20.04' + container: linux-x64 + dependsOn: + - Compile + jobs: + - job: Linux + steps: + - template: linux/sql-product-build-linux.yml + parameters: + extensionsToUnitTest: ["admin-tool-ext-win", "agent", "azcli", "azurecore", "cms", "dacpac", "data-workspace", "import", "machine-learning", "notebook", "resource-deployment", "schema-compare", "sql-bindings", "sql-database-projects"] + timeoutInMinutes: 90 - - ${{ if eq(variables['VSCODE_BUILD_WIN32'], true) }}: - - stage: Windows - pool: - vmImage: 'windows-2019' - dependsOn: - - Compile - jobs: - - job: Windows - steps: - - template: win32/sql-product-build-win32.yml - timeoutInMinutes: 90 + - stage: Windows + condition: and(succeeded(), eq(variables['VSCODE_BUILD_WIN32'], true)) + pool: + vmImage: 'windows-2019' + dependsOn: + - Compile + jobs: + - job: Windows + steps: + - template: win32/sql-product-build-win32.yml + timeoutInMinutes: 90 # disable due to invalid machine pool (karlb 3/9/2022) # - job: Windows_Test @@ -99,21 +99,23 @@ stages: # - template: win32/sql-product-test-win32.yml # timeoutInMinutes: 90 - - ${{ if or(eq(variables['VSCODE_RELEASE'], 'true'), and(eq(variables['VSCODE_QUALITY'], 'insider'), eq(variables['Build.Reason'], 'Schedule'))) }}: - - stage: Release - pool: - vmImage: 'Ubuntu-20.04' - dependsOn: - - macOS - - Linux - - Windows - # disable due to invalid machine pool (karlb 3/9/2022) - # - Windows_Test - - macOS_Signing - jobs: - - job: Release - steps: - - template: sql-release.yml + - stage: Release + condition: and(succeeded(), or(eq(variables['VSCODE_RELEASE'], 'true'), and(eq(variables['VSCODE_QUALITY'], 'insider'), eq(variables['Build.Reason'], 'Schedule')))) + pool: + vmImage: 'Ubuntu-20.04' + dependsOn: + - macOS + - Linux + - Windows + # disable due to invalid machine pool (karlb 3/9/2022) + # - Windows_Test + - macOS_Signing + - macOS_ARM64 + - macOS_ARM64_Signing + jobs: + - job: Release + steps: + - template: sql-release.yml trigger: none pr: none From 9aa253b069996d912a8a184100ec446241fb523b Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Wed, 5 Oct 2022 19:20:46 -0700 Subject: [PATCH 08/36] fix container --- build/azure-pipelines/sql-product-build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build/azure-pipelines/sql-product-build.yml b/build/azure-pipelines/sql-product-build.yml index 5ee25e0a5317..e1ac5f0c1209 100644 --- a/build/azure-pipelines/sql-product-build.yml +++ b/build/azure-pipelines/sql-product-build.yml @@ -6,11 +6,11 @@ resources: stages: - stage: Compile - pool: - vmImage: 'Ubuntu-20.04' - container: linux-x64 jobs: - job: Compile + pool: + vmImage: 'Ubuntu-20.04' + container: linux-x64 steps: - script: | set -e @@ -62,13 +62,13 @@ stages: - stage: Linux condition: and(succeeded(), eq(variables['VSCODE_BUILD_LINUX'], true)) - pool: - vmImage: 'Ubuntu-20.04' - container: linux-x64 dependsOn: - Compile jobs: - job: Linux + pool: + vmImage: 'Ubuntu-20.04' + container: linux-x64 steps: - template: linux/sql-product-build-linux.yml parameters: From 507b8cb9ee79fc27e616f04583255e9722f36a95 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Wed, 5 Oct 2022 19:22:02 -0700 Subject: [PATCH 09/36] fix --- build/azure-pipelines/sql-product-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/azure-pipelines/sql-product-build.yml b/build/azure-pipelines/sql-product-build.yml index e1ac5f0c1209..a7a147d168b6 100644 --- a/build/azure-pipelines/sql-product-build.yml +++ b/build/azure-pipelines/sql-product-build.yml @@ -36,7 +36,7 @@ stages: - job: macOS_Signing variables: VSCODE_ARCH: x64 - condition: eq(variables['signed'], true)) + condition: eq(variables['signed'], true) dependsOn: - macOS steps: @@ -53,7 +53,7 @@ stages: - job: macOS_Signing_ARM64 variables: VSCODE_ARCH: arm64 - condition: eq(variables['signed'], true)) + condition: eq(variables['signed'], true) dependsOn: - macOS steps: From 9c33d2ba996775245c04d1f5fd25e9fb6c515424 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Wed, 5 Oct 2022 19:24:10 -0700 Subject: [PATCH 10/36] fix stage --- build/azure-pipelines/sql-product-build.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/build/azure-pipelines/sql-product-build.yml b/build/azure-pipelines/sql-product-build.yml index a7a147d168b6..b4e96d92477a 100644 --- a/build/azure-pipelines/sql-product-build.yml +++ b/build/azure-pipelines/sql-product-build.yml @@ -109,9 +109,6 @@ stages: - Windows # disable due to invalid machine pool (karlb 3/9/2022) # - Windows_Test - - macOS_Signing - - macOS_ARM64 - - macOS_ARM64_Signing jobs: - job: Release steps: From fd101e94de7dbc1369459bbe4667e1dddadf8d58 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Wed, 5 Oct 2022 20:30:41 -0700 Subject: [PATCH 11/36] skip tests --- .../darwin/sql-product-build-darwin.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build/azure-pipelines/darwin/sql-product-build-darwin.yml b/build/azure-pipelines/darwin/sql-product-build-darwin.yml index 641fb78f06c4..bdeb2c07156d 100644 --- a/build/azure-pipelines/darwin/sql-product-build-darwin.yml +++ b/build/azure-pipelines/darwin/sql-product-build-darwin.yml @@ -109,7 +109,7 @@ steps: set -e ./scripts/test.sh --build --tfs "Unit Tests" --coverage displayName: Run unit tests - condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true')) + condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'), eq($(VSCODE_ARCH), 'x64')) - script: | # Figure out the full absolute path of the product we just built @@ -122,7 +122,7 @@ steps: VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/azuredatastudio-reh-darwin" \ ./scripts/test-integration.sh --build --tfs "Integration Tests" displayName: Run integration tests (Electron) - condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true')) + condition: and(succeeded(), eq($(VSCODE_ARCH), 'x64'), eq(variables['RUN_TESTS'], 'true')) - script: | set -e @@ -138,7 +138,7 @@ steps: yarn smoketest --build "$APP_ROOT/$APP_NAME" --screenshots "$(build.artifactstagingdirectory)/smokeshots" --log "$(build.artifactstagingdirectory)/logs/darwin/smoke.log" --extensionsDir "$(build.sourcesdirectory)/extensions" displayName: Run smoke tests (Electron) (Continue on Error) continueOnError: true - condition: and(succeeded(), and(or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true')), ne(variables['SMOKE_FAIL_ON_ERROR'], 'true'))) + condition: and(succeeded(), eq($(VSCODE_ARCH), 'x64'), and(or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true')), ne(variables['SMOKE_FAIL_ON_ERROR'], 'true'))) - script: | set -e @@ -146,7 +146,7 @@ steps: APP_NAME="`ls $APP_ROOT | head -n 1`" yarn smoketest --build "$APP_ROOT/$APP_NAME" --screenshots "$(build.artifactstagingdirectory)/smokeshots" --log "$(build.artifactstagingdirectory)/logs/darwin/smoke.log" --extensionsDir "$(build.sourcesdirectory)/extensions" displayName: Run smoke tests (Electron) (Fail on Error) - condition: and(succeeded(), and(or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true')), eq(variables['SMOKE_FAIL_ON_ERROR'], 'true'))) + condition: and(succeeded(), eq($(VSCODE_ARCH), 'x64'), and(or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true')), eq(variables['SMOKE_FAIL_ON_ERROR'], 'true'))) # - script: | # set -e @@ -219,7 +219,7 @@ steps: testResultsFiles: "*-results.xml" searchFolder: "$(Build.ArtifactStagingDirectory)/test-results" continueOnError: true - condition: and(succeededOrFailed(), or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true'))) + condition: and(succeededOrFailed(), eq($(VSCODE_ARCH), 'x64'), or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true'))) - task: PublishCodeCoverageResults@1 displayName: 'Publish code coverage from $(Build.SourcesDirectory)/.build/coverage/cobertura-coverage.xml' @@ -228,7 +228,7 @@ steps: summaryFileLocation: '$(Build.SourcesDirectory)/.build/coverage/cobertura-coverage.xml' reportDirectory: '$(Build.SourcesDirectory)/.build/coverage' continueOnError: true - condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true')) + condition: and(succeeded(), eq($(VSCODE_ARCH), 'x64'), eq(variables['RUN_TESTS'], 'true')) - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 displayName: 'Component Detection' From 0e6d54473f7474d0e05e641caf9c0d1bf5306bf5 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Thu, 6 Oct 2022 08:58:06 -0700 Subject: [PATCH 12/36] variable --- .../darwin/sql-product-build-darwin.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build/azure-pipelines/darwin/sql-product-build-darwin.yml b/build/azure-pipelines/darwin/sql-product-build-darwin.yml index bdeb2c07156d..7d0ab41cb39c 100644 --- a/build/azure-pipelines/darwin/sql-product-build-darwin.yml +++ b/build/azure-pipelines/darwin/sql-product-build-darwin.yml @@ -109,7 +109,7 @@ steps: set -e ./scripts/test.sh --build --tfs "Unit Tests" --coverage displayName: Run unit tests - condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'), eq($(VSCODE_ARCH), 'x64')) + condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'), eq(variables['VSCODE_ARCH'], 'x64')) - script: | # Figure out the full absolute path of the product we just built @@ -122,7 +122,7 @@ steps: VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/azuredatastudio-reh-darwin" \ ./scripts/test-integration.sh --build --tfs "Integration Tests" displayName: Run integration tests (Electron) - condition: and(succeeded(), eq($(VSCODE_ARCH), 'x64'), eq(variables['RUN_TESTS'], 'true')) + condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['RUN_TESTS'], 'true')) - script: | set -e @@ -138,7 +138,7 @@ steps: yarn smoketest --build "$APP_ROOT/$APP_NAME" --screenshots "$(build.artifactstagingdirectory)/smokeshots" --log "$(build.artifactstagingdirectory)/logs/darwin/smoke.log" --extensionsDir "$(build.sourcesdirectory)/extensions" displayName: Run smoke tests (Electron) (Continue on Error) continueOnError: true - condition: and(succeeded(), eq($(VSCODE_ARCH), 'x64'), and(or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true')), ne(variables['SMOKE_FAIL_ON_ERROR'], 'true'))) + condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), and(or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true')), ne(variables['SMOKE_FAIL_ON_ERROR'], 'true'))) - script: | set -e @@ -146,7 +146,7 @@ steps: APP_NAME="`ls $APP_ROOT | head -n 1`" yarn smoketest --build "$APP_ROOT/$APP_NAME" --screenshots "$(build.artifactstagingdirectory)/smokeshots" --log "$(build.artifactstagingdirectory)/logs/darwin/smoke.log" --extensionsDir "$(build.sourcesdirectory)/extensions" displayName: Run smoke tests (Electron) (Fail on Error) - condition: and(succeeded(), eq($(VSCODE_ARCH), 'x64'), and(or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true')), eq(variables['SMOKE_FAIL_ON_ERROR'], 'true'))) + condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), and(or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true')), eq(variables['SMOKE_FAIL_ON_ERROR'], 'true'))) # - script: | # set -e @@ -219,7 +219,7 @@ steps: testResultsFiles: "*-results.xml" searchFolder: "$(Build.ArtifactStagingDirectory)/test-results" continueOnError: true - condition: and(succeededOrFailed(), eq($(VSCODE_ARCH), 'x64'), or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true'))) + condition: and(succeededOrFailed(), eq(variables['VSCODE_ARCH'], 'x64'), or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true'))) - task: PublishCodeCoverageResults@1 displayName: 'Publish code coverage from $(Build.SourcesDirectory)/.build/coverage/cobertura-coverage.xml' @@ -228,7 +228,7 @@ steps: summaryFileLocation: '$(Build.SourcesDirectory)/.build/coverage/cobertura-coverage.xml' reportDirectory: '$(Build.SourcesDirectory)/.build/coverage' continueOnError: true - condition: and(succeeded(), eq($(VSCODE_ARCH), 'x64'), eq(variables['RUN_TESTS'], 'true')) + condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['RUN_TESTS'], 'true')) - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 displayName: 'Component Detection' From 45e59940d2514afbbecc03ec77fcaae94223fcee Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Thu, 6 Oct 2022 09:36:41 -0700 Subject: [PATCH 13/36] dependency --- build/azure-pipelines/sql-product-build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/azure-pipelines/sql-product-build.yml b/build/azure-pipelines/sql-product-build.yml index b4e96d92477a..439999f7c3b2 100644 --- a/build/azure-pipelines/sql-product-build.yml +++ b/build/azure-pipelines/sql-product-build.yml @@ -36,7 +36,7 @@ stages: - job: macOS_Signing variables: VSCODE_ARCH: x64 - condition: eq(variables['signed'], true) + condition: and(succeeded(), eq(variables['signed'], true)) dependsOn: - macOS steps: @@ -53,9 +53,9 @@ stages: - job: macOS_Signing_ARM64 variables: VSCODE_ARCH: arm64 - condition: eq(variables['signed'], true) + condition: and(succeeded(), eq(variables['signed'], true)) dependsOn: - - macOS + - macOS_ARM64 steps: - template: darwin/sql-product-build-darwin-signing.yml timeoutInMinutes: 60 From 0a87c9349026a186a8bd1e2b20b55f30000d240f Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Thu, 6 Oct 2022 10:53:01 -0700 Subject: [PATCH 14/36] fix name error --- .../azure-pipelines/darwin/sql-product-build-darwin-signing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/azure-pipelines/darwin/sql-product-build-darwin-signing.yml b/build/azure-pipelines/darwin/sql-product-build-darwin-signing.yml index ed6dc3043c8e..91957dc0124b 100644 --- a/build/azure-pipelines/darwin/sql-product-build-darwin-signing.yml +++ b/build/azure-pipelines/darwin/sql-product-build-darwin-signing.yml @@ -14,7 +14,7 @@ steps: - script: | pushd $(Build.SourcesDirectory)/.build/drop/darwin/archive - mv azuredatastudio-darwin-$(VSCODE_ARCH)-unsigned.zip azuredatastudio-$(VSCODE_ARCH)-darwin.zip + mv azuredatastudio-darwin-$(VSCODE_ARCH)-unsigned.zip azuredatastudio-darwin-$(VSCODE_ARCH).zip displayName: 'Rename the file' - task: UseDotNet@2 From 726cc5c899c35a97f769644177b73c9c60ecf6d4 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Thu, 6 Oct 2022 14:09:01 -0700 Subject: [PATCH 15/36] sts --- build/.cachesalt | 2 +- extensions/mssql/build/postinstall.js | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/build/.cachesalt b/build/.cachesalt index b7ac004d6cb4..3b2a71b972e8 100644 --- a/build/.cachesalt +++ b/build/.cachesalt @@ -1 +1 @@ -2021-11-19T02:27:18.022Z +2022-10-06T02:27:18.022Z diff --git a/extensions/mssql/build/postinstall.js b/extensions/mssql/build/postinstall.js index d692b49cc06e..64a2b33461f8 100644 --- a/extensions/mssql/build/postinstall.js +++ b/extensions/mssql/build/postinstall.js @@ -5,7 +5,7 @@ (async () => { const serviceDownloader = require('@microsoft/ads-service-downloader').ServiceDownloadProvider; - const platform = require('@microsoft/ads-service-downloader/out/platform').PlatformInformation; + const platform = require('@microsoft/ads-service-downloader/out/platform'); const path = require('path'); const fs = require('fs').promises; const rimraf = require('rimraf'); @@ -15,7 +15,14 @@ async function installService() { const absoluteConfigPath = require.resolve('../config.json'); const config = require(absoluteConfigPath); - const runtime = (await platform.getCurrent()).runtimeId; + const runtime = (await platform.PlatformInformation.getCurrent()).runtimeId; + const arch = process.env['npm_config_arch']; + + // We use macOS on x64 to produce arm64 build, as a result, we need to overwrite the runtime if the arch is arm64 + if (runtime === platform.Runtime.OSX && arch === 'arm64') { + console.log(`Change the target runtime to OSX_ARM64`); + runtime = platform.Runtime.OSX_ARM64; + } // fix path since it won't be correct config.installDirectory = path.join(path.dirname(absoluteConfigPath), config.installDirectory); let installer = new serviceDownloader(config); From 75553b9be3fc57faecbad5467f678214194361e2 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Thu, 6 Oct 2022 15:29:44 -0700 Subject: [PATCH 16/36] const --- extensions/mssql/build/postinstall.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/mssql/build/postinstall.js b/extensions/mssql/build/postinstall.js index 64a2b33461f8..b68254263cd1 100644 --- a/extensions/mssql/build/postinstall.js +++ b/extensions/mssql/build/postinstall.js @@ -15,7 +15,7 @@ async function installService() { const absoluteConfigPath = require.resolve('../config.json'); const config = require(absoluteConfigPath); - const runtime = (await platform.PlatformInformation.getCurrent()).runtimeId; + let runtime = (await platform.PlatformInformation.getCurrent()).runtimeId; const arch = process.env['npm_config_arch']; // We use macOS on x64 to produce arm64 build, as a result, we need to overwrite the runtime if the arch is arm64 From c92e6213b98e9bee5fad7ba43dfb3369e8f60efb Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Thu, 6 Oct 2022 17:15:54 -0700 Subject: [PATCH 17/36] fall back to x64 --- extensions/mssql/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/mssql/config.json b/extensions/mssql/config.json index cf180f8f3f4e..76da078ea1a1 100644 --- a/extensions/mssql/config.json +++ b/extensions/mssql/config.json @@ -5,7 +5,7 @@ "Windows_86": "win-x86-net6.0.zip", "Windows_64": "win-x64-net6.0.zip", "OSX": "osx-x64-net6.0.tar.gz", - "OSX_ARM64": "osx-arm64-net6.0.tar.gz", + "OSX_ARM64": "osx-x64-net6.0.tar.gz", "Linux": "rhel-x64-net6.0.tar.gz" }, "installDirectory": "./sqltoolsservice/{#platform#}/{#version#}", From a75cedf41c91010aebd421033ffbe79b9d4c9260 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Fri, 7 Oct 2022 10:01:45 -0700 Subject: [PATCH 18/36] pass in variable --- .../darwin/sql-product-build-darwin.yml | 18 ++++++++++----- build/azure-pipelines/sql-product-build.yml | 22 +++++++++++++++++-- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/build/azure-pipelines/darwin/sql-product-build-darwin.yml b/build/azure-pipelines/darwin/sql-product-build-darwin.yml index 7d0ab41cb39c..7b1aaa220511 100644 --- a/build/azure-pipelines/darwin/sql-product-build-darwin.yml +++ b/build/azure-pipelines/darwin/sql-product-build-darwin.yml @@ -109,7 +109,8 @@ steps: set -e ./scripts/test.sh --build --tfs "Unit Tests" --coverage displayName: Run unit tests - condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'), eq(variables['VSCODE_ARCH'], 'x64')) + condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true')) + #condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'), eq(variables['VSCODE_ARCH'], 'x64')) - script: | # Figure out the full absolute path of the product we just built @@ -122,7 +123,8 @@ steps: VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/azuredatastudio-reh-darwin" \ ./scripts/test-integration.sh --build --tfs "Integration Tests" displayName: Run integration tests (Electron) - condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['RUN_TESTS'], 'true')) + condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true')) + # condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['RUN_TESTS'], 'true')) - script: | set -e @@ -138,7 +140,8 @@ steps: yarn smoketest --build "$APP_ROOT/$APP_NAME" --screenshots "$(build.artifactstagingdirectory)/smokeshots" --log "$(build.artifactstagingdirectory)/logs/darwin/smoke.log" --extensionsDir "$(build.sourcesdirectory)/extensions" displayName: Run smoke tests (Electron) (Continue on Error) continueOnError: true - condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), and(or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true')), ne(variables['SMOKE_FAIL_ON_ERROR'], 'true'))) + condition: and(succeeded(), and(or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true')), ne(variables['SMOKE_FAIL_ON_ERROR'], 'true'))) + #condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), and(or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true')), ne(variables['SMOKE_FAIL_ON_ERROR'], 'true'))) - script: | set -e @@ -146,7 +149,8 @@ steps: APP_NAME="`ls $APP_ROOT | head -n 1`" yarn smoketest --build "$APP_ROOT/$APP_NAME" --screenshots "$(build.artifactstagingdirectory)/smokeshots" --log "$(build.artifactstagingdirectory)/logs/darwin/smoke.log" --extensionsDir "$(build.sourcesdirectory)/extensions" displayName: Run smoke tests (Electron) (Fail on Error) - condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), and(or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true')), eq(variables['SMOKE_FAIL_ON_ERROR'], 'true'))) + condition: and(succeeded(), and(or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true')), eq(variables['SMOKE_FAIL_ON_ERROR'], 'true'))) + #condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), and(or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true')), eq(variables['SMOKE_FAIL_ON_ERROR'], 'true'))) # - script: | # set -e @@ -219,7 +223,8 @@ steps: testResultsFiles: "*-results.xml" searchFolder: "$(Build.ArtifactStagingDirectory)/test-results" continueOnError: true - condition: and(succeededOrFailed(), eq(variables['VSCODE_ARCH'], 'x64'), or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true'))) + condition: and(succeededOrFailed(), or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true'))) + #condition: and(succeededOrFailed(), eq(variables['VSCODE_ARCH'], 'x64'), or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true'))) - task: PublishCodeCoverageResults@1 displayName: 'Publish code coverage from $(Build.SourcesDirectory)/.build/coverage/cobertura-coverage.xml' @@ -228,7 +233,8 @@ steps: summaryFileLocation: '$(Build.SourcesDirectory)/.build/coverage/cobertura-coverage.xml' reportDirectory: '$(Build.SourcesDirectory)/.build/coverage' continueOnError: true - condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['RUN_TESTS'], 'true')) + condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true')) + #condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['RUN_TESTS'], 'true')) - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 displayName: 'Component Detection' diff --git a/build/azure-pipelines/sql-product-build.yml b/build/azure-pipelines/sql-product-build.yml index 439999f7c3b2..5b77cb231548 100644 --- a/build/azure-pipelines/sql-product-build.yml +++ b/build/azure-pipelines/sql-product-build.yml @@ -46,6 +46,9 @@ stages: - job: macOS_ARM64 variables: VSCODE_ARCH: arm64 + # Do not run tests for arm64 builds + RUN_TESTS: false + RUN_SMOKE_TESTS: false steps: - template: darwin/sql-product-build-darwin.yml timeoutInMinutes: 90 @@ -60,6 +63,23 @@ stages: - template: darwin/sql-product-build-darwin-signing.yml timeoutInMinutes: 60 + # - job: macOS_Universal + # variables: + # VSCODE_ARCH: universal + # steps: + # - template: darwin/sql-product-build-darwin-universal.yml + # timeoutInMinutes: 90 + + # - job: macOS_Signing_Universal + # variables: + # VSCODE_ARCH: arm64 + # condition: and(succeeded(), eq(variables['signed'], true)) + # dependsOn: + # - macOS_Signing_ARM64 + # steps: + # - template: darwin/sql-product-build-darwin-signing.yml + # timeoutInMinutes: 60 + - stage: Linux condition: and(succeeded(), eq(variables['VSCODE_BUILD_LINUX'], true)) dependsOn: @@ -107,8 +127,6 @@ stages: - macOS - Linux - Windows - # disable due to invalid machine pool (karlb 3/9/2022) - # - Windows_Test jobs: - job: Release steps: From 59744947d2985467dc2254ae429173df6550bdd1 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Fri, 7 Oct 2022 10:52:09 -0700 Subject: [PATCH 19/36] universal flavor --- .../sql-product-build-darwin-universal.yml | 173 ++++++++++++++++++ build/azure-pipelines/sql-product-build.yml | 33 ++-- build/darwin/create-universal-app.js | 6 +- build/darwin/create-universal-app.ts | 6 +- 4 files changed, 197 insertions(+), 21 deletions(-) create mode 100644 build/azure-pipelines/darwin/sql-product-build-darwin-universal.yml diff --git a/build/azure-pipelines/darwin/sql-product-build-darwin-universal.yml b/build/azure-pipelines/darwin/sql-product-build-darwin-universal.yml new file mode 100644 index 000000000000..4d90b9648e99 --- /dev/null +++ b/build/azure-pipelines/darwin/sql-product-build-darwin-universal.yml @@ -0,0 +1,173 @@ +steps: + - task: InstallAppleCertificate@2 + displayName: 'Install developer certificate' + inputs: + certSecureFile: 'osx_signing_key.p12' + condition: eq(variables['signed'], true) + + - task: DownloadPipelineArtifact@2 + inputs: + artifact: Compilation + displayName: Download compilation output + + - script: | + set -e + tar -xzf $(Pipeline.Workspace)/compilation.tar.gz + displayName: Extract compilation output + + - task: NodeTool@0 + inputs: + versionSpec: "16.x" + + - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@3 + inputs: + versionSpec: "1.x" + + - task: AzureKeyVault@1 + displayName: 'Azure Key Vault: Get Secrets' + inputs: + azureSubscription: 'ClientToolsInfra_670062 (88d5392f-a34f-4769-b405-f597fc533613)' + KeyVaultName: ado-secrets + SecretsFilter: 'github-distro-mixin-password' + + - script: | + set -e + + cat << EOF > ~/.netrc + machine github.com + login azuredatastudio + password $(github-distro-mixin-password) + EOF + + git config user.email "sqltools@service.microsoft.com" + git config user.name "AzureDataStudio" + displayName: Prepare tooling + + - script: | + set -e + git remote add distro "https://github.com/$(VSCODE_MIXIN_REPO).git" + git fetch distro + git merge $(node -p "require('./package.json').distro") + displayName: Merge distro + + - script: | + mkdir -p .build + node build/azure-pipelines/common/sql-computeNodeModulesCacheKey.js $(VSCODE_ARCH) > .build/yarnlockhash + displayName: Prepare yarn cache key + + - task: Cache@2 + displayName: Restore Cache - Node Modules + inputs: + key: 'nodeModules | $(Agent.OS) | .build/yarnlockhash' + path: .build/node_modules_cache + cacheHitVar: NODE_MODULES_RESTORED + continueOnError: true + + - script: | + set -e + tar -xzf .build/node_modules_cache/cache.tgz + condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true')) + displayName: Extract node_modules archive + + - script: | + set -e + export npm_config_arch=$(VSCODE_ARCH) + CHILD_CONCURRENCY=1 yarn --frozen-lockfile + displayName: Install dependencies + env: + GITHUB_TOKEN: $(github-distro-mixin-password) + condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true')) + + - script: | + set -e + node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt + mkdir -p .build/node_modules_cache + tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt + condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true')) + displayName: Create node_modules archive + + - script: | + set -e + yarn postinstall + displayName: Run postinstall scripts + condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true')) + + - script: | + set -e + node build/azure-pipelines/mixin + displayName: Mix in quality + + - task: DownloadBuildArtifacts@0 + displayName: 'Download arm64 and x64 packages' + inputs: + downloadType: specific + itemPattern: 'drop/darwin/archive/azuredatastudio-darwin-@(arm64|x64)-unsigned.zip' + downloadPath: $(agent.builddirectory) + + - script: | + set -e + unzip $(agent.builddirectory)/azuredatastudio-darwin-x64-unsigned.zip -d $(agent.builddirectory)/azuredatastudio-darwin-x64 + unzip $(agent.builddirectory)/azuredatastudio-darwin-arm64-unsigned.zip -d $(agent.builddirectory)/azuredatastudio-darwin-arm64 + DEBUG=* node build/darwin/create-universal-app.js + displayName: Create Universal App + + - script: | + set -e + pushd $(agent.builddirectory)/azuredatastudio-darwin-$(VSCODE_ARCH) + ls + + echo "Cleaning the application" + xattr -cr *.app + cd *.app + find . -name '._*' -print0 | xargs -0 rm -rf -- + cd .. + + echo "Signing the application with deep" + codesign --deep --force --timestamp --options runtime --entitlements $(Build.SourcesDirectory)/build/azure-pipelines/darwin/entitlements.xml -s LPV3BJJYXS *.app + + cd *.app + ls + echo "Signing specific components" + find . -type f -print0 | xargs -0 file | grep ': *Mach-O' | sed 's/: *Mach-O.*//' | while read -r file; do codesign --options runtime --timestamp --entitlements $(Build.SourcesDirectory)/build/azure-pipelines/darwin/entitlements.xml -s LPV3BJJYXS --force "$file" || break; done + + echo "Signing Electron again..." + codesign --force --timestamp --options runtime --entitlements $(Build.SourcesDirectory)/build/azure-pipelines/darwin/entitlements.xml -s LPV3BJJYXS Contents/Frameworks/Electron\ Framework.framework + cd .. + + echo "Signing the entire application one more time" + codesign --force --timestamp --options runtime --entitlements $(Build.SourcesDirectory)/build/azure-pipelines/darwin/entitlements.xml -s LPV3BJJYXS *.app + popd + displayName: 'Manual codesign' + condition: and(succeeded(), eq(variables['signed'], true)) + + - script: | + set -e + mkdir -p .build/darwin/archive + pushd ../azuredatastudio-darwin-$(VSCODE_ARCH) + ditto -c -k --keepParent *.app $(Build.SourcesDirectory)/.build/darwin/archive/azuredatastudio-darwin-$(VSCODE_ARCH).zip + popd + displayName: 'Archive (no signing)' + condition: and(succeeded(), eq(variables['signed'], false)) + + - script: | + set -e + mkdir -p .build/darwin/archive + pushd ../azuredatastudio-darwin-$(VSCODE_ARCH) + ditto -c -k --keepParent *.app $(Build.SourcesDirectory)/.build/darwin/archive/azuredatastudio-darwin-$(VSCODE_ARCH)-unsigned.zip + popd + displayName: 'Archive' + condition: and(succeeded(), eq(variables['signed'], true)) + + - script: | + set -e + ./build/azure-pipelines/darwin/createDrop.sh + displayName: Create Drop + + - task: PublishBuildArtifacts@1 + displayName: 'Publish Artifact: drop' + condition: always() + + - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 + displayName: 'Component Detection' + inputs: + failOnAlert: true diff --git a/build/azure-pipelines/sql-product-build.yml b/build/azure-pipelines/sql-product-build.yml index 5b77cb231548..5837be0a2aec 100644 --- a/build/azure-pipelines/sql-product-build.yml +++ b/build/azure-pipelines/sql-product-build.yml @@ -63,22 +63,25 @@ stages: - template: darwin/sql-product-build-darwin-signing.yml timeoutInMinutes: 60 - # - job: macOS_Universal - # variables: - # VSCODE_ARCH: universal - # steps: - # - template: darwin/sql-product-build-darwin-universal.yml - # timeoutInMinutes: 90 + - job: macOS_Universal + variables: + VSCODE_ARCH: universal + dependsOn: + - macOS + - macOS_ARM64 + steps: + - template: darwin/sql-product-build-darwin-universal.yml + timeoutInMinutes: 90 - # - job: macOS_Signing_Universal - # variables: - # VSCODE_ARCH: arm64 - # condition: and(succeeded(), eq(variables['signed'], true)) - # dependsOn: - # - macOS_Signing_ARM64 - # steps: - # - template: darwin/sql-product-build-darwin-signing.yml - # timeoutInMinutes: 60 + - job: macOS_Signing_Universal + variables: + VSCODE_ARCH: universal + condition: and(succeeded(), eq(variables['signed'], true)) + dependsOn: + - macOS_Universal + steps: + - template: darwin/sql-product-build-darwin-signing.yml + timeoutInMinutes: 60 - stage: Linux condition: and(succeeded(), eq(variables['VSCODE_BUILD_LINUX'], true)) diff --git a/build/darwin/create-universal-app.js b/build/darwin/create-universal-app.js index 04e63f13d9cb..304105588278 100644 --- a/build/darwin/create-universal-app.js +++ b/build/darwin/create-universal-app.js @@ -17,11 +17,11 @@ async function main() { throw new Error('$AGENT_BUILDDIRECTORY not set'); } const appName = product.nameLong + '.app'; - const x64AppPath = path.join(buildDir, 'VSCode-darwin-x64', appName); - const arm64AppPath = path.join(buildDir, 'VSCode-darwin-arm64', appName); + const x64AppPath = path.join(buildDir, 'azuredatastudio-darwin-x64', appName); // {{SQL CARBON EDIT}} - CHANGE VSCode to azuredatastudio + const arm64AppPath = path.join(buildDir, 'azuredatastudio-darwin-arm64', appName); // {{SQL CARBON EDIT}} - CHANGE VSCode to azuredatastudio const x64AsarPath = path.join(x64AppPath, 'Contents', 'Resources', 'app', 'node_modules.asar'); const arm64AsarPath = path.join(arm64AppPath, 'Contents', 'Resources', 'app', 'node_modules.asar'); - const outAppPath = path.join(buildDir, `VSCode-darwin-${arch}`, appName); + const outAppPath = path.join(buildDir, `azuredatastudio-darwin-${arch}`, appName); // {{SQL CARBON EDIT}} - CHANGE VSCode to azuredatastudio const productJsonPath = path.resolve(outAppPath, 'Contents', 'Resources', 'app', 'product.json'); const infoPlistPath = path.resolve(outAppPath, 'Contents', 'Info.plist'); await (0, vscode_universal_bundler_1.makeUniversalApp)({ diff --git a/build/darwin/create-universal-app.ts b/build/darwin/create-universal-app.ts index 7cfd8e2050f2..aa03ca27846a 100644 --- a/build/darwin/create-universal-app.ts +++ b/build/darwin/create-universal-app.ts @@ -21,11 +21,11 @@ async function main() { } const appName = product.nameLong + '.app'; - const x64AppPath = path.join(buildDir, 'VSCode-darwin-x64', appName); - const arm64AppPath = path.join(buildDir, 'VSCode-darwin-arm64', appName); + const x64AppPath = path.join(buildDir, 'azuredatastudio-darwin-x64', appName); // {{SQL CARBON EDIT}} - CHANGE VSCode to azuredatastudio + const arm64AppPath = path.join(buildDir, 'azuredatastudio-darwin-arm64', appName); // {{SQL CARBON EDIT}} - CHANGE VSCode to azuredatastudio const x64AsarPath = path.join(x64AppPath, 'Contents', 'Resources', 'app', 'node_modules.asar'); const arm64AsarPath = path.join(arm64AppPath, 'Contents', 'Resources', 'app', 'node_modules.asar'); - const outAppPath = path.join(buildDir, `VSCode-darwin-${arch}`, appName); + const outAppPath = path.join(buildDir, `azuredatastudio-darwin-${arch}`, appName); // {{SQL CARBON EDIT}} - CHANGE VSCode to azuredatastudio const productJsonPath = path.resolve(outAppPath, 'Contents', 'Resources', 'app', 'product.json'); const infoPlistPath = path.resolve(outAppPath, 'Contents', 'Info.plist'); From 1334aa96efcd795eae15c295d2d83850cb1bd5bb Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Fri, 7 Oct 2022 12:39:12 -0700 Subject: [PATCH 20/36] fix universal --- .../darwin/sql-product-build-darwin-universal.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build/azure-pipelines/darwin/sql-product-build-darwin-universal.yml b/build/azure-pipelines/darwin/sql-product-build-darwin-universal.yml index 4d90b9648e99..b7f11df05725 100644 --- a/build/azure-pipelines/darwin/sql-product-build-darwin-universal.yml +++ b/build/azure-pipelines/darwin/sql-product-build-darwin-universal.yml @@ -52,7 +52,7 @@ steps: - script: | mkdir -p .build - node build/azure-pipelines/common/sql-computeNodeModulesCacheKey.js $(VSCODE_ARCH) > .build/yarnlockhash + node build/azure-pipelines/common/sql-computeNodeModulesCacheKey.js x64 > .build/yarnlockhash displayName: Prepare yarn cache key - task: Cache@2 @@ -71,7 +71,6 @@ steps: - script: | set -e - export npm_config_arch=$(VSCODE_ARCH) CHILD_CONCURRENCY=1 yarn --frozen-lockfile displayName: Install dependencies env: From 13002f32c8a8c386a8f6b1f18fab20b809f048fe Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Fri, 7 Oct 2022 13:57:31 -0700 Subject: [PATCH 21/36] fix path --- .../darwin/sql-product-build-darwin-universal.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/azure-pipelines/darwin/sql-product-build-darwin-universal.yml b/build/azure-pipelines/darwin/sql-product-build-darwin-universal.yml index b7f11df05725..936bddc65f50 100644 --- a/build/azure-pipelines/darwin/sql-product-build-darwin-universal.yml +++ b/build/azure-pipelines/darwin/sql-product-build-darwin-universal.yml @@ -105,8 +105,8 @@ steps: - script: | set -e - unzip $(agent.builddirectory)/azuredatastudio-darwin-x64-unsigned.zip -d $(agent.builddirectory)/azuredatastudio-darwin-x64 - unzip $(agent.builddirectory)/azuredatastudio-darwin-arm64-unsigned.zip -d $(agent.builddirectory)/azuredatastudio-darwin-arm64 + unzip $(agent.builddirectory)/drop/darwin/archive/azuredatastudio-darwin-x64-unsigned.zip -d $(agent.builddirectory)/azuredatastudio-darwin-x64 + unzip $(agent.builddirectory)/drop/darwin/archive/azuredatastudio-darwin-arm64-unsigned.zip -d $(agent.builddirectory)/azuredatastudio-darwin-arm64 DEBUG=* node build/darwin/create-universal-app.js displayName: Create Universal App From 7b606710632473642fafd106adec3d925f22060e Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Fri, 7 Oct 2022 15:49:11 -0700 Subject: [PATCH 22/36] remove --- build/darwin/create-universal-app.js | 1 + build/darwin/create-universal-app.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/build/darwin/create-universal-app.js b/build/darwin/create-universal-app.js index 304105588278..22a2ac92a9b0 100644 --- a/build/darwin/create-universal-app.js +++ b/build/darwin/create-universal-app.js @@ -51,6 +51,7 @@ async function main() { LSRequiresNativeExecution: true }); await fs.writeFile(infoPlistPath, plist.build(infoPlistJson), 'utf8'); + await fs.remove(path.join(buildDir, 'azuredatastudio-darwin-arm64', appName, '/Contents/Resources/app/extensions/mssql/sqltoolsservice')); // Verify if native module architecture is correct const findOutput = await (0, cross_spawn_promise_1.spawn)('find', [outAppPath, '-name', 'keytar.node']); const lipoOutput = await (0, cross_spawn_promise_1.spawn)('lipo', ['-archs', findOutput.replace(/\n$/, "")]); diff --git a/build/darwin/create-universal-app.ts b/build/darwin/create-universal-app.ts index aa03ca27846a..663eabb760cd 100644 --- a/build/darwin/create-universal-app.ts +++ b/build/darwin/create-universal-app.ts @@ -58,6 +58,7 @@ async function main() { LSRequiresNativeExecution: true }); await fs.writeFile(infoPlistPath, plist.build(infoPlistJson), 'utf8'); + await fs.remove(path.join(buildDir, 'azuredatastudio-darwin-arm64', appName, '/Contents/Resources/app/extensions/mssql/sqltoolsservice')); // Verify if native module architecture is correct const findOutput = await spawn('find', [outAppPath, '-name', 'keytar.node']) From a0e3842b9d527651530992f4f3766d0df86c8045 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Fri, 7 Oct 2022 20:40:00 -0700 Subject: [PATCH 23/36] special processing --- build/darwin/create-universal-app.js | 25 ++++++++++++++++++++++--- build/darwin/create-universal-app.ts | 27 ++++++++++++++++++++++++--- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/build/darwin/create-universal-app.js b/build/darwin/create-universal-app.js index 22a2ac92a9b0..f57eb8ec73ec 100644 --- a/build/darwin/create-universal-app.js +++ b/build/darwin/create-universal-app.js @@ -10,20 +10,40 @@ const fs = require("fs-extra"); const path = require("path"); const plist = require("plist"); const product = require("../../product.json"); +const glob = require("glob"); // {{SQL CARBON EDIT}} async function main() { const buildDir = process.env['AGENT_BUILDDIRECTORY']; const arch = process.env['VSCODE_ARCH']; if (!buildDir) { throw new Error('$AGENT_BUILDDIRECTORY not set'); } + // {{SQL CARBON EDIT}} + const x64AppNameBase = 'azuredatastudio-darwin-x64'; + const arm64AppNameBase = 'azuredatastudio-darwin-arm64'; + // {{SQL CARBON EDIT}} - END const appName = product.nameLong + '.app'; - const x64AppPath = path.join(buildDir, 'azuredatastudio-darwin-x64', appName); // {{SQL CARBON EDIT}} - CHANGE VSCode to azuredatastudio - const arm64AppPath = path.join(buildDir, 'azuredatastudio-darwin-arm64', appName); // {{SQL CARBON EDIT}} - CHANGE VSCode to azuredatastudio + const x64AppPath = path.join(buildDir, x64AppNameBase, appName); // {{SQL CARBON EDIT}} - CHANGE VSCode to azuredatastudio + const arm64AppPath = path.join(buildDir, arm64AppNameBase, appName); // {{SQL CARBON EDIT}} - CHANGE VSCode to azuredatastudio const x64AsarPath = path.join(x64AppPath, 'Contents', 'Resources', 'app', 'node_modules.asar'); const arm64AsarPath = path.join(arm64AppPath, 'Contents', 'Resources', 'app', 'node_modules.asar'); const outAppPath = path.join(buildDir, `azuredatastudio-darwin-${arch}`, appName); // {{SQL CARBON EDIT}} - CHANGE VSCode to azuredatastudio const productJsonPath = path.resolve(outAppPath, 'Contents', 'Resources', 'app', 'product.json'); const infoPlistPath = path.resolve(outAppPath, 'Contents', 'Info.plist'); + // {{SQL CARBON EDIT}} + const stsPath = '/Contents/Resources/app/extensions/mssql/sqltoolsservice'; + await fs.remove(path.join(x64AppPath, stsPath)); + await fs.remove(path.join(arm64AppPath, stsPath)); + glob(path.join(x64AppPath, '/Contents/Resources/app/**/nls.metadata.json'), (err, files) => { + if (err) { + console.warn(`Error occured while looking for nls.metadata.json files: ${err}`); + } + files.forEach(async (file) => { + const fileToReplace = file.replace(x64AppNameBase, arm64AppNameBase); + console.debug(`replacing file '${fileToReplace}' with '${file}'`); + await fs.move(file, fileToReplace, { overwrite: true }); + }); + }); + // {{SQL CARBON EDIT}} - END await (0, vscode_universal_bundler_1.makeUniversalApp)({ x64AppPath, arm64AppPath, @@ -51,7 +71,6 @@ async function main() { LSRequiresNativeExecution: true }); await fs.writeFile(infoPlistPath, plist.build(infoPlistJson), 'utf8'); - await fs.remove(path.join(buildDir, 'azuredatastudio-darwin-arm64', appName, '/Contents/Resources/app/extensions/mssql/sqltoolsservice')); // Verify if native module architecture is correct const findOutput = await (0, cross_spawn_promise_1.spawn)('find', [outAppPath, '-name', 'keytar.node']); const lipoOutput = await (0, cross_spawn_promise_1.spawn)('lipo', ['-archs', findOutput.replace(/\n$/, "")]); diff --git a/build/darwin/create-universal-app.ts b/build/darwin/create-universal-app.ts index 663eabb760cd..baf6727498e5 100644 --- a/build/darwin/create-universal-app.ts +++ b/build/darwin/create-universal-app.ts @@ -11,6 +11,7 @@ import * as fs from 'fs-extra'; import * as path from 'path'; import * as plist from 'plist'; import * as product from '../../product.json'; +import * as glob from 'glob'; // {{SQL CARBON EDIT}} async function main() { const buildDir = process.env['AGENT_BUILDDIRECTORY']; @@ -20,15 +21,36 @@ async function main() { throw new Error('$AGENT_BUILDDIRECTORY not set'); } + // {{SQL CARBON EDIT}} + const x64AppNameBase = 'azuredatastudio-darwin-x64'; + const arm64AppNameBase = 'azuredatastudio-darwin-arm64'; + // {{SQL CARBON EDIT}} - END + const appName = product.nameLong + '.app'; - const x64AppPath = path.join(buildDir, 'azuredatastudio-darwin-x64', appName); // {{SQL CARBON EDIT}} - CHANGE VSCode to azuredatastudio - const arm64AppPath = path.join(buildDir, 'azuredatastudio-darwin-arm64', appName); // {{SQL CARBON EDIT}} - CHANGE VSCode to azuredatastudio + const x64AppPath = path.join(buildDir, x64AppNameBase, appName); // {{SQL CARBON EDIT}} - CHANGE VSCode to azuredatastudio + const arm64AppPath = path.join(buildDir, arm64AppNameBase, appName); // {{SQL CARBON EDIT}} - CHANGE VSCode to azuredatastudio const x64AsarPath = path.join(x64AppPath, 'Contents', 'Resources', 'app', 'node_modules.asar'); const arm64AsarPath = path.join(arm64AppPath, 'Contents', 'Resources', 'app', 'node_modules.asar'); const outAppPath = path.join(buildDir, `azuredatastudio-darwin-${arch}`, appName); // {{SQL CARBON EDIT}} - CHANGE VSCode to azuredatastudio const productJsonPath = path.resolve(outAppPath, 'Contents', 'Resources', 'app', 'product.json'); const infoPlistPath = path.resolve(outAppPath, 'Contents', 'Info.plist'); + // {{SQL CARBON EDIT}} + const stsPath = '/Contents/Resources/app/extensions/mssql/sqltoolsservice'; + await fs.remove(path.join(x64AppPath, stsPath)); + await fs.remove(path.join(arm64AppPath, stsPath)); + glob(path.join(x64AppPath, '/Contents/Resources/app/**/nls.metadata.json'), (err, files) => { + if (err) { + console.warn(`Error occured while looking for nls.metadata.json files: ${err}`); + } + files.forEach(async file => { + const fileToReplace = file.replace(x64AppNameBase, arm64AppNameBase); + console.debug(`replacing file '${fileToReplace}' with '${file}'`); + await fs.move(file, fileToReplace, { overwrite: true }); + }); + }); + // {{SQL CARBON EDIT}} - END + await makeUniversalApp({ x64AppPath, arm64AppPath, @@ -58,7 +80,6 @@ async function main() { LSRequiresNativeExecution: true }); await fs.writeFile(infoPlistPath, plist.build(infoPlistJson), 'utf8'); - await fs.remove(path.join(buildDir, 'azuredatastudio-darwin-arm64', appName, '/Contents/Resources/app/extensions/mssql/sqltoolsservice')); // Verify if native module architecture is correct const findOutput = await spawn('find', [outAppPath, '-name', 'keytar.node']) From 0b88d75f19c06cdacc65967813c565f3f2df9c9b Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Fri, 7 Oct 2022 20:40:35 -0700 Subject: [PATCH 24/36] return on error --- build/darwin/create-universal-app.js | 1 + build/darwin/create-universal-app.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/build/darwin/create-universal-app.js b/build/darwin/create-universal-app.js index f57eb8ec73ec..a4e74edfbc63 100644 --- a/build/darwin/create-universal-app.js +++ b/build/darwin/create-universal-app.js @@ -36,6 +36,7 @@ async function main() { glob(path.join(x64AppPath, '/Contents/Resources/app/**/nls.metadata.json'), (err, files) => { if (err) { console.warn(`Error occured while looking for nls.metadata.json files: ${err}`); + return; } files.forEach(async (file) => { const fileToReplace = file.replace(x64AppNameBase, arm64AppNameBase); diff --git a/build/darwin/create-universal-app.ts b/build/darwin/create-universal-app.ts index baf6727498e5..41188a8467f9 100644 --- a/build/darwin/create-universal-app.ts +++ b/build/darwin/create-universal-app.ts @@ -42,6 +42,7 @@ async function main() { glob(path.join(x64AppPath, '/Contents/Resources/app/**/nls.metadata.json'), (err, files) => { if (err) { console.warn(`Error occured while looking for nls.metadata.json files: ${err}`); + return; } files.forEach(async file => { const fileToReplace = file.replace(x64AppNameBase, arm64AppNameBase); From 06d18c08a2f1e22f987196b4ffccdbf66d3c116e Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Fri, 7 Oct 2022 21:59:23 -0700 Subject: [PATCH 25/36] copy instead of move --- build/darwin/create-universal-app.js | 2 +- build/darwin/create-universal-app.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/darwin/create-universal-app.js b/build/darwin/create-universal-app.js index a4e74edfbc63..c7f4211c2cf4 100644 --- a/build/darwin/create-universal-app.js +++ b/build/darwin/create-universal-app.js @@ -41,7 +41,7 @@ async function main() { files.forEach(async (file) => { const fileToReplace = file.replace(x64AppNameBase, arm64AppNameBase); console.debug(`replacing file '${fileToReplace}' with '${file}'`); - await fs.move(file, fileToReplace, { overwrite: true }); + await fs.copy(file, fileToReplace, { overwrite: true }); }); }); // {{SQL CARBON EDIT}} - END diff --git a/build/darwin/create-universal-app.ts b/build/darwin/create-universal-app.ts index 41188a8467f9..7dafbe5f63bb 100644 --- a/build/darwin/create-universal-app.ts +++ b/build/darwin/create-universal-app.ts @@ -47,7 +47,7 @@ async function main() { files.forEach(async file => { const fileToReplace = file.replace(x64AppNameBase, arm64AppNameBase); console.debug(`replacing file '${fileToReplace}' with '${file}'`); - await fs.move(file, fileToReplace, { overwrite: true }); + await fs.copy(file, fileToReplace, { overwrite: true }); }); }); // {{SQL CARBON EDIT}} - END From 42f117fac27a489ffe7e9526f214c5a1d8321625 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Sat, 8 Oct 2022 11:51:34 -0700 Subject: [PATCH 26/36] restore sts --- build/darwin/create-universal-app.js | 12 ++++++++++-- build/darwin/create-universal-app.ts | 14 ++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/build/darwin/create-universal-app.js b/build/darwin/create-universal-app.js index c7f4211c2cf4..c2cbae2233be 100644 --- a/build/darwin/create-universal-app.js +++ b/build/darwin/create-universal-app.js @@ -31,8 +31,14 @@ async function main() { const infoPlistPath = path.resolve(outAppPath, 'Contents', 'Info.plist'); // {{SQL CARBON EDIT}} const stsPath = '/Contents/Resources/app/extensions/mssql/sqltoolsservice'; - await fs.remove(path.join(x64AppPath, stsPath)); - await fs.remove(path.join(arm64AppPath, stsPath)); + const tempSTSDir = path.join(buildDir, 'sqltoolsservice'); + const x64STSDir = path.join(x64AppPath, stsPath); + const arm64STSDir = path.join(arm64AppPath, stsPath); + const targetSTSDirs = [x64STSDir, arm64STSDir]; + await fs.copy(x64STSDir, tempSTSDir); + targetSTSDirs.forEach(async (dir) => { + await fs.remove(dir); + }); glob(path.join(x64AppPath, '/Contents/Resources/app/**/nls.metadata.json'), (err, files) => { if (err) { console.warn(`Error occured while looking for nls.metadata.json files: ${err}`); @@ -78,6 +84,8 @@ async function main() { if (lipoOutput.replace(/\n$/, "") !== 'x86_64 arm64') { throw new Error(`Invalid arch, got : ${lipoOutput}`); } + // {{SQL CARBON EDIT}} - copy the sts back to its original place + await fs.copy(tempSTSDir, path.join(outAppPath, stsPath), { overwrite: true }); } if (require.main === module) { main().catch(err => { diff --git a/build/darwin/create-universal-app.ts b/build/darwin/create-universal-app.ts index 7dafbe5f63bb..48be04bce2aa 100644 --- a/build/darwin/create-universal-app.ts +++ b/build/darwin/create-universal-app.ts @@ -37,8 +37,15 @@ async function main() { // {{SQL CARBON EDIT}} const stsPath = '/Contents/Resources/app/extensions/mssql/sqltoolsservice'; - await fs.remove(path.join(x64AppPath, stsPath)); - await fs.remove(path.join(arm64AppPath, stsPath)); + const tempSTSDir = path.join(buildDir, 'sqltoolsservice'); + const x64STSDir = path.join(x64AppPath, stsPath); + const arm64STSDir = path.join(arm64AppPath, stsPath); + const targetSTSDirs = [x64STSDir, arm64STSDir]; + await fs.copy(x64STSDir, tempSTSDir); + targetSTSDirs.forEach(async dir => { + await fs.remove(dir); + }); + glob(path.join(x64AppPath, '/Contents/Resources/app/**/nls.metadata.json'), (err, files) => { if (err) { console.warn(`Error occured while looking for nls.metadata.json files: ${err}`); @@ -88,6 +95,9 @@ async function main() { if (lipoOutput.replace(/\n$/, "") !== 'x86_64 arm64') { throw new Error(`Invalid arch, got : ${lipoOutput}`) } + + // {{SQL CARBON EDIT}} - copy the sts back to its original place + await fs.copy(tempSTSDir, path.join(outAppPath, stsPath), { overwrite: true }); } if (require.main === module) { From 1d62c0113711907b8f2e94409732fc747c28fc47 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Sat, 8 Oct 2022 15:39:10 -0700 Subject: [PATCH 27/36] release --- README.md | 4 +++- build/azure-pipelines/darwin/sql-publish.ps1 | 24 ++++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 41be67cace1c..62544d059cb4 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,9 @@ Go to our [download page](https://aka.ms/getazuredatastudio) for more specific i - [Windows User Installer - **Insiders build**](https://azuredatastudio-update.azurewebsites.net/latest/win32-x64-user/insider) - [Windows System Installer - **Insiders build**](https://azuredatastudio-update.azurewebsites.net/latest/win32-x64/insider) - [Windows ZIP - **Insiders build**](https://azuredatastudio-update.azurewebsites.net/latest/win32-x64-archive/insider) -- [macOS ZIP - **Insiders build**](https://azuredatastudio-update.azurewebsites.net/latest/darwin/insider) +- [macOS - Universal - **Insiders build**](https://azuredatastudio-update.azurewebsites.net/latest/darwin-universal/insider) +- [macOS - Intel chip - **Insiders build**](https://azuredatastudio-update.azurewebsites.net/latest/darwin/insider) +- [macOS - Apple Silicon ZIP - **Insiders build**](https://azuredatastudio-update.azurewebsites.net/latest/darwin-arm64/insider) - [Linux TAR.GZ - **Insiders build**](https://azuredatastudio-update.azurewebsites.net/latest/linux-x64/insider) See the [change log](https://github.com/Microsoft/azuredatastudio/blob/main/CHANGELOG.md) for additional details of what's in this release. diff --git a/build/azure-pipelines/darwin/sql-publish.ps1 b/build/azure-pipelines/darwin/sql-publish.ps1 index c22c77200875..6072132cb89e 100644 --- a/build/azure-pipelines/darwin/sql-publish.ps1 +++ b/build/azure-pipelines/darwin/sql-publish.ps1 @@ -13,12 +13,22 @@ $Version = $VersionJson.version $Quality = $VersionJson.quality $CommitId = $VersionJson.commit -$ZipName = "azuredatastudio-darwin.zip" -$Zip = "$artifactsDir\darwin\archive\$ZipName" -$UploadName = "azuredatastudio-macos-$Version" +$Flavors = "x64","arm64","universal" +$FlavorSuffixes = "","-arm64","-universal" -If (-NOT ($Quality -eq "stable")) { - $UploadName = "$UploadName-$Quality" -} +For($i = 0; $i < $Flavors.length; $i++) +{ + $Flavor = $Flavors[$i] + $FlavorSuffix = $FlavorSuffixes[$i] + $ZipName = "azuredatastudio-darwin-$Flavor.zip" + $Zip = "$artifactsDir\darwin\archive\$ZipName" + $UploadName = "azuredatastudio-macos$FlavorSuffix-$Version" + + If (-NOT ($Quality -eq "stable")) { + $UploadName = "$UploadName-$Quality" + } -node $sourcesDir\build\azure-pipelines\common\publish.js $Quality darwin archive "$UploadName.zip" $Version true $Zip $CommitId + $Platform = "darwin$FlavorSuffix" + + node $sourcesDir\build\azure-pipelines\common\publish.js $Quality $Platform archive "$UploadName.zip" $Version true $Zip $CommitId +} From 165cfa93b5fa94a7128c299bb0aa774db1e1cafa Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Sat, 8 Oct 2022 20:47:23 -0700 Subject: [PATCH 28/36] fix error --- build/azure-pipelines/darwin/sql-publish.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/azure-pipelines/darwin/sql-publish.ps1 b/build/azure-pipelines/darwin/sql-publish.ps1 index 6072132cb89e..e4a480eba5b6 100644 --- a/build/azure-pipelines/darwin/sql-publish.ps1 +++ b/build/azure-pipelines/darwin/sql-publish.ps1 @@ -16,7 +16,7 @@ $CommitId = $VersionJson.commit $Flavors = "x64","arm64","universal" $FlavorSuffixes = "","-arm64","-universal" -For($i = 0; $i < $Flavors.length; $i++) +For($i = 0; $i -lt $Flavors.Length; $i++) { $Flavor = $Flavors[$i] $FlavorSuffix = $FlavorSuffixes[$i] From e69a5056a33919fea612b75ac0b817c58b1dcf6a Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Sun, 9 Oct 2022 10:43:04 -0700 Subject: [PATCH 29/36] Fix readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 62544d059cb4..d581a7c8c007 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,9 @@ Go to our [download page](https://aka.ms/getazuredatastudio) for more specific i - [Windows User Installer - **Insiders build**](https://azuredatastudio-update.azurewebsites.net/latest/win32-x64-user/insider) - [Windows System Installer - **Insiders build**](https://azuredatastudio-update.azurewebsites.net/latest/win32-x64/insider) - [Windows ZIP - **Insiders build**](https://azuredatastudio-update.azurewebsites.net/latest/win32-x64-archive/insider) -- [macOS - Universal - **Insiders build**](https://azuredatastudio-update.azurewebsites.net/latest/darwin-universal/insider) -- [macOS - Intel chip - **Insiders build**](https://azuredatastudio-update.azurewebsites.net/latest/darwin/insider) -- [macOS - Apple Silicon ZIP - **Insiders build**](https://azuredatastudio-update.azurewebsites.net/latest/darwin-arm64/insider) +- [macOS ZIP (Universal) - **Insiders build**](https://azuredatastudio-update.azurewebsites.net/latest/darwin-universal/insider) +- [macOS ZIP (Intel Chip) - **Insiders build**](https://azuredatastudio-update.azurewebsites.net/latest/darwin/insider) +- [macOS ZIP (Apple Silicon) - **Insiders build**](https://azuredatastudio-update.azurewebsites.net/latest/darwin-arm64/insider) - [Linux TAR.GZ - **Insiders build**](https://azuredatastudio-update.azurewebsites.net/latest/linux-x64/insider) See the [change log](https://github.com/Microsoft/azuredatastudio/blob/main/CHANGELOG.md) for additional details of what's in this release. From 1ea2fee58a00daab11fa47e8dae9a3bb4b54202b Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Sun, 9 Oct 2022 11:31:53 -0700 Subject: [PATCH 30/36] remove commented code --- build/azure-pipelines/darwin/sql-product-build-darwin.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/build/azure-pipelines/darwin/sql-product-build-darwin.yml b/build/azure-pipelines/darwin/sql-product-build-darwin.yml index 7b1aaa220511..641fb78f06c4 100644 --- a/build/azure-pipelines/darwin/sql-product-build-darwin.yml +++ b/build/azure-pipelines/darwin/sql-product-build-darwin.yml @@ -110,7 +110,6 @@ steps: ./scripts/test.sh --build --tfs "Unit Tests" --coverage displayName: Run unit tests condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true')) - #condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true'), eq(variables['VSCODE_ARCH'], 'x64')) - script: | # Figure out the full absolute path of the product we just built @@ -124,7 +123,6 @@ steps: ./scripts/test-integration.sh --build --tfs "Integration Tests" displayName: Run integration tests (Electron) condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true')) - # condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['RUN_TESTS'], 'true')) - script: | set -e @@ -141,7 +139,6 @@ steps: displayName: Run smoke tests (Electron) (Continue on Error) continueOnError: true condition: and(succeeded(), and(or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true')), ne(variables['SMOKE_FAIL_ON_ERROR'], 'true'))) - #condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), and(or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true')), ne(variables['SMOKE_FAIL_ON_ERROR'], 'true'))) - script: | set -e @@ -150,7 +147,6 @@ steps: yarn smoketest --build "$APP_ROOT/$APP_NAME" --screenshots "$(build.artifactstagingdirectory)/smokeshots" --log "$(build.artifactstagingdirectory)/logs/darwin/smoke.log" --extensionsDir "$(build.sourcesdirectory)/extensions" displayName: Run smoke tests (Electron) (Fail on Error) condition: and(succeeded(), and(or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true')), eq(variables['SMOKE_FAIL_ON_ERROR'], 'true'))) - #condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), and(or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true')), eq(variables['SMOKE_FAIL_ON_ERROR'], 'true'))) # - script: | # set -e @@ -224,7 +220,6 @@ steps: searchFolder: "$(Build.ArtifactStagingDirectory)/test-results" continueOnError: true condition: and(succeededOrFailed(), or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true'))) - #condition: and(succeededOrFailed(), eq(variables['VSCODE_ARCH'], 'x64'), or(eq(variables['RUN_TESTS'], 'true'), eq(variables['RUN_SMOKE_TESTS'], 'true'))) - task: PublishCodeCoverageResults@1 displayName: 'Publish code coverage from $(Build.SourcesDirectory)/.build/coverage/cobertura-coverage.xml' @@ -234,7 +229,6 @@ steps: reportDirectory: '$(Build.SourcesDirectory)/.build/coverage' continueOnError: true condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true')) - #condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['RUN_TESTS'], 'true')) - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 displayName: 'Component Detection' From f1dba9bfdf5aa45885b88c350803fda1511ff241 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Sun, 9 Oct 2022 15:11:34 -0700 Subject: [PATCH 31/36] add comments --- build/darwin/create-universal-app.ts | 17 +++++++++++++++-- extensions/mssql/build/postinstall.js | 5 +++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/build/darwin/create-universal-app.ts b/build/darwin/create-universal-app.ts index 48be04bce2aa..aa614197e9cb 100644 --- a/build/darwin/create-universal-app.ts +++ b/build/darwin/create-universal-app.ts @@ -36,16 +36,29 @@ async function main() { const infoPlistPath = path.resolve(outAppPath, 'Contents', 'Info.plist'); // {{SQL CARBON EDIT}} + // Current STS arm64 builds doesn't work on osx-arm64, we need to use the x64 version of STS on osx-arm64 until the issue is fixed. + // Tracked by: https://github.com/microsoft/azuredatastudio/issues/20775 + // makeUniversalApp function will complain if the x64 ADS and arm64 ADS have the same STS binaries, to workaround the issue, we need + // to delete STS from both of them and then copy it to the universal app. const stsPath = '/Contents/Resources/app/extensions/mssql/sqltoolsservice'; const tempSTSDir = path.join(buildDir, 'sqltoolsservice'); const x64STSDir = path.join(x64AppPath, stsPath); const arm64STSDir = path.join(arm64AppPath, stsPath); const targetSTSDirs = [x64STSDir, arm64STSDir]; + + // backup the x64 STS to a temporary directory, later it will be copied to the universal app directory. await fs.copy(x64STSDir, tempSTSDir); + + // delete STS directories from both x64 ADS and arm64 ADS. targetSTSDirs.forEach(async dir => { await fs.remove(dir); }); + // makeUniversalApp requires the non-binary files in arm64 and x64 versions to be exactly the same, + // but sometimes the content of nls.metadata.json files could be different due to the fact that method JSON.stringify() is + // non-deterministic, the order of the properties might differ. + // the nls.metadata.json files are produced by https://github.com/microsoft/azuredatastudio/blob/711203ac4082919a814114e0910d171db3388b3f/src/vs/nls.build.js#L166 + // To workaround the issue, we need to replace these files in arm64 ADS with the files from x64 ADS. glob(path.join(x64AppPath, '/Contents/Resources/app/**/nls.metadata.json'), (err, files) => { if (err) { console.warn(`Error occured while looking for nls.metadata.json files: ${err}`); @@ -53,7 +66,7 @@ async function main() { } files.forEach(async file => { const fileToReplace = file.replace(x64AppNameBase, arm64AppNameBase); - console.debug(`replacing file '${fileToReplace}' with '${file}'`); + console.debug(`Replacing file '${fileToReplace}' with '${file}'`); await fs.copy(file, fileToReplace, { overwrite: true }); }); }); @@ -96,7 +109,7 @@ async function main() { throw new Error(`Invalid arch, got : ${lipoOutput}`) } - // {{SQL CARBON EDIT}} - copy the sts back to its original place + // {{SQL CARBON EDIT}} - copy SQLTOOLSService to universal app folder await fs.copy(tempSTSDir, path.join(outAppPath, stsPath), { overwrite: true }); } diff --git a/extensions/mssql/build/postinstall.js b/extensions/mssql/build/postinstall.js index b68254263cd1..3db216ff11bd 100644 --- a/extensions/mssql/build/postinstall.js +++ b/extensions/mssql/build/postinstall.js @@ -18,9 +18,10 @@ let runtime = (await platform.PlatformInformation.getCurrent()).runtimeId; const arch = process.env['npm_config_arch']; - // We use macOS on x64 to produce arm64 build, as a result, we need to overwrite the runtime if the arch is arm64 + // In the build pipeline, macOS x64 image is used to produce arm64 build, + // we need to check the environment variable to determine the actual target runtime. if (runtime === platform.Runtime.OSX && arch === 'arm64') { - console.log(`Change the target runtime to OSX_ARM64`); + console.log(`Set the target runtime to OSX_ARM64`); runtime = platform.Runtime.OSX_ARM64; } // fix path since it won't be correct From 0e3795f785be9b527c8aab562d3fcf5de4e2f145 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Mon, 10 Oct 2022 09:49:29 -0700 Subject: [PATCH 32/36] add issue --- build/darwin/create-universal-app.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build/darwin/create-universal-app.ts b/build/darwin/create-universal-app.ts index aa614197e9cb..bfa4e4cfea52 100644 --- a/build/darwin/create-universal-app.ts +++ b/build/darwin/create-universal-app.ts @@ -45,11 +45,10 @@ async function main() { const x64STSDir = path.join(x64AppPath, stsPath); const arm64STSDir = path.join(arm64AppPath, stsPath); const targetSTSDirs = [x64STSDir, arm64STSDir]; - // backup the x64 STS to a temporary directory, later it will be copied to the universal app directory. await fs.copy(x64STSDir, tempSTSDir); - // delete STS directories from both x64 ADS and arm64 ADS. + console.debug(`Removing SqlToolsService folders.`); targetSTSDirs.forEach(async dir => { await fs.remove(dir); }); @@ -59,6 +58,7 @@ async function main() { // non-deterministic, the order of the properties might differ. // the nls.metadata.json files are produced by https://github.com/microsoft/azuredatastudio/blob/711203ac4082919a814114e0910d171db3388b3f/src/vs/nls.build.js#L166 // To workaround the issue, we need to replace these files in arm64 ADS with the files from x64 ADS. + // Tracked by issue: https://github.com/microsoft/azuredatastudio/issues/20792 glob(path.join(x64AppPath, '/Contents/Resources/app/**/nls.metadata.json'), (err, files) => { if (err) { console.warn(`Error occured while looking for nls.metadata.json files: ${err}`); @@ -109,7 +109,8 @@ async function main() { throw new Error(`Invalid arch, got : ${lipoOutput}`) } - // {{SQL CARBON EDIT}} - copy SQLTOOLSService to universal app folder + // {{SQL CARBON EDIT}} + console.debug(`Copying SqlToolsService to the universal app folder.`); await fs.copy(tempSTSDir, path.join(outAppPath, stsPath), { overwrite: true }); } From dfdf2f57a66972c4572926cd905d980ba5fc675f Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Mon, 10 Oct 2022 12:58:25 -0700 Subject: [PATCH 33/36] update comment --- build/darwin/create-universal-app.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build/darwin/create-universal-app.ts b/build/darwin/create-universal-app.ts index bfa4e4cfea52..c8f5aad62577 100644 --- a/build/darwin/create-universal-app.ts +++ b/build/darwin/create-universal-app.ts @@ -54,9 +54,7 @@ async function main() { }); // makeUniversalApp requires the non-binary files in arm64 and x64 versions to be exactly the same, - // but sometimes the content of nls.metadata.json files could be different due to the fact that method JSON.stringify() is - // non-deterministic, the order of the properties might differ. - // the nls.metadata.json files are produced by https://github.com/microsoft/azuredatastudio/blob/711203ac4082919a814114e0910d171db3388b3f/src/vs/nls.build.js#L166 + // but sometimes the content of nls.metadata.json files could be different(only the order of the entries). // To workaround the issue, we need to replace these files in arm64 ADS with the files from x64 ADS. // Tracked by issue: https://github.com/microsoft/azuredatastudio/issues/20792 glob(path.join(x64AppPath, '/Contents/Resources/app/**/nls.metadata.json'), (err, files) => { From 521f60d4e12e3bda94f2f4b84d322c5697b9d468 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Mon, 10 Oct 2022 16:23:51 -0700 Subject: [PATCH 34/36] pr comments --- .../darwin/sql-product-build-darwin.yml | 22 +++++++++++++++++-- build/azure-pipelines/sql-product-build.yml | 10 +++++++-- build/darwin/create-universal-app.ts | 15 +++++-------- extensions/mssql/config.json | 1 - 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/build/azure-pipelines/darwin/sql-product-build-darwin.yml b/build/azure-pipelines/darwin/sql-product-build-darwin.yml index 641fb78f06c4..7667af04dedc 100644 --- a/build/azure-pipelines/darwin/sql-product-build-darwin.yml +++ b/build/azure-pipelines/darwin/sql-product-build-darwin.yml @@ -52,7 +52,7 @@ steps: - script: | mkdir -p .build - node build/azure-pipelines/common/sql-computeNodeModulesCacheKey.js $VSCODE_ARCH > .build/yarnlockhash + node build/azure-pipelines/common/sql-computeNodeModulesCacheKey.js $(NPM_CONFIG_ARCH) > .build/yarnlockhash displayName: Prepare yarn cache key - task: Cache@2 @@ -71,7 +71,7 @@ steps: - script: | set -e - export npm_config_arch=$(VSCODE_ARCH) + export npm_config_arch=$(NPM_CONFIG_ARCH) CHILD_CONCURRENCY=1 yarn --frozen-lockfile displayName: Install dependencies env: @@ -104,6 +104,7 @@ steps: displayName: Build env: VSCODE_MIXIN_PASSWORD: $(github-distro-mixin-password) + condition: and(succeeded(), ne(variables['VSCODE_ARCH'], 'universal')) - script: | set -e @@ -128,6 +129,7 @@ steps: set -e yarn gulp compile-extensions displayName: Compile Extensions + condition: and(succeeded(), ne(variables['VSCODE_ARCH'], 'universal')) # Per https://developercommunity.visualstudio.com/t/variablesexpressions-dont-work-with-continueonerro/1187733 we can't use variables # in continueOnError directly so instead make two copies of the task and only run one or the other based on the SMOKE_FAIL_ON_ERROR value @@ -157,6 +159,22 @@ steps: # continueOnError: true # condition: and(succeeded(), eq(variables['RUN_TESTS'], 'true')) + - task: DownloadBuildArtifacts@0 + displayName: 'Download arm64 and x64 packages' + inputs: + downloadType: specific + itemPattern: 'drop/darwin/archive/azuredatastudio-darwin-@(arm64|x64)-unsigned.zip' + downloadPath: $(agent.builddirectory) + condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'universal')) + + - script: | + set -e + unzip $(agent.builddirectory)/drop/darwin/archive/azuredatastudio-darwin-x64-unsigned.zip -d $(agent.builddirectory)/azuredatastudio-darwin-x64 + unzip $(agent.builddirectory)/drop/darwin/archive/azuredatastudio-darwin-arm64-unsigned.zip -d $(agent.builddirectory)/azuredatastudio-darwin-arm64 + DEBUG=* node build/darwin/create-universal-app.js + displayName: Create Universal App + condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'universal')) + - script: | set -e pushd ../azuredatastudio-darwin-$(VSCODE_ARCH) diff --git a/build/azure-pipelines/sql-product-build.yml b/build/azure-pipelines/sql-product-build.yml index 5837be0a2aec..e6335e82b7e2 100644 --- a/build/azure-pipelines/sql-product-build.yml +++ b/build/azure-pipelines/sql-product-build.yml @@ -28,6 +28,7 @@ stages: jobs: - job: macOS variables: + NPM_CONFIG_ARCH: x64 VSCODE_ARCH: x64 steps: - template: darwin/sql-product-build-darwin.yml @@ -45,8 +46,9 @@ stages: - job: macOS_ARM64 variables: + NPM_CONFIG_ARCH: arm64 VSCODE_ARCH: arm64 - # Do not run tests for arm64 builds + # Do not run tests for arm64 build RUN_TESTS: false RUN_SMOKE_TESTS: false steps: @@ -65,12 +67,16 @@ stages: - job: macOS_Universal variables: + NPM_CONFIG_ARCH: x64 VSCODE_ARCH: universal + # Do not run tests for universal build + RUN_TESTS: false + RUN_SMOKE_TESTS: false dependsOn: - macOS - macOS_ARM64 steps: - - template: darwin/sql-product-build-darwin-universal.yml + - template: darwin/sql-product-build-darwin.yml timeoutInMinutes: 90 - job: macOS_Signing_Universal diff --git a/build/darwin/create-universal-app.ts b/build/darwin/create-universal-app.ts index c8f5aad62577..9c974e04d82e 100644 --- a/build/darwin/create-universal-app.ts +++ b/build/darwin/create-universal-app.ts @@ -57,16 +57,11 @@ async function main() { // but sometimes the content of nls.metadata.json files could be different(only the order of the entries). // To workaround the issue, we need to replace these files in arm64 ADS with the files from x64 ADS. // Tracked by issue: https://github.com/microsoft/azuredatastudio/issues/20792 - glob(path.join(x64AppPath, '/Contents/Resources/app/**/nls.metadata.json'), (err, files) => { - if (err) { - console.warn(`Error occured while looking for nls.metadata.json files: ${err}`); - return; - } - files.forEach(async file => { - const fileToReplace = file.replace(x64AppNameBase, arm64AppNameBase); - console.debug(`Replacing file '${fileToReplace}' with '${file}'`); - await fs.copy(file, fileToReplace, { overwrite: true }); - }); + const sourceFiles = glob.sync(path.join(x64AppPath, '/Contents/Resources/app/**/nls.metadata.json')); + sourceFiles.forEach(source => { + const target = source.replace(x64AppNameBase, arm64AppNameBase); + console.debug(`Replacing file '${target}' with '${source}'`); + fs.copySync(source, target, { overwrite: true }); }); // {{SQL CARBON EDIT}} - END diff --git a/extensions/mssql/config.json b/extensions/mssql/config.json index 76da078ea1a1..013b247f579b 100644 --- a/extensions/mssql/config.json +++ b/extensions/mssql/config.json @@ -5,7 +5,6 @@ "Windows_86": "win-x86-net6.0.zip", "Windows_64": "win-x64-net6.0.zip", "OSX": "osx-x64-net6.0.tar.gz", - "OSX_ARM64": "osx-x64-net6.0.tar.gz", "Linux": "rhel-x64-net6.0.tar.gz" }, "installDirectory": "./sqltoolsservice/{#platform#}/{#version#}", From b6916eb4a73fd122c1a7c8e575ce1af939ac8b0a Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Mon, 10 Oct 2022 16:47:26 -0700 Subject: [PATCH 35/36] delete universal yml --- .../sql-product-build-darwin-universal.yml | 172 ------------------ 1 file changed, 172 deletions(-) delete mode 100644 build/azure-pipelines/darwin/sql-product-build-darwin-universal.yml diff --git a/build/azure-pipelines/darwin/sql-product-build-darwin-universal.yml b/build/azure-pipelines/darwin/sql-product-build-darwin-universal.yml deleted file mode 100644 index 936bddc65f50..000000000000 --- a/build/azure-pipelines/darwin/sql-product-build-darwin-universal.yml +++ /dev/null @@ -1,172 +0,0 @@ -steps: - - task: InstallAppleCertificate@2 - displayName: 'Install developer certificate' - inputs: - certSecureFile: 'osx_signing_key.p12' - condition: eq(variables['signed'], true) - - - task: DownloadPipelineArtifact@2 - inputs: - artifact: Compilation - displayName: Download compilation output - - - script: | - set -e - tar -xzf $(Pipeline.Workspace)/compilation.tar.gz - displayName: Extract compilation output - - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - - - task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@3 - inputs: - versionSpec: "1.x" - - - task: AzureKeyVault@1 - displayName: 'Azure Key Vault: Get Secrets' - inputs: - azureSubscription: 'ClientToolsInfra_670062 (88d5392f-a34f-4769-b405-f597fc533613)' - KeyVaultName: ado-secrets - SecretsFilter: 'github-distro-mixin-password' - - - script: | - set -e - - cat << EOF > ~/.netrc - machine github.com - login azuredatastudio - password $(github-distro-mixin-password) - EOF - - git config user.email "sqltools@service.microsoft.com" - git config user.name "AzureDataStudio" - displayName: Prepare tooling - - - script: | - set -e - git remote add distro "https://github.com/$(VSCODE_MIXIN_REPO).git" - git fetch distro - git merge $(node -p "require('./package.json').distro") - displayName: Merge distro - - - script: | - mkdir -p .build - node build/azure-pipelines/common/sql-computeNodeModulesCacheKey.js x64 > .build/yarnlockhash - displayName: Prepare yarn cache key - - - task: Cache@2 - displayName: Restore Cache - Node Modules - inputs: - key: 'nodeModules | $(Agent.OS) | .build/yarnlockhash' - path: .build/node_modules_cache - cacheHitVar: NODE_MODULES_RESTORED - continueOnError: true - - - script: | - set -e - tar -xzf .build/node_modules_cache/cache.tgz - condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true')) - displayName: Extract node_modules archive - - - script: | - set -e - CHILD_CONCURRENCY=1 yarn --frozen-lockfile - displayName: Install dependencies - env: - GITHUB_TOKEN: $(github-distro-mixin-password) - condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true')) - - - script: | - set -e - node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt - mkdir -p .build/node_modules_cache - tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt - condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true')) - displayName: Create node_modules archive - - - script: | - set -e - yarn postinstall - displayName: Run postinstall scripts - condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true')) - - - script: | - set -e - node build/azure-pipelines/mixin - displayName: Mix in quality - - - task: DownloadBuildArtifacts@0 - displayName: 'Download arm64 and x64 packages' - inputs: - downloadType: specific - itemPattern: 'drop/darwin/archive/azuredatastudio-darwin-@(arm64|x64)-unsigned.zip' - downloadPath: $(agent.builddirectory) - - - script: | - set -e - unzip $(agent.builddirectory)/drop/darwin/archive/azuredatastudio-darwin-x64-unsigned.zip -d $(agent.builddirectory)/azuredatastudio-darwin-x64 - unzip $(agent.builddirectory)/drop/darwin/archive/azuredatastudio-darwin-arm64-unsigned.zip -d $(agent.builddirectory)/azuredatastudio-darwin-arm64 - DEBUG=* node build/darwin/create-universal-app.js - displayName: Create Universal App - - - script: | - set -e - pushd $(agent.builddirectory)/azuredatastudio-darwin-$(VSCODE_ARCH) - ls - - echo "Cleaning the application" - xattr -cr *.app - cd *.app - find . -name '._*' -print0 | xargs -0 rm -rf -- - cd .. - - echo "Signing the application with deep" - codesign --deep --force --timestamp --options runtime --entitlements $(Build.SourcesDirectory)/build/azure-pipelines/darwin/entitlements.xml -s LPV3BJJYXS *.app - - cd *.app - ls - echo "Signing specific components" - find . -type f -print0 | xargs -0 file | grep ': *Mach-O' | sed 's/: *Mach-O.*//' | while read -r file; do codesign --options runtime --timestamp --entitlements $(Build.SourcesDirectory)/build/azure-pipelines/darwin/entitlements.xml -s LPV3BJJYXS --force "$file" || break; done - - echo "Signing Electron again..." - codesign --force --timestamp --options runtime --entitlements $(Build.SourcesDirectory)/build/azure-pipelines/darwin/entitlements.xml -s LPV3BJJYXS Contents/Frameworks/Electron\ Framework.framework - cd .. - - echo "Signing the entire application one more time" - codesign --force --timestamp --options runtime --entitlements $(Build.SourcesDirectory)/build/azure-pipelines/darwin/entitlements.xml -s LPV3BJJYXS *.app - popd - displayName: 'Manual codesign' - condition: and(succeeded(), eq(variables['signed'], true)) - - - script: | - set -e - mkdir -p .build/darwin/archive - pushd ../azuredatastudio-darwin-$(VSCODE_ARCH) - ditto -c -k --keepParent *.app $(Build.SourcesDirectory)/.build/darwin/archive/azuredatastudio-darwin-$(VSCODE_ARCH).zip - popd - displayName: 'Archive (no signing)' - condition: and(succeeded(), eq(variables['signed'], false)) - - - script: | - set -e - mkdir -p .build/darwin/archive - pushd ../azuredatastudio-darwin-$(VSCODE_ARCH) - ditto -c -k --keepParent *.app $(Build.SourcesDirectory)/.build/darwin/archive/azuredatastudio-darwin-$(VSCODE_ARCH)-unsigned.zip - popd - displayName: 'Archive' - condition: and(succeeded(), eq(variables['signed'], true)) - - - script: | - set -e - ./build/azure-pipelines/darwin/createDrop.sh - displayName: Create Drop - - - task: PublishBuildArtifacts@1 - displayName: 'Publish Artifact: drop' - condition: always() - - - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 - displayName: 'Component Detection' - inputs: - failOnAlert: true From bcd06e8f9b6477b9ae2c38206f598d716bbd2872 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Mon, 10 Oct 2022 16:55:19 -0700 Subject: [PATCH 36/36] update the generated js file --- build/darwin/create-universal-app.js | 29 +++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/build/darwin/create-universal-app.js b/build/darwin/create-universal-app.js index c2cbae2233be..f706d6e512ca 100644 --- a/build/darwin/create-universal-app.js +++ b/build/darwin/create-universal-app.js @@ -30,25 +30,31 @@ async function main() { const productJsonPath = path.resolve(outAppPath, 'Contents', 'Resources', 'app', 'product.json'); const infoPlistPath = path.resolve(outAppPath, 'Contents', 'Info.plist'); // {{SQL CARBON EDIT}} + // Current STS arm64 builds doesn't work on osx-arm64, we need to use the x64 version of STS on osx-arm64 until the issue is fixed. + // Tracked by: https://github.com/microsoft/azuredatastudio/issues/20775 + // makeUniversalApp function will complain if the x64 ADS and arm64 ADS have the same STS binaries, to workaround the issue, we need + // to delete STS from both of them and then copy it to the universal app. const stsPath = '/Contents/Resources/app/extensions/mssql/sqltoolsservice'; const tempSTSDir = path.join(buildDir, 'sqltoolsservice'); const x64STSDir = path.join(x64AppPath, stsPath); const arm64STSDir = path.join(arm64AppPath, stsPath); const targetSTSDirs = [x64STSDir, arm64STSDir]; + // backup the x64 STS to a temporary directory, later it will be copied to the universal app directory. await fs.copy(x64STSDir, tempSTSDir); + // delete STS directories from both x64 ADS and arm64 ADS. + console.debug(`Removing SqlToolsService folders.`); targetSTSDirs.forEach(async (dir) => { await fs.remove(dir); }); - glob(path.join(x64AppPath, '/Contents/Resources/app/**/nls.metadata.json'), (err, files) => { - if (err) { - console.warn(`Error occured while looking for nls.metadata.json files: ${err}`); - return; - } - files.forEach(async (file) => { - const fileToReplace = file.replace(x64AppNameBase, arm64AppNameBase); - console.debug(`replacing file '${fileToReplace}' with '${file}'`); - await fs.copy(file, fileToReplace, { overwrite: true }); - }); + // makeUniversalApp requires the non-binary files in arm64 and x64 versions to be exactly the same, + // but sometimes the content of nls.metadata.json files could be different(only the order of the entries). + // To workaround the issue, we need to replace these files in arm64 ADS with the files from x64 ADS. + // Tracked by issue: https://github.com/microsoft/azuredatastudio/issues/20792 + const sourceFiles = glob.sync(path.join(x64AppPath, '/Contents/Resources/app/**/nls.metadata.json')); + sourceFiles.forEach(source => { + const target = source.replace(x64AppNameBase, arm64AppNameBase); + console.debug(`Replacing file '${target}' with '${source}'`); + fs.copySync(source, target, { overwrite: true }); }); // {{SQL CARBON EDIT}} - END await (0, vscode_universal_bundler_1.makeUniversalApp)({ @@ -84,7 +90,8 @@ async function main() { if (lipoOutput.replace(/\n$/, "") !== 'x86_64 arm64') { throw new Error(`Invalid arch, got : ${lipoOutput}`); } - // {{SQL CARBON EDIT}} - copy the sts back to its original place + // {{SQL CARBON EDIT}} + console.debug(`Copying SqlToolsService to the universal app folder.`); await fs.copy(tempSTSDir, path.join(outAppPath, stsPath), { overwrite: true }); } if (require.main === module) {