Skip to content

Commit

Permalink
🥕 Javet v1.1.4 (#160)
Browse files Browse the repository at this point in the history
* Upgraded V8 to `v10.2.154.4` [(2022-05-06)](https://v8.dev/blog/v8-release-102)
* Applied C++ 17 to V8
* Added `isPurgeEventLoopBeforeClose()` and `setPurgeEventLoopBeforeClose()` to `NodeRuntime`
  • Loading branch information
caoccao authored May 21, 2022
1 parent 5345bd9 commit 0836a40
Show file tree
Hide file tree
Showing 403 changed files with 1,087 additions and 854 deletions.
12 changes: 6 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 ``v16.15.0`` + V8 ``v10.1.124.11``
* Node.js ``v16.15.0`` + V8 ``v10.2.154.4``
* 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>1.1.3</version>
<version>1.1.4</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:1.1.3") // Linux and Windows (x86_64)
implementation("com.caoccao.javet:javet:1.1.4") // Linux and Windows (x86_64)
implementation("com.caoccao.javet:javet-macos:1.1.0") // Mac OS (x86_64 and arm64)
implementation("com.caoccao.javet:javet-android:1.1.2") // Android (arm, arm64, x86 and x86_64)
implementation("com.caoccao.javet:javet-android:1.1.4") // Android (arm, arm64, x86 and x86_64)
Gradle Groovy DSL
^^^^^^^^^^^^^^^^^

.. code-block:: groovy
implementation 'com.caoccao.javet:javet:1.1.3' // Linux and Windows (x86_64)
implementation 'com.caoccao.javet:javet:1.1.4' // Linux and Windows (x86_64)
implementation 'com.caoccao.javet:javet-macos:1.1.0' // Mac OS (x86_64 and arm64)
implementation 'com.caoccao.javet:javet-android:1.1.2' // Android (arm, arm64, x86 and x86_64)
implementation 'com.caoccao.javet:javet-android:1.1.4' // Android (arm, arm64, x86 and x86_64)
Hello Javet
-----------
Expand Down
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 = "1.1.3"
version = "1.1.4"

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="1.1.3"
android:versionName="1.1.4"
>

</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>1.1.3</version>
<version>1.1.4</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>1.1.3</tag>
<tag>1.1.4</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 = "1.1.3"
version = "1.1.4"

dependencies {
testImplementation("org.eclipse.jetty.websocket:websocket-server:9.4.44.v20210927")
Expand Down
6 changes: 5 additions & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ set(importLibraries)
set(JAVET_LIB_PREFIX)
set(JAVET_LIB_TYPE)
set(JAVET_LIB_SYSTEM)
set(CMAKE_CXX_STANDARD 14)
if(DEFINED V8_DIR)
set(CMAKE_CXX_STANDARD 17)
else()
set(CMAKE_CXX_STANDARD 14)
endif()
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "limited configs" FORCE)
if(DEFINED ENABLE_LOGGING)
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=1.1.3
JAVET_VERSION=1.1.4
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=1.1.3
JAVET_VERSION=1.1.4
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=1.1.3
JAVET_VERSION=1.1.4
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=1.1.3
SET JAVET_VERSION=1.1.4
rd /s/q build
mkdir build
cd build
Expand Down
18 changes: 18 additions & 0 deletions cpp/jni/com_caoccao_javet_interop_NodeNative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,21 @@ JNIEXPORT void JNICALL Java_com_caoccao_javet_interop_NodeNative_await
v8Runtime->Await();
}

JNIEXPORT jboolean JNICALL Java_com_caoccao_javet_interop_NodeNative_isPurgeEventLoopBeforeClose
(JNIEnv* jniEnv, jobject caller, jlong v8RuntimeHandle) {
#ifdef ENABLE_NODE
auto v8Runtime = Javet::V8Runtime::FromHandle(v8RuntimeHandle);
return v8Runtime->purgeEventLoopBeforeClose;
#else
return false;
#endif
}

JNIEXPORT void JNICALL Java_com_caoccao_javet_interop_NodeNative_setPurgeEventLoopBeforeClose
(JNIEnv* jniEnv, jobject caller, jlong v8RuntimeHandle, jboolean purgeEventLoopBeforeClose) {
#ifdef ENABLE_NODE
auto v8Runtime = Javet::V8Runtime::FromHandle(v8RuntimeHandle);
v8Runtime->purgeEventLoopBeforeClose = purgeEventLoopBeforeClose;
#endif
}

16 changes: 16 additions & 0 deletions cpp/jni/com_caoccao_javet_interop_NodeNative.h

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

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 1,1,3,0
PRODUCTVERSION 1,1,3,0
FILEVERSION 1,1,4,0
PRODUCTVERSION 1,1,4,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", "1.1.3.0"
VALUE "InternalName", "libjavet-node-windows-x86_64.v.1.1.3.dll"
VALUE "FileVersion", "1.1.4.0"
VALUE "InternalName", "libjavet-node-windows-x86_64.v.1.1.4.dll"
VALUE "LegalCopyright", "Copyright (C) 2021"
VALUE "OriginalFilename", "libjavet-node-windows-x86_64.v.1.1.3.dll"
VALUE "OriginalFilename", "libjavet-node-windows-x86_64.v.1.1.4.dll"
VALUE "ProductName", "Javet Windows"
VALUE "ProductVersion", "1.1.3.0"
VALUE "ProductVersion", "1.1.4.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 1,1,3,0
PRODUCTVERSION 1,1,3,0
FILEVERSION 1,1,4,0
PRODUCTVERSION 1,1,4,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", "1.1.3.0"
VALUE "InternalName", "libjavet-v8-windows-x86_64.v.1.1.3.dll"
VALUE "FileVersion", "1.1.4.0"
VALUE "InternalName", "libjavet-v8-windows-x86_64.v.1.1.4.dll"
VALUE "LegalCopyright", "Copyright (C) 2021"
VALUE "OriginalFilename", "libjavet-v8-windows-x86_64.v.1.1.3.dll"
VALUE "OriginalFilename", "libjavet-v8-windows-x86_64.v.1.1.4.dll"
VALUE "ProductName", "Javet Windows"
VALUE "ProductVersion", "1.1.3.0"
VALUE "ProductVersion", "1.1.4.0"
END
END
BLOCK "VarFileInfo"
Expand Down
1 change: 1 addition & 0 deletions cpp/jni/javet_v8_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* otherwise compilation errors will take place.
*/

#pragma warning(disable: 4146)
#pragma warning(disable: 4244)
#pragma warning(disable: 4267)
#pragma warning(disable: 4291)
Expand Down
3 changes: 2 additions & 1 deletion cpp/jni/javet_v8_runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ namespace Javet {
#ifdef ENABLE_NODE
V8Runtime::V8Runtime(node::MultiIsolatePlatform* v8PlatformPointer, std::shared_ptr<node::ArrayBufferAllocator> nodeArrayBufferAllocator)
: nodeEnvironment(nullptr, node::FreeEnvironment), nodeIsolateData(nullptr, node::FreeIsolateData), v8Locker(nullptr), uvLoop() {
purgeEventLoopBeforeClose = false;
this->nodeArrayBufferAllocator = nodeArrayBufferAllocator;
#else
V8Runtime::V8Runtime(V8Platform * v8PlatformPointer)
Expand Down Expand Up @@ -101,7 +102,7 @@ namespace Javet {
Unregister(v8LocalContext);
v8GlobalObject.Reset();
#ifdef ENABLE_NODE
{
if (!purgeEventLoopBeforeClose) {
auto v8ContextScope = GetV8ContextScope(v8LocalContext);
v8::SealHandleScope v8SealHandleScope(v8Isolate);
bool hasMoreTasks;
Expand Down
1 change: 1 addition & 0 deletions cpp/jni/javet_v8_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace Javet {
public:
#ifdef ENABLE_NODE
node::MultiIsolatePlatform* v8PlatformPointer;
bool purgeEventLoopBeforeClose;
#else
V8Platform* v8PlatformPointer;
#endif
Expand Down
6 changes: 3 additions & 3 deletions docker/android/base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Usage: docker build -t sjtucaocao/javet-android:1.1.0.1 -f docker/android/base.Dockerfile .
# Usage: docker build -t sjtucaocao/javet-android:1.1.4 -f docker/android/base.Dockerfile .

FROM ubuntu:20.04
WORKDIR /

# Update Ubuntu
ENV DEBIAN_FRONTEND=noninteractive
RUN echo Cache V3
RUN echo Cache V7
RUN apt-get update
RUN apt-get install --upgrade -qq -y --no-install-recommends git curl wget build-essential software-properties-common patchelf maven sudo zip unzip execstack cmake
RUN apt-get install --upgrade -qq -y --no-install-recommends python3 python python3-pip python3-distutils python3-testresources
Expand All @@ -46,7 +46,7 @@ ENV PATH=/google/depot_tools:$PATH
WORKDIR /google
RUN fetch v8
WORKDIR /google/v8
RUN git checkout 9.8.177.11
RUN git checkout 10.2.154.4
RUN sed -i 's/snapcraft/nosnapcraft/g' ./build/install-build-deps.sh
RUN ./build/install-build-deps.sh
RUN sed -i 's/nosnapcraft/snapcraft/g' ./build/install-build-deps.sh
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:1.1.0.1
FROM sjtucaocao/javet-android:1.1.4
WORKDIR /

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

# Usage: docker build -t sjtucaocao/javet:1.1.3 -f docker/linux-x86_64/base.Dockerfile .
# Usage: docker build -t sjtucaocao/javet:1.1.4 -f docker/linux-x86_64/base.Dockerfile .

FROM ubuntu:20.04
WORKDIR /

# Update Ubuntu
ENV DEBIAN_FRONTEND=noninteractive
RUN echo Cache V6
RUN echo Cache V7
RUN apt-get update
RUN apt-get install --upgrade -qq -y --no-install-recommends git curl wget build-essential software-properties-common patchelf maven sudo zip unzip execstack cmake
RUN apt-get install --upgrade -qq -y --no-install-recommends python3 python python3-pip python3-distutils python3-testresources
Expand All @@ -46,7 +46,7 @@ ENV PATH=/google/depot_tools:$PATH
WORKDIR /google
RUN fetch v8
WORKDIR /google/v8
RUN git checkout 10.1.124.11
RUN git checkout 10.2.154.4
RUN sed -i 's/snapcraft/nosnapcraft/g' ./build/install-build-deps.sh
RUN ./build/install-build-deps.sh
RUN sed -i 's/nosnapcraft/snapcraft/g' ./build/install-build-deps.sh
Expand Down
2 changes: 1 addition & 1 deletion docker/linux-x86_64/build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

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

FROM sjtucaocao/javet:1.1.3
FROM sjtucaocao/javet:1.1.4
WORKDIR /

# Copy Javet
Expand Down
4 changes: 2 additions & 2 deletions docker/windows-x86_64/base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# 2. Restart WSL2
# 3. Restart docker

# Usage: docker build -t sjtucaocao/javet-windows:1.1.3 -m 4G -f docker/windows-x86_64/base.Dockerfile .
# Usage: docker build -t sjtucaocao/javet-windows:1.1.4 -m 4G -f docker/windows-x86_64/base.Dockerfile .

# https://hub.docker.com/_/microsoft-windows
FROM mcr.microsoft.com/windows:20H2-amd64
Expand Down Expand Up @@ -60,7 +60,7 @@ ENV DEPOT_TOOLS_WIN_TOOLCHAIN=0
WORKDIR /google
RUN fetch v8
WORKDIR /google/v8
RUN git checkout 10.1.124.11
RUN git checkout 10.2.154.4
WORKDIR /google
RUN gclient sync
RUN echo V8 preparation is completed.
Expand Down
2 changes: 1 addition & 1 deletion docker/windows-x86_64/build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

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

FROM sjtucaocao/javet-windows:1.1.3
FROM sjtucaocao/javet-windows:1.1.4

SHELL ["cmd", "/S", "/C"]
WORKDIR /
Expand Down
2 changes: 1 addition & 1 deletion docs/_static/documentation_options.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '1.1.3',
VERSION: '1.1.4',
LANGUAGE: 'en, zh-CN',
COLLAPSE_INDEX: false,
BUILDER: 'html',
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author = 'Sam Cao'

# The full version, including alpha/beta/rc tags
release = '1.1.3'
release = '1.1.4'


# -- General configuration ---------------------------------------------------
Expand Down
Loading

0 comments on commit 0836a40

Please sign in to comment.