Skip to content

Commit

Permalink
❤️‍🔥 Javet v1.1.0 (#144)
Browse files Browse the repository at this point in the history
* Upgraded Node.js to `v16.14.0` ([2022-02-08](https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V16.md#16.14.0))
* Upgraded V8 to `v9.8.177.11` ([2022-02-08](https://v8.dev/blog/v8-release-98))
* Upgraded Android NDK to r23b
* Updated Android ABI >= 23
* Added static libgcc and libstdc++ for Linux
* Supported legacy Linux distributions like CentOS 7, Ubuntu 16.04
  • Loading branch information
caoccao authored Feb 14, 2022
1 parent 4a0e0cc commit 17c1aee
Show file tree
Hide file tree
Showing 397 changed files with 1,385 additions and 994 deletions.
18 changes: 9 additions & 9 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.13.1`` + V8 ``v9.7.106.18``
* Node.js ``v16.14.0`` + V8 ``v9.8.177.11``
* 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,33 +58,33 @@ Maven
<dependency>
<groupId>com.caoccao.javet</groupId>
<artifactId>javet</artifactId>
<version>1.0.7</version>
<version>1.1.0</version>
</dependency>
<!-- Mac OS (x86_64 and arm64) -->
<dependency>
<groupId>com.caoccao.javet</groupId>
<artifactId>javet-macos</artifactId>
<version>1.0.7</version>
<version>1.1.0</version>
</dependency>
Gradle Kotlin DSL
^^^^^^^^^^^^^^^^^

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

.. code-block:: groovy
implementation 'com.caoccao.javet:javet:1.0.7' // Linux and Windows (x86_64)
implementation 'com.caoccao.javet:javet-macos:1.0.7' // Mac OS (x86_64 and arm64)
implementation 'com.caoccao.javet:javet-android:1.0.7' // Android (arm, arm64, x86 and x86_64)
implementation 'com.caoccao.javet:javet:1.1.0' // 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.0' // 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.7"
version = "1.1.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="1.0.7"
android:versionName="1.1.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>1.0.7</version>
<version>1.1.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>1.0.7</tag>
<tag>1.1.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 @@ -26,7 +26,7 @@ repositories {
}

group = "com.caoccao.javet"
version = "1.0.7"
version = "1.1.0"

dependencies {
testImplementation("org.eclipse.jetty.websocket:websocket-server:9.4.44.v20210927")
Expand Down
18 changes: 9 additions & 9 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Android")
else()
message(FATAL_ERROR "CMAKE_ANDROID_ARCH must be one of arm, arm64, x86, x86_64.")
endif()
# For now, the target ABI version is set to 26 because not all Java code is fully compatible with legacy SDK.
# In the future, more work will be done to lower the target ABI version.
set(CMAKE_SYSTEM_VERSION 21)
# The target ABI version is set to 23 because pre-23 is no longer supported by V8 v9.7+.
set(CMAKE_SYSTEM_VERSION 23)
set(CMAKE_ANDROID_STL_TYPE c++_static)
set(JAVA_RESOURCES_DIR ${CMAKE_SOURCE_DIR}/../android/javet-android/src/main/jniLibs/${CMAKE_ANDROID_ARCH_ABI})
else()
Expand Down Expand Up @@ -138,6 +137,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
list(APPEND includeDirs $ENV{JAVA_HOME}/include/win32)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
if(DEFINED V8_DIR)
add_definitions(-D_WIN32_WINNT)
foreach(importLibrary ${importLibraries})
set_target_properties(${importLibrary} PROPERTIES IMPORTED_LOCATION ${V8_RELEASE_DIR}/obj/${importLibrary}.lib)
endforeach(importLibrary)
Expand Down Expand Up @@ -177,9 +177,9 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android
set_target_properties(${importLibrary} PROPERTIES IMPORTED_LOCATION ${V8_RELEASE_DIR}/obj/lib${importLibrary}.a)
endforeach(importLibrary)
target_link_libraries(Javet PUBLIC -Wl,--whole-archive ${importLibraries} -Wl,--no-whole-archive
debug "-lrt" optimized "-lrt" "${libgcc}")
debug "-lrt" -static-libgcc -static-libstdc++ optimized "-lrt" "${libgcc}")
target_link_libraries(JavetStatic PUBLIC -Wl,--whole-archive ${importLibraries} -Wl,--no-whole-archive
debug "-lrt" optimized "-lrt" "${libgcc}")
debug "-lrt" -static-libgcc -static-libstdc++ optimized "-lrt" "${libgcc}")
endif()
if(DEFINED NODE_DIR)
list(APPEND includeDirs
Expand All @@ -191,9 +191,9 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android
endforeach(importLibrary)
list(REMOVE_ITEM importLibraries v8_init)
target_link_libraries(Javet PUBLIC -Wl,--whole-archive ${importLibraries} -Wl,--no-whole-archive
v8_init debug "-lrt" optimized "-lrt" "${libgcc}")
v8_init debug "-lrt" -static-libgcc -static-libstdc++ optimized "-lrt" "${libgcc}")
target_link_libraries(JavetStatic PUBLIC -Wl,--whole-archive ${importLibraries} -Wl,--no-whole-archive
v8_init debug "-lrt" optimized "-lrt" "${libgcc}")
v8_init debug "-lrt" -static-libgcc -static-libstdc++ optimized "-lrt" "${libgcc}")
endif()
# Exported symbol filter is disabled unless production issues call for it.
# https://www.gnu.org/software/gnulib/manual/html_node/LD-Version-Scripts.html
Expand All @@ -209,9 +209,9 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android
set_target_properties(${importLibrary} PROPERTIES IMPORTED_LOCATION ${V8_RELEASE_DIR}/obj/lib${importLibrary}.a)
endforeach(importLibrary)
target_link_libraries(Javet PUBLIC -Wl,--whole-archive ${importLibraries} -Wl,--no-whole-archive
-llog "${libgcc}")
-llog -static-libgcc -static-libstdc++ "${libgcc}")
target_link_libraries(JavetStatic PUBLIC -Wl,--whole-archive ${importLibraries} -Wl,--no-whole-archive
-llog "${libgcc}")
-llog -static-libgcc -static-libstdc++ "${libgcc}")
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "(arm64|x86_64)")
set(JAVET_LIB_SYSTEM "macos")
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.7
JAVET_VERSION=1.1.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=1.0.7
JAVET_VERSION=1.1.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=1.0.7
JAVET_VERSION=1.1.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=1.0.7
SET JAVET_VERSION=1.1.0
rd /s/q build
mkdir build
cd build
Expand Down
3 changes: 2 additions & 1 deletion cpp/jni/javet_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@
#pragma warning(default: 4275)
#pragma warning(default: 4251)

