Skip to content

Commit

Permalink
🛌🏿 Javet v2.2.3 (#271)
Browse files Browse the repository at this point in the history
* Upgraded V8 to `v11.7.439.16` (2023-09-07)
* Fixed some API changes in V8 v11.7
  • Loading branch information
caoccao authored Sep 14, 2023
1 parent a999674 commit 0a588f3
Show file tree
Hide file tree
Showing 478 changed files with 10,978 additions and 22,253 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/android_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:

env:
JAVET_NODE_VERSION: 18.17.1
JAVET_V8_VERSION: 11.6.189.18
JAVET_VERSION: 2.2.2
JAVET_V8_VERSION: 11.7.439.16
JAVET_VERSION: 2.2.3
ROOT: /home/runner/work/Javet

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linux_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:

env:
JAVET_NODE_VERSION: 18.17.1
JAVET_V8_VERSION: 11.6.189.18
JAVET_VERSION: 2.2.2
JAVET_V8_VERSION: 11.7.439.16
JAVET_VERSION: 2.2.3
ROOT: /home/runner/work/Javet

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linux_build_artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_REPO_JAVET: ${{ secrets.DOCKERHUB_REPO_JAVET }}
JAVET_NODE_VERSION: 18.17.1
JAVET_V8_VERSION: 11.6.189.18
JAVET_VERSION: 2.2.2
JAVET_V8_VERSION: 11.7.439.16
JAVET_VERSION: 2.2.3

jobs:
javet_linux_x86_64:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linux_build_node_v8_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_REPO_JAVET: ${{ secrets.DOCKERHUB_REPO_JAVET }}
JAVET_NODE_VERSION: 18.17.1
JAVET_V8_VERSION: 11.6.189.18
JAVET_VERSION: 2.2.2
JAVET_V8_VERSION: 11.7.439.16
JAVET_VERSION: 2.2.3

# 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
4 changes: 2 additions & 2 deletions .github/workflows/macos_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:

env:
JAVET_NODE_VERSION: 18.17.1
JAVET_V8_VERSION: 11.6.189.18
JAVET_VERSION: 2.2.2
JAVET_V8_VERSION: 11.7.439.16
JAVET_VERSION: 2.2.3
ROOT: /Users/runner/work/Javet

jobs:
Expand Down
20 changes: 10 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Javet

`Javet <https://github.com/caoccao/Javet/>`_ is Java + V8 (JAVa + V + EighT). It is an awesome way of embedding Node.js and V8 in Java.

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

💖 If you like my work, please `donate <https://opencollective.com/javet>`_ to support me. If you have a retired Mac OS (x86_64) device and are fine with mailing it to me, that will be great because I don't have such device to support the community. Thank you for supporting Javet.

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

* Linux (x86_64) + Mac OS (x86_64, arm64) + ️Windows (x86_64)
* Android (arm, arm64, x86 and x86_64)
* Node.js ``v18.17.1`` + V8 ``v11.6.189.18``
* Node.js ``v18.17.1`` + V8 ``v11.7.439.16``
* 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 @@ -59,33 +59,33 @@ Maven
<dependency>
<groupId>com.caoccao.javet</groupId>
<artifactId>javet</artifactId>
<version>2.2.2</version>
<version>2.2.3</version>
</dependency>
<!-- Mac OS (x86_64 and arm64) -->
<dependency>
<groupId>com.caoccao.javet</groupId>
<artifactId>javet-macos</artifactId>
<version>2.2.2</version>
<version>2.2.3</version>
</dependency>
Gradle Kotlin DSL
^^^^^^^^^^^^^^^^^

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

.. code-block:: groovy
implementation 'com.caoccao.javet:javet:2.2.2' // Linux and Windows (x86_64)
implementation 'com.caoccao.javet:javet-macos:2.2.2' // Mac OS (x86_64 and arm64)
implementation 'com.caoccao.javet:javet-android:2.2.2' // Android (arm, arm64, x86 and x86_64)
implementation 'com.caoccao.javet:javet:2.2.3' // Linux and Windows (x86_64)
implementation 'com.caoccao.javet:javet-macos:2.2.3' // Mac OS (x86_64 and arm64)
implementation 'com.caoccao.javet:javet-android:2.2.3' // Android (arm, arm64, x86 and x86_64)
Hello Javet
-----------
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Oct 21 08:49:28 CST 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
2 changes: 1 addition & 1 deletion android/javet-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ plugins {
id("com.android.library")
}

version = "2.2.2"
version = "2.2.3"

android {
compileSdk = 30
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.2.2"
android:versionName="2.2.3"
>

</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.2.2</version>
<version>2.2.3</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.2.2</tag>
<tag>2.2.3</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.2.2"
version = "2.2.3"

dependencies {
testImplementation("org.eclipse.jetty.websocket:websocket-server:9.4.49.v20220914")
Expand Down
5 changes: 5 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android
target_link_libraries(Javet PUBLIC -force_load ${importLibrary})
target_link_libraries(JavetStatic PUBLIC -force_load ${importLibrary})
endforeach(importLibrary)
# From V8 v11.7 abseil is somehow not built properly.
# This is a patch build.
# https://github.com/abseil/abseil-cpp/blob/master/CMake/README.md
add_subdirectory(${V8_DIR}/third_party/abseil-cpp ${V8_RELEASE_DIR}/third_party/abseil-cpp)
target_link_libraries(Javet PUBLIC absl::base absl::time)
endif()
if(DEFINED NODE_DIR)
list(APPEND includeDirs
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.2.2
JAVET_VERSION=2.2.3
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.2.2
JAVET_VERSION=2.2.3
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.2.2
JAVET_VERSION=2.2.3
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.2.2
SET JAVET_VERSION=2.2.3
rd /s/q build
mkdir build
cd build
Expand Down
23 changes: 23 additions & 0 deletions cpp/jni/javet_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ namespace Javet {
const V8LocalContext& v8Context,
const V8InternalObject& v8InternalObject) noexcept {
auto v8InternalIsolate = reinterpret_cast<V8InternalIsolate*>(v8Context->GetIsolate());
#ifdef ENABLE_NODE
if (v8InternalObject.IsJSObject() || v8InternalObject.IsPrimitive()
|| v8InternalObject.IsJSArray() || v8InternalObject.IsJSTypedArray()) {
auto v8LocalObject = v8::Utils::ToLocal(v8::internal::handle(v8InternalObject, v8InternalIsolate));
Expand All @@ -569,6 +570,28 @@ namespace Javet {
else if (v8InternalObject.IsCode()) {
LOG_DEBUG("Converter: Code is not supported.");
}
#else
if (v8::internal::IsJSObject(v8InternalObject) || v8::internal::IsPrimitive(v8InternalObject)
|| v8::internal::IsJSArray(v8InternalObject) || v8::internal::IsJSTypedArray(v8InternalObject)) {
auto v8LocalObject = v8::Utils::ToLocal(v8::internal::handle(v8InternalObject, v8InternalIsolate));
return ToExternalV8Value(jniEnv, v8Runtime, v8Context, v8LocalObject);
}
else if (v8::internal::IsContext(v8InternalObject)) {
auto v8InternalContext = V8InternalContext::cast(v8InternalObject);
auto v8LocalContext = v8::Utils::ToLocal(v8::internal::handle(v8InternalContext, v8InternalIsolate));
return ToExternalV8Context(jniEnv, v8Runtime, v8Context, v8LocalContext);
}
else if (v8::internal::IsModule(v8InternalObject)) {
auto v8LocalModule = v8::Utils::ToLocal(v8::internal::handle(V8InternalModule::cast(v8InternalObject), v8InternalIsolate));
return ToExternalV8Module(jniEnv, v8Runtime, v8Context, v8LocalModule);
}
else if (v8::internal::IsScript(v8InternalObject)) {
LOG_DEBUG("Converter: Script is not supported.");
}
else if (v8::internal::IsCode(v8InternalObject)) {
LOG_DEBUG("Converter: Code is not supported.");
}
#endif
return ToExternalV8ValueUndefined(jniEnv, v8Runtime);
}

Expand Down
14 changes: 12 additions & 2 deletions cpp/jni/javet_jni_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,11 @@ JNIEXPORT jboolean JNICALL Java_com_caoccao_javet_interop_V8Native_functionSetSc
const int endPosition = jniEnv->CallIntMethod(mScriptSource, Javet::Converter::jmethodIDIV8ValueFunctionScriptGetEndPosition);
auto v8InternalScript = V8InternalScript::cast(v8InternalShared.script());
auto v8InternalSource = v8::Utils::OpenHandle(*umSourceCode);
#ifdef ENABLE_NODE
bool sourceCodeEquals = v8InternalScript.source().StrictEquals(*v8InternalSource);
#else
bool sourceCodeEquals = V8InternalObject::StrictEquals(v8InternalScript.source(), *v8InternalSource);
#endif
bool positionEquals = startPosition == v8InternalShared.StartPosition() && endPosition == v8InternalShared.EndPosition();
if (!sourceCodeEquals || !positionEquals) {
if (v8InternalShared.CanDiscardCompiled()) {
Expand All @@ -482,10 +486,11 @@ JNIEXPORT jboolean JNICALL Java_com_caoccao_javet_interop_V8Native_functionSetSc
#ifdef ENABLE_NODE
auto clonedV8InternalScript = v8InternalIsolate->factory()->CloneScript(v8InternalScriptHandle);
clonedV8InternalScript->set_source(*v8InternalSource, V8InternalWriteBarrierMode::UPDATE_WRITE_BARRIER);
v8InternalShared.set_script(*clonedV8InternalScript);
#else
auto clonedV8InternalScript = v8InternalIsolate->factory()->CloneScript(v8InternalScriptHandle, v8InternalSource);
v8InternalShared.set_script(*clonedV8InternalScript, v8::kReleaseStore);
#endif
v8InternalShared.set_script(*clonedV8InternalScript);
}
else {
#ifdef ENABLE_NODE
Expand Down Expand Up @@ -581,7 +586,11 @@ JNIEXPORT jboolean JNICALL Java_com_caoccao_javet_interop_V8Native_functionSetSo
const int newEndPosition = startPosition + newSourceLength;

auto newV8InternalSource = v8::Utils::OpenHandle(*newSourceCode);
#ifdef ENABLE_NODE
bool sourceCodeEquals = v8InternalSource.StrictEquals(*newV8InternalSource);
#else
bool sourceCodeEquals = V8InternalObject::StrictEquals(v8InternalSource, *newV8InternalSource);
#endif
bool positionEquals = newEndPosition == v8InternalShared.EndPosition();

if (!sourceCodeEquals || !positionEquals) {
Expand All @@ -596,10 +605,11 @@ JNIEXPORT jboolean JNICALL Java_com_caoccao_javet_interop_V8Native_functionSetSo
#ifdef ENABLE_NODE
auto clonedV8InternalScript = v8InternalIsolate->factory()->CloneScript(v8InternalScriptHandle);
clonedV8InternalScript->set_source(*newV8InternalSource, V8InternalWriteBarrierMode::UPDATE_WRITE_BARRIER);
v8InternalShared.set_script(*clonedV8InternalScript);
#else
auto clonedV8InternalScript = v8InternalIsolate->factory()->CloneScript(v8InternalScriptHandle, newV8InternalSource);
v8InternalShared.set_script(*clonedV8InternalScript, v8::kReleaseStore);
#endif
v8InternalShared.set_script(*clonedV8InternalScript);
}
else {
#ifdef ENABLE_NODE
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,2,2,0
PRODUCTVERSION 2,2,2,0
FILEVERSION 2,2,3,0
PRODUCTVERSION 2,2,3,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.2.2.0"
VALUE "InternalName", "libjavet-node-windows-x86_64.v.2.2.2.dll"
VALUE "FileVersion", "2.2.3.0"
VALUE "InternalName", "libjavet-node-windows-x86_64.v.2.2.3.dll"
VALUE "LegalCopyright", "Copyright (C) 2021"
VALUE "OriginalFilename", "libjavet-node-windows-x86_64.v.2.2.2.dll"
VALUE "OriginalFilename", "libjavet-node-windows-x86_64.v.2.2.3.dll"
VALUE "ProductName", "Javet Windows"
VALUE "ProductVersion", "2.2.2.0"
VALUE "ProductVersion", "2.2.3.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,2,2,0
PRODUCTVERSION 2,2,2,0
FILEVERSION 2,2,3,0
PRODUCTVERSION 2,2,3,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.2.2.0"
VALUE "InternalName", "libjavet-v8-windows-x86_64.v.2.2.2.dll"
VALUE "FileVersion", "2.2.3.0"
VALUE "InternalName", "libjavet-v8-windows-x86_64.v.2.2.3.dll"
VALUE "LegalCopyright", "Copyright (C) 2021"
VALUE "OriginalFilename", "libjavet-v8-windows-x86_64.v.2.2.2.dll"
VALUE "OriginalFilename", "libjavet-v8-windows-x86_64.v.2.2.3.dll"
VALUE "ProductName", "Javet Windows"
VALUE "ProductVersion", "2.2.2.0"
VALUE "ProductVersion", "2.2.3.0"
END
END
BLOCK "VarFileInfo"
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.2.2 -f docker/android/base.Dockerfile .
# Usage: docker build -t sjtucaocao/javet-android:2.2.3 -f docker/android/base.Dockerfile .

ARG JAVET_V8_VERSION=11.6.189.18
ARG JAVET_V8_VERSION=11.7.439.16

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.2.2
FROM sjtucaocao/javet-android:2.2.3
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.2.2 -f docker/linux-arm64/base_all_in_one.Dockerfile .
# Usage: docker build -t sjtucaocao/javet-arm64:2.2.3 -f docker/linux-arm64/base_all_in_one.Dockerfile .

ARG JAVET_NODE_VERSION=18.15.0
ARG JAVET_V8_VERSION=11.6.189.18
ARG JAVET_V8_VERSION=11.7.439.16

FROM ubuntu:20.04
WORKDIR /
Expand Down
Loading

0 comments on commit 0a588f3

Please sign in to comment.