Skip to content

Commit

Permalink
Javet v1.0.1 (#106)
Browse files Browse the repository at this point in the history
* Upgraded Node.js to `v16.11.1` [(2021-10-12)](https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V16.md#16.11.1)
* Upgraded V8 to `v9.4.146.19` [(2021-10-01)](https://v8.dev/blog/v8-release-94)
* Upgraded callback function and proxy converter to implicitly cast more primitive types
* Added `IJavetLibLoadingListener` and `JavetLibLoadingListener` to allow custom lib loading
* Fixed a potential memory leak introduced mistakenly in `v1.0.0`
  • Loading branch information
caoccao authored Oct 15, 2021
1 parent 35585f8 commit 4aded4a
Show file tree
Hide file tree
Showing 377 changed files with 4,711 additions and 1,726 deletions.
14 changes: 7 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Major Features
==============

* Linux + Mac OS + ️Windows (x86_64)
* Node.js ``v16.10.0`` + V8 ``v9.4.146.16`` (`Which Node.js version do you prefer? <https://github.com/caoccao/Javet/issues/89>`_)
* Node.js ``v16.11.1`` + V8 ``v9.4.146.19``
* 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 @@ -52,31 +52,31 @@ Maven
<dependency>
<groupId>com.caoccao.javet</groupId>
<artifactId>javet</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</dependency>
<!-- Mac OS (x86_64 Only) -->
<dependency>
<groupId>com.caoccao.javet</groupId>
<artifactId>javet-macos</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</dependency>
Gradle Kotlin DSL
^^^^^^^^^^^^^^^^^

.. code-block:: kotlin
implementation("com.caoccao.javet:javet:1.0.0") // Linux or Windows
implementation("com.caoccao.javet:javet-macos:1.0.0") // Mac OS (x86_64 Only)
implementation("com.caoccao.javet:javet:1.0.1") // Linux or Windows
implementation("com.caoccao.javet:javet-macos:1.0.1") // Mac OS (x86_64 Only)
Gradle Groovy DSL
^^^^^^^^^^^^^^^^^

.. code-block:: groovy
implementation 'com.caoccao.javet:javet:1.0.0' // Linux or Windows
implementation 'com.caoccao.javet:javet-macos:1.0.0' // Mac OS (x86_64 Only)
implementation 'com.caoccao.javet:javet:1.0.1' // Linux or Windows
implementation 'com.caoccao.javet:javet-macos:1.0.1' // Mac OS (x86_64 Only)
Hello Javet
-----------
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.0.0"
version = "1.0.1"

repositories {
mavenCentral()
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.0
JAVET_VERSION=1.0.1
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.0
JAVET_VERSION=1.0.1
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.0
SET JAVET_VERSION=1.0.1
rd /s/q build
mkdir build
cd build
Expand Down
6 changes: 3 additions & 3 deletions cpp/jni/com_caoccao_javet_interop_V8Native.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1272,9 +1272,9 @@ JNIEXPORT jboolean JNICALL Java_com_caoccao_javet_interop_V8Native_setAccessor
JNIEXPORT void JNICALL Java_com_caoccao_javet_interop_V8Native_setFlags
(JNIEnv* jniEnv, jobject caller, jstring flags) {
if (flags) {
char const* str = jniEnv->GetStringUTFChars(flags, nullptr);
v8::V8::SetFlagsFromString(str, jniEnv->GetStringUTFLength(flags));
jniEnv->ReleaseStringUTFChars(flags, str);
char const* utfChars = jniEnv->GetStringUTFChars(flags, nullptr);
v8::V8::SetFlagsFromString(utfChars, jniEnv->GetStringUTFLength(flags));
jniEnv->ReleaseStringUTFChars(flags, utfChars);
v8::V8::Initialize();
}
}
Expand Down
6 changes: 2 additions & 4 deletions cpp/jni/javet_converter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,17 +399,15 @@ namespace Javet {
if (managedString == nullptr) {
return V8LocalString();
}
const uint16_t* unmanagedString = jniEnv->GetStringChars(managedString, &Javet::Config::COPY_CHAR);
const uint16_t* unmanagedString = jniEnv->GetStringChars(managedString, nullptr);
int length = jniEnv->GetStringLength(managedString);
auto twoByteString = v8::String::NewFromTwoByte(
v8Context->GetIsolate(), unmanagedString, v8::NewStringType::kNormal, length);
jniEnv->ReleaseStringChars(managedString, unmanagedString);
if (twoByteString.IsEmpty()) {
return V8LocalString();
}
auto localV8String = twoByteString.ToLocalChecked();
if (Javet::Config::COPY_CHAR) {
jniEnv->ReleaseStringChars(managedString, unmanagedString);
}
return localV8String;
}

Expand Down
3 changes: 1 addition & 2 deletions cpp/jni/javet_converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ namespace Javet {
}

static inline std::unique_ptr<std::string> ToStdString(JNIEnv* jniEnv, jstring mString) {
jboolean isCopy(false);
const char* utfChars = jniEnv->GetStringUTFChars(mString, &isCopy);
const char* utfChars = jniEnv->GetStringUTFChars(mString, nullptr);
auto stdStringPointer = std::make_unique<std::string>(utfChars, jniEnv->GetStringUTFLength(mString));
jniEnv->ReleaseStringUTFChars(mString, utfChars);
return stdStringPointer;
Expand Down
5 changes: 0 additions & 5 deletions cpp/jni/javet_native.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,6 @@ extern JavaVM* GlobalJavaVM;

namespace Javet {

namespace Config {
// Do not copy chars from JVM for performance.
static jboolean COPY_CHAR = false;
}

#ifdef ENABLE_NODE
namespace NodeNative {
void Dispose(JNIEnv* jniEnv);
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,0,0
PRODUCTVERSION 1,0,0,0
FILEVERSION 1,0,1,0
PRODUCTVERSION 1,0,1,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.0.0"
VALUE "InternalName", "libjavet-node-windows-x86_64.v.1.0.0.dll"
VALUE "FileVersion", "1.0.1.0"
VALUE "InternalName", "libjavet-node-windows-x86_64.v.1.0.1.dll"
VALUE "LegalCopyright", "Copyright (C) 2021"
VALUE "OriginalFilename", "libjavet-node-windows-x86_64.v.1.0.0.dll"
VALUE "OriginalFilename", "libjavet-node-windows-x86_64.v.1.0.1.dll"
VALUE "ProductName", "Javet Windows"
VALUE "ProductVersion", "1.0.0.0"
VALUE "ProductVersion", "1.0.1.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,0,0
PRODUCTVERSION 1,0,0,0
FILEVERSION 1,0,1,0
PRODUCTVERSION 1,0,1,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.0.0"
VALUE "InternalName", "libjavet-v8-windows-x86_64.v.1.0.0.dll"
VALUE "FileVersion", "1.0.1.0"
VALUE "InternalName", "libjavet-v8-windows-x86_64.v.1.0.1.dll"
VALUE "LegalCopyright", "Copyright (C) 2021"
VALUE "OriginalFilename", "libjavet-v8-windows-x86_64.v.1.0.0.dll"
VALUE "OriginalFilename", "libjavet-v8-windows-x86_64.v.1.0.1.dll"
VALUE "ProductName", "Javet Windows"
VALUE "ProductVersion", "1.0.0.0"
VALUE "ProductVersion", "1.0.1.0"
END
END
BLOCK "VarFileInfo"
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,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.0 -f docker/linux-x86_64/base.Dockerfile .
# Usage: docker build -t sjtucaocao/javet:1.0.2 -f docker/linux-x86_64/base.Dockerfile .

FROM ubuntu:20.04
WORKDIR /
Expand All @@ -36,7 +36,7 @@ ENV PATH=/google/depot_tools:$PATH
WORKDIR /google
RUN fetch v8
WORKDIR /google/v8
RUN git checkout 9.4.146.16
RUN git checkout 9.4.146.19
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 @@ -54,7 +54,7 @@ RUN echo V8 build is completed.
WORKDIR /
RUN git clone https://github.com/nodejs/node.git
WORKDIR /node
RUN git checkout v16.10.0
RUN git checkout v16.11.1
RUN echo Node.js preparation is completed.

# Build Node.js
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.0.0
FROM sjtucaocao/javet:1.0.2
WORKDIR /

# Copy Javet
Expand Down
6 changes: 3 additions & 3 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.0.0 -m 4G -f docker/windows-x86_64/base.Dockerfile .
# Usage: docker build -t sjtucaocao/javet-windows:1.0.2 -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 9.4.146.16
RUN git checkout 9.4.146.19
WORKDIR /google
RUN gclient sync
RUN echo V8 preparation is completed.
Expand Down Expand Up @@ -103,7 +103,7 @@ RUN powershell -ExecutionPolicy Bypass -c "iex(New-Object Net.WebClient).Downloa
RUN choco install -y nasm
RUN git clone https://github.com/nodejs/node.git
WORKDIR /node
RUN git checkout v16.10.0
RUN git checkout v16.11.1
RUN echo Node.js preparation is completed.

# Build Node.js
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.0.0
FROM sjtucaocao/javet-windows:1.0.2

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.0.0',
VERSION: '1.0.1',
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.0'
release = '1.0.1'


# -- General configuration ---------------------------------------------------
Expand Down
14 changes: 7 additions & 7 deletions docs/development/build.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="color-scheme" content="light dark"><link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="Build Javet with Docker" href="build_javet_with_docker.html" /><link rel="prev" title="Development Tools" href="tools.html" />

<link rel="shortcut icon" href="../_static/logo.ico"/><meta name="generator" content="sphinx-4.2.0, furo 2021.09.08"/>
<title>Build Javet - Javet 1.0.0 documentation</title>
<title>Build Javet - Javet 1.0.1 documentation</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../_static/styles/furo.css?digest=c7c65a82b42f6b978e58466c1e9ef2509836d916" />
<link rel="stylesheet" type="text/css" href="../_static/tabs.css" />
Expand Down Expand Up @@ -124,7 +124,7 @@
</label>
</div>
<div class="header-center">
<a href="../index.html"><div class="brand">Javet 1.0.0 documentation</div></a>
<a href="../index.html"><div class="brand">Javet 1.0.1 documentation</div></a>
</div>
<div class="header-right">
<div class="theme-toggle-container theme-toggle-header">
Expand All @@ -150,7 +150,7 @@
<img class="sidebar-logo" src="../_static/logo.png" alt="Logo"/>
</div>

<span class="sidebar-brand-text">Javet 1.0.0 documentation</span>
<span class="sidebar-brand-text">Javet 1.0.1 documentation</span>

</a><form class="sidebar-search-container" method="get" action="../search.html" role="search">
<input class="sidebar-search" placeholder=Search name="q" aria-label="Search">
Expand All @@ -161,14 +161,14 @@
<ul class="current">
<li class="toctree-l1 has-children"><a class="reference internal" href="../tutorial/index.html">Tutorial</a><input class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l2 has-children"><a class="reference internal" href="../tutorial/basic/index.html">Basic</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/basic/engine_pool.html">Javet Engine Pool</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/basic/hello_javet.html">Hello Javet</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/basic/installation.html">Installation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/basic/interception.html">Interception</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/basic/hello_javet.html">Hello Javet</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/basic/javet_shell.html">Javet Shell</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/basic/interception.html">Interception</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/basic/engine_pool.html">Javet Engine Pool</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/basic/node_js_mode_and_v8_mode.html">Node.js Mode and V8 Mode</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/basic/polyfill.html">Polyfill</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/basic/spring_integration.html">Spring Integration</a></li>
<li class="toctree-l3"><a class="reference internal" href="../tutorial/basic/polyfill.html">Polyfill</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../tutorial/advanced/index.html">Advanced</a><input class="toctree-checkbox" id="toctree-checkbox-3" name="toctree-checkbox-3" role="switch" type="checkbox"/><label for="toctree-checkbox-3"><div class="visually-hidden">Toggle child pages in navigation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
Expand Down
Loading

0 comments on commit 4aded4a

Please sign in to comment.