-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
103 lines (82 loc) · 3.04 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
import org.apache.tools.ant.filters.ReplaceTokens
apply plugin: 'java'
apply plugin: 'eclipse'
ext {
major = 0
minor = 0
patch = 0
adapterName = project.name
replacements = [
adapterName: adapterName,
]
}
version = major + "." + minor + "." + patch
repositories {
mavenCentral()
maven {
credentials {
username "$caplinNexusUser"
password "$caplinNexusSecret"
}
url "https://repository.caplin.com"
}
}
dependencies {
//implementation fileTree(dir: 'lib', include: '*.jar')
implementation(group: 'com.caplin.platform.integration.java', name: 'datasource', version: '7.1.+')
implementation(group: 'com.caplin.platform.integration.java', name: 'notification', version: '7.1.+')
}
jar {
manifest {
attributes(
'Main-Class': 'com.caplin.template.NotificationTemplate',
"Class-Path": configurations.runtimeClasspath.collect { it.getName() }.join(' ')
)
}
}
task createKit(type: Zip, dependsOn: jar) {
archiveFileName = adapterName + "-" + archiveVersion.get() + ".zip"
def topDirName = archiveFileName.get().substring(0, archiveFileName.get().lastIndexOf("."))
into("${topDirName}") {
from "${project.projectDir}/blade"
include 'blade_config/bootstrap.conf'
if (!project.hasProperty("configOnly")) {
include 'DataSource/bin/start-jar.sh'
}
filter(ReplaceTokens, tokens: replacements)
}
into("${topDirName}") {
from "${project.projectDir}/blade"
exclude 'blade_config/bootstrap.conf'
exclude 'DataSource/bin/start-jar.sh'
}
if (!project.hasProperty("configOnly")) {
into("${topDirName}/DataSource/lib") {
from([project.jar.outputs, configurations.runtimeClasspath])
}
}
}
task setupWorkingDirectory(type: Copy) {
from("${project.projectDir}/blade") {
include 'blade_config/bootstrap.conf'
filter(ReplaceTokens, tokens: replacements)
}
from("${project.projectDir}/blade") {
exclude 'blade_config/bootstrap.conf'
exclude 'DataSource/bin'
exclude 'Liberator'
}
into("${buildDir}/env")
}
task createEnvironmentConfig {
String thisLeg = (project.hasProperty("thisLeg") ? project.thisLeg : "1")
String content = """
define THIS_LEG ${thisLeg}
define LIBERATOR${thisLeg}_HOST ${(project.hasProperty("liberatorHost") ? project.liberatorHost : "localhost")}
define LIBERATOR${thisLeg}_DATASRCPORT ${(project.hasProperty("liberatorDsPort") ? project.liberatorDsPort : "15001")}
""".stripIndent()
new File("${setupWorkingDirectory.getDestinationDir().getAbsolutePath()}/blade_config/").mkdirs()
new File("${setupWorkingDirectory.getDestinationDir().getAbsolutePath()}/blade_config/environment-ide.conf").text=content
}
setupWorkingDirectory.finalizedBy createEnvironmentConfig
assemble.dependsOn(createKit)