mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 00:57:33 +08:00
[Android] Add CxxBuffer to native and Java PaddleSegModel (#677)
[Android] Add CxxBuffer to native PaddleSegModel
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import java.security.MessageDigest
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
|
||||
@@ -56,26 +54,23 @@ task downloadAndExtractLibs(type: DefaultTask) {
|
||||
println "Downloading and extracting fastdeploy android c++ lib ..."
|
||||
}
|
||||
doLast {
|
||||
// Prepare cache folder for archives
|
||||
String cachePath = "cache"
|
||||
if (!file("${cachePath}").exists()) {
|
||||
mkdir "${cachePath}"
|
||||
}
|
||||
FD_CXX_LIB.eachWithIndex { lib, index ->
|
||||
MessageDigest messageDigest = MessageDigest.getInstance('MD5')
|
||||
messageDigest.update(lib.src.bytes)
|
||||
String cacheName = new BigInteger(1, messageDigest.digest()).toString(32)
|
||||
// Download the target archive if not exists
|
||||
boolean copyFiles = !file("${lib.dest}").exists()
|
||||
if (!file("${cachePath}/${cacheName}.tgz").exists()) {
|
||||
ant.get(src: lib.src, dest: file("${cachePath}/${cacheName}.tgz"))
|
||||
String[] libPaths = lib.src.split("/")
|
||||
String libName = libPaths[libPaths.length - 1]
|
||||
libName = libName.split("\\.")[0]
|
||||
boolean copyFiles = !file("${lib.dest}/${libName}").exists()
|
||||
if (!file("${cachePath}/${libName}.tgz").exists()) {
|
||||
println "Downloading ${lib.src} -> ${cachePath}/${libName}.tgz"
|
||||
ant.get(src: lib.src, dest: file("${cachePath}/${libName}.tgz"))
|
||||
copyFiles = true
|
||||
// force to copy files from the latest archive files
|
||||
}
|
||||
// Extract the target archive if its dest path does not exists
|
||||
if (copyFiles) {
|
||||
copy {
|
||||
from tarTree("${cachePath}/${cacheName}.tgz")
|
||||
from tarTree("${cachePath}/${libName}.tgz")
|
||||
into "${lib.dest}"
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user