-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
178 lines (155 loc) · 5 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
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 'de.undercouch:gradle-download-task:5.3.0'
}
}
description = "library template project"
group = 'net.rossonet.commons'
version = '0.0.1'
ext {
sourceCompatibility = 1.8
ossrhPassword = System.getenv('OSSRH_PASSWORD')
}
repositories {
mavenCentral()
jcenter()
}
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'eclipse'
apply plugin: "com.gorylenko.gradle-git-properties"
apply plugin: 'jacoco'
apply plugin: 'base'
apply plugin: 'distribution'
apply plugin: 'signing'
apply plugin: 'maven-publish'
dependencies {
api group: 'org.json', name: 'json', version: '20220924'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.1'
testImplementation group: 'com.ginsberg', name: 'junit5-system-exit', version: '1.1.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.1'
}
task eclipseClosedDependencies {}
task eclipseClosedDependencies_ {}
eclipse {
classpath {
downloadJavadoc = true
downloadSources = true
}
}
task view { doLast { println "Working on project ${project.name} [ ${project.description} ]" } }
jar.doLast { task ->
ant.checksum file: task.archivePath
}
java {
withJavadocJar()
withSourcesJar()
}
gitProperties {
failOnNoGitDirectory = false
customProperty 'component', "${project.name}"
dateFormat = "yyyy-MM-dd HH:mm:ssZ"
dateFormatTimeZone = 'GMT'
}
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 = 'andrea.ambrosini@rossonet.org'
}
}
scm {
connection = 'scm:git:git://github.com/rossonet/TemplateCommons.git'
developerConnection = 'scm:git:ssh://github.com:rossonet/TemplateCommons.git'
url = 'https://github.com/rossonet/TemplateCommons/tree/master'
}
}
}
}
repositories {
maven {
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
name = "sonatype"
credentials {
username "rossonet"
password "${ossrhPassword}"
}
}
}
}
signing {
sign publishing.publications.mavenJava
}