Skip to content

Commit

Permalink
🎂 Javet v2.1.2 (#244)
Browse files Browse the repository at this point in the history
* Upgraded V8 to `v11.3.244.8` (2023-04-12)
* Upgraded Node.js to `v18.16.0` ([2023-04-12](https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V18.md#18.16.0))
* Fixed a crash issue when closing the V8 runtime with dangling callback contexts on Android
* Update ABI to 24 for Android
  • Loading branch information
caoccao authored Apr 28, 2023
1 parent 2594a3e commit 0732447
Show file tree
Hide file tree
Showing 430 changed files with 955 additions and 932 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/linux_build_artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ on:
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_REPO_JAVET: ${{ secrets.DOCKERHUB_REPO_JAVET }}
JAVET_NODE_VERSION: 18.15.0
JAVET_V8_VERSION: 11.2.214.13
JAVET_VERSION: 2.1.1
JAVET_NODE_VERSION: 18.16.0
JAVET_V8_VERSION: 11.3.244.8
JAVET_VERSION: 2.1.2

jobs:
javet_linux_x86_64:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/linux_build_node_v8_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ on:
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_REPO_JAVET: ${{ secrets.DOCKERHUB_REPO_JAVET }}
JAVET_NODE_VERSION: 18.15.0
JAVET_V8_VERSION: 11.2.214.13
JAVET_VERSION: 2.1.1
JAVET_NODE_VERSION: 18.16.0
JAVET_V8_VERSION: 11.3.244.8
JAVET_VERSION: 2.1.2

# if we skip a job using a job level `if` condition, then any dependent jobs also don't run.
# we can skip a step of the job, using a step level `if` condition.
Expand Down
14 changes: 7 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Javet

If you like my work, please **Star** this project. And, you may follow me `@sjtucaocao <https://twitter.com/sjtucaocao>`_, or visit http://caoccao.blogspot.com/. And the official support channel is at `discord <https://discord.gg/R4vvKU96gw>`_.

💖 If you use Mac OS (x86_64), please be aware that the Mac OS (x86_64) build will discontinue anytime because my `MacBook Air mid-2012 <https://caoccao.blogspot.com/2021/09/macbook-air-mid-2012-from-lion-to-mojave.html>`_ will be soon deprecated by new version of V8. Please `donate <https://opencollective.com/javet>`_ to support me purchasing a new Mac OS (x86_64) device. Or, if you have a retired Mac OS (x86_64) device and are fine with mailing it to me, that will also be great. Thank you for supporting Javet. There is no new official releases after v2.1.1. Please contact the maintainer for the new private releases.
💖 If you use Mac OS (x86_64), please be aware that the Mac OS (x86_64) build will discontinue anytime because I'm no longer able to build new versions of V8 with my `MacBook Air mid-2012 <https://caoccao.blogspot.com/2021/09/macbook-air-mid-2012-from-lion-to-mojave.html>`_. Please `donate <https://opencollective.com/javet>`_ to support me purchasing a new Mac OS (x86_64) device. Or, if you have a retired Mac OS (x86_64) device and are fine with mailing it to me, that will also be great. Thank you for supporting Javet.

💖 If you use Mac OS (arm64), there is no new releases after v2.1.1. That's because I don't have any Mac OS (arm64) device to produce any new builds. Please `donate <https://opencollective.com/javet>`_ to support me purchasing a new Mac OS (arm64) device.

Expand All @@ -33,7 +33,7 @@ Major Features

* Linux (x86_64) + Mac OS (x86_64, arm64) + ️Windows (x86_64)
* Android (arm, arm64, x86 and x86_64)
* Node.js ``v18.15.0`` + V8 ``v11.2.214.13``
* Node.js ``v18.16.0`` + V8 ``v11.3.244.8``
* Dynamic switch between Node.js and V8 mode (`Which mode do you prefer? <https://github.com/caoccao/Javet/discussions/92>`_)
* Polyfill V8 mode with `Javenode <https://github.com/caoccao/Javenode>`_
* V8 API exposure in JVM
Expand All @@ -58,7 +58,7 @@ Maven
<dependency>
<groupId>com.caoccao.javet</groupId>
<artifactId>javet</artifactId>
<version>2.1.1</version>
<version>2.1.2</version>
</dependency>
<!-- Mac OS (x86_64 and arm64) -->
Expand All @@ -73,18 +73,18 @@ Gradle Kotlin DSL

.. code-block:: kotlin
implementation("com.caoccao.javet:javet:2.1.1") // Linux and Windows (x86_64)
implementation("com.caoccao.javet:javet:2.1.2") // Linux and Windows (x86_64)
implementation("com.caoccao.javet:javet-macos:2.1.1") // Mac OS (x86_64 and arm64)
implementation("com.caoccao.javet:javet-android:2.1.1") // Android (arm, arm64, x86 and x86_64)
implementation("com.caoccao.javet:javet-android:2.1.2") // Android (arm, arm64, x86 and x86_64)
Gradle Groovy DSL
^^^^^^^^^^^^^^^^^

.. code-block:: groovy
implementation 'com.caoccao.javet:javet:2.1.1' // Linux and Windows (x86_64)
implementation 'com.caoccao.javet:javet:2.1.2' // Linux and Windows (x86_64)
implementation 'com.caoccao.javet:javet-macos:2.1.1' // Mac OS (x86_64 and arm64)
implementation 'com.caoccao.javet:javet-android:2.1.1' // Android (arm, arm64, x86 and x86_64)
implementation 'com.caoccao.javet:javet-android:2.1.2' // Android (arm, arm64, x86 and x86_64)
Hello Javet
-----------
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.0.3")
classpath("com.android.tools.build:gradle:8.0.0")
}
}

Expand Down
5 changes: 3 additions & 2 deletions android/javet-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ plugins {
id("com.android.library")
}

version = "2.1.1"
version = "2.1.2"

android {
compileSdk = 30
namespace = "com.caoccao.javet"

defaultConfig {
minSdk = 23
minSdk = 24
targetSdk = 30

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down
2 changes: 1 addition & 1 deletion android/javet-android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.caoccao.javet"
android:versionCode="1"
android:versionName="2.1.1"
android:versionName="2.1.2"
>

</manifest>
4 changes: 2 additions & 2 deletions android/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>com.caoccao.javet</groupId>
<artifactId>javet-android</artifactId>
<version>2.1.1</version>
<version>2.1.2</version>
<name>javet</name>
<packaging>aar</packaging>
<description>Javet is Java + V8 (JAVa + V + EighT). It is an awesome way of embedding V8 in Java.</description>
Expand All @@ -29,7 +29,7 @@
<connection>scm:git:git://github.com/caoccao/Javet.git</connection>
<developerConnection>scm:git:git@github.com:caoccao/caoccao.git</developerConnection>
<url>https://github.com/caoccao/Javet</url>
<tag>2.1.1</tag>
<tag>2.1.2</tag>
</scm>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repositories {
}

group = "com.caoccao.javet"
version = "2.1.1"
version = "2.1.2"

dependencies {
testImplementation("org.eclipse.jetty.websocket:websocket-server:9.4.49.v20220914")
Expand Down
7 changes: 4 additions & 3 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Android")
else()
message(FATAL_ERROR "CMAKE_ANDROID_ARCH must be one of arm, arm64, x86, x86_64.")
endif()
# The target ABI version is set to 23 because pre-23 is no longer supported by V8 v9.7+.
set(CMAKE_SYSTEM_VERSION 23)
# The target ABI version is set to 24 because pre-24 is no longer supported by V8 v11+.
# https://github.com/android/ndk/issues/1179
set(CMAKE_SYSTEM_VERSION 24)
set(CMAKE_ANDROID_STL_TYPE c++_static)
set(JAVA_RESOURCES_DIR ${CMAKE_SOURCE_DIR}/../android/javet-android/src/main/jniLibs/${CMAKE_ANDROID_ARCH_ABI})
else()
Expand Down Expand Up @@ -113,7 +114,7 @@ if(DEFINED NODE_DIR)
${NODE_DIR}/deps/v8/include
${NODE_DIR}/src)
list(APPEND importLibraries
base64 brotli cares histogram llhttp nghttp2 nghttp3 ngtcp2 openssl simdutf torque_base uvwasi
ada base64 brotli cares histogram llhttp nghttp2 nghttp3 ngtcp2 openssl simdutf torque_base uvwasi
v8_base_without_compiler v8_compiler v8_init v8_initializers
v8_libbase v8_libplatform v8_snapshot v8_zlib zlib zlib_adler32_simd zlib_inflate_chunk_simd)
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "(arm64|aarch64)")
Expand Down
2 changes: 1 addition & 1 deletion cpp/build-android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Usage for V8: sh build-android.sh -DV8_DIR=${HOME}/v8 -DCMAKE_ANDROID_NDK=${HOME}/android -DCMAKE_ANDROID_ARCH=arm64
# Usage for Node: sh build-android.sh -DNODE_DIR=${HOME}/node -DCMAKE_ANDROID_NDK=${HOME}/android -DCMAKE_ANDROID_ARCH=arm64
JAVET_VERSION=2.1.1
JAVET_VERSION=2.1.2
rm -rf build
mkdir build
cd build
Expand Down
2 changes: 1 addition & 1 deletion cpp/build-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Usage for V8: sh build-linux.sh -DV8_DIR=${HOME}/v8
# Usage for Node: sh build-linux.sh -DNODE_DIR=${HOME}/node
JAVET_VERSION=2.1.1
JAVET_VERSION=2.1.2
rm -rf build
mkdir build
cd build
Expand Down
2 changes: 1 addition & 1 deletion cpp/build-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Usage for V8: sh build-macos.sh -DV8_DIR=${HOME}/v8
# Usage for Node: sh build-macos.sh -DNODE_DIR=${HOME}/node
JAVET_VERSION=2.1.1
JAVET_VERSION=2.1.2
rm -rf build
mkdir build
cd build
Expand Down
2 changes: 1 addition & 1 deletion cpp/build-windows.cmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@echo off
REM Usage for V8: build -DV8_DIR=C:\v8
REM Usage for Node: build -DNODE_DIR=C:\node
SET JAVET_VERSION=2.1.1
SET JAVET_VERSION=2.1.2
rd /s/q build
mkdir build
cd build
Expand Down
12 changes: 6 additions & 6 deletions cpp/jni/javet_resource_node.rc
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,1,1,0
PRODUCTVERSION 2,1,1,0
FILEVERSION 2,1,2,0
PRODUCTVERSION 2,1,2,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -79,12 +79,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "caoccao.com"
VALUE "FileDescription", "caoccao.com"
VALUE "FileVersion", "2.1.1.0"
VALUE "InternalName", "libjavet-node-windows-x86_64.v.2.1.1.dll"
VALUE "FileVersion", "2.1.2.0"
VALUE "InternalName", "libjavet-node-windows-x86_64.v.2.1.2.dll"
VALUE "LegalCopyright", "Copyright (C) 2021"
VALUE "OriginalFilename", "libjavet-node-windows-x86_64.v.2.1.1.dll"
VALUE "OriginalFilename", "libjavet-node-windows-x86_64.v.2.1.2.dll"
VALUE "ProductName", "Javet Windows"
VALUE "ProductVersion", "2.1.1.0"
VALUE "ProductVersion", "2.1.2.0"
END
END
BLOCK "VarFileInfo"
Expand Down
12 changes: 6 additions & 6 deletions cpp/jni/javet_resource_v8.rc
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 2,1,1,0
PRODUCTVERSION 2,1,1,0
FILEVERSION 2,1,2,0
PRODUCTVERSION 2,1,2,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -79,12 +79,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "caoccao.com"
VALUE "FileDescription", "caoccao.com"
VALUE "FileVersion", "2.1.1.0"
VALUE "InternalName", "libjavet-v8-windows-x86_64.v.2.1.1.dll"
VALUE "FileVersion", "2.1.2.0"
VALUE "InternalName", "libjavet-v8-windows-x86_64.v.2.1.2.dll"
VALUE "LegalCopyright", "Copyright (C) 2021"
VALUE "OriginalFilename", "libjavet-v8-windows-x86_64.v.2.1.1.dll"
VALUE "OriginalFilename", "libjavet-v8-windows-x86_64.v.2.1.2.dll"
VALUE "ProductName", "Javet Windows"
VALUE "ProductVersion", "2.1.1.0"
VALUE "ProductVersion", "2.1.2.0"
END
END
BLOCK "VarFileInfo"
Expand Down
14 changes: 9 additions & 5 deletions cpp/jni/javet_v8_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,8 @@ namespace Javet {
if (!purgeEventLoopBeforeClose) {
auto v8ContextScope = GetV8ContextScope(v8LocalContext);
if (!nodeEnvironment->is_stopping()) {
nodeEnvironment->set_trace_sync_io(nodeEnvironment->options()->trace_sync_io);
bool hasMoreTasks;
nodeEnvironment->performance_state()->Mark(node::performance::NODE_PERFORMANCE_MILESTONE_LOOP_START);
// nodeEnvironment->performance_state()->Mark(node::performance::NODE_PERFORMANCE_MILESTONE_LOOP_START);
do {
if (nodeEnvironment->is_stopping()) { break; }
uv_run(&uvLoop, UV_RUN_DEFAULT);
Expand All @@ -152,12 +151,11 @@ namespace Javet {
hasMoreTasks = uv_loop_alive(&uvLoop);
}
} while (hasMoreTasks && !nodeEnvironment->is_stopping());
nodeEnvironment->performance_state()->Mark(node::performance::NODE_PERFORMANCE_MILESTONE_LOOP_EXIT);
// nodeEnvironment->performance_state()->Mark(node::performance::NODE_PERFORMANCE_MILESTONE_LOOP_EXIT);
}
}
int errorCode = 0;
if (!nodeEnvironment->is_stopping()) {
nodeEnvironment->set_trace_sync_io(false);
// Do not call nodeEnvironment->set_snapshot_serialize_callback(V8LocalFunction());
// Do not call nodeEnvironment->PrintInfoForSnapshotIfDebug();
// Do not call nodeEnvironment->ForEachRealm([](node::Realm* realm) { realm->VerifyNoStrongBaseObjects(); });
Expand Down Expand Up @@ -254,8 +252,14 @@ namespace Javet {
}
// node::CreateEnvironment is not thread-safe.
std::lock_guard<std::mutex> lock(mutexForNodeResetEnvrironment);
nodeEnvironment.reset(node::CreateEnvironment(nodeIsolateData.get(), v8LocalContext, args, execArgs));
nodeEnvironment.reset(node::CreateEnvironment(
nodeIsolateData.get(),
v8LocalContext,
args,
execArgs,
node::EnvironmentFlags::kOwnsProcessState));
// node::LoadEnvironment is thread-safe.
nodeEnvironment->set_trace_sync_io(false);
auto v8MaybeLocalValue = node::LoadEnvironment(
nodeEnvironment.get(),
"const publicRequire = require('module').createRequire(process.cwd() + '/');"
Expand Down
4 changes: 2 additions & 2 deletions docker/android/base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Usage: docker build -t sjtucaocao/javet-android:2.1.1 -f docker/android/base.Dockerfile .
# Usage: docker build -t sjtucaocao/javet-android:2.1.2 -f docker/android/base.Dockerfile .

ARG JAVET_V8_VERSION=11.2.214.13
ARG JAVET_V8_VERSION=11.3.244.8

FROM ubuntu:20.04
WORKDIR /
Expand Down
2 changes: 1 addition & 1 deletion docker/android/build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

# Usage: docker build -t javet-android:local -f docker/android/build.Dockerfile .

FROM sjtucaocao/javet-android:2.1.1
FROM sjtucaocao/javet-android:2.1.2
WORKDIR /

# Copy Javet
Expand Down
4 changes: 2 additions & 2 deletions docker/linux-arm64/base_all_in_one.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Usage: docker build -t sjtucaocao/javet-arm64:2.1.1 -f docker/linux-arm64/base_all_in_one.Dockerfile .
# Usage: docker build -t sjtucaocao/javet-arm64:2.1.2 -f docker/linux-arm64/base_all_in_one.Dockerfile .

ARG JAVET_NODE_VERSION=18.15.0
ARG JAVET_V8_VERSION=11.2.214.13
ARG JAVET_V8_VERSION=11.3.244.8

FROM ubuntu:20.04
WORKDIR /
Expand Down
2 changes: 1 addition & 1 deletion docker/linux-arm64/base_gradle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.

# Usage: docker build \
# -t sjtucaocao/javet:arm64-2.1.1 \
# -t sjtucaocao/javet:arm64-2.1.2 \
# --build-arg JAVET_REPO=sjtucaocao/javet \
# -f docker/linux-arm64/base_gradle.Dockerfile .

Expand Down
6 changes: 3 additions & 3 deletions docker/linux-arm64/base_v8.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
# limitations under the License.

# Usage: docker build \
# -t sjtucaocao/javet:arm64-base-v8_11.2.214.13 \
# -t sjtucaocao/javet:arm64-base-v8_11.3.244.8 \
# --build-arg JAVET_REPO=sjtucaocao/javet \
# --build-arg JAVET_V8_VERSION=11.2.214.13 \
# --build-arg JAVET_V8_VERSION=11.3.244.8 \
# -f docker/linux-arm64/base_v8.Dockerfile .

ARG JAVET_REPO=sjtucaocao/javet
ARG JAVET_V8_VERSION=11.2.214.13
ARG JAVET_V8_VERSION=11.3.244.8

FROM ${JAVET_REPO}:arm64-base-jvm

Expand Down
4 changes: 2 additions & 2 deletions docker/linux-arm64/build_artifact.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
# --build-arg JAVET_REPO=sjtucaocao/javet \
# --build-arg JAVET_NODE_VERSION=18.12.1 \
# --build-arg JAVET_V8_VERSION=10.8.168.20 \
# --build-arg JAVET_VERSION=2.1.1 \
# --build-arg JAVET_VERSION=2.1.2 \
# -f docker/linux-arm64/build_artifact.Dockerfile .

ARG JAVET_REPO=sjtucaocao/javet
ARG JAVET_NODE_VERSION=18.12.1
ARG JAVET_V8_VERSION=10.8.168.20
ARG JAVET_VERSION=2.1.1
ARG JAVET_VERSION=2.1.2

FROM ${JAVET_REPO}:arm64-base-node_${JAVET_NODE_VERSION} as base-node

Expand Down
6 changes: 3 additions & 3 deletions docker/linux-x86_64/base_all_in_one.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Usage: docker build -t sjtucaocao/javet:2.1.1 -f docker/linux-x86_64/base_all_in_one.Dockerfile .
# Usage: docker build -t sjtucaocao/javet:2.1.2 -f docker/linux-x86_64/base_all_in_one.Dockerfile .

ARG JAVET_NODE_VERSION=18.15.0
ARG JAVET_V8_VERSION=11.2.214.13
ARG JAVET_NODE_VERSION=18.16.0
ARG JAVET_V8_VERSION=11.3.244.8

FROM ubuntu:20.04
WORKDIR /
Expand Down
2 changes: 1 addition & 1 deletion docker/linux-x86_64/base_gradle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.

# Usage: docker build \
# -t sjtucaocao/javet:x86_64-2.1.1 \
# -t sjtucaocao/javet:x86_64-2.1.2 \
# --build-arg JAVET_REPO=sjtucaocao/javet \
# -f docker/linux-x86_64/base_gradle.Dockerfile .

Expand Down
Loading

0 comments on commit 0732447

Please sign in to comment.