Skip to content

Commit

Permalink
😇 Javet v3.0.1 (#284)
Browse files Browse the repository at this point in the history
* Upgraded V8 to `v11.9.169.6` (2023-10-25)
* Upgraded Node.js to `v20.9.0` ([2023-10-24](https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V20.md#20.9.0))
* Upgraded to Ubuntu 22.04
* Upgraded GCC to v11 on Linux
* Turned on a few compiler options for performance
* Added `isSourceTextModule()`, `isSyntheticModule()` to `V8Module`
* Added `createV8Module()` to `V8Runtime`
* Added `freeze()` to `V8ValueBuiltInObject`
* Added `JavetBuiltInModuleResolver`
  • Loading branch information
caoccao authored Nov 7, 2023
1 parent 2b0745f commit ea4a679
Show file tree
Hide file tree
Showing 485 changed files with 3,710 additions and 1,731 deletions.
18 changes: 11 additions & 7 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: 20.8.0
JAVET_V8_VERSION: 11.8.172.15
JAVET_VERSION: 3.0.0
JAVET_NODE_VERSION: 20.9.0
JAVET_V8_VERSION: 11.9.169.6
JAVET_VERSION: 3.0.1
ROOT: /home/runner/work/Javet

jobs:
Expand All @@ -37,7 +37,7 @@ jobs:
uses: nttld/setup-ndk@v1
with:
ndk-version: r25b
local-cache: true
local-cache: false

- name: Setup Path
run: |
Expand All @@ -61,6 +61,7 @@ jobs:
gclient sync -D
cd v8
python3 tools/dev/v8gen.py arm.release -- 'target_os="android"' 'target_cpu="arm"' 'v8_target_cpu="arm"' v8_monolithic=true v8_use_external_startup_data=false is_component_build=false v8_enable_i18n_support=false v8_enable_pointer_compression=false v8_static_library=true symbol_level=0 use_custom_libcxx=false v8_enable_sandbox=false
ninja -C out.gn/arm.release v8_monolith || python3 ${{ env.ROOT }}/Javet/scripts/python/patch_v8_build.py -p ./
ninja -C out.gn/arm.release v8_monolith
- name: Setup JDK 11
Expand Down Expand Up @@ -108,7 +109,7 @@ jobs:
uses: nttld/setup-ndk@v1
with:
ndk-version: r25b
local-cache: true
local-cache: false

- name: Setup Path
run: |
Expand All @@ -132,6 +133,7 @@ jobs:
gclient sync -D
cd v8
python3 tools/dev/v8gen.py arm64.release -- 'target_os="android"' 'target_cpu="arm64"' 'v8_target_cpu="arm64"' v8_monolithic=true v8_use_external_startup_data=false is_component_build=false v8_enable_i18n_support=false v8_enable_pointer_compression=false v8_static_library=true symbol_level=0 use_custom_libcxx=false v8_enable_sandbox=false
ninja -C out.gn/arm64.release v8_monolith || python3 ${{ env.ROOT }}/Javet/scripts/python/patch_v8_build.py -p ./
ninja -C out.gn/arm64.release v8_monolith
- name: Setup JDK 11
Expand Down Expand Up @@ -179,7 +181,7 @@ jobs:
uses: nttld/setup-ndk@v1
with:
ndk-version: r25b
local-cache: true
local-cache: false

- name: Setup Path
run: |
Expand All @@ -203,6 +205,7 @@ jobs:
gclient sync -D
cd v8
python3 tools/dev/v8gen.py ia32.release -- 'target_os="android"' 'target_cpu="x86"' 'v8_target_cpu="x86"' v8_monolithic=true v8_use_external_startup_data=false is_component_build=false v8_enable_i18n_support=false v8_enable_pointer_compression=false v8_static_library=true symbol_level=0 use_custom_libcxx=false v8_enable_sandbox=false
ninja -C out.gn/ia32.release v8_monolith || python3 ${{ env.ROOT }}/Javet/scripts/python/patch_v8_build.py -p ./
ninja -C out.gn/ia32.release v8_monolith
- name: Setup JDK 11
Expand Down Expand Up @@ -250,7 +253,7 @@ jobs:
uses: nttld/setup-ndk@v1
with:
ndk-version: r25b
local-cache: true
local-cache: false

- name: Setup Path
run: |
Expand All @@ -274,6 +277,7 @@ jobs:
gclient sync -D
cd v8
python3 tools/dev/v8gen.py x64.release -- 'target_os="android"' 'target_cpu="x64"' 'v8_target_cpu="x64"' v8_monolithic=true v8_use_external_startup_data=false is_component_build=false v8_enable_i18n_support=false v8_enable_pointer_compression=false v8_static_library=true symbol_level=0 use_custom_libcxx=false v8_enable_sandbox=false
ninja -C out.gn/x64.release v8_monolith || python3 ${{ env.ROOT }}/Javet/scripts/python/patch_v8_build.py -p ./
ninja -C out.gn/x64.release v8_monolith
- name: Setup JDK 11
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: 20.8.0
JAVET_V8_VERSION: 11.8.172.15
JAVET_VERSION: 3.0.0
JAVET_NODE_VERSION: 20.9.0
JAVET_V8_VERSION: 11.9.169.6
JAVET_VERSION: 3.0.1

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: 20.8.0
JAVET_V8_VERSION: 11.8.172.15
JAVET_VERSION: 3.0.0
JAVET_NODE_VERSION: 20.9.0
JAVET_V8_VERSION: 11.9.169.6
JAVET_VERSION: 3.0.1

# 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
7 changes: 4 additions & 3 deletions .github/workflows/linux_x86_64_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: 20.8.0
JAVET_V8_VERSION: 11.8.172.15
JAVET_VERSION: 3.0.0
JAVET_NODE_VERSION: 20.9.0
JAVET_V8_VERSION: 11.9.169.6
JAVET_VERSION: 3.0.1
ROOT: /home/runner/work/Javet

jobs:
Expand Down Expand Up @@ -52,6 +52,7 @@ jobs:
gclient sync -D
cd v8
python3 tools/dev/v8gen.py x64.release -- v8_monolithic=true v8_use_external_startup_data=false is_component_build=false v8_enable_i18n_support=false v8_enable_pointer_compression=false v8_static_library=true symbol_level=0 use_custom_libcxx=false v8_enable_sandbox=false
ninja -C out.gn/x64.release v8_monolith || python3 ${{ env.ROOT }}/Javet/scripts/python/patch_v8_build.py -p ./
ninja -C out.gn/x64.release v8_monolith
- name: Setup JDK 8
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/macos_arm64_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: 20.8.0
JAVET_NODE_VERSION: 11.8.172.15
JAVET_V8_VERSION: 11.8.172.15
JAVET_VERSION: 3.0.0
JAVET_VERSION: 3.0.1
ROOT: /Users/runner/work/Javet

jobs:
Expand Down Expand Up @@ -53,6 +53,7 @@ jobs:
cd v8
python3 tools/dev/v8gen.py arm64.release -- v8_monolithic=true v8_use_external_startup_data=false is_component_build=false v8_enable_i18n_support=false v8_enable_pointer_compression=false v8_static_library=true symbol_level=0 use_custom_libcxx=false v8_enable_sandbox=false
gn gen out.gn/arm64.release
ninja -C out.gn/arm64.release v8_monolith || python3 ${{ env.ROOT }}/Javet/scripts/python/patch_v8_build.py -p ./
ninja -C out.gn/arm64.release v8_monolith
- name: Setup JDK 8
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/macos_x86_64_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: 20.8.0
JAVET_V8_VERSION: 11.8.172.15
JAVET_VERSION: 3.0.0
JAVET_NODE_VERSION: 20.9.0
JAVET_V8_VERSION: 11.9.169.6
JAVET_VERSION: 3.0.1
ROOT: /Users/runner/work/Javet

jobs:
Expand Down Expand Up @@ -53,6 +53,7 @@ jobs:
cd v8
python3 tools/dev/v8gen.py x64.release -- v8_monolithic=true v8_use_external_startup_data=false is_component_build=false v8_enable_i18n_support=false v8_enable_pointer_compression=false v8_static_library=true symbol_level=0 use_custom_libcxx=false v8_enable_sandbox=false
gn gen out.gn/x64.release
ninja -C out.gn/x64.release v8_monolith || python3 ${{ env.ROOT }}/Javet/scripts/python/patch_v8_build.py -p ./
ninja -C out.gn/x64.release v8_monolith
- name: Setup JDK 8
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,8 @@ _build
pom.xml.releaseBackup
release.properties
target

# ------------------------------------------------------------------------------
# JNI

cpp/build*
2 changes: 0 additions & 2 deletions .sdkmanrc

This file was deleted.

50 changes: 27 additions & 23 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ Javet

|Maven Central| |Discord| |Donate|

|Linux x86_64 Build| |MacOS arm64 Build| |MacOS x86_64 Build| |Android Build|
|Linux x86_64 Build| |MacOS x86_64 Build| |Android Build|

.. |Maven Central| image:: https://img.shields.io/maven-central/v/com.caoccao.javet/javet?style=for-the-badge
:target: https://search.maven.org/search?q=g:com.caoccao.javet
:target: https://central.sonatype.com/search?q=g:com.caoccao.javet

.. |Discord| image:: https://img.shields.io/discord/870518906115211305?label=join%20our%20Discord&style=for-the-badge
:target: https://discord.gg/R4vvKU96gw
Expand All @@ -17,9 +17,6 @@ Javet
.. |Linux x86_64 Build| image:: https://github.com/caoccao/Javet/actions/workflows/linux_x86_64_build.yml/badge.svg
:target: https://github.com/caoccao/Javet/actions/workflows/linux_x86_64_build.yml

.. |MacOS arm64 Build| image:: https://github.com/caoccao/Javet/actions/workflows/macos_arm64_build.yml/badge.svg
:target: https://github.com/caoccao/Javet/actions/workflows/macos_arm64_build.yml

.. |MacOS x86_64 Build| image:: https://github.com/caoccao/Javet/actions/workflows/macos_x86_64_build.yml/badge.svg
:target: https://github.com/caoccao/Javet/actions/workflows/macos_x86_64_build.yml

Expand All @@ -38,13 +35,13 @@ Major Features
=========== ======= ======= ======= =======
CPU Arch Android Linux MacOS Windows
=========== ======= ======= ======= =======
x86 ✔ ❌ ❌ ❌
x86_64 ✔ ✔ ✔ ✔
arm ✔ ❌ ❌ ❌
arm64 ✔ ✔ ✔ ❌
x86 ✔ ❌ ❌ ❌
x86_64 ✔
arm ✔ ❌ ❌ ❌
arm64 ✔
=========== ======= ======= ======= =======

* Node.js ``v20.8.0`` + V8 ``v11.8.172.15``
* Node.js ``v20.9.0`` + V8 ``v11.9.169.6``
* 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 @@ -53,6 +50,7 @@ arm64 ✔ ✔ ✔ ❌
* Javet engine pool
* Easy spring integration
* Live debug with Chrome DevTools
* AST Analysis with `JavetSanitizer <https://github.com/caoccao/JavetSanitizer>`_

Quick Start
===========
Expand All @@ -69,42 +67,42 @@ Maven
<dependency>
<groupId>com.caoccao.javet</groupId>
<artifactId>javet</artifactId>
<version>3.0.0</version>
<version>3.0.1</version>
</dependency>
<!-- Linux (arm64) -->
<dependency>
<groupId>com.caoccao.javet</groupId>
<artifactId>javet-linux-arm64</artifactId>
<version>3.0.0</version>
<version>3.0.1</version>
</dependency>
<!-- Mac OS (x86_64 and arm64) -->
<dependency>
<groupId>com.caoccao.javet</groupId>
<artifactId>javet-macos</artifactId>
<version>3.0.0</version>
<version>3.0.1</version>
</dependency>
Gradle Kotlin DSL
^^^^^^^^^^^^^^^^^

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

.. code-block:: groovy
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)
implementation 'com.caoccao.javet:javet:3.0.1' // Linux and Windows (x86_64)
implementation 'com.caoccao.javet:javet-linux-arm64:3.0.1' // Linux (arm64)
implementation 'com.caoccao.javet:javet-macos:3.0.1' // Mac OS (x86_64 and arm64)
implementation 'com.caoccao.javet:javet-android:3.0.1' // Android (arm, arm64, x86 and x86_64)
Hello Javet
-----------
Expand All @@ -129,12 +127,18 @@ Sponsors
License
=======

`APACHE LICENSE, VERSION 2.0 <LICENSE>`_.
`APACHE LICENSE, VERSION 2.0 <LICENSE>`_

Blog
====

* `Performance Comparison of GraalJS, Javet and Nashorn <https://medium.com/towardsdev/performance-comparison-of-graaljs-javet-and-nashorn-7bae6925826a>`_
* `How to Elegantly Expose JsonNode in V8 <https://medium.com/stackademic/how-to-elegantly-expose-jsonnode-in-v8-638aff9da549>`_
* `How to Compromise V8 on JVM <https://sjtucaocao.medium.com/how-to-compromise-v8-on-jvm-ceb385572461>`_

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 = "3.0.0"
version = "3.0.1"

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

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

dependencies {
testImplementation("org.eclipse.jetty.websocket:websocket-server:9.4.51.v20230217")
Expand Down
10 changes: 5 additions & 5 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(JAVET_LIB_ARCH x86_64)
set(JAVET_LIB_ARCH x86_64)
# Generate PDB file
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi /MP")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi /MP /O2 /Ob2 /GS-")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
add_definitions(-D_ITERATOR_DEBUG_LEVEL=0 -D_WIN32)
list(APPEND includeDirs $ENV{JAVA_HOME}/include/win32)
Expand Down Expand Up @@ -185,8 +185,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
add_library(Javet SHARED ${sourceFiles})
add_library(JavetStatic STATIC ${sourceFiles})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-invalid-offsetof ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-offsetof ")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-invalid-offsetof -O3 ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-offsetof -O3 ")
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "(arm64|x86_64|aarch64)")
set(JAVET_LIB_SYSTEM "linux")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated ")
Expand Down Expand Up @@ -231,8 +231,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android
set(JAVET_LIB_SYSTEM "android")
add_definitions(-D__ANDROID__)
list(APPEND includeDirs $ENV{JAVA_HOME}/include/linux)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-unknown-pragmas -Wno-unused-function -Wno-unused-variable -O3 -funroll-loops -ftree-vectorize -ffast-math -fpermissive -fPIC ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unknown-pragmas -Wno-unused-function -Wno-unused-variable -O3 -funroll-loops -ftree-vectorize -ffast-math -fpermissive -fPIC ")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-unknown-pragmas -Wno-unused-function -Wno-unused-variable -funroll-loops -ftree-vectorize -ffast-math -fpermissive -fPIC ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-unknown-pragmas -Wno-unused-function -Wno-unused-variable -funroll-loops -ftree-vectorize -ffast-math -fpermissive -fPIC ")
if(DEFINED V8_DIR)
foreach(importLibrary ${importLibraries})
set_target_properties(${importLibrary} PROPERTIES IMPORTED_LOCATION ${V8_RELEASE_DIR}/obj/lib${importLibrary}.a)
Expand Down
Loading

0 comments on commit ea4a679

Please sign in to comment.