-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
186 lines (161 loc) · 5.71 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
buildscript {
repositories {
mavenCentral()
}
}
plugins {
id 'java'
id 'idea'
id 'application'
id "org.jruyi.thrift" version "0.3.1"
id "us.kirchmeier.capsule" version "1.0.2"
id 'org.hidetake.ssh' version '2.3.0'
}
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
defaultTasks 'build', 'writeClasspath'
version = '1.0'
def jarTitle = 'uvb-server'
def mainClass = 'net.batchik.crdt.Main'
mainClassName = mainClass
group 'net.batchik'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
targetCompatibility = 1.8
idea.module.excludeDirs = []
idea.module.sourceDirs += file("$projectDir/src/generated/gen-java")
repositories {
mavenCentral()
}
configurations {
quasar
capsule
}
dependencies {
// gossip crdt service
compile group: 'org.apache.thrift', name: 'libthrift', version: '0.9.3'
compile group: 'com.pinterest', name: 'quasar-thrift', version: '0.3'
// logging infrastructure
compile group: 'log4j', name: 'log4j', version: '1.2.17'
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.3'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.3'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.21'
compile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.21'
compile group: 'commons-cli', name: 'commons-cli', version: '1.3.1'
compile group: 'commons-configuration', name: 'commons-configuration', version: '1.10'
compile group: 'org.apache.httpcomponents', name: 'httpcore-nio', version: '4.4.4'
compile group: 'org.apache.curator', name: 'curator-x-discovery', version: '2.10.0'
compile 'co.paralleluniverse:capsule:1.0.2'
compile 'co.paralleluniverse:quasar-core:0.7.5:jdk8'
quasar "co.paralleluniverse:quasar-core:0.7.5:jdk8@jar"
}
task wrapper(type: Wrapper) {
gradleVersion = '2.13'
}
compileThrift {
recurse true
generator 'html'
generator 'java', 'private-members'
outputDir "$projectDir/src/generated"
}
classes {
doFirst {
ant.taskdef(
name: 'scanSuspendables',
classname: 'co.paralleluniverse.fibers.instrument.SuspendablesScanner',
classpath: "build/classes/main:build/resources/main:${configurations.quasar.asPath}:${configurations.runtime.asPath}")
ant.scanSuspendables(
auto: true,
suspendablesFile: "src/main/resources/META-INF/suspendables",
supersFile: "src/main/resources/META-INF/suspendable-supers",
append: true) {
fileset(dir: sourceSets.main.output.classesDir)
}
}
}
jar {
baseName = 'uvb-server'
manifest {
attributes (
'Implementation-Title': jarTitle,
'Implementation-Version': version,
'Main-Class': mainClass
)
}
}
run {
jvmArgs "-javaagent:${configurations.quasar.iterator().next()}"
}
// converts Gradle dependencies to Capsule dependencies
def getDependencies(config) {
return config.getAllDependencies().collect {
def res = it.group + ':' + it.name + ':' + it.version +
(!it.artifacts.isEmpty() ? ':' + it.artifacts.iterator().next().classifier : '')
if(!it.excludeRules.isEmpty()) {
res += "(" + it.excludeRules.collect { it.group + ':' + it.module }.join(',') + ")"
}
return res
}
}
task fatCapsule(type: FatCapsule) {
applicationClass mainClass
baseName = 'uvb-server-fat-capsule'
manifest {
attributes(
'Main-Class' : 'Capsule',
'Application-Class' : mainClassName,
'Min-Java-Version' : '1.8.0',
'JVM-Args' : '-server -XX:+UseParNewGC -XX:+UseConcMarkSweepGC',
//'JVM-Args' : run.jvmArgs.join(' '), // copy JVM args from the run task
'System-Properties' : run.systemProperties.collect { k,v -> "$k=$v" }.join(' '),
'Java-Agents' : configurations.quasar.iterator().next().getName()
)
}
}
task mavenCapsule(type: MavenCapsule) {
applicationClass mainClass
baseName = 'uvb-server-capsule'
manifest {
attributes(
'Main-Class' : 'Capsule',
'Application-Class' : mainClassName,
'Min-Java-Version' : '1.8.0',
'JVM-Args' : '-server -XX:+UseParNewGC -XX:+UseConcMarkSweepGC',
//run.jvmArgs.join(' '), // copy JVM args from the run task
'System-Properties' : run.systemProperties.collect { k,v -> "$k=$v" }.join(' '),
'Java-Agents' : getDependencies(configurations.quasar).iterator().next(),
'Dependencies': getDependencies(configurations.runtime).join(' ')
)
}
}
/*
* Write out the classpath for all internal dependencies, then append the
* actual expected build JAR to the end of it.
*/
task writeClasspath(dependsOn: build) << {
new File(buildDir.absolutePath + "/runtime.classpath").withWriter {
out -> out.writeLine(sourceSets.main.runtimeClasspath.asPath +
":" + jar.archivePath);
}
new File(buildDir.absolutePath + "/quasar-core.path").withWriter {
out -> out.writeLine(configurations.quasar.asPath);
}
}
remotes {
shell {
host = 'shell.csh.rit.edu'
user = 'jd'
knownHosts = allowAnyHosts
agent = true
identity = file("${System.getProperty('user.home')}/.ssh/id_rsa")
}
}
def jarName = "build/libs/uvb-server-fat-capsule-1.0-SNAPSHOT-capsule.jar"
task deploy << {
println "deploying jar: $jarName"
ssh.run {
session(remotes.shell) {
put from: jarName,
into: '/users/u20/jd/public_html/uvb.jar'
}
}
}