Skip to content

Commit de2b25c

Browse files
authored
Merge pull request #648 from Tencent/feature/dev
Matrix v2.0.1
2 parents 7e3671a + 7d108e0 commit de2b25c

File tree

99 files changed

+6446
-1524
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+6446
-1524
lines changed

matrix/matrix-android/gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryErro
1414
# org.gradle.parallel=true
1515
#Tue Jun 20 10:24:33 CST 2017
1616

17-
VERSION_NAME_PREFIX=2.0.0
17+
VERSION_NAME_PREFIX=2.0.1
1818
VERSION_NAME_SUFFIX=
1919
## two options: Internal (for wechat), External (for public repo)
2020
PUBLISH_CHANNEL=Internal
21-
android.useAndroidX=true
21+
android.useAndroidX=true

matrix/matrix-android/gradle/android-publish.gradle

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -113,25 +113,30 @@ android.libraryVariants.all { variant ->
113113
classifier = 'sources'
114114
from sourceDirs
115115
}
116-
def jniSymbolsJar = task("${variant.name}SymbolJar", type: Jar, dependsOn: 'build') {
117-
classifier = "so-symbols"
118-
boolean hasNativeBuildTask = false
119-
tasks.each { task ->
120-
if (task.getName().startsWith("externalNativeBuild")) {
121-
hasNativeBuildTask = true
116+
def externalNativeBuildTask = project.tasks.findByName(
117+
"externalNativeBuild${variant.name.capitalize()}")
118+
def jniSymbolsJar = null
119+
if (externalNativeBuildTask != null) {
120+
jniSymbolsJar = task("${variant.name}SymbolJar", type: Jar, dependsOn: externalNativeBuildTask) {
121+
classifier = "so-symbols"
122+
boolean hasNativeBuildTask = false
123+
tasks.each { task ->
124+
if (task.getName().startsWith("externalNativeBuild")) {
125+
hasNativeBuildTask = true
126+
}
122127
}
123-
}
124128

125-
if (!hasNativeBuildTask) {
126-
return
127-
}
129+
if (!hasNativeBuildTask) {
130+
return
131+
}
128132

129-
if (hasFlavors) {
130-
variant.productFlavors.each { flavor ->
131-
from file("build/intermediates/cmake/${flavor.name}/release/obj/")
133+
if (hasFlavors) {
134+
variant.productFlavors.each { flavor ->
135+
from file("build/intermediates/cmake/${flavor.name}/release/obj/")
136+
}
137+
} else {
138+
from file("build/intermediates/cmake/release/obj/")
132139
}
133-
} else {
134-
from file("build/intermediates/cmake/release/obj/")
135140
}
136141
}
137142

@@ -148,7 +153,9 @@ android.libraryVariants.all { variant ->
148153

149154
artifact sourcesJar
150155
artifact javadocJar
151-
artifact jniSymbolsJar
156+
if (jniSymbolsJar) {
157+
artifact jniSymbolsJar
158+
}
152159

153160
// append additional configurations
154161
pom.withXml {
@@ -190,7 +197,7 @@ if (JavaVersion.current().isJava8Compatible()) {
190197
}
191198
}
192199

193-
task buildAndPublishToLocalMaven(type: Copy, dependsOn: ['build', 'publishToMavenLocal']) {
200+
task buildAndPublishToLocalMaven(type: Copy, dependsOn: ['publishToMavenLocal']) {
194201
group = 'publishing'
195202

196203
// save artifacts files to artifacts folder
@@ -205,7 +212,7 @@ task buildAndPublishToLocalMaven(type: Copy, dependsOn: ['build', 'publishToMave
205212
}
206213
}
207214

208-
task buildAndPublishRepo(type: Copy, dependsOn: ['build', 'publish']) {
215+
task buildAndPublishRepo(type: Copy, dependsOn: ['publish']) {
209216
group = "publishing"
210217

211218
// save artifacts files to artifacts folder
Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,5 @@
11
cmake_minimum_required(VERSION 3.4.1)
2-
project(libxhook C)
3-
4-
set(xhook_source_dir src/main/cpp/libxhook)
5-
6-
set(xhook_source
7-
${xhook_source_dir}/xh_core.c
8-
${xhook_source_dir}/xh_elf.c
9-
${xhook_source_dir}/xh_jni.c
10-
${xhook_source_dir}/xh_log.c
11-
${xhook_source_dir}/xh_util.c
12-
${xhook_source_dir}/xh_version.c
13-
${xhook_source_dir}/xhook.c
14-
${xhook_source_dir}/xhook_ext.c)
15-
16-
add_library(xhook STATIC ${xhook_source})
17-
18-
find_library(
19-
log-lib
20-
log
21-
)
22-
23-
target_include_directories(
24-
xhook
25-
PUBLIC ${xhook_source_dir}
26-
)
27-
28-
target_link_libraries(
29-
xhook
30-
${log-lib}
31-
)
2+
project(android-commons C)
323

4+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/libsemi_dlfcn)
5+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/libxhook)

matrix/matrix-android/matrix-android-commons/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@ android {
1818

1919
externalNativeBuild {
2020
cmake {
21-
targets = ['xhook']
21+
targets = ['xhook', 'semi_dlfcn']
2222
}
2323
exportHeaders {
2424
from('src/main/cpp/libxhook') {
2525
include '**/*.h'
2626
}
27+
from('src/main/cpp/libsemi_dlfcn') {
28+
include '**/*.h'
29+
}
2730
}
2831
}
2932
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
cmake_minimum_required(VERSION 3.4.1)
2+
project(libsemi_dlfcn C)
3+
4+
set(semi_dlfcn_source_dir ${CMAKE_CURRENT_SOURCE_DIR})
5+
6+
set(semi_dlfcn_source
7+
${semi_dlfcn_source_dir}/semi_dlfcn.c
8+
${semi_dlfcn_source_dir}/sd_log.c)
9+
10+
add_library(semi_dlfcn STATIC ${semi_dlfcn_source})
11+
12+
target_include_directories(
13+
semi_dlfcn
14+
PUBLIC ${semi_dlfcn_source_dir}
15+
)
16+
17+
target_link_libraries(
18+
semi_dlfcn
19+
PUBLIC ${log-lib}
20+
)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//
2+
// Created by YinSheng Tang on 2021/7/21.
3+
//
4+
5+
#include "sd_log.h"
6+
7+
bool g_semi_dlfcn_log_enabled = true;
8+
int g_semi_dlfcn_log_level = ANDROID_LOG_DEBUG;
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//
2+
// Created by YinSheng Tang on 2021/7/21.
3+
//
4+
5+
#ifndef MATRIX_ANDROID_SD_LOG_H
6+
#define MATRIX_ANDROID_SD_LOG_H
7+
8+
9+
#include <stdbool.h>
10+
#include <android/log.h>
11+
12+
extern bool g_semi_dlfcn_log_enabled;
13+
extern int g_semi_dlfcn_log_level;
14+
15+
#define LOGV(tag, fmt, args...) \
16+
do { \
17+
if (g_semi_dlfcn_log_enabled && (g_semi_dlfcn_log_level <= ANDROID_LOG_VERBOSE)) { \
18+
__android_log_print(ANDROID_LOG_VERBOSE, tag, fmt, ##args); \
19+
} \
20+
} while (false)
21+
22+
#define LOGD(tag, fmt, args...) \
23+
do { \
24+
if (g_semi_dlfcn_log_enabled && (g_semi_dlfcn_log_level <= ANDROID_LOG_DEBUG)) { \
25+
__android_log_print(ANDROID_LOG_DEBUG, tag, fmt, ##args); \
26+
} \
27+
} while (false)
28+
29+
#define LOGI(tag, fmt, args...) \
30+
do { \
31+
if (g_semi_dlfcn_log_enabled && (g_semi_dlfcn_log_level <= ANDROID_LOG_INFO)) { \
32+
__android_log_print(ANDROID_LOG_INFO, tag, fmt, ##args); \
33+
} \
34+
} while (false)
35+
36+
#define LOGW(tag, fmt, args...) \
37+
do { \
38+
if (g_semi_dlfcn_log_enabled && (g_semi_dlfcn_log_level <= ANDROID_LOG_WARN)) { \
39+
__android_log_print(ANDROID_LOG_WARN, tag, fmt, ##args); \
40+
} \
41+
} while (false)
42+
43+
#define LOGE(tag, fmt, args...) \
44+
do { \
45+
if (g_semi_dlfcn_log_enabled && (g_semi_dlfcn_log_level <= ANDROID_LOG_ERROR)) { \
46+
__android_log_print(ANDROID_LOG_ERROR, tag, fmt, ##args); \
47+
} \
48+
} while (false)
49+
50+
51+
#endif //MATRIX_ANDROID_SD_LOG_H

0 commit comments

Comments
 (0)