-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathbuild.gradle
136 lines (122 loc) · 4.62 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
id 'kotlin-android'
id 'com.google.devtools.ksp'
id 'kotlin-parcelize'
id 'kotlinx-serialization'
}
static def versionNameDate() {
return new Date().format("yyyyMMdd.HH", TimeZone.getTimeZone("GMT+8"))
}
static def getSDKGitHead() {
return "git --git-dir=/home/gure/devproject/Private/Yuyan/YuyanIme/yuyansdk/.git rev-parse HEAD".execute().text.trim()
}
static def getAppGitHead() {
return "git rev-parse HEAD".execute().text.trim()
}
static def getAppBuildTime() {
return "git log -1 --pretty=%ai".execute().text.trim()
}
android {
compileSdk 35
defaultConfig {
minSdk 23
targetSdk 35
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
ndk {
abiFilters 'arm64-v8a', 'armeabi-v7a', "x86", "x86_64"
}
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
lintOptions {
abortOnError false
}
buildConfigField "String", "versionName", "\"${versionNameDate()}\""
buildConfigField "String", "SdkCommitHead", "\"${getSDKGitHead()}\""
buildConfigField "String", "AppCommitHead", "\"${getAppGitHead()}\""
buildConfigField "String", "AppBuildTime", "\"${getAppBuildTime()}\""
}
//多渠道打包: app中多渠道配置要一致
flavorDimensions = ["default"]
productFlavors {
publishNonDefault true //唯一的不同
online {
dimension "default"
buildConfigField "Boolean", "offline", "false"
}
offline {
dimension "default"
buildConfigField "Boolean", "offline", "true"
}
}
buildFeatures {
viewBinding = true
buildConfig = true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard.cfg'
resValue("drawable", "app_icon", "@drawable/ic_sdk_launcher")
resValue("string", "app_name", "@string/ime_yuyan_name")
}
debug {
resValue("drawable", "app_icon", "@drawable/ic_sdk_launcher_debug")
resValue("string", "app_name", "@string/ime_yuyan_name")
}
}
sourceSets {
// offline 离线版本
offline {
jniLibs.srcDirs = ['libs', "src/offline/libs"]
manifest.srcFile('src/offline/AndroidManifest.xml')
}
// online 在线版本
online {
jniLibs.srcDirs = ['libs', "src/online/libs"]
manifest.srcFile('src/online/AndroidManifest.xml')
}
}
//第三方库使用java1.8
compileOptions {
sourceCompatibility 17
targetCompatibility 17
}
namespace 'com.yuyan.imemodule'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.android.material:material:1.11.0'
implementation 'com.google.android.flexbox:flexbox:3.0.0'
implementation 'androidx.emoji2:emoji2:1.3.0'
implementation 'androidx.emoji2:emoji2-views:1.3.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib:2.0.0"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0"
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2'
implementation 'androidx.preference:preference:1.2.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.7'
implementation 'androidx.navigation:navigation-ui-ktx:2.7.7'
implementation 'com.louiscad.splitties:splitties-resources:3.0.0'
implementation 'com.louiscad.splitties:splitties-views-dsl-recyclerview:3.0.0'
implementation 'com.louiscad.splitties:splitties-views-dsl-constraintlayout:3.0.0'
implementation 'com.louiscad.splitties:splitties-views-dsl-appcompat:3.0.0'
implementation 'com.vanniktech:android-image-cropper:4.5.0'
implementation 'com.yanzhenjie.recyclerview:x:1.3.2'
implementation "androidx.room:room-runtime:2.6.1"
ksp "androidx.room:room-compiler:2.6.1"
implementation "androidx.room:room-ktx:2.6.1"
}
tasks.register('makeaar', Copy) {
from('build/outputs/aar/')
into('build/outputs/aar/')
include('imeModule-dev-debug.aar')
rename('imeModule-dev-debug.aar', 'imesdk_' + versionNameDate() + '.aar')
}
makeaar.dependsOn(build)