Skip to content

Commit ae42634

Browse files
JakeChampionGuy Bedford
andauthored
fix: keep sdkVersion property always up-to-date with the correct version of the SDK (#829)
Co-authored-by: Guy Bedford <[email protected]>
1 parent befea03 commit ae42634

File tree

6 files changed

+9
-6
lines changed

6 files changed

+9
-6
lines changed

runtime/fastly/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,6 @@ add_builtin(fastly::fetch SRC builtins/fetch/fetch.cpp builtins/fetch/request-re
1919
add_builtin(fastly::cache_override SRC builtins/cache-override.cpp)
2020
add_builtin(fastly::fetch_event SRC builtins/fetch-event.cpp DEPENDENCIES OpenSSL)
2121

22+
add_compile_definitions(PUBLIC RUNTIME_VERSION=${RUNTIME_VERSION})
23+
2224
project(FastlyJS)

runtime/fastly/build-debug.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env bash
22
cd "$(dirname "$0")" || exit 1
3-
HOST_API=$(realpath host-api) cmake -B build-debug -DCMAKE_BUILD_TYPE=Debug -DENABLE_BUILTIN_WEB_FETCH=0 -DENABLE_BUILTIN_WEB_FETCH_FETCH_EVENT=0
3+
RUNTIME_VERSION=$(npm pkg get version --json --prefix=../../ | jq -r)
4+
HOST_API=$(realpath host-api) cmake -B build-debug -DCMAKE_BUILD_TYPE=Debug -DENABLE_BUILTIN_WEB_FETCH=0 -DENABLE_BUILTIN_WEB_FETCH_FETCH_EVENT=0 -DRUNTIME_VERSION="\"starlingmonkey-$RUNTIME_VERSION\""
45
cmake --build build-debug --parallel 10
56
mv build-debug/starling.wasm/starling.wasm ../../

runtime/fastly/build-release.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env bash
22
cd "$(dirname "$0")" || exit 1
3-
HOST_API=$(realpath host-api) cmake -B build-release -DCMAKE_BUILD_TYPE=Release -DENABLE_BUILTIN_WEB_FETCH=0 -DENABLE_BUILTIN_WEB_FETCH_FETCH_EVENT=0
3+
RUNTIME_VERSION=$(npm pkg get version --json --prefix=../../ | jq -r)
4+
HOST_API=$(realpath host-api) cmake -B build-release -DCMAKE_BUILD_TYPE=Release -DENABLE_BUILTIN_WEB_FETCH=0 -DENABLE_BUILTIN_WEB_FETCH_FETCH_EVENT=0 -DRUNTIME_VERSION="\"starlingmonkey-$RUNTIME_VERSION\""
45
cmake --build build-release
56
mv build-release/starling.wasm/starling.wasm ../../

runtime/fastly/builtins/fastly.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
namespace fastly::fastly {
1313

14-
#define RUNTIME_VERSION "starlingmonkey-dev"
15-
1614
class Env : public builtins::BuiltinNoConstructor<Env> {
1715
private:
1816
static bool env_get(JSContext *cx, unsigned argc, JS::Value *vp);

runtime/js-compute-runtime/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ WIT_BINDGEN ?= $(shell which wit-bindgen)
3838
# Default optimization flgs for clang/clang++.
3939
OPT_FLAGS ?= -O2
4040

41+
RUNTIME_VERSION ?= $(shell npm pkg get version --json | jq -r)
42+
4143
# Command helpers for making nice build output.
4244
include mk/commands.mk
4345

@@ -92,6 +94,7 @@ SM_OBJ += $(wildcard $(SM_SRC)/lib/*.a)
9294
# This is required when using spidermonkey headers, as it allows us to enable
9395
# the streams library when setting up the js context.
9496
DEFINES := -DMOZ_JS_STREAMS
97+
DEFINES += -DRUNTIME_VERSION='"$(RUNTIME_VERSION)"'
9598

9699
# Flags for c++ compilation
97100
CXX_FLAGS := -std=gnu++20 -Wall -Werror -Qunused-arguments

runtime/js-compute-runtime/js-compute-builtins.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ const JSErrorFormatString js_ErrorFormatString[JSErrNum_Limit] = {
3232

3333
#include "host_interface/host_api.h"
3434

35-
#define RUNTIME_VERSION "3.13.2-dev"
36-
3735
const JSErrorFormatString *GetErrorMessage(void *userRef, unsigned errorNumber);
3836

3937
JSObject *PromiseRejectedWithPendingError(JSContext *cx);

0 commit comments

Comments
 (0)