Skip to content

Commit

Permalink
💵 Javet v3.0.0 (#278)
Browse files Browse the repository at this point in the history
* Upgraded V8 to `v11.8.172.15` (2023-10-09)
* Upgraded Node.js to `v20.8.0` ([2023-09-28](https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V20.md#20.8.0))
* Upgraded GCC to v10 on Linux
* Supported Linux arm64
* Fixed a contention issue in closing the reference
  • Loading branch information
caoccao authored Oct 12, 2023
1 parent 0a588f3 commit 5a1e80a
Show file tree
Hide file tree
Showing 472 changed files with 2,177 additions and 2,088 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/android_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ on:
workflow_dispatch:

env:
JAVET_NODE_VERSION: 18.17.1
JAVET_V8_VERSION: 11.7.439.16
JAVET_VERSION: 2.2.3
JAVET_NODE_VERSION: 20.8.0
JAVET_V8_VERSION: 11.8.172.15
JAVET_VERSION: 3.0.0
ROOT: /home/runner/work/Javet

jobs:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/linux_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ on:
workflow_dispatch:

env:
JAVET_NODE_VERSION: 18.17.1
JAVET_V8_VERSION: 11.7.439.16
JAVET_VERSION: 2.2.3
JAVET_NODE_VERSION: 20.8.0
JAVET_V8_VERSION: 11.8.172.15
JAVET_VERSION: 3.0.0
ROOT: /home/runner/work/Javet

jobs:
Expand Down
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.17.1
JAVET_V8_VERSION: 11.7.439.16
JAVET_VERSION: 2.2.3
JAVET_NODE_VERSION: 20.8.0
JAVET_V8_VERSION: 11.8.172.15
JAVET_VERSION: 3.0.0

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.17.1
JAVET_V8_VERSION: 11.7.439.16
JAVET_VERSION: 2.2.3
JAVET_NODE_VERSION: 20.8.0
JAVET_V8_VERSION: 11.8.172.15
JAVET_VERSION: 3.0.0

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

env:
JAVET_NODE_VERSION: 18.17.1
JAVET_V8_VERSION: 11.7.439.16
JAVET_VERSION: 2.2.3
JAVET_NODE_VERSION: 20.8.0
JAVET_V8_VERSION: 11.8.172.15
JAVET_VERSION: 3.0.0
ROOT: /Users/runner/work/Javet

jobs:
Expand Down
44 changes: 33 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,16 @@ If you like my work, please **Star** this project. And, you may follow me `@sjtu
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.7.439.16``
=========== ======= ======= ======= =======
CPU Arch Android Linux MacOS Windows
=========== ======= ======= ======= =======
x86 ✔ ❌ ❌ ❌
x86_64 ✔ ✔ ✔ ✔
arm ✔ ❌ ❌ ❌
arm64 ✔ ✔ ✔ ❌
=========== ======= ======= ======= =======

* Node.js ``v20.8.0`` + V8 ``v11.8.172.15``
* 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 +66,42 @@ Maven
<dependency>
<groupId>com.caoccao.javet</groupId>
<artifactId>javet</artifactId>
<version>2.2.3</version>
<version>3.0.0</version>
</dependency>
<!-- Linux (arm64) -->
<dependency>
<groupId>com.caoccao.javet</groupId>
<artifactId>javet-linux-arm64</artifactId>
<version>3.0.0</version>
</dependency>
<!-- Mac OS (x86_64 and arm64) -->
<dependency>
<groupId>com.caoccao.javet</groupId>
<artifactId>javet-macos</artifactId>
<version>2.2.3</version>
<version>3.0.0</version>
</dependency>
Gradle Kotlin DSL
^^^^^^^^^^^^^^^^^

.. code-block:: kotlin
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)
implementation("com.caoccao.javet:javet:3.0.0") // Linux and Windows (x86_64)
implementation("com.caoccao.javet:javet-linux-arm64:3.0.0") // Linux (arm64)
implementation("com.caoccao.javet:javet-macos:3.0.0") // Mac OS (x86_64 and arm64)
implementation("com.caoccao.javet:javet-android:3.0.0") // Android (arm, arm64, x86 and x86_64)
Gradle Groovy DSL
^^^^^^^^^^^^^^^^^

.. code-block:: groovy
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)
implementation 'com.caoccao.javet:javet:3.0.0' // Linux and Windows (x86_64)
implementation 'com.caoccao.javet:javet-linux-arm64:3.0.0' // Linux (arm64)
implementation 'com.caoccao.javet:javet-macos:3.0.0' // Mac OS (x86_64 and arm64)
implementation 'com.caoccao.javet:javet-android:3.0.0' // Android (arm, arm64, x86 and x86_64)
Hello Javet
-----------
Expand All @@ -102,6 +118,11 @@ Hello Javet
System.out.println(v8Runtime.getExecutor("'Hello Javet'").executeString());
}
Sponsors
========

`HiveMQ <https://www.hivemq.com/>`_

License
=======

Expand All @@ -111,5 +132,6 @@ Documents
=========

* `Javet Intro <https://docs.google.com/presentation/d/1lQ8xIHuywuE0ydqm2w6xq8OeQZO_WeTLYXW9bNflQb8/>`_
* `Performance Comparison of GraalJS, Javet and Nashorn <https://github.com/caoccao/GraalJS-vs-Javet-vs-Nashorn>`_
* `Javet Javadoc <https://www.caoccao.com/Javet/reference/javadoc/index.html>`_
* `Javet Document Portal <https://www.caoccao.com/Javet/>`_
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.3"
version = "3.0.0"

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.3"
android:versionName="3.0.0"
>

</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.3</version>
<version>3.0.0</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.3</tag>
<tag>3.0.0</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.3"
version = "3.0.0"

dependencies {
testImplementation("org.eclipse.jetty.websocket:websocket-server:9.4.49.v20220914")
Expand Down
6 changes: 3 additions & 3 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ if(DEFINED NODE_DIR)
list(APPEND importLibraries
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)
v8_libbase v8_libplatform v8_snapshot v8_turboshaft v8_zlib zlib zlib_adler32_simd zlib_inflate_chunk_simd)
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "(arm64|aarch64)")
list(APPEND importLibraries base64_neon64)
else()
Expand All @@ -135,8 +135,8 @@ if(DEFINED NODE_DIR)
list(APPEND importLibraries zlib_arm_crc32)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "(arm64|aarch64)")
list(APPEND importLibraries zlib_arm_crc32)
else()
list(APPEND importLibraries zlib_crc32_simd)
# else()
# list(APPEND importLibraries zlib_crc32_simd)
endif()
add_definitions(-DENABLE_NODE)
set(JAVET_LIB_TYPE "node")
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.3
JAVET_VERSION=3.0.0
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.3
JAVET_VERSION=3.0.0
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.3
JAVET_VERSION=3.0.0
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.3
SET JAVET_VERSION=3.0.0
rd /s/q build
mkdir build
cd build
Expand Down
4 changes: 2 additions & 2 deletions cpp/jni/com_caoccao_javet_interop_V8Native.h

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

7 changes: 0 additions & 7 deletions cpp/jni/javet_inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,11 @@ namespace Javet {
auto v8Context = v8Runtime->GetV8LocalContext();
javetInspectorChannel.reset(new JavetInspectorChannel(v8Runtime, mV8Inspector));
v8Inspector.reset(v8_inspector::V8Inspector::create(v8Runtime->v8Isolate, this).release());
#ifdef ENABLE_NODE
v8InspectorSession.reset(v8Inspector->connect(
CONTEXT_GROUP_ID,
javetInspectorChannel.get(),
v8_inspector::StringView()).release());
#else
v8InspectorSession.reset(v8Inspector->connect(
CONTEXT_GROUP_ID,
javetInspectorChannel.get(),
v8_inspector::StringView(),
v8_inspector::V8Inspector::kFullyTrusted).release());
#endif
v8Context->SetAlignedPointerInEmbedderData(EMBEDDER_DATA_INDEX, this);
auto humanReadableNamePointer = ConvertFromStdStringToStringViewPointer(name);
v8Inspector->contextCreated(v8_inspector::V8ContextInfo(v8Context, CONTEXT_GROUP_ID, *humanReadableNamePointer.get()));
Expand Down
14 changes: 8 additions & 6 deletions cpp/jni/javet_jni_core_v8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

#include "javet_jni.h"

/*
* Development Guide:
* 1. Omitting namespace is not recommended in this project.
* 2. Methods are expected to be sorted alphabatically except JNI_OnLoad.
*/
/*
* Development Guide:
* 1. Omitting namespace is not recommended in this project.
* 2. Methods are expected to be sorted alphabatically except JNI_OnLoad.
*/

JNIEXPORT void JNICALL Java_com_caoccao_javet_interop_V8Native_allowCodeGenerationFromStrings
(JNIEnv* jniEnv, jobject caller, jlong v8RuntimeHandle, jboolean allow) {
Expand Down Expand Up @@ -333,7 +333,9 @@ JNIEXPORT void JNICALL Java_com_caoccao_javet_interop_V8Native_removeJNIGlobalRe
}

JNIEXPORT void JNICALL Java_com_caoccao_javet_interop_V8Native_removeReferenceHandle
(JNIEnv* jniEnv, jobject caller, jlong referenceHandle, jint referenceType) {
(JNIEnv* jniEnv, jobject caller, jlong v8RuntimeHandle, jlong referenceHandle, jint referenceType) {
auto v8Runtime = Javet::V8Runtime::FromHandle(v8RuntimeHandle);
auto v8Locker = v8Runtime->GetSharedV8Locker();
auto v8PersistentDataPointer = TO_V8_PERSISTENT_DATA_POINTER(referenceHandle);
v8PersistentDataPointer->Reset();
delete v8PersistentDataPointer;
Expand Down
Loading

0 comments on commit 5a1e80a

Please sign in to comment.