generated from adempiere/adempiere-grpc-template-service
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuild.gradle
More file actions
247 lines (216 loc) · 7.2 KB
/
build.gradle
File metadata and controls
247 lines (216 loc) · 7.2 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
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
plugins {
id 'java'
id 'com.google.protobuf' version '0.9.4'
id 'idea'
// Provide convenience executables for trying out the examples.
id 'application'
// Generate Visual Studio Code .vscode & .json project files
id 'visual-studio'
// Read .env files
id "io.github.uoxx3.project-environment" version "1.0.1"
}
def grpcVersion = '1.65.1'
def protobufVersion = '3.25.3'
def baseVersion = '3.9.4'
def baseGroupId = 'io.github.adempiere'
def privateDependencyBaseVersion = "adempiere-3.9.4"
def descriptorFile = "adempiere-processors-service.dsc"
ext {
javaMainClass = "org.spin.processor.server.ProcessorServer"
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_17
}
application {
mainClass.set(javaMainClass)
// distribution output
distributions {
main {
contents {
}
}
}
}
jar {
manifest {
attributes(
"Main-Class": javaMainClass
)
}
}
run {
doFirst {
// Set environment variables by .env project file
environment 'JWT_SECRET_KEY', '52D11677CBB494878FD6E93B5A6615052A93B8AC654DE543CC4F53BA56027B1C'
environment 'JWT_EXPIRATION_TIME', 86400000
environment "TZ", projectEnv.get("TZ", null) ?: "America/Caracas"
}
args = [
"resources/env.yaml"
]
}
repositories {
mavenLocal()
mavenCentral()
maven {
// Custom GitHub Repository (ADempiere by Default)
url = findProperty("deployRepository") ?: System.properties['deploy.repository'] ?:
projectEnv.get("GITHUB_DEPLOY_REPOSITORY", null) ?: System.getenv("GITHUB_DEPLOY_REPOSITORY") ?:
"https://maven.pkg.github.com/adempiere/adempiere"
credentials {
// project property, system property, .env project file, system enviroment variable
username = findProperty("deployUsername") ?: System.properties['deploy.user'] ?:
projectEnv.get("GITHUB_DEPLOY_USER", null) ?: System.getenv("GITHUB_DEPLOY_USER")
password = findProperty("deployToken") ?: System.properties['deploy.token'] ?:
projectEnv.get("GITHUB_DEPLOY_TOKEN", null) ?: System.getenv("GITHUB_DEPLOY_TOKEN")
}
}
maven {
// Adempiere GitHub Organization
url = 'https://maven.pkg.github.com/adempiere/adempiere'
credentials {
// project property, system property, .env project file, system enviroment variable
username = findProperty("deployUsername") ?: System.properties['deploy.user'] ?:
projectEnv.get("GITHUB_DEPLOY_USER", null) ?: System.getenv("GITHUB_DEPLOY_USER")
password = findProperty("deployToken") ?: System.properties['deploy.token'] ?:
projectEnv.get("GITHUB_DEPLOY_TOKEN", null) ?: System.getenv("GITHUB_DEPLOY_TOKEN")
}
}
}
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:${protobufVersion}"
}
plugins {
grpc {
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
}
}
generateProtoTasks {
all()*.plugins {
grpc {}
}
all().configureEach { task ->
// If true, will generate a descriptor_set.desc file under
// task.outputBaseDir. Default is false.
// See --descriptor_set_out in protoc documentation about what it is.
task.generateDescriptorSet = true
// Allows to override the default for the descriptor set location
task.descriptorSetOptions.path = "${projectDir}/build/descriptors/${descriptorFile}"
// task.descriptorSetOptions.path = "${projectDir}/build/descriptors/adempiere-processors-service.dsc"
// If true, the descriptor set will contain line number information
// and comments. Default is false.
task.descriptorSetOptions.includeSourceInfo = true
// If true, the descriptor set will contain all transitive imports and
// is therefore self-contained. Default is false.
task.descriptorSetOptions.includeImports = true
}
}
}
sourceSets {
main {
java {
srcDirs 'build/generated/source/proto/main/grpc'
srcDirs 'build/generated/source/proto/main/java'
srcDirs 'src/main/proto'
}
resources {
srcDirs 'src/main/java'
include 'org/spin/base/version.properties'
}
}
}
startScripts {
applicationName = 'start-backend'
// default JVM setting
defaultJvmOpts = [
"-DPropertyFile=Adempiere.properties",
"-Dorg.adempiere.server.embedded=true"
]
outputDir = new File(project.buildDir, 'tmp')
classpath = jar.outputs.files + project.configurations.runtimeClasspath
// Configure script names with extensions
doLast {
def unixScript = file(getUnixScript())
def windowsScript = file(getWindowsScript())
// Rename files after generating them
unixScript.renameTo("${unixScript.parent}/${applicationName}.sh")
windowsScript.renameTo("${windowsScript.parent}/${applicationName}.bat")
// Configure permissions for generated scripts
unixScript.setExecutable(true, false)
// windowsScript.setExecutable(true, false)
}
}
// Copy proto descriptor another folder
allprojects {
task copyDescriptor(type: Copy) {
from "${projectDir}/build/descriptors/${descriptorFile}"
into "${projectDir}/docker-compose/envoy/definitions"
// rename { "${descriptorFile}" }
// task dependency
dependsOn "generateTestProto"
}
tasks.matching {
it.name.startsWith('compileJava')
}.each { task ->
task.finalizedBy copyDescriptor
}
}
// compressed files task
distTar {
dependsOn compileTestJava, copyDescriptor, startScripts
}
distZip {
dependsOn compileTestJava, copyDescriptor, startScripts
}
// Create release for project
task createRelease(type: Copy) {
dependsOn build
from file("$buildDir/distributions/")
into file("$buildDir/release/")
//destinationDir(file('build/release/'))
doLast {
file('build/release/')
.listFiles({file -> file.isFile()} as FileFilter).sort()
.each { File file ->
ant.checksum file: file
}
}
}
task cleanBuild(type: GradleBuild) {
tasks = ['clean', 'build']
}
dependencies {
implementation fileTree(
dir: 'dependencies',
include: [
'*.jar'
]
)
implementation "io.grpc:grpc-netty-shaded:${grpcVersion}"
implementation "io.grpc:grpc-alts:${grpcVersion}"
implementation "io.netty:netty-handler:4.1.107.Final"
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
implementation "io.grpc:grpc-stub:${grpcVersion}"
implementation "io.grpc:grpc-netty:${grpcVersion}"
// https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java
implementation "com.google.protobuf:protobuf-java:${protobufVersion}"
implementation "com.google.protobuf:protobuf-java-util:${protobufVersion}"
implementation "io.jsonwebtoken:jjwt-api:0.12.6"
implementation "io.jsonwebtoken:jjwt-impl:0.12.6"
implementation "io.jsonwebtoken:jjwt-jackson:0.12.6"
//implementation 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359'
//implementation 'com.sun.xml.bind:jaxb-impl:3.0.0-M4'
//implementation 'com.sun.xml.bind:jaxb-core:3.0.0-M4'
//implementation 'javax.activation:activation:1.1.1'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.17.2'
// ADempiere Core
implementation "${baseGroupId}:base:${baseVersion}"
implementation "${baseGroupId}:jasperreports:${baseVersion}"
// ADempiere Projects with additional features
implementation "${baseGroupId}:adempiere-grpc-utils:1.6.2"
implementation "${baseGroupId}:adempiere-business-processors:1.1.8"
// Others
compileOnly 'org.apache.tomcat:annotations-api:6.0.53'
}