-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathbuild.gradle
More file actions
155 lines (131 loc) · 3.93 KB
/
build.gradle
File metadata and controls
155 lines (131 loc) · 3.93 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
ext.connectorprojects = subprojects - project("shared-lib")
subprojects {
apply plugin: 'java'
apply plugin: 'idea'
// Folder where the plugins are built
ext.pluginsDir = "${rootProject.buildDir}/plugins"
configurations {
provided
compileClasspath.extendsFrom(provided)
remoteConnector
}
repositories {
mavenCentral()
mavenLocal()
maven {
url "https://artifactory.lucidworks.com/artifactory/public-artifacts/"
}
repositories {
def pluginsLucidworks = ivy {
url 'https://plugins.lucidworks.com/'
patternLayout {
artifact '/[organisation]/5.3/[module]-[revision].[ext]'
artifact '/[organisation]/5.4/[module]-[revision].[ext]'
}
metadataSources { artifact() }
}
exclusiveContent {
forRepositories(pluginsLucidworks)
filter { includeGroup("remote-connector") }
}
}
}
dependencies {
provided "com.lucidworks-connector.sdk:connector-plugin-sdk:${connectorsSDKVersion}"
provided "org.slf4j:slf4j-api:${slf4jVersion}"
testImplementation 'junit:junit:4.12'
remoteConnector "remote-connector:connector-plugin-standalone:${fusionVersion}"
}
}
configure(connectorprojects) { p ->
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.compileClasspath - configurations.provided
// Copy the plugin
from jar
}
extension('zip')
}
configure(plugin) {
group = 'connectors'
description = "Build the connector plugin in the build directory"
}
task assemblePlugin(type: Copy) {
from plugin
into pluginsDir
}
configure(assemblePlugin) {
group = 'connectors'
description = "Creates a connector plugin zip file that can be deployed in Fusion"
}
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()}")
}
}
configure(deploy) {
group = 'connectors'
description = "Deploys the plugin in Fusion"
}
task connect(type: JavaExec, dependsOn: assemblePlugin) {
main = 'com.lucidworks.connectors.ConnectorPluginStandaloneApp'
classpath = configurations.remoteConnector
File configYamlFile = file("${configYamlPath}")
String zipFile = "" + project.buildDir + "/libs/" + project.name + ".zip"
jvmArgs "-Dplugin.path=${zipFile}"
args configYamlFile.path
doFirst {
println " >> Using plugin zip from: ${zipFile}"
println " >> Using the config file from: ${configYamlFile.path}"
}
}
configure(connect) {
group = 'connectors'
description = "Runs the connector plugin remotely"
}
}
// Assemble all the plugins
task assemblePlugins(type: Copy) {
dependsOn connectorprojects.assemblePlugin
}
configure(assemblePlugins) {
group = 'connectors'
description = "Creates a plugin zip file for all the connector plugins "
}
// Deploy all plugins
// ./gradlew deployPlugins -PrestService=https://<fusion-proxy>/connectors -PuserPass=<user>:<password>
task deployPlugins {
dependsOn connectorprojects.deploy
}
configure(deployPlugins) {
group = 'connectors'
description = "Deploy all the connector plugins in Fusion "
}