From 34e4447aea1e2347495bb329535917e09b75565e Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Fri, 13 Sep 2024 00:40:49 -0700 Subject: [PATCH] Update some paths --- .vscode/c_cpp_properties.json | 4 ++-- .vscode/settings.json | 4 ++-- CONTRIBUTING.md | 4 ++-- build.zig | 2 +- src/bun.js/bindings/bindings.zig | 2 +- src/js/builtins.d.ts | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 108bcddc4ae20a..8e3517a2e35f07 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -6,7 +6,7 @@ "compileCommands": "${workspaceFolder}/build/debug/compile_commands.json", "includePath": [ "${workspaceFolder}/build/bun-webkit/include", - "${workspaceFolder}/build/codegen", + "${workspaceFolder}/build/debug/codegen", "${workspaceFolder}/src/bun.js/bindings/", "${workspaceFolder}/src/bun.js/bindings/webcore/", "${workspaceFolder}/src/bun.js/bindings/sqlite/", @@ -55,7 +55,7 @@ "name": "BunWithJSCDebug", "forcedInclude": ["${workspaceFolder}/src/bun.js/bindings/root.h"], "includePath": [ - "${workspaceFolder}/build/codegen", + "${workspaceFolder}/build/debug/codegen", "${workspaceFolder}/vendor/WebKit/WebKitBuild/Debug/", "${workspaceFolder}/vendor/WebKit/WebKitBuild/Debug/ICU/Headers/", "${workspaceFolder}/vendor/WebKit/WebKitBuild/Debug/JavaScriptCore/PrivateHeaders/", diff --git a/.vscode/settings.json b/.vscode/settings.json index e1e8aa36ba4eea..58ded00a0a4f4a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -30,12 +30,12 @@ "zig.initialSetupDone": true, "zig.buildOption": "build", "zig.zls.zigLibPath": "${workspaceFolder}/vendor/zig/lib", - "zig.buildArgs": ["-Dgenerated-code=./build/codegen"], + "zig.buildArgs": ["-Dgenerated-code=./build/debug/codegen"], "zig.zls.buildOnSaveStep": "check", // "zig.zls.enableBuildOnSave": true, // "zig.buildOnSave": true, "zig.buildFilePath": "${workspaceFolder}/build.zig", - "zig.path": "${workspaceFolder}/.cache/zig/zig.exe", + "zig.path": "${workspaceFolder}/vendor/zig/zig.exe", "zig.formattingProvider": "zls", "zig.zls.enableInlayHints": false, "[zig]": { diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d462390bb54d31..6d3dbb0fd22442 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -163,8 +163,8 @@ Several code generation scripts are used during Bun's build process. These are r In particular, these are: -- `./src/codegen/generate-jssink.ts` -- Generates `build/codegen/JSSink.cpp`, `build/codegen/JSSink.h` which implement various classes for interfacing with `ReadableStream`. This is internally how `FileSink`, `ArrayBufferSink`, `"type": "direct"` streams and other code related to streams works. -- `./src/codegen/generate-classes.ts` -- Generates `build/codegen/ZigGeneratedClasses*`, which generates Zig & C++ bindings for JavaScriptCore classes implemented in Zig. In `**/*.classes.ts` files, we define the interfaces for various classes, methods, prototypes, getters/setters etc which the code generator reads to generate boilerplate code implementing the JavaScript objects in C++ and wiring them up to Zig +- `./src/codegen/generate-jssink.ts` -- Generates `build/debug/codegen/JSSink.cpp`, `build/debug/codegen/JSSink.h` which implement various classes for interfacing with `ReadableStream`. This is internally how `FileSink`, `ArrayBufferSink`, `"type": "direct"` streams and other code related to streams works. +- `./src/codegen/generate-classes.ts` -- Generates `build/debug/codegen/ZigGeneratedClasses*`, which generates Zig & C++ bindings for JavaScriptCore classes implemented in Zig. In `**/*.classes.ts` files, we define the interfaces for various classes, methods, prototypes, getters/setters etc which the code generator reads to generate boilerplate code implementing the JavaScript objects in C++ and wiring them up to Zig - `./src/codegen/bundle-modules.ts` -- Bundles built-in modules like `node:fs`, `bun:ffi` into files we can include in the final binary. In development, these can be reloaded without rebuilding Zig (you still need to run `bun run build`, but it re-reads the transpiled files from disk afterwards). In release builds, these are embedded into the binary. - `./src/codegen/bundle-functions.ts` -- Bundles globally-accessible functions implemented in JavaScript/TypeScript like `ReadableStream`, `WritableStream`, and a handful more. These are used similarly to the builtin modules, but the output more closely aligns with what WebKit/Safari does for Safari's built-in functions so that we can copy-paste the implementations from WebKit as a starting point. diff --git a/build.zig b/build.zig index 1f9654ea9cd011..064f47852e660d 100644 --- a/build.zig +++ b/build.zig @@ -197,7 +197,7 @@ pub fn build(b: *Build) !void { const generated_code_dir = b.pathFromRoot( b.option([]const u8, "generated-code", "Set the generated code directory") orelse - "build/codegen", + "build/debug/codegen", ); const bun_version = b.option([]const u8, "version", "Value of `Bun.version`") orelse "0.0.0"; const force_embed_js_code = b.option(bool, "force_embed_js_code", "Always embed JavaScript builtins") orelse false; diff --git a/src/bun.js/bindings/bindings.zig b/src/bun.js/bindings/bindings.zig index 97c876a47d39f6..b8075c90a64232 100644 --- a/src/bun.js/bindings/bindings.zig +++ b/src/bun.js/bindings/bindings.zig @@ -6752,7 +6752,7 @@ pub const ScriptExecutionStatus = enum(i32) { }; comptime { - // this file is gennerated, but cant be placed in the build/codegen folder + // this file is gennerated, but cant be placed in the build/debug/codegen folder // because zig will complain about outside-of-module stuff _ = @import("./GeneratedJS2Native.zig"); } diff --git a/src/js/builtins.d.ts b/src/js/builtins.d.ts index 23c09853298dac..12d7d7e7f9bd82 100644 --- a/src/js/builtins.d.ts +++ b/src/js/builtins.d.ts @@ -1,4 +1,4 @@ -/// +/// // Typedefs for JSC intrinsics. Instead of @, we use $ type TODO = any;