forked from bcgit/bc-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
189 lines (157 loc) · 5.53 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
plugins {
// OSGI
id "biz.aQute.bnd.builder" version "7.0.0"
// Provide convenience executables for trying out the examples.
id 'application'
id 'com.google.protobuf' version '0.9.4'
// Generate IntelliJ IDEA's .idea & .iml project files
// id 'idea'
}
apply plugin: 'java'
apply plugin: 'com.google.protobuf'
sourceSets {
main {
java {
srcDirs 'build/generated/source/proto/main/grpc'
srcDirs 'build/generated/source/proto/main/java'
}
}
java9 {
java {
srcDirs = ['src/main/jdk1.9']
}
}
}
dependencies {
implementation project(':core')
implementation project(':util')
implementation project(':pkix')
implementation project(':prov')
//Provided
implementation(files("../test/libs/annotations-api-6.0.53.jar"))
// implementation(files("../test/libs/protobuf-java-util-3.22.3.jar"))
implementation(files("../test/libs/guava-32.0.1-android.jar"))
implementation(files("../test/libs/grpc-stub-1.58.0.jar"))
implementation(files("../test/libs/protobuf-java-3.22.3.jar"))
implementation(files("../test/libs/grpc-api-1.58.0.jar"))
implementation(files("../test/libs/grpc-protobuf-lite-1.58.0.jar"))
implementation(files("../test/libs/failureaccess-1.0.1.jar"))
implementation(files("../test/libs/grpc-protobuf-1.58.0.jar"))
//Compile
compileOnly(files("../test/libs/grpc-services-1.58.0.jar"))
//Runtime
runtimeOnly(files("../test/libs/grpc-netty-shaded-1.58.0.jar"))
runtimeOnly(files("../test/libs/grpc-core-1.58.0.jar"))
runtimeOnly(files("../test/libs/perfmark-api-0.26.0.jar"))
//Download jars online
// implementation "io.grpc:grpc-protobuf:${grpcVersion}"
// implementation "io.grpc:grpc-services:${grpcVersion}"
// implementation "io.grpc:grpc-stub:${grpcVersion}"
// compileOnly "org.apache.tomcat:annotations-api:6.0.53"
// runtimeOnly "io.grpc:grpc-netty-shaded:${grpcVersion}"
// implementation "com.google.protobuf:protobuf-java-util:${protocVersion}"
java9Implementation files("$bc_prov")
java9Implementation files("$bc_util")
java9Implementation files("$bc_pkix")
java9Implementation files(sourceSets.main.output.classesDirs) {
builtBy compileJava
}
}
def grpcVersion = '1.58.0' // CURRENT_GRPC_VERSION
def protocVersion = '3.22.3'
checkstyleMain {
source = fileTree('src/main/java')
}
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
options.errorprone.disableWarningsInGeneratedCode = true
options.errorprone.errorproneArgs = ["-Xep:IgnoredPureGetter:OFF"]
options.errorprone.errorproneArgs.add("-XepExcludedPaths:.*/build/generated/.*")
}
compileJava9Java {
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(17)
}
sourceCompatibility = 9
targetCompatibility = 9
options.compilerArgs += [
'--module-path', "${bc_prov}${File.pathSeparator}${bc_util}${File.pathSeparator}${bc_pkix}"
]
options.sourcepath = files(['src/main/java', 'src/main/jdk1.9'])
}
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:${protocVersion}"
}
plugins {
grpc {
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
}
}
generateProtoTasks {
all()*.plugins {
grpc {}
}
}
}
jar.archiveBaseName = "bcmls-$vmrange"
startScripts.enabled = false
// Creates start scripts for a class name and adds it to the distribution.
def createStartScripts(String mainClassName) {
String bareName = mainClassName.substring(mainClassName.lastIndexOf('.') + 1);
String taskName = bareName.uncapitalize();
def newTask = tasks.register(taskName, CreateStartScripts) {
mainClass = mainClassName
applicationName = taskName.replaceAll('([A-Z])') { '-' + it[0].uncapitalize() }
outputDir = new File(project.buildDir, 'tmp/scripts/' + name)
// classpath = startScripts.classpath
}
application {
applicationDistribution.into('bin') {
from(newTask)
fileMode = 0755
}
}
}
extractIncludeProto {
dependsOn(":prov:jar",":util:jar")
}
extractIncludeTestProto {
dependsOn(":prov:jar",":util:jar")
}
createStartScripts('org.bouncycastle.mls.client.impl.MLSClient')
jar {
from sourceSets.main.output
into('META-INF/versions/9') {
from sourceSets.java9.output
}
String packages = 'org.bouncycastle.mls.*'
String v = "${rootProject.extensions.ext.bundle_version}"
manifest.attributes('Multi-Release': 'true')
manifest.attributes('Bundle-Name': 'bcmls')
manifest.attributes('Bundle-SymbolicName': 'bcmls')
manifest.attributes('Bundle-RequiredExecutionEnvironment': 'JavaSE-1.8')
manifest.attributes('Export-Package': "${packages};version=${v}")
manifest.attributes('Import-Package': "java.*;resolution:=optional,javax.*;resolution:=optional,!${packages},org.bouncycastle.*;version=\"[${v},${maxVersion})\"")
manifest.attributes('Bundle-Version': "${v}")
}
task sourcesJar(type: Jar) {
archiveBaseName = jar.archiveBaseName
archiveClassifier = 'sources'
from sourceSets.main.allSource
duplicatesStrategy = DuplicatesStrategy.INCLUDE
into('META-INF/versions/9') {
from sourceSets.java9.allSource
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveBaseName = jar.archiveBaseName
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}