Skip to content

Commit

Permalink
upgrade gradle of xlog sample
Browse files Browse the repository at this point in the history
  • Loading branch information
garryyan authored and astrozhou committed Jul 11, 2019
1 parent d8774f3 commit 485c9d2
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 95 deletions.
45 changes: 0 additions & 45 deletions samples/android/xlogSample/CMakeLists.txt

This file was deleted.

53 changes: 40 additions & 13 deletions samples/android/xlogSample/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
compileSdkVersion 26
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.tencent.mars.xlogsample"
minSdkVersion 16
targetSdkVersion 23
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
abiFilters "armeabi"
abiFilters "x86"
}
externalNativeBuild {
cmake {
arguments "-DANDROID_STL=c++_shared"
}
}

}
Expand All @@ -22,27 +28,48 @@ android {
}
}

copy {
from "build/intermediates/exploded-aar/com.tencent.mars/mars-xlog/${VERSION_NAME}${VERSION_NAME_SUFFIX}/jni/armeabi/"
into "src/main/jni/export_include"

sourceSets {
main {
jniLibs.srcDirs = ["jniLibs/jni"]
}
}

externalNativeBuild {

ndkBuild {
path "src/main/jni/Android.mk"
cmake {
path "src/main/jni/CMakeLists.txt"
}
}

}

configurations {
cmake_depends
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:23.1.1'
testCompile 'junit:junit:4.12'
compile "com.tencent.mars:mars-xlog:${VERSION_NAME}${VERSION_NAME_SUFFIX}"
implementation 'com.android.support:appcompat-v7:26.1.0'
testImplementation 'junit:junit:4.12'
implementation "com.tencent.mars:mars-xlog:${VERSION_NAME}${VERSION_NAME_SUFFIX}"
cmake_depends "com.tencent.mars:mars-xlog:${VERSION_NAME}${VERSION_NAME_SUFFIX}"
}

task resolveDependencies {
project.configurations.each { configuration ->
if ("cmake_depends".equalsIgnoreCase(configuration.name)) {
def lib = configuration.resolve()[0]
copy {
from zipTree(lib)
into "${project.rootDir}/${project.name}/src/main/jniLibs/"
include "jni/**/*.so"
}
}
}
}

build.dependsOn resolveDependencies
18 changes: 0 additions & 18 deletions samples/android/xlogSample/app/src/main/jni/Android.mk

This file was deleted.

3 changes: 0 additions & 3 deletions samples/android/xlogSample/app/src/main/jni/Application.mk

This file was deleted.

13 changes: 13 additions & 0 deletions samples/android/xlogSample/app/src/main/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.4.1)

include_directories(export_include)

add_library(native-lib SHARED native-lib.cpp)

find_library(log-lib log)

set(XLOG_PATH ../jniLibs/jni/${ANDROID_ABI}/)

find_library(XLOG_LIB marsxlog PATHS ${XLOG_PATH} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)

target_link_libraries(native-lib ${log-lib} ${XLOG_LIB})

This file was deleted.

4 changes: 3 additions & 1 deletion samples/android/xlogSample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
buildscript {
repositories {
mavenLocal()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
classpath 'com.android.tools.build:gradle:3.4.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -16,6 +17,7 @@ buildscript {
allprojects {
repositories {
mavenLocal()
google()
jcenter()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

0 comments on commit 485c9d2

Please sign in to comment.