-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
127 lines (110 loc) · 3.1 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
plugins {
id 'idea'
id 'java-library'
id 'maven-publish'
}
group 'com.linkedin.ktls'
ext {
jfrogUsername = System.getenv('JFROG_USERNAME')
jfrogApiKey = System.getenv('JFROG_API_KEY')
// By default, publish to JFrog.
mavenUrl = project.hasProperty('mavenUrl') ? project.mavenUrl : jfrogRepoUrl
mavenUsername = project.hasProperty('mavenUsername') ? project.mavenUsername : jfrogUsername
mavenPassword = project.hasProperty('mavenPassword') ? project.mavenPassword : jfrogApiKey
}
repositories {
//Uncomment mavenLocal to publish artifacts to local maven
//mavenLocal()
mavenCentral()
}
java {
toolchain {
//Used java version 11 for enabling supported cipher suites for enabling KTLS
languageVersion = JavaLanguageVersion.of(11)
}
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.1'
testImplementation 'org.bouncycastle:bcpkix-jdk18on:1.71.1'
testImplementation 'commons-codec:commons-codec:1.15'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
}
test {
useJUnitPlatform()
}
sourceSets {
main {
resources {
srcDirs "src/main/resources", "build/natives/lib"
}
}
}
compileJava {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
options.compilerArgs += ["-h", file("src/main/include/jni_generated")]
}
def os = System.getProperty("os.name").toLowerCase()
def isLinux = os.contains("linux")
task compileJNI {
dependsOn compileJava
doLast {
// Run the build-native.sh script if the "buildType" flag is set
if (project.hasProperty('buildType') && project.getProperty('buildType') == 'native') {
exec {
commandLine 'scripts/build-native.sh'
}
} else {
exec {
commandLine 'scripts/prepare-docker-image.sh'
}
exec {
commandLine 'scripts/build-linux-on-docker.sh'
}
}
}
}
clean.doFirst {
delete fileTree('src/main/include/jni_generated') {
include '*.h'
}
}
processResources {
dependsOn compileJNI
}
tasks.withType(Test) {
systemProperty "java.library.path", "build/natives/lib"
testLogging.showStandardStreams = true
}
publishing {
repositories {
maven {
url = mavenUrl
credentials {
username = mavenUsername
password = mavenPassword
}
}
}
publications {
maven(MavenPublication) {
from components.java
pom {
url = 'https://github.com/linkedin/ktls-jni'
licenses {
license {
name = 'BSD 2-Clause License'
url = 'https://opensource.org/licenses/BSD-2-Clause'
distribution = 'repo'
}
}
}
}
}
}
publishToMavenLocal.dependsOn(assemble)
task install {
dependsOn publishToMavenLocal
}
publish.dependsOn install