-
Notifications
You must be signed in to change notification settings - Fork 848
/
build.gradle.kts
52 lines (45 loc) · 1.85 KB
/
build.gradle.kts
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
import ru.vyarus.gradle.plugin.animalsniffer.info.SignatureInfoTask
import ru.vyarus.gradle.plugin.animalsniffer.signature.BuildSignatureTask
plugins {
id("otel.java-conventions")
id("ru.vyarus.animalsniffer")
}
description = "Build tool to generate the Animal Sniffer Android signature"
otelJava.moduleName.set("io.opentelemetry.internal.animalsniffer")
val signatureJar = configurations.create("signatureJar") {
isCanBeConsumed = false
isCanBeResolved = false
}
val signatureJarClasspath = configurations.create("signatureJarClasspath") {
isCanBeConsumed = false
isCanBeResolved = true
extendsFrom(signatureJar)
}
val generatedSignature = configurations.create("generatedSignature") {
isCanBeConsumed = true
isCanBeResolved = false
}
configurations.add(signatureJar)
configurations.add(signatureJarClasspath)
configurations.add(generatedSignature)
dependencies {
signature("com.toasttab.android:gummy-bears-api-21:0.10.0@signature")
signatureJar("com.android.tools:desugar_jdk_libs")
}
val signatureSimpleName = "android.signature"
val signatureBuilderTask = tasks.register("buildSignature", BuildSignatureTask::class.java) {
files(signatureJarClasspath) // All the jar files here will be added to the signature file.
signatures(configurations.signature) // We'll extend from the existing signatures added to this config.
outputName = signatureSimpleName // Name for the generated signature file.
}
// Exposing the "generatedSignature" consumable config to be used in other subprojects
artifacts {
add("generatedSignature", project.provider { File(signatureBuilderTask.get().outputs.files.singleFile, signatureSimpleName) }) {
builtBy(signatureBuilderTask)
}
}
// Utility task to show what's in the signature file
tasks.register("printSignature", SignatureInfoTask::class.java) {
signature = signatureBuilderTask.get().outputFiles
depth = 1
}