From 050e18aa1642a7d36e9b144557d2b6746673c9e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=83=E9=87=8C=E8=8D=89?= Date: Fri, 5 Apr 2019 06:05:35 +0800 Subject: [PATCH] copy libweexcore.so and libweexjss.so to libs automatically --- android/sdk/build.gradle | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/android/sdk/build.gradle b/android/sdk/build.gradle index 7dac40278b..40529f76cf 100755 --- a/android/sdk/build.gradle +++ b/android/sdk/build.gradle @@ -371,3 +371,43 @@ bintray { } } } + +def copy_so_and_backup() { + def cpu_list = ["armeabi", "armeabi-v7a", "x86"] + cpu_list.forEach { cpu_name -> + File so_file = new File(project.buildDir, "/intermediates/bundles/default/jni/" + cpu_name) + if (so_file.exists()) { + println(so_file.getAbsolutePath()) + copy { + from so_file.getAbsolutePath() + into new File("libs/" + cpu_name) + include 'libweexjss.so', 'libweexcore.so' + } + + if(cpu_name == "armeabi") { + File back_file = new File(project.buildDir, "/intermediates/cmake/release/obj/armeabi/") + //backup so to project'parent's path + File backup_des = new File(project.buildDir.parentFile.parentFile.parentFile.parentFile,"weex_so_armeabi") + if(backup_des.exists()){ + backup_des.deleteDir() + backup_des.mkdir() + } + println(backup_des.absolutePath) + + println("so backup to "+ backup_des.absolutePath) + copy { + from back_file.getAbsolutePath() + into backup_des + include 'libweexjss.so', 'libweexcore.so' + } + } + } + } +} + +afterEvaluate { project -> + project.tasks.find { (it.name.contains("assembleRelease")) }?.doLast { + println("begin_copy_so") + copy_so_and_backup() + } +}