-
Notifications
You must be signed in to change notification settings - Fork 0
/
licenses.gradle
37 lines (32 loc) · 1.22 KB
/
licenses.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
//////////////////////// ADD LICENSE IN AAR //////////////////////////////////
def projName = name
def outputAarDir = file('build/outputs/aar')
def outputAarUnzipedDir = file('build/outputs/aar/unziped')
def aarReleaseFile = file('build/outputs/aar/' + projName + '-release.aar')
task unzipAar(type: Copy, dependsOn: 'bundleReleaseAar') {
from zipTree(aarReleaseFile)
into outputAarUnzipedDir
doLast { println("unzipAar task completed.") }
}
task generateThirdPartiesLicenses(type: Exec, dependsOn: 'unzipAar') {
workingDir '../scripts'
commandLine 'python3', 'generate_third_parties_licenses.py', project.getName()
doLast { println("generateThirdPartiesLicenses task completed.") }
}
task reZipAar(type: Zip, dependsOn: 'generateThirdPartiesLicenses') {
from outputAarUnzipedDir
includeEmptyDirs = false
include '*'
include '*/*'
include '*/*/*'
archiveFileName.set(projName + "-release.aar")
destinationDirectory.set(outputAarDir)
doLast {
outputAarUnzipedDir.deleteDir()
println("reZipAar task completed.")
}
}
afterEvaluate {
tasks["generateMetadataFileForReleasePublication"].dependsOn(tasks.getByName("reZipAar"))
bundleReleaseAar.finalizedBy(reZipAar)
}