forked from RxReader/tencent_kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
96 lines (76 loc) · 2.71 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
File pubspec = new File(project.projectDir.parentFile, 'pubspec.yaml')
String yaml = pubspec.text
// Using \s*['|"]?([^\n|'|"]*)['|"]? to extract version number.
java.util.regex.Matcher versionMatcher = java.util.regex.Pattern.compile("^version:\\s*['|\"]?([^\\n|'|\"]*)['|\"]?\$", java.util.regex.Pattern.MULTILINE).matcher(yaml)
versionMatcher.find()
String library_version = versionMatcher.group(1).replaceAll("\\+", "-")
File flutter_project_dir = rootProject.projectDir.parentFile
def cfg = new org.yaml.snakeyaml.Yaml().load(new File(flutter_project_dir, 'pubspec.yaml').text)
String app_id = cfg.tencent_kit?.app_id
if (app_id == null) {
throw new IllegalArgumentException("tencent app id is null, add code in pubspec.yaml:\ntencent_kit:" +
"\n app_id: \${your tencent app id}" +
"\n universal_link: https://\${your applinks domain}/universal_link/\${example_app}/qq_conn/\${your tencent app id}/ # 可选项目")
}
group 'io.github.v7lin.tencent_kit'
version library_version
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath 'org.yaml:snakeyaml:1.17'
}
}
rootProject.allprojects {
repositories {
google()
mavenCentral()
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 31
if (project.android.hasProperty("namespace")) {
namespace 'com.io.github.v7lin.tencent_kit'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// useLibrary 'org.apache.http.legacy'
resourcePrefix 'tencent_kit'
defaultConfig {
minSdkVersion 16
// library 混淆 -> 随 library 引用,自动添加到 apk 打包混淆
consumerProguardFiles 'consumer-rules.pro'
manifestPlaceholders += [
TENCENT_APP_ID: app_id
]
}
flavorDimensions 'vendor'
productFlavors {
vendor {
dimension 'vendor'
// library 混淆 -> 随 library 引用,自动添加到 apk 打包混淆
consumerProguardFiles 'consumer-vendor-rules.pro'
}
}
dependencies {
vendorImplementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:5.0.0'
}
testOptions {
unitTests.all {
unitTests.returnDefaultValues = true
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
outputs.upToDateWhen {false}
showStandardStreams = true
}
}
}
}