summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md41
-rw-r--r--README_zh.md41
2 files changed, 82 insertions, 0 deletions
diff --git a/README.md b/README.md
index f37cdfb36..85233b96e 100644
--- a/README.md
+++ b/README.md
@@ -332,6 +332,47 @@ Please download and install more other plugins from the plugins repository [xmak
* [xmake.vim](https://github.com/luzhlon/xmake.vim) (third-party, thanks [@luzhlon](https://github.com/luzhlon))
+### XMake Gradle Plugin (JNI)
+
+We can uses [xmake-gradle](https://github.com/xmake-io/xmake-gradle) plugin to compile JNI library in gradle.
+
+```
+plugins {
+ id 'org.tboox.gradle-xmake-plugin' version '1.0.6'
+}
+
+android {
+ externalNativeBuild {
+ xmake {
+ path "jni/xmake.lua"
+ }
+ }
+}
+```
+
+The `xmakeBuild` will be injected to `assemble` task automatically if the gradle-xmake-plugin has been applied.
+
+```console
+$ ./gradlew app:assembleDebug
+> Task :nativelib:xmakeConfigureForArm64
+> Task :nativelib:xmakeBuildForArm64
+>> xmake build
+[ 50%]: ccache compiling.debug nativelib.cc
+[ 75%]: linking.debug libnativelib.so
+[100%]: build ok!
+>> install artifacts to /Users/ruki/projects/personal/xmake-gradle/nativelib/libs/arm64-v8a
+> Task :nativelib:xmakeConfigureForArmv7
+> Task :nativelib:xmakeBuildForArmv7
+>> xmake build
+[ 50%]: ccache compiling.debug nativelib.cc
+[ 75%]: linking.debug libnativelib.so
+[100%]: build ok!
+>> install artifacts to /Users/ruki/projects/personal/xmake-gradle/nativelib/libs/armeabi-v7a
+> Task :nativelib:preBuild
+> Task :nativelib:assemble
+> Task :app:assembleDebug
+```
+
## Project Examples
Some projects using xmake:
diff --git a/README_zh.md b/README_zh.md
index 0d60b4779..75a81a867 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -338,6 +338,47 @@ $ xmake l
* [xmake.vim](https://github.com/luzhlon/xmake.vim) (third-party, thanks [@luzhlon](https://github.com/luzhlon))
+### XMake Gradle插件 (JNI)
+
+我们也可以在Gradle中使用[xmake-gradle](https://github.com/xmake-io/xmake-gradle)插件来集成编译JNI库
+
+```
+plugins {
+ id 'org.tboox.gradle-xmake-plugin' version '1.0.6'
+}
+
+android {
+ externalNativeBuild {
+ xmake {
+ path "jni/xmake.lua"
+ }
+ }
+}
+```
+
+当`gradle-xmake-plugin`插件被应用生效后,`xmakeBuild`任务会自动注入到现有的`assemble`任务中去,自动执行jni库编译和集成。
+
+```console
+$ ./gradlew app:assembleDebug
+> Task :nativelib:xmakeConfigureForArm64
+> Task :nativelib:xmakeBuildForArm64
+>> xmake build
+[ 50%]: ccache compiling.debug nativelib.cc
+[ 75%]: linking.debug libnativelib.so
+[100%]: build ok!
+>> install artifacts to /Users/ruki/projects/personal/xmake-gradle/nativelib/libs/arm64-v8a
+> Task :nativelib:xmakeConfigureForArmv7
+> Task :nativelib:xmakeBuildForArmv7
+>> xmake build
+[ 50%]: ccache compiling.debug nativelib.cc
+[ 75%]: linking.debug libnativelib.so
+[100%]: build ok!
+>> install artifacts to /Users/ruki/projects/personal/xmake-gradle/nativelib/libs/armeabi-v7a
+> Task :nativelib:preBuild
+> Task :nativelib:assemble
+> Task :app:assembleDebug
+```
+
## 项目例子
一些使用xmake的项目: