-
Notifications
You must be signed in to change notification settings - Fork 34
/
build.gradle
208 lines (179 loc) · 5.32 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
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
/*
* Copyright 2020 Amazon.com, Inc. or its affiliates.
* Licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
plugins {
id 'java-library'
id 'com.diffplug.spotless' version '5.8.2'
id 'maven-publish'
id 'signing'
id "me.champeau.jmh" version "0.6.6"
}
group "software.amazon.cloudwatchlogs"
allprojects {
compileJava {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
version = '4.2.0'
}
java {
withJavadocJar()
withSourcesJar()
}
repositories {
jcenter()
mavenCentral()
}
sourceSets {
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration-test/java')
}
resources.srcDir file('src/integration-test/resources')
}
}
configurations {
integrationTestImplementation.extendsFrom testImplementation
}
dependencies {
annotationProcessor 'org.projectlombok:lombok:1.18.24'
compileOnly 'org.projectlombok:lombok:1.18.12'
implementation 'com.fasterxml.jackson.core:jackson-core:2.14.2'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.14.2'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.2'
implementation 'org.slf4j:slf4j-api:2.0.6'
implementation 'org.javatuples:javatuples:1.2'
implementation 'org.apache.commons:commons-lang3:3.12.0'
// Use JUnit test framework
testImplementation 'software.amazon.awssdk:cloudwatch:2.20.13'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.9.2'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.9.2'
testImplementation 'org.junit.vintage:junit-vintage-engine:5.9.2'
testImplementation 'org.mockito:mockito-core:2.+'
testImplementation 'org.powermock:powermock-module-junit4:2.0.9'
testImplementation 'org.powermock:powermock-api-mockito2:2.0.9'
testImplementation 'com.github.javafaker:javafaker:1.0.2'
testImplementation 'com.github.tomakehurst:wiremock-jre8:2.35.0'
testCompileOnly 'org.projectlombok:lombok:1.18.26'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.26'
testImplementation 'org.openjdk.jmh:jmh-core:1.36'
testImplementation 'org.openjdk.jmh:jmh-generator-annprocess:1.36'
jmhAnnotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.36'
}
spotless {
format 'misc', {
target '*.gradle', '*.md', '.gitignore'
trimTrailingWhitespace()
indentWithTabs()
endWithNewline()
}
java {
importOrder()
googleJavaFormat('1.7').aosp()
removeUnusedImports()
}
}
test {
outputs.upToDateWhen {false}
useJUnitPlatform()
}
jar {
manifest {
attributes 'Implementation-Version': archiveVersion.get()
}
}
task integrationTest(type: Test) {
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
testLogging.showStandardStreams = true
}
task integ(type: Exec) {
commandLine './bin/run-integ-tests.sh'
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
tasks.named('wrapper') {
gradleVersion = '7.4.2'
distributionType = Wrapper.DistributionType.ALL
}
def repoUrl = "https://aws.oss.sonatype.org/service/local/staging/deploy/maven2/"
def repoPassword = System.getenv('mavenPassword')
def repoUserName = System.getenv('mavenUserName')
def buildNumber = System.getenv('CODEBUILD_BUILD_NUMBER')
publishing {
publications {
mavenJava(MavenPublication) {
ext.get_version = {
if (buildNumber == null) {
return version + ".dev"
} else {
return version + "." + buildNumber
}
}
//TODO: add the build version properly
//version = get_version()
from components.java
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = 'aws-embedded-metrics'
description = 'aws-embedded-metrics for java'
url = 'https://github.com/awslabs/aws-embedded-metrics-java'
scm {
url = 'https://github.com/awslabs/aws-embedded-metrics-java'
connection = 'https://github.com/awslabs/aws-embedded-metrics-java'
developerConnection = 'https://github.com/awslabs/aws-embedded-metrics-java'
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://github.com/awslabs/aws-embedded-metrics-java/blob/master/LICENSE'
}
}
developers {
developer {
id = 'aws_emf'
name = 'AWS CloudWatch'
email = '[email protected]'
}
}
}
}
}
repositories {
maven {
name = "mavenRepo"
url = repoUrl
credentials {
username = repoUserName
password = repoPassword
}
}
}
}
signing {
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}