-
Notifications
You must be signed in to change notification settings - Fork 36
/
build.gradle.kts
74 lines (69 loc) · 2.41 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import com.newrelic.telemetry.gradle.configureRepositories
import com.newrelic.telemetry.gradle.configuredPom
plugins {
java
id("java-library")
id("maven-publish")
id("signing")
id("com.github.sherter.google-java-format") version "0.9"
id("org.ysb33r.java.modulehelper") version("0.9.0") apply false
id("com.github.johnrengelman.shadow") version ("5.2.0") apply false
}
allprojects {
val release: String? by project
version = if ("true" == release) version else "${version}-SNAPSHOT"
repositories {
mavenCentral()
jcenter()
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
}
listOf(":telemetry-http-okhttp", ":telemetry-http-java11" , ":telemetry-all").forEach {
project(it) {
apply(plugin = "java-library")
apply(plugin = "maven-publish")
apply(plugin = "signing")
val release: String? by project
tasks {
val taskScope = this
val sources = sourceSets
val sourcesJar by creating(Jar::class) {
dependsOn(JavaPlugin.CLASSES_TASK_NAME)
archiveClassifier.set("sources")
from(sources.main.get().allSource)
}
val javadocJar by creating(Jar::class) {
dependsOn(JavaPlugin.JAVADOC_TASK_NAME)
archiveClassifier.set("javadoc")
from(taskScope.javadoc)
}
val jar: Jar by taskScope
jar.apply {
manifest {
attributes(mapOf(
"Implementation-Version" to project.version,
"Implementation-Vendor" to "New Relic, Inc.",
"Automatic-Module-Name" to "com.newrelic.telemetry" // Hack
))
}
}
}
val useLocalSonatype = project.properties["useLocalSonatype"] == "true"
configure<PublishingExtension> {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
artifact(tasks["sourcesJar"])
artifact(tasks["javadocJar"])
configuredPom(project)
}
}
configureRepositories(project, useLocalSonatype, "mavenJava", release)
}
}
}