Skip to content

Commit

Permalink
Merge pull request #648 from Tencent/feature/dev
Browse files Browse the repository at this point in the history
Matrix v2.0.1
  • Loading branch information
gryamy authored Sep 22, 2021
2 parents 7e3671a + 7d108e0 commit de2b25c
Show file tree
Hide file tree
Showing 99 changed files with 6,446 additions and 1,524 deletions.
4 changes: 2 additions & 2 deletions matrix/matrix-android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryErro
# org.gradle.parallel=true
#Tue Jun 20 10:24:33 CST 2017

VERSION_NAME_PREFIX=2.0.0
VERSION_NAME_PREFIX=2.0.1
VERSION_NAME_SUFFIX=
## two options: Internal (for wechat), External (for public repo)
PUBLISH_CHANNEL=Internal
android.useAndroidX=true
android.useAndroidX=true
43 changes: 25 additions & 18 deletions matrix/matrix-android/gradle/android-publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -113,25 +113,30 @@ android.libraryVariants.all { variant ->
classifier = 'sources'
from sourceDirs
}
def jniSymbolsJar = task("${variant.name}SymbolJar", type: Jar, dependsOn: 'build') {
classifier = "so-symbols"
boolean hasNativeBuildTask = false
tasks.each { task ->
if (task.getName().startsWith("externalNativeBuild")) {
hasNativeBuildTask = true
def externalNativeBuildTask = project.tasks.findByName(
"externalNativeBuild${variant.name.capitalize()}")
def jniSymbolsJar = null
if (externalNativeBuildTask != null) {
jniSymbolsJar = task("${variant.name}SymbolJar", type: Jar, dependsOn: externalNativeBuildTask) {
classifier = "so-symbols"
boolean hasNativeBuildTask = false
tasks.each { task ->
if (task.getName().startsWith("externalNativeBuild")) {
hasNativeBuildTask = true
}
}
}

if (!hasNativeBuildTask) {
return
}
if (!hasNativeBuildTask) {
return
}

if (hasFlavors) {
variant.productFlavors.each { flavor ->
from file("build/intermediates/cmake/${flavor.name}/release/obj/")
if (hasFlavors) {
variant.productFlavors.each { flavor ->
from file("build/intermediates/cmake/${flavor.name}/release/obj/")
}
} else {
from file("build/intermediates/cmake/release/obj/")
}
} else {
from file("build/intermediates/cmake/release/obj/")
}
}

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

artifact sourcesJar
artifact javadocJar
artifact jniSymbolsJar
if (jniSymbolsJar) {
artifact jniSymbolsJar
}

// append additional configurations
pom.withXml {
Expand Down Expand Up @@ -190,7 +197,7 @@ if (JavaVersion.current().isJava8Compatible()) {
}
}

task buildAndPublishToLocalMaven(type: Copy, dependsOn: ['build', 'publishToMavenLocal']) {
task buildAndPublishToLocalMaven(type: Copy, dependsOn: ['publishToMavenLocal']) {
group = 'publishing'

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

task buildAndPublishRepo(type: Copy, dependsOn: ['build', 'publish']) {
task buildAndPublishRepo(type: Copy, dependsOn: ['publish']) {
group = "publishing"

// save artifacts files to artifacts folder
Expand Down
33 changes: 3 additions & 30 deletions matrix/matrix-android/matrix-android-commons/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1,5 @@
cmake_minimum_required(VERSION 3.4.1)
project(libxhook C)

set(xhook_source_dir src/main/cpp/libxhook)

set(xhook_source
${xhook_source_dir}/xh_core.c
${xhook_source_dir}/xh_elf.c
${xhook_source_dir}/xh_jni.c
${xhook_source_dir}/xh_log.c
${xhook_source_dir}/xh_util.c
${xhook_source_dir}/xh_version.c
${xhook_source_dir}/xhook.c
${xhook_source_dir}/xhook_ext.c)

add_library(xhook STATIC ${xhook_source})

find_library(
log-lib
log
)

target_include_directories(
xhook
PUBLIC ${xhook_source_dir}
)

target_link_libraries(
xhook
${log-lib}
)
project(android-commons C)

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/libsemi_dlfcn)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/libxhook)
5 changes: 4 additions & 1 deletion matrix/matrix-android/matrix-android-commons/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ android {

externalNativeBuild {
cmake {
targets = ['xhook']
targets = ['xhook', 'semi_dlfcn']
}
exportHeaders {
from('src/main/cpp/libxhook') {
include '**/*.h'
}
from('src/main/cpp/libsemi_dlfcn') {
include '**/*.h'
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.4.1)
project(libsemi_dlfcn C)

set(semi_dlfcn_source_dir ${CMAKE_CURRENT_SOURCE_DIR})

set(semi_dlfcn_source
${semi_dlfcn_source_dir}/semi_dlfcn.c
${semi_dlfcn_source_dir}/sd_log.c)

add_library(semi_dlfcn STATIC ${semi_dlfcn_source})

target_include_directories(
semi_dlfcn
PUBLIC ${semi_dlfcn_source_dir}
)

target_link_libraries(
semi_dlfcn
PUBLIC ${log-lib}
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
// Created by YinSheng Tang on 2021/7/21.
//

#include "sd_log.h"

bool g_semi_dlfcn_log_enabled = true;
int g_semi_dlfcn_log_level = ANDROID_LOG_DEBUG;
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//
// Created by YinSheng Tang on 2021/7/21.
//

#ifndef MATRIX_ANDROID_SD_LOG_H
#define MATRIX_ANDROID_SD_LOG_H


#include <stdbool.h>
#include <android/log.h>

extern bool g_semi_dlfcn_log_enabled;
extern int g_semi_dlfcn_log_level;

#define LOGV(tag, fmt, args...) \
do { \
if (g_semi_dlfcn_log_enabled && (g_semi_dlfcn_log_level <= ANDROID_LOG_VERBOSE)) { \
__android_log_print(ANDROID_LOG_VERBOSE, tag, fmt, ##args); \
} \
} while (false)

#define LOGD(tag, fmt, args...) \
do { \
if (g_semi_dlfcn_log_enabled && (g_semi_dlfcn_log_level <= ANDROID_LOG_DEBUG)) { \
__android_log_print(ANDROID_LOG_DEBUG, tag, fmt, ##args); \
} \
} while (false)

#define LOGI(tag, fmt, args...) \
do { \
if (g_semi_dlfcn_log_enabled && (g_semi_dlfcn_log_level <= ANDROID_LOG_INFO)) { \
__android_log_print(ANDROID_LOG_INFO, tag, fmt, ##args); \
} \
} while (false)

#define LOGW(tag, fmt, args...) \
do { \
if (g_semi_dlfcn_log_enabled && (g_semi_dlfcn_log_level <= ANDROID_LOG_WARN)) { \
__android_log_print(ANDROID_LOG_WARN, tag, fmt, ##args); \
} \
} while (false)

#define LOGE(tag, fmt, args...) \
do { \
if (g_semi_dlfcn_log_enabled && (g_semi_dlfcn_log_level <= ANDROID_LOG_ERROR)) { \
__android_log_print(ANDROID_LOG_ERROR, tag, fmt, ##args); \
} \
} while (false)


#endif //MATRIX_ANDROID_SD_LOG_H
Loading

0 comments on commit de2b25c

Please sign in to comment.