Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into nektro-patch-36343
Browse files Browse the repository at this point in the history
  • Loading branch information
nektro committed Nov 25, 2024
2 parents b4cb9f7 + a6f37b3 commit a8da2e0
Show file tree
Hide file tree
Showing 34 changed files with 424 additions and 257 deletions.
24 changes: 16 additions & 8 deletions .buildkite/ci.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -304,15 +304,23 @@ function getPipeline(options) {
* @param {Target} target
* @returns {Agent}
*/
const getZigAgent = target => {
const { abi, arch } = target;
// if (abi === "musl") {
// const instanceType = arch === "aarch64" ? "c8g.large" : "c7i.large";
// return getEmphemeralAgent("v2", target, instanceType);
// }
const getZigAgent = platform => {
const { arch } = platform;
const instanceType = arch === "aarch64" ? "c8g.2xlarge" : "c7i.2xlarge";
return {
queue: "build-zig",
robobun: true,
robobun2: true,
os: "linux",
arch,
distro: "debian",
release: "11",
"image-name": `linux-${arch}-debian-11-v5`, // v5 is not on main yet
"instance-type": instanceType,
};
// TODO: Temporarily disable due to configuration
// return {
// queue: "build-zig",
// };
};

/**
Expand Down Expand Up @@ -443,7 +451,7 @@ function getPipeline(options) {
label: `${getTargetLabel(platform)} - build-zig`,
depends_on: getDependsOn(platform),
agents: getZigAgent(platform),
retry: getRetry(1), // FIXME: Sometimes zig build hangs, so we need to retry once
retry: getRetry(),
cancel_on_build_failing: isMergeQueue(),
env: getBuildEnv(platform),
command: `bun run build:ci --target bun-zig --toolchain ${toolchain}`,
Expand Down
3 changes: 3 additions & 0 deletions .vscode/launch.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

93 changes: 50 additions & 43 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,57 @@
"version": "2.0.0",
"tasks": [
{
"type": "process",
"label": "Install Dependencies",
"command": "scripts/all-dependencies.sh",
"windows": {
"command": "scripts/all-dependencies.ps1",
},
"icon": {
"id": "arrow-down",
},
"options": {
"cwd": "${workspaceFolder}",
},
},
{
"type": "process",
"label": "Setup Environment",
"dependsOn": ["Install Dependencies"],
"command": "scripts/setup.sh",
"windows": {
"command": "scripts/setup.ps1",
},
"icon": {
"id": "check",
},
"options": {
"cwd": "${workspaceFolder}",
},
},
{
"type": "process",
"label": "Build Bun",
"dependsOn": ["Setup Environment"],
"command": "bun",
"args": ["run", "build"],
"icon": {
"id": "gear",
},
"options": {
"cwd": "${workspaceFolder}",
},
"isBuildCommand": true,
"runOptions": {
"instanceLimit": 1,
"reevaluateOnRerun": true,
"type": "shell",
"command": "bun run build",
"group": {
"kind": "build",
"isDefault": true,
},
"problemMatcher": [
{
"owner": "zig",
"fileLocation": ["relative", "${workspaceFolder}"],
"pattern": [
{
"regexp": "^(.+?):(\\d+):(\\d+): (error|warning|note): (.+)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5,
},
{
"regexp": "^\\s+(.+)$",
"message": 1,
"loop": true,
},
],
},
{
"owner": "clang",
"fileLocation": ["relative", "${workspaceFolder}"],
"pattern": [
{
"regexp": "^([^:]+):(\\d+):(\\d+):\\s+(warning|error|note|remark):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5,
},
{
"regexp": "^\\s*(.*)$",
"message": 1,
"loop": true,
},
],
},
],
"presentation": {
"reveal": "always",
"panel": "shared",
"clear": true,
},
},
],
Expand Down
10 changes: 0 additions & 10 deletions cmake/Globals.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,6 @@ else()
set(WARNING WARNING)
endif()

if(LINUX)
if(EXISTS "/etc/alpine-release")
set(DEFAULT_ABI "musl")
else()
set(DEFAULT_ABI "gnu")
endif()

optionx(ABI "musl|gnu" "The ABI to use (e.g. musl, gnu)" DEFAULT ${DEFAULT_ABI})
endif()

# TODO: This causes flaky zig builds in CI, so temporarily disable it.
# if(CI)
# set(DEFAULT_VENDOR_PATH ${CACHE_PATH}/vendor)
Expand Down
10 changes: 10 additions & 0 deletions cmake/Options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ else()
message(FATAL_ERROR "Unsupported architecture: ${CMAKE_SYSTEM_PROCESSOR}")
endif()

if(LINUX)
if(EXISTS "/etc/alpine-release")
set(DEFAULT_ABI "musl")
else()
set(DEFAULT_ABI "gnu")
endif()

optionx(ABI "musl|gnu" "The ABI to use (e.g. musl, gnu)" DEFAULT ${DEFAULT_ABI})
endif()

if(ARCH STREQUAL "x64")
optionx(ENABLE_BASELINE BOOL "If baseline features should be used for older CPUs (e.g. disables AVX, AVX2)" DEFAULT OFF)
endif()
Expand Down
2 changes: 1 addition & 1 deletion cmake/targets/BuildBun.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ if(NOT BUN_CPP_ONLY)

if(CI)
set(bunTriplet bun-${OS}-${ARCH})
if(ABI STREQUAL "musl")
if(LINUX AND ABI STREQUAL "musl")
set(bunTriplet ${bunTriplet}-musl)
endif()
if(ENABLE_BASELINE)
Expand Down
2 changes: 1 addition & 1 deletion cmake/tools/SetupLLVM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if(NOT ENABLE_LLVM)
return()
endif()

if(CMAKE_HOST_WIN32 OR CMAKE_HOST_APPLE OR ABI STREQUAL "musl")
if(CMAKE_HOST_WIN32 OR CMAKE_HOST_APPLE OR EXISTS "/etc/alpine-release")
set(DEFAULT_LLVM_VERSION "18.1.8")
else()
set(DEFAULT_LLVM_VERSION "16.0.6")
Expand Down
2 changes: 1 addition & 1 deletion cmake/tools/SetupWebKit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ else()
message(FATAL_ERROR "Unsupported architecture: ${CMAKE_SYSTEM_PROCESSOR}")
endif()

if(ABI STREQUAL "musl")
if(LINUX AND ABI STREQUAL "musl")
set(WEBKIT_SUFFIX "-musl")
endif()

Expand Down
4 changes: 2 additions & 2 deletions docs/api/sqlite.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ To instead throw an error when a parameter is missing and allow binding without
import { Database } from "bun:sqlite";

const strict = new Database(
":memory:",
":memory:",
{ strict: true }
);

Expand Down Expand Up @@ -177,7 +177,7 @@ const query = db.prepare("SELECT * FROM foo WHERE bar = ?");

## WAL mode

SQLite supports [write-ahead log mode](https://www.sqlite.org/wal.html) (WAL) which dramatically improves performance, especially in situations with many concurrent writes. It's broadly recommended to enable WAL mode for most typical applications.
SQLite supports [write-ahead log mode](https://www.sqlite.org/wal.html) (WAL) which dramatically improves performance, especially in situations with many concurrent readers and a single writer. It's broadly recommended to enable WAL mode for most typical applications.

To enable WAL mode, run this pragma query at the beginning of your application:

Expand Down
File renamed without changes.
3 changes: 1 addition & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ There are also image variants for different operating systems.
$ docker pull oven/bun:debian
$ docker pull oven/bun:slim
$ docker pull oven/bun:distroless
# alpine not recommended until #918 is fixed
# $ docker pull oven/bun:alpine
$ docker pull oven/bun:alpine
```

## Checking installation
Expand Down
67 changes: 0 additions & 67 deletions docs/troubleshooting.md

This file was deleted.

10 changes: 8 additions & 2 deletions packages/bun-debug-adapter-protocol/src/debugger/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export abstract class BaseDebugAdapter<T extends Inspector = Inspector>

/**
* Gets the inspector url. This is deprecated and exists for compat.
* @deprecated You should get the inspector directly, and if it's a WebSocketInspector you can access `.url` direclty.
* @deprecated You should get the inspector directly (with .getInspector()), and if it's a WebSocketInspector you can access `.url` direclty.
*/
get url(): string {
// This code has been migrated from a time when the inspector was always a WebSocketInspector.
Expand All @@ -305,6 +305,10 @@ export abstract class BaseDebugAdapter<T extends Inspector = Inspector>
throw new Error("Inspector does not offer a URL");
}

public getInspector() {
return this.inspector;
}

abstract start(...args: unknown[]): Promise<boolean>;

/**
Expand Down Expand Up @@ -2064,7 +2068,7 @@ export class NodeSocketDebugAdapter extends BaseDebugAdapter<NodeSocketInspector
/**
* The default debug adapter. Connects via WebSocket
*/
export class DebugAdapter extends BaseDebugAdapter<WebSocketInspector> {
export class WebSocketDebugAdapter extends BaseDebugAdapter<WebSocketInspector> {
#process?: ChildProcess;

public constructor(url?: string | URL, untitledDocPath?: string, bunEvalPath?: string) {
Expand Down Expand Up @@ -2331,6 +2335,8 @@ export class DebugAdapter extends BaseDebugAdapter<WebSocketInspector> {
}
}

export const DebugAdapter = WebSocketDebugAdapter;

function stoppedReason(reason: JSC.Debugger.PausedEvent["reason"]): DAP.StoppedEvent["reason"] {
switch (reason) {
case "Breakpoint":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export class NodeSocketInspector extends EventEmitter<InspectorEventMap> impleme
this.#pendingResponses = new Map();

this.#framer = new SocketFramer(socket, message => {
// console.log(message);
if (Array.isArray(message)) {
for (const m of message) {
this.#accept(m);
Expand Down
3 changes: 2 additions & 1 deletion packages/bun-inspector-protocol/src/inspector/websocket.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EventEmitter } from "node:events";
import { WebSocket } from "ws";
import type { Inspector, InspectorEventMap } from "./index";
import type { JSC } from "../protocol";
import type { Inspector, InspectorEventMap } from "./index";

/**
* An inspector that communicates with a debugger over a WebSocket.
Expand Down Expand Up @@ -170,6 +170,7 @@ export class WebSocketInspector extends EventEmitter<InspectorEventMap> implemen

#accept(message: string): void {
let data: JSC.Event | JSC.Response;

try {
data = JSON.parse(message);
} catch (cause) {
Expand Down
4 changes: 3 additions & 1 deletion packages/bun-types/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules/
dist/
dist/
docs/
*.tgz
Loading

0 comments on commit a8da2e0

Please sign in to comment.