aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroki Tagato <tagattie@FreeBSD.org>2023-04-09 07:58:27 +0000
committerHiroki Tagato <tagattie@FreeBSD.org>2023-04-09 08:01:17 +0000
commit7bf327888c9057ba0e884ca50ad467d70a4fbbdc (patch)
tree78fc3e4c27c798c9f494114db090b9fef7cc2fd3
parent45dc00cc469c3e87bb313378a8f5fb8c870d59aa (diff)
downloadports-7bf327888c9057ba0e884ca50ad467d70a4fbbdc.tar.gz
ports-7bf327888c9057ba0e884ca50ad467d70a4fbbdc.zip
editors/vscode: switch from VS Market Place to Open VSX Registry
According to Microsoft Visual Studio Marketplace Terms of Use[1], "Marketplace Offerings are intended for use only with In-Scope Products and Services and you may install and use Marketplace Offerings only with In-Scope Products and Services." In-Scope Products and Services are "Microsoft Visual Studio, Visual Studio for Mac, Visual Studio Code, GitHub Codespaces, Azure DevOps, Azure DevOps Server, and successor products and services" and does not include Code - OSS. So switch to Open VSX Registry, a community driven, fully open platform for publishing and consuming VS Code extensions. While here, add option for building remote extension host (off by default). [1] https://aka.ms/vsmarketplace-ToU
-rw-r--r--editors/vscode/Makefile41
-rw-r--r--editors/vscode/files/patch-build_npm_postinstall.js12
-rw-r--r--editors/vscode/files/patch-product.json9
3 files changed, 42 insertions, 20 deletions
diff --git a/editors/vscode/Makefile b/editors/vscode/Makefile
index 1ddd526fb9d0..8738380a38a1 100644
--- a/editors/vscode/Makefile
+++ b/editors/vscode/Makefile
@@ -1,10 +1,9 @@
PORTNAME= vscode
DISTVERSION= 1.77.1
+PORTREVISION= 1
CATEGORIES= editors
-MASTER_SITES= https://nodejs.org/dist/v${NODE_VER}/:node_headers \
- https://github.com/tagattie/FreeBSD-VSCode/releases/download/${DISTVERSION}/:yarn_cache
-DISTFILES= node-v${NODE_VER}-headers${EXTRACT_SUFX}:node_headers \
- yarn-offline-cache-${DISTVERSION}${EXTRACT_SUFX}:yarn_cache \
+MASTER_SITES= https://github.com/tagattie/FreeBSD-VSCode/releases/download/${DISTVERSION}/:yarn_cache
+DISTFILES= yarn-offline-cache-${DISTVERSION}${EXTRACT_SUFX}:yarn_cache \
vscode-marketplace-exts-${DISTVERSION}${EXTRACT_SUFX}:yarn_cache
DIST_SUBDIR= ${PORTNAME}
@@ -58,8 +57,8 @@ RUN_DEPENDS= ${LOCALBASE}/lib/alsa-lib/libasound_module_pcm_oss.so:audio/alsa-pl
TEST_DEPENDS= electron${ELECTRON_VER_MAJOR}:devel/electron${ELECTRON_VER_MAJOR} \
bash:shells/bash
-USES= desktop-file-utils gl gmake gnome iconv jpeg pkgconfig \
- python:build shebangfix xorg
+USES= desktop-file-utils gl gmake gnome iconv jpeg localbase:ldflags \
+ pkgconfig python:build shebangfix xorg
USE_GITHUB= yes
GH_ACCOUNT= microsoft
@@ -75,8 +74,8 @@ USE_GNOME= atk cairo pango gdkpixbuf2 gtk30 libxml2 libxslt
USE_LDCONFIG= ${DATADIR}
-# See ${WRKSRC}/remote/.yarnrc for NODE_VER
-NODE_VER= 16.14.2
+# Keep NODE_VER in sync with www/node16 DISTVERSION
+NODE_VER= 16.20.0
NODE_VER_MAJOR= ${NODE_VER:C/\..*$//}
# See ${WRKSRC}/build/package.json for ESBUILD_VER_BUILD
ESBUILD_VER_BUILD= 0.15.5
@@ -99,6 +98,10 @@ MAKE_ENV+= PLAYWRIGHT_BROWSERS_PATH=${WRKDIR}/pw-browsers \
# This is a workaround to avoid filesystem violations during poudriere build
MAKE_ENV+= PYTHONDONTWRITEBYTECODE=1
+OPTIONS_DEFINE= REH
+OPTIONS_DEFAULT=# none
+REH_DESC= Build remote extension host
+
ELECTRON_DIR= ${.CURDIR}/../../devel/electron19
.include "${ELECTRON_DIR}/Makefile.version"
@@ -118,14 +121,19 @@ post-patch:
# force use of electron version matching port one
${REINPLACE_CMD} -E 's|^(target ").*(")$$|\1${ELECTRON_VER}\2|' \
${WRKSRC}/.yarnrc
+ # force use of node version matching port one
+ ${REINPLACE_CMD} -E 's|^(target ").*(")$$|\1${NODE_VER}\2|' \
+ ${WRKSRC}/remote/.yarnrc
# setup yarnrc for using local node headers
${ECHO_CMD} 'nodedir "${LOCALBASE}/share/electron${ELECTRON_VER_MAJOR}/node_headers"' >> \
${WRKSRC}/.yarnrc
- ${ECHO_CMD} 'nodedir "${WRKDIR}/node-v${NODE_VER}"' >> \
+ ${ECHO_CMD} 'nodedir "${LOCALBASE}"' >> \
${WRKSRC}/remote/.yarnrc
# setup yarnrc for offline node_modules installation
${ECHO_CMD} 'yarn-offline-mirror "../yarn-offline-cache"' >> \
${WRKSRC}/.yarnrc
+ ${ECHO_CMD} 'yarn-offline-mirror "../../yarn-offline-cache"' >> \
+ ${WRKSRC}/remote/.yarnrc
(cd ${WRKSRC} && \
${FIND} -E . -type f -iregex '${SHEBANG_REGEX}' \
-exec ${SED} -i '' -e "s|/usr/bin/pgrep|/bin/pgrep|g" {} ';')
@@ -182,11 +190,22 @@ do-build:
# build and package vscode
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} yarn run tsc -p build/tsconfig.build.json
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} yarn gulp vscode-linux-x64-min
- # cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} yarn gulp vscode-reh-linux-x64-min
- # cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} yarn gulp vscode-reh-web-linux-x64-min
# copy marketplace extensions
${MV} ${WRKDIR}/builtInExtensions/* ${WRKDIR}/VSCode-linux-x64/resources/app/extensions
+do-build-REH-on:
+ # setup download cache for node
+ ${MKDIR} ${WRKSRC}/.build/node/v${NODE_VER}/linux-x64
+ ${CP} ${LOCALBASE}/bin/node ${WRKSRC}/.build/node/v${NODE_VER}/linux-x64
+ # build vscode remote extension host
+ cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} yarn gulp vscode-reh-linux-x64-min
+ ${MKDIR} ${WRKDIR}/vscode-reh/bin/${SOURCE_COMMIT_HASH}
+ cd ${WRKDIR}/vscode-reh-linux-x64 && ${TAR} -cf - . | \
+ ${TAR} -xf - -C ${WRKDIR}/vscode-reh/bin/${SOURCE_COMMIT_HASH}
+ cd ${WRKDIR}/vscode-reh && \
+ ${TAR} -czf ../vscode-reh-${DISTVERSION}-${OPSYS:tl}${OSREL:R}-${ARCH}.tar.gz .
+ # cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} yarn gulp vscode-reh-web-linux-x64-min
+
do-install:
${MKDIR} ${STAGEDIR}${PREFIX}/etc/bash_completion.d
${INSTALL_DATA} ${WRKSRC}/resources/completions/bash/code \
diff --git a/editors/vscode/files/patch-build_npm_postinstall.js b/editors/vscode/files/patch-build_npm_postinstall.js
index 523afaa94179..81e9a96dc775 100644
--- a/editors/vscode/files/patch-build_npm_postinstall.js
+++ b/editors/vscode/files/patch-build_npm_postinstall.js
@@ -1,17 +1,21 @@
---- build/npm/postinstall.js.orig 2022-07-05 18:15:23 UTC
+--- build/npm/postinstall.js.orig 2023-04-04 22:49:54 UTC
+++ build/npm/postinstall.js
-@@ -20,7 +20,9 @@ function yarnInstall(location, opts) {
+@@ -20,7 +20,13 @@ function yarnInstall(location, opts) {
const raw = process.env['npm_config_argv'] || '{}';
const argv = JSON.parse(raw);
const original = argv.original || [];
- const args = original.filter(arg => arg === '--ignore-optional' || arg === '--frozen-lockfile' || arg === '--check-files');
+ const passargs = ['--ignore-optional', '--frozen-lockfile', '--check-files', '--offline', '--no-progress', '--verbose'];
+ const args = original.filter(arg => passargs.includes(arg));
-+ args.push('--use-yarnrc=' + process.env.PWD + '/.yarnrc');
++ if (opts.cwd === 'remote') {
++ args.push('--use-yarnrc=' + process.env.PWD + '/' + opts.cwd + '/.yarnrc');
++ } else {
++ args.push('--use-yarnrc=' + process.env.PWD + '/.yarnrc');
++ }
if (opts.ignoreEngines) {
args.push('--ignore-engines');
delete opts.ignoreEngines;
-@@ -73,5 +75,5 @@ for (let dir of dirs) {
+@@ -73,5 +79,5 @@ for (let dir of dirs) {
yarnInstall(dir, opts);
}
diff --git a/editors/vscode/files/patch-product.json b/editors/vscode/files/patch-product.json
index 6f4ab95bdcc7..e2637d0cf164 100644
--- a/editors/vscode/files/patch-product.json
+++ b/editors/vscode/files/patch-product.json
@@ -1,14 +1,13 @@
---- product.json.orig 2022-11-09 00:04:34 UTC
+--- product.json.orig 2023-04-04 22:49:54 UTC
+++ product.json
-@@ -29,6 +29,17 @@
+@@ -29,6 +29,16 @@
"reportIssueUrl": "https://github.com/microsoft/vscode/issues/new",
"urlProtocol": "code-oss",
"webviewContentExternalBaseUrlTemplate": "https://{{uuid}}.vscode-cdn.net/insider/ef65ac1ba57f57f2a3961bfe94aa20481caca4c6/out/vs/workbench/contrib/webview/browser/pre/",
+ "documentationUrl": "https://go.microsoft.com/fwlink/?LinkID=533484",
+ "extensionsGallery": {
-+ "serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
-+ "cacheUrl": "https://vscode.blob.core.windows.net/gallery/index",
-+ "itemUrl": "https://marketplace.visualstudio.com/items"
++ "serviceUrl": "https://open-vsx.org/vscode/gallery",
++ "itemUrl": "https://open-vsx.org/vscode/item"
+ },
+ "introductoryVideosUrl": "https://go.microsoft.com/fwlink/?linkid=832146",
+ "keyboardShortcutsUrlLinux": "https://go.microsoft.com/fwlink/?linkid=832144",