apply plugin: 'java'
//LEONIND
String javaHome = System.getenv('JAVA_HOME')
if(!javaHome){
throw new GradleException("JAVA_HOME environment variable not set.")
}
def toolsJarFile = new File(javaHome + File.separator + "lib" + File.separator + "tools.jar")
if(!toolsJarFile.exists()){
logger.warn("JAVA_HOME is not pointing to JDK, couldn't find tools.jar $toolsJarFile.absolutePath.")
}
// Map defined without 'def' for global script visibility
cpls_instances_apac = [
global_refdata : [
asset : 'cash',
region : 'APAC',
country : 'HNK',
env : 'dev',
instance : 'global_refdata_cpls',
appName : 'GLOBAL.HNK.GLOBAL.REFDATA.CPLS',
temp : 'global_refdata_cpls',
debugPort : 8890
],
cash_cpls_mys_sales : [
asset : 'cash',
region : 'APAC',
country : 'MYS',
env : 'dev',
instance : 'cash_cpls_mys_sales',
appName : 'GLOBAL.MYS.COMET.CPLS.CASH_CPLS.SALES',
temp : 'cash_cpls_mys_sales',
debugPort: 8890
],
cash_cpls_jpn_trdr1 : [
asset : 'cash',
region : 'APAC',
country : 'JPN',
env : 'dev',
instance : 'cash_cpls_jpn_trdr1',
appName : 'GLOBAL.JPN.COMET.CPLS.CASH_CPLS.TRDR',
temp : 'cash_cpls_jpn_trdr1',
debugPort: 8890
],
deriv_cpls_jpn_prop1 : [
asset : 'derivatives',
region : 'APAC',
country : 'JPN',
env : 'dev',
instance : 'deriv_cpls_jpn_prop1',
appName : 'GLOBAL.JPN.COMET.CPLS.DERIV_PROP_CPLS1',
temp : 'deriv_cpls_jpn_prop1',
debugPort: 8890
],
cash_cpls_sls1 : [
app : 'CPLS',
asset : 'cash',
region : 'US',
env : 'dev',
instance : 'cash_cpls_sls1',
appName : 'GLOBAL.NA.US.COMET.CPLS.CPLS_CASH.CASH_CPLS_INSTANCE1',
temp : 'cash_cpls_sls1',
debugPort: 9797
],
emea_local_dev_cpls : [
app : 'CPLS',
asset : 'multi',
region : 'EMEA',
env : 'dev',
instance : 'emea_cpls_sls102',
appName : 'GLOBAL.COMET.EMEA.CASHSLS.CPLS',
temp : 'emea_cpls_sls102',
topic_instance : 'local_dev_100',
instance_id : 201110100,
isDevLocal : true,
debugPort : 8741
],
cash_position_1_qa : [
app : 'CPLS',
asset : 'cash',
region : 'US',
env : 'qa',
instance : 'cash_position_1',
appName : 'GLOBAL.US.COMET.POSITION.POSITIONINSTANCE1',
temp : 'cash_position_1',
isDevLocal : false,
debugPort : 9798
],
cash_position_1_dev : [
app : 'CPLS',
asset : 'cash',
region : 'US',
env : 'dev',
instance : 'cash_position_1',
appName : 'GLOBAL.US.COMET.POSITION.POSITIONINSTANCE1',
temp : 'cash_position_1',
isDevLocal : true,
debugPort : 9799
]
]
task prepareLibDir(type: Copy) {
from configurations.sharedlib
into 'lib'
rename('libZeusCcDt.*.so', 'libZeusCcDt.so')
rename('libCcDt.*.so', 'libCcDt.so')
}
tasks.withType(JavaExec) {
systemProperty "java.library.path", file("lib").absolutePath
environment "LD_LIBRARY_PATH", file("lib").absolutePath
}
task runQCacheGen(dependsOn: [prepareLibDir], type: JavaExec) {
main = "com.citigroup.get.quantum.store2.generator.gui.CacheManagerGui"
classpath = sourceSets.main.runtimeClasspath
workingDir = "/src/main"
println "###### CLASSPATH SS ######"
sourceSets.main.runtimeClasspath.each { cpEntry ->
println "rc-> " + cpEntry
}
jvmArgs "-Xms512M",
"-Xmx512M",
"-DConfig.Dir=" + file("src/main/config/resources/cachedefinitions"),
"-DDEFAULT_DB=Sybase"
standardInput = System.in
}
cpls_instances_apac.each { task_name, instance_options ->
tasks.register(task_name, JavaExec) {
dependsOn prepareLibDir, classes
// Localized definitions to prevent variable mixing between tasks
def asset = instance_options.asset
def region = instance_options.region
def country = instance_options.country // Can be null
def env = instance_options.env
def instanceName = instance_options.instance
def topic_instance = instance_options.topic_instance ?: '102'
def instance_id = instance_options.instance_id ?: ""
def appName = instance_options.appName
def tempDir = instance_options.temp
def debugPort = instance_options.debugPort
def app = instance_options.app ?: 'CPLS_ASIA'
def isDevLocal = instance_options.isDevLocal?.toString()?.toBoolean() ?: false
// Logic to skip country folder if it is empty/null
def countryPath = country ? "${country}/" : ""
def instanceClasspath = [
file("src/main/config/quantum/$asset/$region/${countryPath}$env"),
file("src/main/config/quantum/$asset/$region/${country ?: ''}"),
file("src/main/config/quantum/$asset/$region/${countryPath}$env/$instanceName"),
file("src/main/config/dds/$asset/$region/${countryPath}$env/$instanceName"),
file('src/main/config'),
toolsJarFile
]
def cfgFileName = 'CFG.' + appName + '.xml'
def cplsConfigFile = file("src/main/config/quantum/$asset/$region/${countryPath}$env/cplsConfig.xml")
def cplsFile = file("src/main/config/dds/$asset/$region/${countryPath}$env/$instanceName/$cfgFileName")
def cplsDir = file("src/main/config/quantum/$asset/$region/${countryPath}$env/$instanceName")
def loggingConfig = file("src/main/config/quantum/$asset/$region/${countryPath}$env/logging.properties.txt")
def cpacs = files("src/main/config/quantum/$asset/$region/${countryPath}$env/cpacs/cpacs.xml", "src/main/config/quantum/$asset/$region/${countryPath}$env/cpacs.xml")
def cpacsFile = cpacs.find { it.exists() } ?: ""
def aleConfig = file("src/main/config/quantum/$asset/$region/${countryPath}$env/alefcg")
def securityFile = file("src/main/config/resources/security.dat")
doFirst {
logger.info "task: " + task_name + " started execution"
if (System.properties.'os.name'.toLowerCase().contains("linux")){
System.properties.'java.io.tmpdir' = '/opt/lgohome'
logger.info "Setting [java.io.tmpdir] to [$System.properties.'java.io.tmpdir']"
}
if (System.properties.'os.name'.toLowerCase().contains("windows")){
System.properties.'java.io.tmpdir' = 'C:/temp'
logger.info "Setting [java.io.tmpdir] to [$System.properties.'java.io.tmpdir']"
}
['dds','log','store'].each { String i ->
def dir = new File("${System.properties.'java.io.tmpdir'}/$tempDir/$i")
dir.mkdirs()
}
if (isDevLocal) {
copy {
from "src/main/config/quantum/$asset/$region/$env/$instanceName/configService.xml"
into "${System.properties.'java.io.tmpdir'}/$tempDir/dds/"
filter { line ->
line.replaceAll('<file-cache location="[/-a-zA-Z0-9_]*\\/>', "<file-cache location=\"${System.properties.'java.io.tmpdir'}/$tempDir/dds/\"/>")
}
rename('configService.xml', 'devConfigService.xml')
}
}
jvmArgs = [
"-Xms26", "-Xmx46", "-Xss256k",
"-Djava.library.path=" + file('lib').absolutePath,
"-DenableRestrictiveQtyCheck=false",
"-Dcom.citigroup.project.config.filename=$cplsConfigFile",
"-Dapplication=$app",
"-Dinstance=$instanceName",
"-Ddds.tmpdir=${System.properties.'java.io.tmpdir'}/$tempDir/dds/",
"-Dcpls.path.store.dir=${System.properties.'java.io.tmpdir'}/$tempDir/store/",
"-Djava.io.tmpdir=${System.properties.'java.io.tmpdir'}/$tempDir/log/",
"-Dcom.citi.get.etsf.config.DDsConfigurationImpl.local.file=" + cplsFile,
"-Dcom.citigroup.get.refdata.dbconn.max.number=60",
"-Dcom.citigroup.get.prodapi.dbconn.max.number=60",
"-Dcom.citigroup.get.citijdbc.dbconn.max.number=60",
"-Dpackage.version=9.1.89n_b7",
"-Dcpls.path.asset.region=$asset/$region/${countryPath}$env",
"-Dcpls.path.springqas.dir=$cplsDir",
"-Dregion=$region${country ? "/$country" : ""}",
"-Djava.util.logging.config.file=$loggingConfig",
"-Dcom.citigroup.cpacs.util.preferences.systemFileName=$cpacsFile",
"-Dquantum.config.springconfigurationBase=" + file("src/main/config/quantum/$asset/$region/${countryPath}$env/$instanceName"),
"-DALE_CONFIGFILE=$aleConfig",
"-DALE_SECURITYFILE=$securityFile",
"-DMD_CONFIG_FILE_LOCATION=",
"-Dcom.citi.get.etsf.appName=$appName"
]
if (isDevLocal) {
jvmArgs += "-Ddev_local=true"
}
}
def quantumJarFile = sourceSets.main.runtimeClasspath.filter {
it.name.endsWith('.jar') && it.name.contains("quantum")
}
classpath = files(instanceClasspath) + quantumJarFile + (sourceSets.main.runtimeClasspath + files("${System.properties.'java.io.tmpdir'}/$tempDir/dds") - quantumJarFile)
def cpFile = new File(buildDir, "real-classpath.txt")
cpFile.text = classpath.asPath
systemProperty "quantum.classpath.file", cpFile.absolutePath
classpath.each { cpEntry -> println 'classpath: ' + cpEntry }
main = 'com.citi.DebugLauncher'
args 'file://' + file("src/main/config/quantum/$asset/$region/${countryPath}$env").absolutePath,
instanceName,
'dummy'
workingDir file('src/main/config')
standardInput = System.in
doLast {
logger.info 'task: ' + task_name + ' completes execution'
}
}
}
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)