-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
104 lines (92 loc) · 3.07 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
// Folder where the plugins are built
ext.pluginsDir = "${rootProject.buildDir}"
apply plugin: 'java'
apply plugin: 'idea'
group 'com.lucidworks.fusion.connector'
version '1.0-SNAPSHOT'
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
repositories {
mavenCentral()
mavenLocal()
maven {
url "https://artifactory.lucidworks.com/artifactory/public-artifacts/"
}
jcenter()
}
dependencies {
implementation "com.lucidworks-connector.sdk:connector-plugin-sdk:${connectorsSDKVersion}"
implementation "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
implementation "com.github.jasminb:jsonapi-converter:${jsonApiVersion}"
compileOnly "org.projectlombok:lombok:${lombokVersion}"
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
testCompile group: 'junit', name: 'junit', version: '4.12'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.6.1'
compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.6.1'
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
}
jar {
baseName = "${project.name}"
}
task plugin(type: Jar) {
archiveName = "${project.name}" + ".zip"
manifest {
attributes 'Plugin-Class': "${pluginClass}",
'Plugin-Type': "connector",
'Plugin-Id': "${pluginId}",
'Plugin-Version': "${version}",
'Plugin-Provider': "${pluginProvider}",
'Plugin-Connectors-SDK-Version': "${connectorsSDKVersion}"
}
into('lib') {
from configurations.compile - configurations.compileOnly
// Copy the plugin
from jar
}
extension('zip')
}
task assemblePlugin(type: Copy) {
from plugin
into pluginsDir
}
task deploy(type: Exec, dependsOn: ["assemblePlugin"]) {
def service = "${restService}"
if (!service.endsWith("/")) {
service += "/"
}
service += "plugins"
commandLine "curl",
"-m ${maxTimeout}",
"-u",
"${userPass}",
"-X",
"PUT",
"-H",
"content-type:application/zip",
"${service}",
"--data-binary",
"@${pluginsDir}/${plugin.outputs.files.singleFile.getName()}"
doLast {
logger.info("Curl result: ${standardOutput.toString().trim()}")
}
}
task connect(type: Exec, dependsOn: ["assemblePlugin"]) {
def clientJar = "${clientJarAbsolutePath}"
def argsList = []
argsList << "java"
argsList << "-Dcom.lucidworks.fusion.plugin.hosts=${fusionRpcTarget}"
argsList << "-Dcom.lucidworks.fusion.plugin.stop.port=${stopPort}"
if (project.hasProperty("debug")) {
argsList << "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5010"
}
argsList << "-jar"
argsList << clientJar
argsList << "${project.buildDir}/libs/${project.name}.zip"
commandLine argsList
doFirst {
println " -- Using client-jar ${clientJar}"
println " -- Connecting plugin ${project.buildDir}/libs/${project.name}.zip to ${fusionRpcTarget}"
}
}