// These libraries are for UV on Windows
#ifdef _WIN32
#pragma comment(lib, "Crypt32.lib")
#pragma comment(lib, "Dbghelp.lib")
#pragma comment(lib, "Iphlpapi.lib")
#pragma comment(lib, "Psapi.lib")
#pragma comment(lib, "Userenv.lib")
#pragma comment(lib, "Winmm.lib")
#pragma comment(lib, "Ws2_32.lib")
#endif

#define DEFAULT_SCRIPT_NAME "javet.js"

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,7,0
PRODUCTVERSION 1,0,7,0
FILEVERSION 1,1,0,0
PRODUCTVERSION 1,1,0,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.7.0"
VALUE "InternalName", "libjavet-node-windows-x86_64.v.1.0.7.dll"
VALUE "FileVersion", "1.1.0.0"
VALUE "InternalName", "libjavet-node-windows-x86_64.v.1.1.0.dll"
VALUE "LegalCopyright", "Copyright (C) 2021"
VALUE "OriginalFilename", "libjavet-node-windows-x86_64.v.1.0.7.dll"
VALUE "OriginalFilename", "libjavet-node-windows-x86_64.v.1.1.0.dll"
VALUE "ProductName", "Javet Windows"
VALUE "ProductVersion", "1.0.7.0"
VALUE "ProductVersion", "1.1.0.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,7,0
PRODUCTVERSION 1,0,7,0
FILEVERSION 1,1,0,0
PRODUCTVERSION 1,1,0,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.7.0"
VALUE "InternalName", "libjavet-v8-windows-x86_64.v.1.0.7.dll"
VALUE "FileVersion", "1.1.0.0"
VALUE "InternalName", "libjavet-v8-windows-x86_64.v.1.1.0.dll"
VALUE "LegalCopyright", "Copyright (C) 2021"
VALUE "OriginalFilename", "libjavet-v8-windows-x86_64.v.1.0.7.dll"
VALUE "OriginalFilename", "libjavet-v8-windows-x86_64.v.1.1.0.dll"
VALUE "ProductName", "Javet Windows"
VALUE "ProductVersion", "1.0.7.0"
VALUE "ProductVersion", "1.1.0.0"
END
END
BLOCK "VarFileInfo"
Expand Down
3 changes: 2 additions & 1 deletion cpp/jni/javet_v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
#include <v8.h>
#include <v8-inspector.h>

// These libraries are for V8 on Windows
#ifdef _WIN32
#pragma comment(lib, "DbgHelp.lib")
#pragma comment(lib, "Iphlpapi.lib")
#pragma comment(lib, "Psapi.lib")
#pragma comment(lib, "Userenv.lib")
#pragma comment(lib, "Winmm.lib")
#pragma comment(lib, "Ws2_32.lib")
#endif

// Scope

Expand Down
19 changes: 14 additions & 5 deletions docker/android/base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

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

FROM ubuntu:20.04
WORKDIR /
Expand All @@ -27,6 +27,15 @@ RUN apt-get install --upgrade -qq -y --no-install-recommends python3 python pyth
RUN apt-get upgrade -y
RUN pip3 install coloredlogs

