From 8fb38c8aaa2db4cada12edc166f67d6a9b696354 Mon Sep 17 00:00:00 2001 From: Sam Cao Date: Tue, 15 Oct 2024 14:38:30 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=83=20docs:=20Update=20docs=20for=20na?= =?UTF-8?q?tive=20jars=20and=20i18n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.rst | 11 +- docs/index.rst | 2 +- .../advanced/internationalization_i18n.rst | 3 +- docs/tutorial/basic/installation.rst | 579 ++++++++++++++++-- 4 files changed, 551 insertions(+), 44 deletions(-) diff --git a/README.rst b/README.rst index 9e190685..bd451ae4 100644 --- a/README.rst +++ b/README.rst @@ -51,6 +51,7 @@ arm64 ✔️ ✔️ ✔️ ❌ =========== ======= ======= ======= ======= * Node.js ``v22.9.0`` + V8 ``v13.0.245.16`` +* i18n and non-i18n * Dynamic switch between Node.js and V8 mode * Polyfill V8 mode with `Javenode `_ * V8 API exposure in JVM @@ -103,8 +104,8 @@ Gradle Kotlin DSL implementation("com.caoccao.javet:javet:4.0.0") // Linux and Windows (x86_64) implementation("com.caoccao.javet:javet-linux-arm64:4.0.0") // Linux (arm64) implementation("com.caoccao.javet:javet-macos:4.0.0") // Mac OS (x86_64 and arm64) - implementation("com.caoccao.javet:javet-android-node:4.0.0") // Android Node (arm, arm64, x86 and x86_64) - implementation("com.caoccao.javet:javet-android-v8:4.0.0") // Android V8 (arm, arm64, x86 and x86_64) + implementation("com.caoccao.javet:javet-node-android:4.0.0") // Android Node (arm, arm64, x86 and x86_64) + implementation("com.caoccao.javet:javet-v8-android:4.0.0") // Android V8 (arm, arm64, x86 and x86_64) Gradle Groovy DSL ^^^^^^^^^^^^^^^^^ @@ -114,8 +115,10 @@ Gradle Groovy DSL implementation 'com.caoccao.javet:javet:4.0.0' // Linux and Windows (x86_64) implementation 'com.caoccao.javet:javet-linux-arm64:4.0.0' // Linux (arm64) implementation 'com.caoccao.javet:javet-macos:4.0.0' // Mac OS (x86_64 and arm64) - implementation 'com.caoccao.javet:javet-android-node:4.0.0' // Android Node (arm, arm64, x86 and x86_64) - implementation 'com.caoccao.javet:javet-android-v8:4.0.0' // Android V8 (arm, arm64, x86 and x86_64) + implementation 'com.caoccao.javet:javet-node-android:4.0.0' // Android Node (arm, arm64, x86 and x86_64) + implementation 'com.caoccao.javet:javet-v8-android:4.0.0' // Android V8 (arm, arm64, x86 and x86_64) + +For more detail, please visit the `installation `_ page. Hello Javet ----------- diff --git a/docs/index.rst b/docs/index.rst index 3c49c9a8..b5bc75e9 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,6 +1,6 @@ .. include:: ../README.rst :start-line: 0 - :end-line: 157 + :end-line: 160 .. toctree:: :maxdepth: 2 diff --git a/docs/tutorial/advanced/internationalization_i18n.rst b/docs/tutorial/advanced/internationalization_i18n.rst index d40b4da5..817c7014 100644 --- a/docs/tutorial/advanced/internationalization_i18n.rst +++ b/docs/tutorial/advanced/internationalization_i18n.rst @@ -14,8 +14,7 @@ The default Javet releases don't support i18n for the following reasons. How to Enable i18n? =================== -* Download the snapshot builds from `Actions `_. -* Reference the snapshot builds in the project. +* Follow :doc:`../basic/installation` to turn i18n on. * Download and save ``icudt*.dat`` files from somewhere to a local directory. E.g. ``v8/third_party/icu``, ``node/deps/icu-tmp``. * Set a flag as follows before the first Node.js or V8 runtime is created. diff --git a/docs/tutorial/basic/installation.rst b/docs/tutorial/basic/installation.rst index d98b229f..354c7ad8 100644 --- a/docs/tutorial/basic/installation.rst +++ b/docs/tutorial/basic/installation.rst @@ -2,38 +2,466 @@ Installation ============ -Dependency -========== +Dependency - Desktop +==================== + +The Javet dependency design for the desktop consists of the following: + +* A core library that contains the Java code. +* Various libraries each of which contains a native binary for various OS / JS Runtime Type / i18n Type. + +With this design, only the libraries needed are loaded. Maven ----- -.. tab:: Express +The following dependency must be added. + +.. code-block:: xml + + + com.caoccao.javet + javet-core + 4.0.0 + + +The following dependencies contain the non-i18n binaries for various OS / JS Runtime Type. + +.. tab:: Node (Express) .. code-block:: xml - + com.caoccao.javet - javet + javet-node-linux-x86_64 4.0.0 com.caoccao.javet - javet-linux-arm64 + javet-node-linux-arm64 4.0.0 - + com.caoccao.javet - javet-macos + javet-node-macos-x86_64 4.0.0 -.. tab:: Complete + + + com.caoccao.javet + javet-node-macos-arm64 + 4.0.0 + + + + + com.caoccao.javet + javet-node-windows-x86_64 + 4.0.0 + + +.. tab:: V8 (Express) + + .. code-block:: xml + + + + com.caoccao.javet + javet-v8-linux-x86_64 + 4.0.0 + + + + + com.caoccao.javet + javet-v8-linux-arm64 + 4.0.0 + + + + + com.caoccao.javet + javet-v8-macos-x86_64 + 4.0.0 + + + + + com.caoccao.javet + javet-v8-macos-arm64 + 4.0.0 + + + + + com.caoccao.javet + javet-v8-windows-x86_64 + 4.0.0 + + +.. tab:: Node (Complete) + + .. code-block:: xml + + + 4.0.0 + + + + + windows + + + windows + x86 + + + + + com.caoccao.javet + javet-node-windows-x86_64 + ${javet.version} + + + + + linux + + + unix + x86 + + true + + + + com.caoccao.javet + javet-node-linux-x86_64 + ${javet.version} + + + + + linux-arm64 + + + unix + arm64 + + + + + com.caoccao.javet + javet-node-linux-arm64 + ${javet.version} + + + + + macos + + + mac + x86 + + + + + com.caoccao.javet + javet-node-macos-x86_64 + ${javet.version} + + + + + macos-arm64 + + + mac + arm64 + + + + + com.caoccao.javet + javet-node-macos-arm64 + ${javet.version} + + + + + +.. tab:: V8 (Complete) + + .. code-block:: xml + + + 4.0.0 + + + + + windows + + + windows + x86 + + + + + com.caoccao.javet + javet-v8-windows-x86_64 + ${javet.version} + + + + + linux + + + unix + x86 + + true + + + + com.caoccao.javet + javet-v8-linux-x86_64 + ${javet.version} + + + + + linux-arm64 + + + unix + arm64 + + + + + com.caoccao.javet + javet-v8-linux-arm64 + ${javet.version} + + + + + macos + + + mac + x86 + + + + + com.caoccao.javet + javet-v8-macos-x86_64 + ${javet.version} + + + + + macos-arm64 + + + mac + arm64 + + + + + com.caoccao.javet + javet-v8-macos-arm64 + ${javet.version} + + + + + +The following dependencies contain the i18n binaries for various OS / JS Runtime Type. + +.. tab:: Node i18n (Express) + + .. code-block:: xml + + + + com.caoccao.javet + javet-node-linux-x86_64-i18n + 4.0.0 + + + + + com.caoccao.javet + javet-node-linux-arm64-i18n + 4.0.0 + + + + + com.caoccao.javet + javet-node-macos-x86_64-i18n + 4.0.0 + + + + + com.caoccao.javet + javet-node-macos-arm64-i18n + 4.0.0 + + + + + com.caoccao.javet + javet-node-windows-x86_64-i18n + 4.0.0 + + +.. tab:: V8 i18n (Express) + + .. code-block:: xml + + + + com.caoccao.javet + javet-v8-linux-x86_64-i18n + 4.0.0 + + + + + com.caoccao.javet + javet-v8-linux-arm64-i18n + 4.0.0 + + + + + com.caoccao.javet + javet-v8-macos-x86_64-i18n + 4.0.0 + + + + + com.caoccao.javet + javet-v8-macos-arm64-i18n + 4.0.0 + + + + + com.caoccao.javet + javet-v8-windows-x86_64-i18n + 4.0.0 + + +.. tab:: Node i18n (Complete) + + .. code-block:: xml + + + 4.0.0 + + + + + windows + + + windows + x86 + + + + + com.caoccao.javet + javet-node-windows-x86_64-i18n + ${javet.version} + + + + + linux + + + unix + x86 + + true + + + + com.caoccao.javet + javet-node-linux-x86_64-i18n + ${javet.version} + + + + + linux-arm64 + + + unix + arm64 + + + + + com.caoccao.javet + javet-node-linux-arm64-i18n + ${javet.version} + + + + + macos + + + mac + x86 + + + + + com.caoccao.javet + javet-node-macos-x86_64-i18n + ${javet.version} + + + + + macos-arm64 + + + mac + arm64 + + + + + com.caoccao.javet + javet-node-macos-arm64-i18n + ${javet.version} + + + + + +.. tab:: V8 i18n (Complete) .. code-block:: xml @@ -53,7 +481,7 @@ Maven com.caoccao.javet - javet + javet-v8-windows-x86_64-i18n ${javet.version} @@ -70,7 +498,7 @@ Maven com.caoccao.javet - javet + javet-v8-linux-x86_64-i18n ${javet.version} @@ -86,7 +514,7 @@ Maven com.caoccao.javet - javet-linux-arm64 + javet-v8-linux-arm64-i18n ${javet.version} @@ -96,30 +524,63 @@ Maven mac + x86 com.caoccao.javet - javet-macos + javet-v8-macos-x86_64-i18n + ${javet.version} + + + + + macos-arm64 + + + mac + arm64 + + + + + com.caoccao.javet + javet-v8-macos-arm64-i18n ${javet.version} -Gradle Kotlin DSL ------------------ +Gradle Kotlin DSL - Desktop +--------------------------- .. tab:: Express .. code-block:: kotlin - implementation("com.caoccao.javet:javet:4.0.0") // Linux and Windows (x86_64) - implementation("com.caoccao.javet:javet-linux-arm64:4.0.0") // Linux (arm64) - implementation("com.caoccao.javet:javet-macos:4.0.0") // Mac OS (x86_64 and arm64) - implementation("com.caoccao.javet:javet-android-node:4.0.0") // Android Node (arm, arm64, x86 and x86_64) - implementation("com.caoccao.javet:javet-android-v8:4.0.0") // Android V8 (arm, arm64, x86 and x86_64) + implementation("com.caoccao.javet:javet-core:4.0.0") // Must-have + implementation("com.caoccao.javet:javet-node-linux-arm64:4.0.0") + implementation("com.caoccao.javet:javet-node-linux-arm64-i18n:4.0.0") + implementation("com.caoccao.javet:javet-node-linux-x86_64:4.0.0") + implementation("com.caoccao.javet:javet-node-linux-x86_64-i18n:4.0.0") + implementation("com.caoccao.javet:javet-node-macos-arm64:4.0.0") + implementation("com.caoccao.javet:javet-node-macos-arm64-i18n:4.0.0") + implementation("com.caoccao.javet:javet-node-macos-x86_64:4.0.0") + implementation("com.caoccao.javet:javet-node-macos-x86_64-i18n:4.0.0") + implementation("com.caoccao.javet:javet-node-windows-x86_64:4.0.0") + implementation("com.caoccao.javet:javet-node-windows-x86_64-i18n:4.0.0") + implementation("com.caoccao.javet:javet-v8-linux-arm64:4.0.0") + implementation("com.caoccao.javet:javet-v8-linux-arm64-i18n:4.0.0") + implementation("com.caoccao.javet:javet-v8-linux-x86_64:4.0.0") + implementation("com.caoccao.javet:javet-v8-linux-x86_64-i18n:4.0.0") + implementation("com.caoccao.javet:javet-v8-macos-arm64:4.0.0") + implementation("com.caoccao.javet:javet-v8-macos-arm64-i18n:4.0.0") + implementation("com.caoccao.javet:javet-v8-macos-x86_64:4.0.0") + implementation("com.caoccao.javet:javet-v8-macos-x86_64-i18n:4.0.0") + implementation("com.caoccao.javet:javet-v8-windows-x86_64:4.0.0") + implementation("com.caoccao.javet:javet-v8-windows-x86_64-i18n:4.0.0") .. tab:: Complete @@ -128,25 +589,67 @@ Gradle Kotlin DSL import org.gradle.internal.os.OperatingSystem val os = OperatingSystem.current() - val cpuArch = System.getProperty("os.arch") - if (os.isMacOsX) { - implementation("com.caoccao.javet:javet:4.0.0") - } else if (os.isLinux && (cpuArch == "aarch64" || cpuArch == "arm64")) { - implementation("com.caoccao.javet:javet-linux-arm64:4.0.0") - } else { - implementation("com.caoccao.javet:javet-macos:4.0.0") - } - -Gradle Groovy DSL ------------------ + val arch = System.getProperty("os.arch") + val isI18n = false + val isNode = false + val i18nType = if (isI18n) "-i18n" else "" + val jsRuntimeTimeType = if (isNode) "node" else "v8" + val osType = if (os.isWindows) "windows" else + if (os.isMacOsX) "macos" else + if (os.isLinux) "linux" else "" + val archType = if (arch == "aarch64" || arch == "arm64") "arm64" else "x86_64" + implementation("com.caoccao.javet:javet-core:4.0.0") + implementation("com.caoccao.javet:javet-$jsRuntimeTimeType-$osType-$archType$i18nType:4.0.0") + +Gradle Groovy DSL - Desktop +--------------------------- + +.. code-block:: groovy + + implementation 'com.caoccao.javet:javet-core:4.0.0' // Must-have + implementation 'com.caoccao.javet:javet-node-linux-arm64:4.0.0' + implementation 'com.caoccao.javet:javet-node-linux-arm64-i18n:4.0.0' + implementation 'com.caoccao.javet:javet-node-linux-x86_64:4.0.0' + implementation 'com.caoccao.javet:javet-node-linux-x86_64-i18n:4.0.0' + implementation 'com.caoccao.javet:javet-node-macos-arm64:4.0.0' + implementation 'com.caoccao.javet:javet-node-macos-arm64-i18n:4.0.0' + implementation 'com.caoccao.javet:javet-node-macos-x86_64:4.0.0' + implementation 'com.caoccao.javet:javet-node-macos-x86_64-i18n:4.0.0' + implementation 'com.caoccao.javet:javet-node-windows-x86_64:4.0.0' + implementation 'com.caoccao.javet:javet-node-windows-x86_64-i18n:4.0.0' + implementation 'com.caoccao.javet:javet-v8-linux-arm64:4.0.0' + implementation 'com.caoccao.javet:javet-v8-linux-arm64-i18n:4.0.0' + implementation 'com.caoccao.javet:javet-v8-linux-x86_64:4.0.0' + implementation 'com.caoccao.javet:javet-v8-linux-x86_64-i18n:4.0.0' + implementation 'com.caoccao.javet:javet-v8-macos-arm64:4.0.0' + implementation 'com.caoccao.javet:javet-v8-macos-arm64-i18n:4.0.0' + implementation 'com.caoccao.javet:javet-v8-macos-x86_64:4.0.0' + implementation 'com.caoccao.javet:javet-v8-macos-x86_64-i18n:4.0.0' + implementation 'com.caoccao.javet:javet-v8-windows-x86_64:4.0.0' + implementation 'com.caoccao.javet:javet-v8-windows-x86_64-i18n:4.0.0' + +Dependencies - Android +====================== + +Gradle Kotlin DSL - Android +--------------------------- + +.. code-block:: kotlin + + implementation("com.caoccao.javet:javet-node-android:4.0.0") // Android Node (arm, arm64, x86 and x86_64) + implementation("com.caoccao.javet:javet-node-android-i18n:4.0.0") // Android Node (arm64 and x86_64) + implementation("com.caoccao.javet:javet-v8-android:4.0.0") // Android V8 (arm, arm64, x86 and x86_64) + implementation("com.caoccao.javet:javet-v8-android-i18n:4.0.0") // Android V8 (arm, arm64, x86 and x86_64) + +Gradle Groovy DSL - Android +--------------------------- .. code-block:: groovy - implementation 'com.caoccao.javet:javet:4.0.0' // Linux and Windows (x86_64) - implementation 'com.caoccao.javet:javet-linux-arm64:4.0.0' // Linux (arm64) - implementation 'com.caoccao.javet:javet-macos:4.0.0' // Mac OS (x86_64 and arm64) - implementation 'com.caoccao.javet:javet-android-node:4.0.0' // Android Node (arm, arm64, x86 and x86_64) - implementation 'com.caoccao.javet:javet-android-v8:4.0.0' // Android V8 (arm, arm64, x86 and x86_64) + implementation 'com.caoccao.javet:javet-node-android:4.0.0' // Android Node (arm, arm64, x86 and x86_64) + implementation 'com.caoccao.javet:javet-node-android-i18n:4.0.0' // Android Node (arm64 and x86_64) + implementation 'com.caoccao.javet:javet-v8-android:4.0.0' // Android V8 (arm, arm64, x86 and x86_64) + implementation 'com.caoccao.javet:javet-v8-android-i18n:4.0.0' // Android V8 (arm, arm64, x86 and x86_64) OS Compatibility ================ @@ -157,6 +660,7 @@ Windows =========================== ======================================================================================================================= OS Compatible =========================== ======================================================================================================================= +Windows 11 Yes Windows 10 Yes Windows 7 Yes Windows Server Not Tested @@ -168,6 +672,7 @@ Linux =========================== ======================================================================================================================= OS Compatible =========================== ======================================================================================================================= +Ubuntu 24.04 Yes Ubuntu 22.04 Yes Ubuntu 20.04 Yes Ubuntu 18.04 Yes (since v1.1.0 and private builds) @@ -221,4 +726,4 @@ ABI Javet Version V8 Version Internationalization (i18n) =========================== -The office builds do not support i18n, but there are snapshot builds supporting i18n. Please refer to :doc:`../advanced/internationalization_i18n` for detail. +If i18n is enabled, please make sure the steps in :doc:`../advanced/internationalization_i18n` are well implemented otherwise Javet will crash.