Browse Source

fix: use correct binary name (#2561)

Baptiste Augrain 2 days ago
parent
commit
51ad421762
3 changed files with 109 additions and 91 deletions
  1. 12 3
      patches/cli.patch
  2. 95 88
      prepare_vscode.sh
  3. 2 0
      utils.sh

+ 12 - 3
patches/cli.patch

@@ -1,13 +1,13 @@
 diff --git a/cli/src/commands/serve_web.rs b/cli/src/commands/serve_web.rs
-index 2ddefe1..ab9c658 100644
+index d3f7db8..988024b 100644
 --- a/cli/src/commands/serve_web.rs
 +++ b/cli/src/commands/serve_web.rs
-@@ -730,3 +730,3 @@ impl ConnectionManager {
+@@ -756,3 +756,3 @@ impl ConnectionManager {
  		let dir_fut = cache.create(&args.release.commit, |target_dir| async move {
 -			info!(log_for_fut, "Downloading server {}", release_for_fut.commit);
 +			info!(log_for_fut, "Downloading server {}/{}", release_for_fut.commit, release_for_fut.name);
  			let tmpdir = tempfile::tempdir().unwrap();
-@@ -758,3 +758,3 @@ impl ConnectionManager {
+@@ -784,3 +784,3 @@ impl ConnectionManager {
  			.join("bin")
 -			.join(args.release.quality.server_entrypoint());
 +			.join(args.release.quality.server_entrypoint().unwrap());
@@ -300,3 +300,12 @@ index 9033914..a39bbf7 100644
 -	}
 -
  	pub fn env_default() -> Option<Platform> {
+diff --git a/extensions/tunnel-forwarding/src/extension.ts b/extensions/tunnel-forwarding/src/extension.ts
+index 299c728..9fb635d 100644
+--- a/extensions/tunnel-forwarding/src/extension.ts
++++ b/extensions/tunnel-forwarding/src/extension.ts
+@@ -28,3 +28,3 @@ const cliPath = process.env.VSCODE_FORWARDING_IS_DEV
+ 		process.platform === 'darwin' ? 'bin' : '../../bin',
+-		vscode.env.appQuality === 'stable' ? 'code-tunnel' : 'code-tunnel-insiders',
++		'!!TUNNEL_APP_NAME!!'
+ 	) + (process.platform === 'win32' ? '.exe' : '');

+ 95 - 88
prepare_vscode.sh

@@ -3,9 +3,6 @@
 
 set -e
 
-# include common functions
-. ./utils.sh
-
 if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
   cp -rp src/insider/* vscode/
 else
@@ -16,88 +13,8 @@ cp -f LICENSE vscode/LICENSE.txt
 
 cd vscode || { echo "'vscode' dir not found"; exit 1; }
 
-# apply patches
-{ set +x; } 2>/dev/null
-
-echo "APP_NAME=\"${APP_NAME}\""
-echo "APP_NAME_LC=\"${APP_NAME_LC}\""
-echo "BINARY_NAME=\"${BINARY_NAME}\""
-echo "GH_REPO_PATH=\"${GH_REPO_PATH}\""
-echo "ORG_NAME=\"${ORG_NAME}\""
-
-if [[ "${DISABLE_UPDATE}" == "yes" ]]; then
-  mv ../patches/disable-update.patch.yet ../patches/disable-update.patch
-fi
-
-for file in ../patches/*.patch; do
-  if [[ -f "${file}" ]]; then
-    apply_patch "${file}"
-  fi
-done
-
-if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
-  for file in ../patches/insider/*.patch; do
-    if [[ -f "${file}" ]]; then
-      apply_patch "${file}"
-    fi
-  done
-fi
-
-if [[ -d "../patches/${OS_NAME}/" ]]; then
-  for file in "../patches/${OS_NAME}/"*.patch; do
-    if [[ -f "${file}" ]]; then
-      apply_patch "${file}"
-    fi
-  done
-fi
-
-for file in ../patches/user/*.patch; do
-  if [[ -f "${file}" ]]; then
-    apply_patch "${file}"
-  fi
-done
-
-set -x
-
-export ELECTRON_SKIP_BINARY_DOWNLOAD=1
-export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
-
-if [[ "${OS_NAME}" == "linux" ]]; then
-  export VSCODE_SKIP_NODE_VERSION_CHECK=1
-
-   if [[ "${npm_config_arch}" == "arm" ]]; then
-    export npm_config_arm_version=7
-  fi
-elif [[ "${OS_NAME}" == "windows" ]]; then
-  if [[ "${npm_config_arch}" == "arm" ]]; then
-    export npm_config_arm_version=7
-  fi
-else
-  if [[ "${CI_BUILD}" != "no" ]]; then
-    clang++ --version
-  fi
-fi
-
-mv .npmrc .npmrc.bak
-cp ../npmrc .npmrc
-
-for i in {1..5}; do # try 5 times
-  if [[ "${CI_BUILD}" != "no" && "${OS_NAME}" == "osx" ]]; then
-    CXX=clang++ npm ci && break
-  else
-    npm ci && break
-  fi
-
-  if [[ $i == 5 ]]; then
-    echo "Npm install failed too many times" >&2
-    exit 1
-  fi
-  echo "Npm install failed $i, trying again..."
-
-  sleep $(( 15 * (i + 1)))
-done
-
-mv .npmrc.bak .npmrc
+# {{{ product.json
+cp product.json{,.bak}
 
 setpath() {
   local jsonTmp
@@ -115,9 +32,6 @@ setpath_json() {
   set -x
 }
 
-# product.json
-cp product.json{,.bak}
-
 setpath "product" "checksumFailMoreInfoUrl" "https://go.microsoft.com/fwlink/?LinkId=828886"
 setpath "product" "documentationUrl" "https://go.microsoft.com/fwlink/?LinkID=533484#vscode"
 setpath_json "product" "extensionsGallery" '{"serviceUrl": "https://open-vsx.org/vscode/gallery", "itemUrl": "https://open-vsx.org/vscode/item", "latestUrlTemplate": "https://open-vsx.org/vscode/gallery/{publisher}/{name}/latest", "controlUrl": "https://raw.githubusercontent.com/EclipseFdn/publish-extensions/refs/heads/master/extension-control/extensions.json"}'
@@ -201,10 +115,103 @@ else
   setpath "product" "win32ContextMenu.arm64.clsid" "4852FC55-4A84-4EA1-9C86-D53BE3DF83C0"
 fi
 
+setpath_json "product" "tunnelApplicationConfig" '{}'
+
 jsonTmp=$( jq -s '.[0] * .[1]' product.json ../product.json )
 echo "${jsonTmp}" > product.json && unset jsonTmp
 
 cat product.json
+# }}}
+
+# include common functions
+. ../utils.sh
+
+# {{{ apply patches
+{ set +x; } 2>/dev/null
+
+echo "APP_NAME=\"${APP_NAME}\""
+echo "APP_NAME_LC=\"${APP_NAME_LC}\""
+echo "BINARY_NAME=\"${BINARY_NAME}\""
+echo "GH_REPO_PATH=\"${GH_REPO_PATH}\""
+echo "ORG_NAME=\"${ORG_NAME}\""
+echo "TUNNEL_APP_NAME=\"${TUNNEL_APP_NAME}\""
+
+if [[ "${DISABLE_UPDATE}" == "yes" ]]; then
+  mv ../patches/disable-update.patch.yet ../patches/disable-update.patch
+fi
+
+for file in ../patches/*.patch; do
+  if [[ -f "${file}" ]]; then
+    apply_patch "${file}"
+  fi
+done
+
+if [[ "${VSCODE_QUALITY}" == "insider" ]]; then
+  for file in ../patches/insider/*.patch; do
+    if [[ -f "${file}" ]]; then
+      apply_patch "${file}"
+    fi
+  done
+fi
+
+if [[ -d "../patches/${OS_NAME}/" ]]; then
+  for file in "../patches/${OS_NAME}/"*.patch; do
+    if [[ -f "${file}" ]]; then
+      apply_patch "${file}"
+    fi
+  done
+fi
+
+for file in ../patches/user/*.patch; do
+  if [[ -f "${file}" ]]; then
+    apply_patch "${file}"
+  fi
+done
+
+set -x
+# }}}
+
+# {{{ install dependencies
+export ELECTRON_SKIP_BINARY_DOWNLOAD=1
+export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
+
+if [[ "${OS_NAME}" == "linux" ]]; then
+  export VSCODE_SKIP_NODE_VERSION_CHECK=1
+
+   if [[ "${npm_config_arch}" == "arm" ]]; then
+    export npm_config_arm_version=7
+  fi
+elif [[ "${OS_NAME}" == "windows" ]]; then
+  if [[ "${npm_config_arch}" == "arm" ]]; then
+    export npm_config_arm_version=7
+  fi
+else
+  if [[ "${CI_BUILD}" != "no" ]]; then
+    clang++ --version
+  fi
+fi
+
+mv .npmrc .npmrc.bak
+cp ../npmrc .npmrc
+
+for i in {1..5}; do # try 5 times
+  if [[ "${CI_BUILD}" != "no" && "${OS_NAME}" == "osx" ]]; then
+    CXX=clang++ npm ci && break
+  else
+    npm ci && break
+  fi
+
+  if [[ $i == 5 ]]; then
+    echo "Npm install failed too many times" >&2
+    exit 1
+  fi
+  echo "Npm install failed $i, trying again..."
+
+  sleep $(( 15 * (i + 1)))
+done
+
+mv .npmrc.bak .npmrc
+# }}}
 
 # package.json
 cp package.json{,.bak}

+ 2 - 0
utils.sh

@@ -6,6 +6,7 @@ ASSETS_REPOSITORY="${ASSETS_REPOSITORY:-VSCodium/vscodium}"
 BINARY_NAME="${BINARY_NAME:-codium}"
 GH_REPO_PATH="${GH_REPO_PATH:-VSCodium/vscodium}"
 ORG_NAME="${ORG_NAME:-VSCodium}"
+TUNNEL_APP_NAME="$( node -p "require(\"./product.json\").tunnelApplicationName" )"
 
 # All common functions can be added to this file
 
@@ -24,6 +25,7 @@ apply_patch() {
   replace "s|!!GH_REPO_PATH!!|${GH_REPO_PATH}|g" "$1"
   replace "s|!!ORG_NAME!!|${ORG_NAME}|g" "$1"
   replace "s|!!RELEASE_VERSION!!|${RELEASE_VERSION}|g" "$1"
+  replace "s|!!TUNNEL_APP_NAME!!|${TUNNEL_APP_NAME}|g" "$1"
 
   if ! git apply --ignore-whitespace "$1"; then
     echo failed to apply patch "$1" >&2