# Install CMake
RUN wget https://github.com/Kitware/CMake/releases/download/v3.21.4/cmake-3.21.4-linux-x86_64.sh
RUN chmod 755 cmake-3.21.4-linux-x86_64.sh
RUN mkdir -p /usr/lib/cmake
RUN ./cmake-3.21.4-linux-x86_64.sh --skip-license --exclude-subdir --prefix=/usr/lib/cmake
RUN ln -sf /usr/lib/cmake/bin/cmake /usr/bin/cmake
RUN ln -sf /usr/lib/cmake/bin/cmake /bin/cmake
RUN rm cmake-3.21.4-linux-x86_64.sh

# Prepare V8
RUN mkdir google
WORKDIR /google
Expand All @@ -37,7 +46,7 @@ ENV PATH=/google/depot_tools:$PATH
WORKDIR /google
RUN fetch v8
WORKDIR /google/v8
RUN git checkout 9.7.106.18
RUN git checkout 9.8.177.11
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 All @@ -48,9 +57,9 @@ RUN echo V8 preparation is completed.

# Prepare Android NDK
WORKDIR /
RUN wget https://dl.google.com/android/repository/android-ndk-r21e-linux-x86_64.zip
RUN unzip android-ndk-r21e-linux-x86_64.zip
RUN rm android-ndk-r21e-linux-x86_64.zip
RUN wget https://dl.google.com/android/repository/android-ndk-r23b-linux.zip
RUN unzip android-ndk-r23b-linux.zip
RUN rm android-ndk-r23b-linux.zip

# Prepare Android SDK
WORKDIR /google/v8/third_party/android_sdk/public/cmdline-tools/latest/bin
Expand Down
10 changes: 5 additions & 5 deletions 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.0.4
FROM sjtucaocao/javet-android:1.1.0.1
WORKDIR /

# Copy Javet
Expand All @@ -25,10 +25,10 @@ COPY . .

# Build JNI
WORKDIR /Javet/cpp
RUN sh ./build-android.sh -DV8_DIR=/google/v8 -DCMAKE_ANDROID_NDK=/android-ndk-r21e -DCMAKE_ANDROID_ARCH=arm
RUN sh ./build-android.sh -DV8_DIR=/google/v8 -DCMAKE_ANDROID_NDK=/android-ndk-r21e -DCMAKE_ANDROID_ARCH=arm64
RUN sh ./build-android.sh -DV8_DIR=/google/v8 -DCMAKE_ANDROID_NDK=/android-ndk-r21e -DCMAKE_ANDROID_ARCH=x86
RUN sh ./build-android.sh -DV8_DIR=/google/v8 -DCMAKE_ANDROID_NDK=/android-ndk-r21e -DCMAKE_ANDROID_ARCH=x86_64
RUN sh ./build-android.sh -DV8_DIR=/google/v8 -DCMAKE_ANDROID_NDK=/android-ndk-r23b -DCMAKE_ANDROID_ARCH=arm
RUN sh ./build-android.sh -DV8_DIR=/google/v8 -DCMAKE_ANDROID_NDK=/android-ndk-r23b -DCMAKE_ANDROID_ARCH=arm64
RUN sh ./build-android.sh -DV8_DIR=/google/v8 -DCMAKE_ANDROID_NDK=/android-ndk-r23b -DCMAKE_ANDROID_ARCH=x86
RUN sh ./build-android.sh -DV8_DIR=/google/v8 -DCMAKE_ANDROID_NDK=/android-ndk-r23b -DCMAKE_ANDROID_ARCH=x86_64

# Build AAR
WORKDIR /Javet/scripts/python
Expand Down
15 changes: 12 additions & 3 deletions docker/linux-x86_64/base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

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

FROM ubuntu:20.04
WORKDIR /
Expand All @@ -27,6 +27,15 @@ RUN apt-get install --upgrade -qq -y --no-install-recommends python3 python pyth
RUN apt-get upgrade -y
RUN pip3 install coloredlogs

# Install CMake
RUN wget https://github.com/Kitware/CMake/releases/download/v3.21.4/cmake-3.21.4-linux-x86_64.sh
RUN chmod 755 cmake-3.21.4-linux-x86_64.sh
RUN mkdir -p /usr/lib/cmake
RUN ./cmake-3.21.4-linux-x86_64.sh --skip-license --exclude-subdir --prefix=/usr/lib/cmake
RUN ln -sf /usr/lib/cmake/bin/cmake /usr/bin/cmake
RUN ln -sf /usr/lib/cmake/bin/cmake /bin/cmake
RUN rm cmake-3.21.4-linux-x86_64.sh

# Prepare V8
RUN mkdir google
WORKDIR /google
Expand All @@ -37,7 +46,7 @@ ENV PATH=/google/depot_tools:$PATH
WORKDIR /google
RUN fetch v8
WORKDIR /google/v8
RUN git checkout 9.7.106.18
RUN git checkout 9.8.177.11
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 All @@ -58,7 +67,7 @@ RUN echo V8 build is completed.
WORKDIR /
RUN git clone https://github.com/nodejs/node.git
WORKDIR /node
RUN git checkout v16.13.1
RUN git checkout v16.14.0
RUN echo Node.js preparation is completed.

# Build Node.js
Expand Down
Loading

0 comments on commit 17c1aee

Please sign in to comment.