Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

拆分项目为jni和App两个模块 #1266

Closed
tumuyan opened this issue Feb 23, 2024 · 1 comment
Closed

拆分项目为jni和App两个模块 #1266

tumuyan opened this issue Feb 23, 2024 · 1 comment

Comments

@tumuyan
Copy link
Contributor

tumuyan commented Feb 23, 2024

Is your feature request related to a problem? Please describe.
由于jni部分代码结构复杂,目前项目clone、设置环境和编译有一定困难

Describe the solution you'd like
拆分项目为jni和App两个模块,jni模块构建librime.so,App模块利用jni构建产物独立构建apk。
同时ci直接提供jni build产物。
另外这样可以使用release build jni+debug build app,让应用运行速度比现有的debug build更快,方便开发者日常使用debug build的版本。

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.
从实现上讲,拆分模块并不困难。
复制jni编译产物到App需要增加一个脚本。
相应的ci脚本也需要更新。
f-droid的构建会不会有问题需要确认。

@WhiredPlanck
Copy link
Collaborator

WhiredPlanck commented Mar 16, 2024

@tumuyan 研究了一下 Gradle 的任务后我想也许不用拆分。其实只要运行一个命令就可以独立构建 JNI 了:

# debug build
./gradlew externalNativeBuildDebug
# release build
./gradlew externalNativeBuildRelease

架构类型可以指定环境变量 BUILD_ABI,比如:

export BUILD_ABI=x86,x86_64

不指定时默认使用 arm64-v8a

这样单独构建的产物位于 app/build/intermediates/cmake/<构建类型>/obj/<架构类型>/ 内。

自己多写一个脚本把产物复制到 app/prebuilt 就能用预构建了。

@tumuyan tumuyan closed this as completed Mar 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants