-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle
90 lines (78 loc) · 2.69 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
apply plugin: 'com.android.library'
ext {
sdkAarName = "${SDK_AAR_NAME}"
demoLibFolder = "${DEMO_LIB_FOLDER}"
}
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
}
def copyFile(String fromFileName, String intoDir, String fileName) {
def fromFile = new File(fromFileName)
if (!fromFile.exists()) {
println("copyFile error: fromFile:" + fromFile.getAbsolutePath() + " is not exists")
return
}
def intoFileName = intoDir + fileName
def intoFile = new File(intoFileName)
if (intoFile.exists()) {
intoFile.delete()
}
println("fromFile=" + fromFileName)
println("intoDir=" + intoDir)
println("fileName=" + fileName)
println("before copy, file=" + intoFile.getAbsolutePath() + ", exists=" + intoFile.exists())
copy {
from fromFile
into intoDir
rename {
fileName
}
}
println(" after copy, file=" + intoFile.getAbsolutePath() + ", exists=" + intoFile.exists() + ", size=" + intoFile.length())
}
def static getFileCount(String path) {
def file = new File(path)
def files = file.listFiles()
def total = 0
if (files != null) {
def len = files.length
for (int i = 0; i < len; i++) {
if (files[i].directory) {
total += getFileCount(files[i].absolutePath)
} else {
total++
}
}
}
return total
}
build {
def taskName = getProject().getName() + " " + getName()
doLast {
println("=====================" + taskName + " doLast start.=======================")
def srcFileDir = getProjectDir().absolutePath + "/src/main/java/"
def fileCnt = getFileCount(srcFileDir)
println("fileCnt=" + fileCnt)
def buildDir = getBuildDir().getAbsolutePath()
def fromFile = buildDir + "/outputs/aar/corestub-debug.aar"
copyFile(fromFile, demoLibFolder, sdkAarName)
println("=====================" + taskName + " doLast end.=========================")
}
}
build.dependsOn([':libsag:build'])
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}