-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
259 lines (225 loc) · 8.02 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
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
248
249
250
251
252
253
254
255
256
257
258
259
buildscript {
repositories {
mavenCentral()
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "com.gorylenko.gradle-git-properties:gradle-git-properties:2.4.1"
classpath 'com.netflix.nebula:gradle-ospackage-plugin:11.2.0'
classpath 'de.undercouch:gradle-download-task:5.4.0'
classpath 'gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0'
classpath "com.palantir.gradle.docker:gradle-docker:0.35.0"
}
}
plugins {
id 'org.graalvm.buildtools.native' version '0.9.20'
}
description = "Rossonet template project for console applications"
group = 'net.rossonet.agent'
version = '0.0.3'
ext {
sourceCompatibility = 1.8
mainClassName = "net.rossonet.agent.MainAgent"
mainPicocliCommandClass = "net.rossonet.cmd.commands.SystemInfoCommand"
debianName = "${project.name}"
packageName = "${project.name}"
ossrhPassword = System.getenv('OSSRH_PASSWORD')
}
repositories {
mavenCentral()
jcenter()
}
apply plugin: 'com.palantir.docker'
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'eclipse'
apply plugin: "com.gorylenko.gradle-git-properties"
apply plugin: 'jacoco'
apply plugin: "com.netflix.nebula.ospackage"
apply plugin: 'base'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'distribution'
apply plugin: 'signing'
apply plugin: 'maven-publish'
apply plugin: 'application'
dependencies {
implementation 'net.rossonet.commons:rossonet-helper:0.3.2'
implementation 'net.rossonet.commons.command:command-line-to-action:0.2.1'
annotationProcessor 'info.picocli:picocli-codegen:4.7.1'
implementation group: 'org.json', name: 'json', version: '20230227'
implementation 'org.yaml:snakeyaml:2.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2'
testImplementation group: 'com.ginsberg', name: 'junit5-system-exit', version: '1.1.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2'
}
task eclipseClosedDependencies {}
task eclipseClosedDependencies_ {}
eclipse {
classpath {
downloadJavadoc = true
downloadSources = true
}
}
docker {
name "rossonet/${project.name.replaceAll(/\B[A-Z]/) { '-' + it }.toLowerCase()}:${version}"
dockerfile file('Dockerfile.gradle')
files "$buildDir/distributions/${project.name}-${version}.tar"
pull true
noCache true
}
tasks.dockerPrepare.dependsOn("distTar")
task view { doLast { println "Working on project ${project.name} [ ${project.description} ]" } }
jar {
manifest {
attributes 'Main-Class': "${mainClassName}"
}
enabled = true
}
jar.doLast { task ->
ant.checksum file: task.archivePath
}
shadowJar {
minimize()
}
java {
withJavadocJar()
withSourcesJar()
}
gitProperties {
failOnNoGitDirectory = false
customProperty 'component', "${project.name}"
dateFormat = "yyyy-MM-dd HH:mm:ssZ"
dateFormatTimeZone = 'GMT'
}
shadowJar.doLast{ println ("You can find the fat jar of ${project.name} at $buildDir/libs/${project.name}-${version}-all.jar") }
test {
useJUnitPlatform()
}
javadoc{
destinationDir = file("${project.buildDir}/docs/javadoc/${project.name}/")
failOnError=false
}
task theiaIdeBackend(type: Exec) {
workingDir "./"
commandLine 'docker', 'run', '--init', '--rm', '-p', '3000:3000', '-d', '-v', "${projectDir}:/home/project:cached", 'rossonet/theia-ide:latest'
}
task theiaIdeBackendNoCached(type: Exec) {
workingDir "./"
commandLine 'docker', 'run', '--init', '--rm', '-p', '3000:3000', '-d', '-v', "${projectDir}:/home/project", 'rossonet/theia-ide:latest'
}
task theiaIdeBackendNoVolume(type: Exec) {
workingDir "./"
commandLine 'docker', 'run', '--init', '--rm', '-p', '3000:3000', '-d', '--name', "docker-ide-${project.name}", 'rossonet/theia-ide:latest'
}
task theiaIdeBackendCopy(type: Exec) {
theiaIdeBackendCopy.dependsOn("theiaIdeBackendNoVolume")
workingDir "./"
commandLine 'docker', 'cp', '.', "docker-ide-${project.name}:/home/project/"
}
task theiaIdeBackendStart(type: Exec) {
description 'Run Theia IDE container with docker.'
theiaIdeBackendStart.dependsOn("theiaIdeBackendCopy")
group "Theia IDE on Docker Container"
workingDir "./"
commandLine 'docker', 'exec', '-u', 'root', "docker-ide-${project.name}", '/bin/chown', '-R', 'theia:theia', '/home/project'
commandLine 'docker', 'exec', '-u', 'root', "docker-ide-${project.name}", '/bin/chown', '-R', 'theia:theia', '/home/theia'
doLast { println "\n\n*** You can find the Theia IDE at http://localhost:3000 ***" }
doLast { println "To shutdown the IDE:\ndocker stop docker-ide-${project.name}\n- save your work on repository before!\n\n" }
}
task printTheiaIdeBackendDockerCommand(type: Exec) {
workingDir "./"
commandLine 'echo', 'docker', 'run', '--init', '-p', '3000:3000', '-d', '--name', "docker-ide-${project.name}", 'rossonet/theia-ide:latest'
}
task theiaIdeLocalBrowser(type: Exec) {
group "Theia IDE on Docker Container"
description 'Open browser to local Theia IDE.'
workingDir "./"
commandLine 'xdg-open', 'http://localhost:3000'
}
publishing {
publications {
mavenJava(MavenPublication){
artifactId = "${project.name}"
from components.java
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = "${project.name}"
description = "${project.description}"
url = 'https://app.rossonet.net/'
licenses {
license {
name = 'Apache-2.0 license'
url = 'https://www.apache.org/licenses/LICENSE-2.0'
}
}
developers {
developer {
id = 'ar4k'
name = 'Andrea Ambrosini'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com/rossonet/TemplateConsoleApplication.git'
developerConnection = 'scm:git:ssh://github.com:rossonet/TemplateConsoleApplication.git'
url = 'https://github.com/rossonet/TemplateConsoleApplication/tree/master'
}
}
}
}
repositories {
maven {
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
name = "sonatype"
credentials {
username "rossonet"
password "${ossrhPassword}"
}
}
}
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
signing {
sign publishing.publications.mavenJava
}
application {
mainClass = "${mainClassName}"
}
graalvmNative {
toolchainDetection = false
binaries {
main {
verbose = true
sharedLibrary = false
mainClass = "${mainClassName}"
}
}
}
task generateGraalReflectionConfig (dependsOn: 'classes', type: JavaExec) {
group = "Build"
description = "Generate GraalVM Reflection Configuration."
main = 'picocli.codegen.aot.graalvm.ReflectionConfigGenerator'
classpath = configurations.annotationProcessor + sourceSets.main.runtimeClasspath
def outputFile = new File(project.buildDir, 'cli-reflect.json')
args = ["--output=$outputFile", "${mainPicocliCommandClass}"]
}
task generateManpageAsciiDoc(type: JavaExec) {
dependsOn(classes)
group = "Documentation"
description = "Generate AsciiDoc manpage."
classpath(configurations.compileClasspath, configurations.annotationProcessor, sourceSets.main.runtimeClasspath)
main 'picocli.codegen.docgen.manpage.ManPageGenerator'
args "${mainPicocliCommandClass}", "--outdir=${project.buildDir}/generated-picocli-docs", "-v" //, "--template-dir=src/docs/mantemplates"
}