-
Notifications
You must be signed in to change notification settings - Fork 15
/
build.gradle.kts
118 lines (105 loc) · 3.92 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
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
buildscript {
dependencies {
classpath("gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.9")
}
}
plugins {
id("com.github.sherter.google-java-format") version "0.9"
`java-library`
`maven-publish`
signing
}
repositories {
mavenCentral()
maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
}
group = "com.newrelic.telemetry"
// -Prelease=true will render a non-snapshot version
val isRelease = project.findProperty("release") == "true"
version = project.findProperty("releaseVersion") as String + if(isRelease) "" else "-SNAPSHOT"
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
googleJavaFormat {
exclude(".**")
}
dependencies {
api("io.dropwizard.metrics:metrics-core:4.2.18")
api("com.newrelic.telemetry:telemetry-core:0.15.0")
implementation("io.dropwizard:dropwizard-metrics:4.0.0")
implementation("com.newrelic.telemetry:telemetry-http-okhttp:0.15.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.4.2")
testRuntimeOnly("org.slf4j:slf4j-simple:1.7.26")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.4.2")
testImplementation("org.mockito:mockito-core:2.28.2")
}
val jar: Jar by tasks
jar.apply {
manifest.attributes["Implementation-Version"] = project.version
manifest.attributes["Implementation-Vendor"] = "New Relic, Inc"
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
withSourcesJar()
withJavadocJar()
}
val useLocalSonatype = project.properties["useLocalSonatype"] == "true"
configure<PublishingExtension> {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
pom {
name.set(project.name)
description.set("Implementation of a DropWizard metrics Reporter that sends data as dimensional metrics to New Relic")
url.set("https://github.com/newrelic/dropwizard-metrics-newrelic")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}
developers {
developer {
id.set("newrelic")
name.set("New Relic")
email.set("[email protected]")
}
}
scm {
url.set("[email protected]:newrelic/dropwizard-metrics-newrelic.git")
connection.set("scm:[email protected]:newrelic/dropwizard-metrics-newrelic.git")
}
}
}
}
repositories {
maven {
if (useLocalSonatype) {
val releasesRepoUrl = uri("http://localhost:8081/repository/maven-releases/")
val snapshotsRepoUrl = uri("http://localhost:8081/repository/maven-snapshots/")
url = if (isRelease) releasesRepoUrl else snapshotsRepoUrl
}
else {
val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
url = if (isRelease) releasesRepoUrl else snapshotsRepoUrl
}
credentials {
username = System.getenv("SONATYPE_USERNAME")
password = System.getenv("SONATYPE_PASSWORD")
}
}
}
}
signing {
val signingKey: String? by project
val signingKeyId: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign(publishing.publications["mavenJava"])
}