Skip to content

Commit

Permalink
💻 Javet v1.0.6 (#125)
Browse files Browse the repository at this point in the history
* Supported Mac OS (arm64)
* Adjusted the priority of getter detection in `JavetProxyConverter`
* Fixed a bug in custom lib loading
* Added capacity to some V8 runtime observers for performance improvement
* Added `V8RuntimeObserverAverageCallbackContextCount`, `V8RuntimeObserverAverageReferenceCount` and `V8RuntimeObserverAverageV8ModuleCount`
* Refactored the doc for object converters
* Added `@V8Convert`, `@V8Property`, `@V8Function`, `@V8Getter`, `@V8Setter`, `@V8Allow` and `@V8Block` to `JavetProxyConverter`
* Added `isSuppressingError()` to `IJavetLibLoadingListener`
* Added `getV8SharedMemoryStatistics()` to `V8Host`
  • Loading branch information
caoccao authored Dec 8, 2021
1 parent 6192b67 commit 4d57f90
Show file tree
Hide file tree
Showing 434 changed files with 10,780 additions and 3,511 deletions.
2 changes: 2 additions & 0 deletions .sdkmanrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gradle=7.2
java=8.0.312-zulu
24 changes: 12 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ If you like my work, please **Star** this project. And, you may follow me `@sjtu

💖 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.

💖 If you use Mac OS (arm64), unfortunately there is no Mac OS (arm64) build because I don't have any Mac OS (arm64) device. Please `donate <https://opencollective.com/javet>`_ to support me purchasing a new Mac OS (arm64) device.
💖 If you use Mac OS (arm64), please thank `@longwa <https://github.com/longwa>`_ for building the M1 version. However, that's a temporary solution because I don't have any Mac OS (arm64) device, so there is no support. Please `donate <https://opencollective.com/javet>`_ to support me purchasing a new Mac OS (arm64) device.

Major Features
==============

* Linux + Mac OS + ️Windows (x86_64)
* Linux (x86_64) + Mac OS (x86_64, arm64) + ️Windows (x86_64)
* Android (arm, arm64, x86 and x86_64)
* Node.js ``v16.13.0`` + V8 ``v9.6.180.8``
* Dynamic switch between Node.js and V8 mode (`Which mode do you prefer? <https://github.com/caoccao/Javet/discussions/92>`_)
Expand All @@ -54,37 +54,37 @@ Maven

.. code-block:: xml
<!-- Linux or Windows -->
<!-- Linux and Windows (x86_64) -->
<dependency>
<groupId>com.caoccao.javet</groupId>
<artifactId>javet</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</dependency>
<!-- Mac OS (x86_64 Only) -->
<!-- Mac OS (x86_64 and arm64) -->
<dependency>
<groupId>com.caoccao.javet</groupId>
<artifactId>javet-macos</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
</dependency>
Gradle Kotlin DSL
^^^^^^^^^^^^^^^^^

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

.. code-block:: groovy
implementation 'com.caoccao.javet:javet:1.0.5' // Linux or Windows
implementation 'com.caoccao.javet:javet-macos:1.0.5' // Mac OS (x86_64 Only)
implementation 'com.caoccao.javet:javet-android:1.0.5' // Android (arm, arm64, x86 and x86_64)
implementation 'com.caoccao.javet:javet:1.0.6' // Linux and Windows (x86_64)
implementation 'com.caoccao.javet:javet-macos:1.0.6' // Mac OS (x86_64 and arm64)
implementation 'com.caoccao.javet:javet-android:1.0.6' // 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.0.5"
version = "1.0.6"

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.0.5"
android:versionName="1.0.6"
>

</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.0.5</version>
<version>1.0.6</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.0.5</tag>
<tag>1.0.6</tag>
</scm>

<properties>
Expand Down
12 changes: 11 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
plugins {
java
`java-library`
`maven-publish`
}

repositories {
mavenCentral()
}

group = "com.caoccao.javet"
version = "1.0.5"
version = "1.0.6"

dependencies {
testImplementation("org.eclipse.jetty.websocket:websocket-server:9.4.38.v20210224")
Expand Down Expand Up @@ -83,3 +84,12 @@ tasks.withType<Test> {
tasks.withType<Javadoc>{
options.encoding = "UTF-8"
}

// Allow for publishing to maven local
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
}
19 changes: 14 additions & 5 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ if(DEFINED V8_DIR)
set(V8_RELEASE_DIR ${V8_DIR}/out.gn/x64.release)
endif()
else()
set(V8_RELEASE_DIR ${V8_DIR}/out.gn/x64.release)
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64")
set(V8_RELEASE_DIR ${V8_DIR}/out.gn/arm64.release)
else()
set(V8_RELEASE_DIR ${V8_DIR}/out.gn/x64.release)
endif()
endif()
list(APPEND includeDirs
${V8_DIR}
Expand Down Expand Up @@ -212,9 +216,14 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android
target_link_libraries(JavetStatic PUBLIC -Wl,--whole-archive ${importLibraries} -Wl,--no-whole-archive
-llog "${libgcc}")
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "(arm64|x86_64)")
set(JAVET_LIB_SYSTEM "macos")
add_definitions(-D__x86_64__)
if (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "arm64")
set(JAVET_LIB_ARCH arm64)
add_definitions(-D__arm64__)
else()
add_definitions(-D__x86_64__)
endif()
add_definitions(-D__APPLE__)
list(APPEND includeDirs $ENV{JAVA_HOME}/include/darwin)
if(DEFINED V8_DIR)
Expand Down Expand Up @@ -243,11 +252,11 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android
# https://caoccao.blogspot.com/2021/08/jni-symbol-conflicts-in-mac-os.html
target_link_libraries(Javet PUBLIC -exported_symbols_list ${CMAKE_SOURCE_DIR}/jni/exported_symbols_list.txt)
else()
message(FATAL_ERROR "Mac OS arm64 is not supported. Please donate to support the maintainer who will be able to purchase an arm64 device.")
message(FATAL_ERROR "Linux or Windows (arm64) have not been supported yet.")
endif()
set_target_properties(JavetStatic PROPERTIES OUTPUT_NAME "${JAVET_LIB_PREFIX}-${JAVET_LIB_TYPE}-${JAVET_LIB_SYSTEM}-${JAVET_LIB_ARCH}.v.${JAVET_VERSION}")
else()
message(FATAL_ERROR "Linux (x86-64), Mac OS (x86-64), Windows (x86-64) and Android are the only supported Operating Systems.")
message(FATAL_ERROR "Linux (x86-64), Mac OS (x86-64, arm64), Windows (x86-64) and Android are the only supported Operating Systems.")
endif()

set_target_properties(Javet PROPERTIES OUTPUT_NAME "${JAVET_LIB_PREFIX}-${JAVET_LIB_TYPE}-${JAVET_LIB_SYSTEM}-${JAVET_LIB_ARCH}.v.${JAVET_VERSION}")
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.0.5
JAVET_VERSION=1.0.6
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.0.5
JAVET_VERSION=1.0.6
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.0.5
JAVET_VERSION=1.0.6
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.0.5
SET JAVET_VERSION=1.0.6
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 1,0,5,0
PRODUCTVERSION 1,0,5,0
FILEVERSION 1,0,6,0
PRODUCTVERSION 1,0,6,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.0.5.0"
VALUE "InternalName", "libjavet-node-windows-x86_64.v.1.0.5.dll"
VALUE "FileVersion", "1.0.6.0"
VALUE "InternalName", "libjavet-node-windows-x86_64.v.1.0.6.dll"
VALUE "LegalCopyright", "Copyright (C) 2021"
VALUE "OriginalFilename", "libjavet-node-windows-x86_64.v.1.0.5.dll"
VALUE "OriginalFilename", "libjavet-node-windows-x86_64.v.1.0.6.dll"
VALUE "ProductName", "Javet Windows"
VALUE "ProductVersion", "1.0.5.0"
VALUE "ProductVersion", "1.0.6.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,0,5,0
PRODUCTVERSION 1,0,5,0
FILEVERSION 1,0,6,0
PRODUCTVERSION 1,0,6,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.0.5.0"
VALUE "InternalName", "libjavet-v8-windows-x86_64.v.1.0.5.dll"
VALUE "FileVersion", "1.0.6.0"
VALUE "InternalName", "libjavet-v8-windows-x86_64.v.1.0.6.dll"
VALUE "LegalCopyright", "Copyright (C) 2021"
VALUE "OriginalFilename", "libjavet-v8-windows-x86_64.v.1.0.5.dll"
VALUE "OriginalFilename", "libjavet-v8-windows-x86_64.v.1.0.6.dll"
VALUE "ProductName", "Javet Windows"
VALUE "ProductVersion", "1.0.5.0"
VALUE "ProductVersion", "1.0.6.0"
END
END
BLOCK "VarFileInfo"
Expand Down
2 changes: 1 addition & 1 deletion docker/android/build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ RUN sh ./build-android.sh -DV8_DIR=/google/v8 -DCMAKE_ANDROID_NDK=/android-ndk-r
WORKDIR /Javet/scripts/python
RUN python3 patch_android_build.py
WORKDIR /Javet/android
RUN gradle build
RUN gradle build --debug

VOLUME /output

Expand Down
4 changes: 2 additions & 2 deletions docker/linux-x86_64/build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ RUN sh ./build-linux.sh -DNODE_DIR=/node
# Build Jar
WORKDIR /Javet
RUN touch src/main/resources/libjavet-v8*
RUN gradle build test --rerun-tasks
RUN gradle build test --rerun-tasks --debug
RUN touch src/main/resources/libjavet-node*
RUN gradle test --rerun-tasks
RUN gradle test --rerun-tasks --debug

VOLUME /output

Expand Down
4 changes: 2 additions & 2 deletions docker/windows-x86_64/build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ RUN build-windows.cmd -DNODE_DIR="C:\node"
# Build Jar
WORKDIR /Javet
RUN touch src/main/resources/libjavet-v8*
RUN gradlew build test --rerun-tasks
RUN gradlew build test --rerun-tasks --debug
RUN touch src/main/resources/libjavet-node*
RUN gradlew test --rerun-tasks
RUN gradlew test --rerun-tasks --debug

VOLUME C:\\output

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.0.5',
VERSION: '1.0.6',
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.0.5'
release = '1.0.6'


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

0 comments on commit 4d57f90

Please sign in to comment.