-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathbuild.gradle
More file actions
157 lines (141 loc) · 5.33 KB
/
build.gradle
File metadata and controls
157 lines (141 loc) · 5.33 KB
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
plugins {
id 'java-library'
id 'com.google.protobuf' version '0.8.16'
// Generate IntelliJ IDEA's .idea & .iml project files
id 'idea'
id 'maven-publish'
id 'signing'
}
group 'com.microsoft'
version = '1.5.0'
archivesBaseName = 'durabletask-client'
def grpcVersion = '1.59.0'
def protocVersion = '3.25.0'
def jacksonVersion = '2.15.3'
// When build on local, you need to set this value to your local jdk11 directory.
// Java11 is used to compile and run all the tests.
// Example for Windows: C:/Program Files/Java/openjdk-11.0.12_7/
def PATH_TO_TEST_JAVA_RUNTIME = "$System.env.JDK_11"
dependencies {
// https://github.com/grpc/grpc-java#download
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
implementation "io.grpc:grpc-stub:${grpcVersion}"
runtimeOnly "io.grpc:grpc-netty-shaded:${grpcVersion}"
compileOnly "org.apache.tomcat:annotations-api:6.0.53"
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
implementation "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"
implementation "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
implementation "com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${jacksonVersion}"
testImplementation(platform('org.junit:junit-bom:5.7.2'))
testImplementation('org.junit.jupiter:junit-jupiter')
}
compileJava {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
compileTestJava {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
options.fork = true
options.forkOptions.executable = "${PATH_TO_TEST_JAVA_RUNTIME}/bin/javac"
}
protobuf {
protoc { artifact = "com.google.protobuf:protoc:${protocVersion}" }
plugins {
grpc { artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}" }
}
generateProtoTasks {
all()*.plugins { grpc {} }
}
}
sourceSets {
main {
proto {
srcDir '../submodules/durabletask-protobuf/protos'
}
java {
srcDirs 'build/generated/source/proto/main/grpc'
srcDirs 'build/generated/source/proto/main/java'
}
}
}
tasks.withType(Test) {
executable = new File("${PATH_TO_TEST_JAVA_RUNTIME}", 'bin/java')
}
test {
useJUnitPlatform {
// Skip tests tagged as "integration" since those are slower
// and require external dependencies.
excludeTags "integration"
}
}
// Unlike normal unit tests, some tests are considered "integration tests" and shouldn't be
// run during a build. We instead tag them as "integration" tests and only run them as part
// of this custom integrationTest task. Normal builds won't execute this, but CI builds will
// by running "gradle check" (see the dependsOn() further down).
task integrationTest(type: Test) {
useJUnitPlatform {
includeTags 'integration'
}
dependsOn build
shouldRunAfter test
testLogging.showStandardStreams = true
}
publishing {
repositories {
maven {
url "file://$project.rootDir/repo"
}
}
publications {
mavenJava(MavenPublication) {
from components.java
artifactId = archivesBaseName
pom {
name = 'Durable Task Client SDK for Java'
description = 'This package contains classes and interfaces for building Durable Task orchestrations in Java.'
url = "https://github.com/microsoft/durabletask-java/tree/main/client"
licenses {
license {
name = "MIT License"
url = "https://opensource.org/licenses/MIT"
distribution = "repo"
}
}
developers {
developer {
id = "Microsoft"
name = "Microsoft Corporation"
}
}
scm {
connection = "scm:git:https://github.com/microsoft/durabletask-java"
developerConnection = "scm:git:git@github.com:microsoft/durabletask-java"
url = "https://github.com/microsoft/durabletask-java/tree/main/client"
}
// use below script to include compile-only dependencies when generated pom file.
// This is pain point when we onboard API docs as the missing compile-only dependencies crash the
// API doc's team onboarding pipeline.
withXml {
project.configurations.compileOnly.allDependencies.each { dependency ->
asNode().dependencies[0].appendNode("dependency").with {
it.appendNode("groupId", dependency.group)
it.appendNode("artifactId", dependency.name)
it.appendNode("version", dependency.version)
it.appendNode("scope", "provided")
}
}
}
}
}
}
}
// TODO: manual signing temporarily disabled, in favor of 1ES signing
//signing {
// sign publishing.publications.mavenJava
//}
java {
withSourcesJar()
withJavadocJar()
}