Skip to content

Commit

Permalink
Try to add riscv64 builds [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
kxxt committed Apr 14, 2024
1 parent ac0f6f2 commit 8996863
Show file tree
Hide file tree
Showing 10 changed files with 173 additions and 101 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/insider-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ jobs:
- vscode_arch: armhf
npm_arch: arm
image: vscodium/vscodium-linux-build-agent:bionic-armhf
- vscode_arch: riscv64
npm_arch: riscv64
image: vscodium/vscodium-linux-build-agent:focal-riscv64
container:
image: ${{ matrix.image }}
env:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/stable-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ jobs:
- vscode_arch: armhf
npm_arch: arm
image: vscodium/vscodium-linux-build-agent:bionic-armhf
- vscode_arch: riscv64
npm_arch: riscv64
image: rsworktech/vscodium-linux-build-agent:focal-riscv64
container:
image: ${{ matrix.image }}
env:
Expand Down
5 changes: 5 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ if [[ "${SHOULD_BUILD}" == "yes" ]]; then

export NODE_OPTIONS="--max-old-space-size=8192"

# Some patches(e.g. remove-mangle.patch) causes unused variables and parameters
sed -ri '/noUnused(Local|Parameter)s/d' build/tsconfig.json
# Recompile ts files in ./build since the patches modifies them
yarn --cwd build compile

yarn monaco-compile-check
yarn valid-layers-check

Expand Down
32 changes: 25 additions & 7 deletions check_tags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -330,20 +330,38 @@ elif [[ "${ASSETS}" != "null" ]]; then

# linux-riscv64
if [[ "${VSCODE_ARCH}" == "riscv64" || "${CHECK_ALL}" == "yes" ]]; then
SHOULD_BUILD_APPIMAGE="no"
SHOULD_BUILD_DEB="no"
SHOULD_BUILD_RPM="no"
SHOULD_BUILD_TAR="no"
if [[ -z $( contains "riscv64.deb" ) ]]; then
echo "Building on Linux RISC-V 64 because we have no DEB"
export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_DEB="no"
fi

if [[ -z $( contains "riscv64.rpm" ) ]]; then
echo "Building on Linux RISC-V 64 because we have no RPM"
export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_RPM="no"
fi

if [[ -z $( contains "${APP_NAME}-linux-riscv64-${RELEASE_VERSION}.tar.gz" ) ]]; then
echo "Building on Linux RISC-V 64 because we have no TAR"
export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_TAR="no"
fi

if [[ -z $( contains "${APP_NAME_LC}-reh-linux-riscv64-${RELEASE_VERSION}.tar.gz" ) ]]; then
echo "Building on Linux RISC-V64 because we have no REH archive"
echo "Building on Linux RISC-V 64 because we have no REH archive"
export SHOULD_BUILD="yes"
else
export SHOULD_BUILD_REH="no"
fi

export SHOULD_BUILD_APPIMAGE="no"

if [[ "${SHOULD_BUILD}" != "yes" ]]; then
echo "Already have all the Linux PowerPC64LE builds"
echo "Already have all the Linux riscv64 builds"
fi
fi

Expand Down Expand Up @@ -394,7 +412,7 @@ else
if [[ "${IS_SPEARHEAD}" == "yes" ]]; then
export SHOULD_BUILD_SRC="yes"
elif [[ "${OS_NAME}" == "linux" ]]; then
if [[ "${VSCODE_ARCH}" == "ppc64le" || "${VSCODE_ARCH}" == "riscv64" ]]; then
if [[ "${VSCODE_ARCH}" == "ppc64le" ]]; then
SHOULD_BUILD_DEB="no"
SHOULD_BUILD_RPM="no"
SHOULD_BUILD_TAR="no"
Expand Down
15 changes: 15 additions & 0 deletions package_linux_bin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ cd vscode || { echo "'vscode' dir not found"; exit 1; }
export VSCODE_SKIP_NODE_VERSION_CHECK=1
export VSCODE_SYSROOT_PREFIX='-glibc-2.17'

if [[ "${VSCODE_ARCH}" == "riscv64" ]]; then
export ELECTRON_SKIP_BINARY_DOWNLOAD=1
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
# Official electron doesn't support riscv64, adding the checksums of forked electron here
# Electron riscv fork might do multiple builds for a same version,
# the tag is in the format of v<version>.riscv<build_number>.
# In order to be compatible with upstream release scheme, riscv fork also re-upload the latest
# RISC-V release to the upstream release tag(v<version>).
# This might be problematic if there is an old electron zip cached locally.
rm -f ~/.cache/electron/*/electron-*-linux-riscv64.zip
ELECTRON_VERSION="v$(yarn config get target)"
CHECKSUM_FILE="https://github.com/riscv-forks/electron-riscv-releases/releases/download/$ELECTRON_VERSION/SHASUMS256.txt"
curl -fsSL "$CHECKSUM_FILE" >> build/checksums/electron.txt
fi

if [[ -d "../patches/${OS_NAME}/client/" ]]; then
for file in "../patches/${OS_NAME}/client/"*.patch; do
if [[ -f "${file}" ]]; then
Expand Down
19 changes: 6 additions & 13 deletions patches/ext-from-gh.patch
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
diff --git a/build/lib/builtInExtensions.js b/build/lib/builtInExtensions.js
index 1b0adc4..b595123 100644
--- a/build/lib/builtInExtensions.js
+++ b/build/lib/builtInExtensions.js
@@ -47,5 +47,3 @@ function isUpToDate(extension) {
function getExtensionDownloadStream(extension) {
- const galleryServiceUrl = productjson.extensionsGallery?.serviceUrl;
- return (galleryServiceUrl ? ext.fromMarketplace(galleryServiceUrl, extension) : ext.fromGithub(extension))
- .pipe(rename(p => p.dirname = `${extension.name}/${p.dirname}`));
+ return ext.fromGithub(extension).pipe(rename(p => p.dirname = `${extension.name}/${p.dirname}`));
}
diff --git a/build/lib/builtInExtensions.ts b/build/lib/builtInExtensions.ts
index fefed43..4ae553e 100644
index fefed436bb9..66520d3ef69 100644
--- a/build/lib/builtInExtensions.ts
+++ b/build/lib/builtInExtensions.ts
@@ -72,5 +72,3 @@ function isUpToDate(extension: IExtensionDefinition): boolean {
@@ -70,9 +70,7 @@ function isUpToDate(extension: IExtensionDefinition): boolean {
}

function getExtensionDownloadStream(extension: IExtensionDefinition) {
- const galleryServiceUrl = productjson.extensionsGallery?.serviceUrl;
- return (galleryServiceUrl ? ext.fromMarketplace(galleryServiceUrl, extension) : ext.fromGithub(extension))
- .pipe(rename(p => p.dirname = `${extension.name}/${p.dirname}`));
+ return ext.fromGithub(extension).pipe(rename(p => p.dirname = `${extension.name}/${p.dirname}`));
}

export function getExtensionStream(extension: IExtensionDefinition) {
51 changes: 28 additions & 23 deletions patches/fix-build-linux.patch
Original file line number Diff line number Diff line change
@@ -1,56 +1,61 @@
diff --git a/build/gulpfile.vscode.linux.js b/build/gulpfile.vscode.linux.js
index 8c2b62f..843e8d4 100644
index 8c2b62f7b2a..843e8d4cb26 100644
--- a/build/gulpfile.vscode.linux.js
+++ b/build/gulpfile.vscode.linux.js
@@ -187,2 +187,3 @@ function prepareRpmPackage(arch) {
@@ -185,6 +185,7 @@ function prepareRpmPackage(arch) {
.pipe(rename(function (p) { p.dirname = 'BUILD/usr/share/' + product.applicationName + '/' + p.dirname; }));

const spec = code.pipe(es.through(
+ null,
async function () {
@@ -302,4 +303,3 @@ BUILD_TARGETS.forEach(({ arch }) => {
const that = this;
const dependencies = await dependenciesGenerator.getDependencies('rpm', binaryDir, product.applicationName, rpmArch);
@@ -300,14 +301,12 @@ const BUILD_TARGETS = [
BUILD_TARGETS.forEach(({ arch }) => {
const debArch = getDebPackageArch(arch);
const prepareDebTask = task.define(`vscode-linux-${arch}-prepare-deb`, task.series(util.rimraf(`.build/linux/deb/${debArch}`), prepareDebPackage(arch)));
- gulp.task(prepareDebTask);
- const buildDebTask = task.define(`vscode-linux-${arch}-build-deb`, buildDebPackage(arch));
+ const buildDebTask = task.define(`vscode-linux-${arch}-build-deb`, task.series(prepareDebTask, buildDebPackage(arch)));
gulp.task(buildDebTask);
@@ -308,4 +308,3 @@ BUILD_TARGETS.forEach(({ arch }) => {

const rpmArch = getRpmPackageArch(arch);
const prepareRpmTask = task.define(`vscode-linux-${arch}-prepare-rpm`, task.series(util.rimraf(`.build/linux/rpm/${rpmArch}`), prepareRpmPackage(arch)));
- gulp.task(prepareRpmTask);
- const buildRpmTask = task.define(`vscode-linux-${arch}-build-rpm`, buildRpmPackage(arch));
+ const buildRpmTask = task.define(`vscode-linux-${arch}-build-rpm`, task.series(prepareRpmTask, buildRpmPackage(arch)));
gulp.task(buildRpmTask);
diff --git a/build/linux/dependencies-generator.js b/build/linux/dependencies-generator.js
index 80c247d..40f1df2 100644
--- a/build/linux/dependencies-generator.js
+++ b/build/linux/dependencies-generator.js
@@ -24,3 +24,3 @@ const product = require("../../product.json");
// are valid, are in dep-lists.ts
-const FAIL_BUILD_FOR_NEW_DEPENDENCIES = true;
+const FAIL_BUILD_FOR_NEW_DEPENDENCIES = false;
// Based on https://source.chromium.org/chromium/chromium/src/+/refs/tags/120.0.6099.268:chrome/installer/linux/BUILD.gn;l=64-80
@@ -56,3 +56,3 @@ async function getDependencies(packageType, buildDir, applicationName, arch) {
// Add the tunnel binary.
- files.push(path.join(buildDir, 'bin', product.tunnelApplicationName));
+ // files.push(path.join(buildDir, 'bin', product.tunnelApplicationName));
// Add the main executable.

const prepareSnapTask = task.define(`vscode-linux-${arch}-prepare-snap`, task.series(util.rimraf(`.build/linux/snap/${arch}`), prepareSnapPackage(arch)));
diff --git a/build/linux/dependencies-generator.ts b/build/linux/dependencies-generator.ts
index 9f1a068..48e3d52 100644
index 9f1a068b8d7..48e3d52067f 100644
--- a/build/linux/dependencies-generator.ts
+++ b/build/linux/dependencies-generator.ts
@@ -25,3 +25,3 @@ import product = require('../../product.json');
@@ -23,7 +23,7 @@ import product = require('../../product.json');
// If true, we fail the build if there are new dependencies found during that task.
// The reference dependencies, which one has to update when the new dependencies
// are valid, are in dep-lists.ts
-const FAIL_BUILD_FOR_NEW_DEPENDENCIES: boolean = true;
+const FAIL_BUILD_FOR_NEW_DEPENDENCIES: boolean = false;

@@ -61,3 +61,3 @@ export async function getDependencies(packageType: 'deb' | 'rpm', buildDir: stri
// Based on https://source.chromium.org/chromium/chromium/src/+/refs/tags/120.0.6099.268:chrome/installer/linux/BUILD.gn;l=64-80
// and the Linux Archive build
@@ -59,7 +59,7 @@ export async function getDependencies(packageType: 'deb' | 'rpm', buildDir: stri
// Add the native modules
const files = findResult.stdout.toString().trimEnd().split('\n');
// Add the tunnel binary.
- files.push(path.join(buildDir, 'bin', product.tunnelApplicationName));
+ // files.push(path.join(buildDir, 'bin', product.tunnelApplicationName));
// Add the main executable.
files.push(appPath);
// Add chrome sandbox and crashpad handler.
diff --git a/resources/linux/rpm/code.spec.template b/resources/linux/rpm/code.spec.template
index c9e57db..bda2604 100644
index c9e57db9562..bda260458a7 100644
--- a/resources/linux/rpm/code.spec.template
+++ b/resources/linux/rpm/code.spec.template
@@ -87 +87,3 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
@@ -85,3 +85,5 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
%{_datadir}/pixmaps/@@ICON@@.png
%{_datadir}/bash-completion/completions/%{name}
%{_datadir}/zsh/site-functions/_%{name}
+
+%config(noreplace) /usr/share/%{name}/resources/app/product.json
Expand Down
86 changes: 61 additions & 25 deletions patches/linux/use-node16.patch
Original file line number Diff line number Diff line change
@@ -1,33 +1,47 @@
diff --git a/build/lib/fetch.js b/build/lib/fetch.js
index ba23e78..9b8a5a1 100644
--- a/build/lib/fetch.js
+++ b/build/lib/fetch.js
@@ -13,2 +13,3 @@ const crypto = require("crypto");
const through2 = require("through2");
+const fetch = require("node-fetch");
function fetchUrls(urls, options) {
diff --git a/build/linux/debian/install-sysroot.js b/build/linux/debian/install-sysroot.js
index d637fce..02cb192 100644
--- a/build/linux/debian/install-sysroot.js
+++ b/build/linux/debian/install-sysroot.js
@@ -14,2 +14,3 @@ const crypto_1 = require("crypto");
const ansiColors = require("ansi-colors");
+const fetch = require("node-fetch");
// Based on https://source.chromium.org/chromium/chromium/src/+/main:build/linux/sysroot_scripts/install-sysroot.py.
diff --git a/build/lib/fetch.ts b/build/lib/fetch.ts
index dc1de777e04..5e263a4c153 100644
--- a/build/lib/fetch.ts
+++ b/build/lib/fetch.ts
@@ -9,6 +9,7 @@ import * as log from 'fancy-log';
import * as ansiColors from 'ansi-colors';
import * as crypto from 'crypto';
import * as through2 from 'through2';
+const fetch: any = require('node-fetch');
import { Stream } from 'stream';

export interface IFetchOptions {
diff --git a/build/linux/debian/install-sysroot.ts b/build/linux/debian/install-sysroot.ts
index aa417dcc722..b2e36892568 100644
--- a/build/linux/debian/install-sysroot.ts
+++ b/build/linux/debian/install-sysroot.ts
@@ -8,6 +8,7 @@ import { tmpdir } from 'os';
import * as fs from 'fs';
import * as https from 'https';
import * as path from 'path';
+const fetch: any = require('node-fetch');
import { createHash } from 'crypto';
import { DebianArchString } from './types';
import * as ansiColors from 'ansi-colors';
diff --git a/package.json b/package.json
index f734771..0d118ad 100644
index 37c2dc22b1f..812217d5407 100644
--- a/package.json
+++ b/package.json
@@ -172,3 +172,3 @@
@@ -170,7 +170,7 @@
"gulp-gzip": "^1.4.2",
"gulp-json-editor": "^2.5.0",
"gulp-plumber": "^1.2.0",
- "gulp-postcss": "^9.1.0",
+ "gulp-postcss": "9.0.1",
"gulp-rename": "^1.2.0",
"gulp-replace": "^0.5.4",
"gulp-sourcemaps": "^3.0.0",
diff --git a/yarn.lock b/yarn.lock
index 7dcbe6f..fc13bba 100644
index ceb55a3520d..3fe0233afdb 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4123,9 +4123,2 @@ fancy-log@^1.3.2, fancy-log@^1.3.3:
@@ -4139,13 +4139,6 @@ fancy-log@^1.3.2, fancy-log@^1.3.3:
parse-node-version "^1.0.0"
time-stamp "^1.0.0"

-fancy-log@^2.0.0:
- version "2.0.0"
Expand All @@ -37,7 +51,11 @@ index 7dcbe6f..fc13bba 100644
- color-support "^1.1.3"
-
fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3:
@@ -4957,10 +4950,10 @@ gulp-plumber@^1.2.0:
version "3.1.3"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
@@ -4973,14 +4966,14 @@ gulp-plumber@^1.2.0:
plugin-error "^0.1.2"
through2 "^2.0.3"

-gulp-postcss@^9.1.0:
- version "9.1.0"
Expand All @@ -55,15 +73,23 @@ index 7dcbe6f..fc13bba 100644
+ plugin-error "^1.0.1"
+ postcss-load-config "^3.0.0"
vinyl-sourcemaps-apply "^0.2.1"
@@ -6172,2 +6165,7 @@ liftoff@^3.1.0:

gulp-rename@1.2.2, gulp-rename@^1.2.0:
@@ -6188,6 +6181,11 @@ liftoff@^3.1.0:
rechoir "^0.6.2"
resolve "^1.1.7"

+lilconfig@^2.0.5:
+ version "2.1.0"
+ resolved "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz#78e23ac89ebb7e1bfbf25b18043de756548e7f52"
+ integrity sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==
+
lilconfig@^3.0.0:
@@ -7592,9 +7590,2 @@ plugin-error@^1.0.0, plugin-error@^1.0.1:
version "3.0.0"
resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-3.0.0.tgz#f8067feb033b5b74dab4602a5f5029420be749bc"
@@ -7603,13 +7601,6 @@ plugin-error@^1.0.0, plugin-error@^1.0.1:
arr-union "^3.1.0"
extend-shallow "^3.0.2"

-plugin-error@^2.0.1:
- version "2.0.1"
Expand All @@ -73,7 +99,11 @@ index 7dcbe6f..fc13bba 100644
- ansi-colors "^1.0.1"
-
posix-character-classes@^0.1.0:
@@ -7650,9 +7641,9 @@ postcss-discard-overridden@^6.0.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"
@@ -7661,13 +7652,13 @@ postcss-discard-overridden@^6.0.1:
resolved "https://registry.yarnpkg.com/postcss-discard-overridden/-/postcss-discard-overridden-6.0.1.tgz#c63c559237758d74bc505452393a64dda9b19ef4"
integrity sha512-qs0ehZMMZpSESbRkw1+inkf51kak6OOzNRaoLd/U7Fatp0aN2HQ1rxGOrJvYcRAN9VpX8kUF13R2ofn8OlvFVA==

-postcss-load-config@^5.0.0:
- version "5.0.2"
Expand All @@ -89,7 +119,11 @@ index 7dcbe6f..fc13bba 100644
+ lilconfig "^2.0.5"
+ yaml "^1.10.2"

@@ -10299,6 +10290,6 @@ yallist@^4.0.0:
postcss-merge-longhand@^6.0.2:
version "6.0.2"
@@ -10315,10 +10306,10 @@ yallist@^4.0.0:
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==

-yaml@^2.3.4:
- version "2.3.4"
Expand All @@ -100,3 +134,5 @@ index 7dcbe6f..fc13bba 100644
+ resolved "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b"
+ integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==

yargs-parser@20.2.4:
version "20.2.4"
23 changes: 21 additions & 2 deletions patches/ppc64le-and-riscv64-support.patch
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,29 @@ index 6f8144b0954..8a8195e9b66 100644

BUILD_TARGETS.forEach(buildTarget => {
diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js
index e1507e0424f..80ed8d91a41 100644
index e1507e0424f..d1a7cf0b20a 100644
--- a/build/gulpfile.vscode.js
+++ b/build/gulpfile.vscode.js
@@ -429,6 +429,8 @@ const BUILD_TARGETS = [
@@ -336,11 +336,17 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
all = es.merge(all, shortcut);
}

+ const electronOverride = {};
+ if (platform === 'linux' && arch === 'riscv64') {
+ // electron doesn't support riscv64, so a fork is used here.
+ electronOverride.repo = 'riscv-forks/electron-riscv-releases';
+ }
+
let result = all
.pipe(util.skipDirectories())
.pipe(util.fixWin32DirectoryPermissions())
.pipe(filter(['**', '!**/.github/**'], { dot: true })) // https://github.com/microsoft/vscode/issues/116523
- .pipe(electron({ ...config, platform, arch: arch === 'armhf' ? 'arm' : arch, ffmpegChromium: false }))
+ .pipe(electron({ ...config, ...electronOverride, platform, arch: arch === 'armhf' ? 'arm' : arch, ffmpegChromium: false }))
.pipe(filter(['**', '!LICENSE', '!version'], { dot: true }));

if (platform === 'linux') {
@@ -429,6 +435,8 @@ const BUILD_TARGETS = [
{ platform: 'linux', arch: 'x64' },
{ platform: 'linux', arch: 'armhf' },
{ platform: 'linux', arch: 'arm64' },
Expand Down
Loading

0 comments on commit 8996863

Please sign in to comment.