Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
* [Android] Change JNI string in cpp/h file (#2928)
Browse files Browse the repository at this point in the history
  • Loading branch information
YorkShen committed Sep 20, 2019
1 parent c542823 commit 724d887
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
13 changes: 11 additions & 2 deletions android/sdk/build.gradle
Expand Up @@ -170,7 +170,16 @@ android {

externalNativeBuild {
cmake {
path '../../weex_core/CMakeLists.txt'
if(project.useApachePackageName) {
path '../../weex_core/CMakeLists.txt'
}
else{
copy{
from new File('../../weex_core/CMakeLists.txt')
into new File('src/legacyRelease/cpp')
}
path 'src/legacyRelease/cpp/CMakeLists.txt'
}
}
}

Expand Down Expand Up @@ -256,4 +265,4 @@ task weex_core_license(type: com.hierynomus.gradle.license.tasks.LicenseFormat)
'Source/include/JavaScriptCore/**/*.cpp'])
}

preBuild.dependsOn copyAndRenamePackage, copyManifest, copyASanLib, checkNdkVersion, licenseFormat
preBuild.dependsOn copyAndRenameCppSourceFile, copyAndRenamePackage, copyManifest, copyASanLib, checkNdkVersion, licenseFormat
25 changes: 25 additions & 0 deletions android/sdk/buildSrc/packageName.gradle
Expand Up @@ -31,3 +31,28 @@ task copyManifest(type: Copy){
}
}
}

task copyOtherCppFile(type: Copy){
if(!project.useApachePackageName) {
doFirst {
delete new File('src/legacyRelease/cpp')
}
from new File('../../weex_core')
into new File('src/legacyRelease/cpp')
exclude '**/*.cpp', '**/*.cc', '**/*.c', '**/*.h', '**/*.hpp'
}
}

task copyAndRenameCppSourceFile(type: Copy, dependsOn: copyOtherCppFile){
if(!project.useApachePackageName) {
from new File('../../weex_core')
into new File('src/legacyRelease/cpp')
include '**/*.cpp', '**/*.cc', '**/*.c', '**/*.h', '**/*.hpp'
filter { String line ->
line.replaceAll('(.*".*)(com/taobao/weex)(.*".*)', { _, prefix, packageName, suffix ->
logger.info("Content substation in .cpp/.h files happpened, \n Input: ${line}, \n Output: ${prefix}org/apache/weex${suffix}")
"${prefix}org/apache/weex${suffix}"
})
}
}
}

0 comments on commit 724d887

Please sign in to comment.