-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
149 lines (124 loc) · 4.49 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
import org.apache.tools.ant.filters.ReplaceTokens
apply plugin: "base"
apply plugin: "maven-publish"
ext {
major = 0
minor = 0
patch = 0
releasecsproj = "TemplatePricingAdapter.csproj"
adapterName = project.name
ideSetting = "FALSE"
replacements = [
adapterName: adapterName,
ideSetting: ideSetting,
]
}
version = major + "." + minor + "." + patch
def msbuild_exe;
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
msbuild_exe = "C:/Windows/Microsoft.NET/Framework64/v4.0.30319/msbuild.exe" // DEFAULT INSTALLATION
} else {
msbuild_exe = "xbuild"
}
configurations {
datasource
}
repositories {
mavenCentral()
/* maven {
credentials {
username "$caplinNexusUser"
password "$caplinNexusSecret"
}
url "https://repository.caplin.com"
}*/
maven {
url "http://artifactory.caplin.com:8081/artifactory/caplin-qa"
allowInsecureProtocol = true
}
}
dependencies {
datasource(group: 'com.caplin.cis.c', name: 'DataSource.NET', version: '7.1+', classifier: 'x86_64-pc-win64', ext: 'zip')
}
task unzipDataSource(type: Copy) {
description "Unzip the .NET Datasource."
from zipTree(configurations.datasource.singleFile)
into("${buildDir}/dsDotNet")
includeEmptyDirs = false
eachFile {
it.path = it.path.substring(it.path.indexOf("/") + 1)
}
}
task compileRelease(type: Exec, dependsOn: unzipDataSource) {
workingDir "."
commandLine "${msbuild_exe}", "${projectDir}/Project/${project.ext.releasecsproj}"
}
clean {
delete += "${projectDir}/Project/obj"
delete += "${projectDir}/Project/bin"
}
task createKit(type: Zip, dependsOn: [compileRelease]) {
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'
filter(ReplaceTokens, tokens: replacements)
}
into("${topDirName}") {
from "${project.projectDir}/blade"
exclude 'blade_config/bootstrap.conf'
exclude 'DataSource/etc/adapterName'
}
into("${topDirName}") {
from "${project.projectDir}/blade"
include 'DataSource/etc/adapterName'
fileMode 0755
}
if (!project.hasProperty("configOnly")) {
into("${topDirName}/DataSource/bin") {
from("${buildDir}/dsDotNet")
include "*.dll"
fileMode 0755
}
into("${topDirName}/DataSource/bin") {
from("${projectDir}/Project/bin/Release")
include "TemplatePricingAdapter.exe"
fileMode 0755
}
} else {
into("${topDirName}/DataSource") {
from("${projectDir}/Project")
include ("bin")
includeEmptyDirs = true
}
}
}
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'
exclude 'Transformer'
}
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")}
define TRANSFORMER${thisLeg}_HOST ${(project.hasProperty("transformerHost") ? project.transformerHost : "localhost")}
define TRANSFORMER${thisLeg}_DATASRCPORT ${(project.hasProperty("transformerDsPort") ? project.transformerDsPort : "15002")}
add-field CONTRIB_USER 20000
""".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)