|
|
|
dependencies {
|
|
|
|
api(
|
|
|
|
project(":io.sc.engine.rule.core"),
|
|
|
|
project(":io.sc.platform.util"),
|
|
|
|
project(":io.sc.platform.groovy"),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 拷贝依赖工程生成的 jar 包
|
|
|
|
* 1. io.sc.engine.rule.core-xxx.jar
|
|
|
|
* 2. io.sc.platform.util-xxx.jar
|
|
|
|
*/
|
|
|
|
tasks.register('copyDependenciesProjectJars') {
|
|
|
|
dependsOn ':io.sc.engine.rule.core:jar',':io.sc.platform.util:jar',':io.sc.creditreport.core:jar',':io.sc.engine.rule.client.spring:jar'
|
|
|
|
doLast {
|
|
|
|
println('copy dependencies project jar ......');
|
|
|
|
def targetDir =file('src/main/resources/io/sc/engine/rule/client/jars/').absolutePath;
|
|
|
|
delete targetDir;
|
|
|
|
file(targetDir).mkdirs();
|
|
|
|
project.getRootProject().subprojects { dependedProject ->
|
|
|
|
if( dependedProject.name=='io.sc.engine.rule.core'
|
|
|
|
|| dependedProject.name=='io.sc.platform.util'
|
|
|
|
|| dependedProject.name=='io.sc.creditreport.core'
|
|
|
|
|| dependedProject.name=='io.sc.engine.rule.client.spring'
|
|
|
|
){
|
|
|
|
def dir =dependedProject.getBuildDir().absolutePath + '/libs';
|
|
|
|
def source =dir + '/' + dependedProject.name + '-' + dependedProject.version + '.jar';
|
|
|
|
if(file(source).exists() && file(source).isFile()){
|
|
|
|
copy {
|
|
|
|
from dir + '/' + dependedProject.name + '-' + dependedProject.version + '.jar'
|
|
|
|
into targetDir
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
println('>>>>>>>>');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 拷贝依赖第三方 jar 包
|
|
|
|
*/
|
|
|
|
tasks.register('copyRuntimeClasspathJars') {
|
|
|
|
dependsOn 'copyDependenciesProjectJars'
|
|
|
|
doLast {
|
|
|
|
configurations.runtimeClasspath.each(r ->{
|
|
|
|
println r
|
|
|
|
});
|
|
|
|
println('copy runtimeClasspath jar ......');
|
|
|
|
copy {
|
|
|
|
from configurations.runtimeClasspath
|
|
|
|
into 'src/main/resources/io/sc/engine/rule/client/jars'
|
|
|
|
include(
|
|
|
|
'jackson-annotations-*.jar',
|
|
|
|
'jackson-core-*.jar',
|
|
|
|
'jackson-databind-*.jar',
|
|
|
|
'slf4j-api-*.jar',
|
|
|
|
'jaxb-api-*.jar'
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 替换可导出资源插件文件, 更新版本
|
|
|
|
*/
|
|
|
|
tasks.register('replaceExportableResourcesPlugins') {
|
|
|
|
dependsOn 'copyRuntimeClasspathJars'
|
|
|
|
doLast {
|
|
|
|
println('replace exportable-resources.json ......');
|
|
|
|
File file =file('src/main/resources/META-INF/platform/plugins/exportable-resources.json');
|
|
|
|
String content =file.text;
|
|
|
|
// replace io.sc.engine.rule.core-xx.xx.xx.jar
|
|
|
|
java.util.regex.Pattern corePattern =java.util.regex.Pattern.compile('io\\.sc\\.engine\\.rule\\.core-(.*)?\\.jar');
|
|
|
|
java.util.regex.Matcher coreMatcher = corePattern.matcher(content);
|
|
|
|
while (coreMatcher.find()) {
|
|
|
|
content =content.replace(coreMatcher.group(0),"io.sc.engine.rule.core-" + project.version + ".jar");
|
|
|
|
}
|
|
|
|
// replace io.sc.platform.util-xx.xx.xx.jar
|
|
|
|
java.util.regex.Pattern utilPattern =java.util.regex.Pattern.compile('io\\.sc\\.platform\\.util-(.*)?\\.jar');
|
|
|
|
java.util.regex.Matcher utilMatcher = utilPattern.matcher(content);
|
|
|
|
while (utilMatcher.find()) {
|
|
|
|
content =content.replace(utilMatcher.group(0),"io.sc.platform.util-" + project.version + ".jar");
|
|
|
|
}
|
|
|
|
|
|
|
|
// replace io.sc.creditreport.core-xx.xx.xx.jar
|
|
|
|
java.util.regex.Pattern creditreportPattern =java.util.regex.Pattern.compile('io\\.sc\\.creditreport\\.core-(.*)?\\.jar');
|
|
|
|
java.util.regex.Matcher creditreportMatcher = creditreportPattern.matcher(content);
|
|
|
|
while (creditreportMatcher.find()) {
|
|
|
|
content =content.replace(creditreportMatcher.group(0),"io.sc.creditreport.core-" + project.version + ".jar");
|
|
|
|
}
|
|
|
|
|
|
|
|
// replace io.sc.engine.rule.client.spring-xx.xx.xx.jar
|
|
|
|
java.util.regex.Pattern clientSpringPattern =java.util.regex.Pattern.compile('io\\.sc\\.engine\\.rule\\.client\\.spring-(.*)?\\.jar');
|
|
|
|
java.util.regex.Matcher clientSpringMatcher = clientSpringPattern.matcher(content);
|
|
|
|
while (clientSpringMatcher.find()) {
|
|
|
|
content =content.replace(clientSpringMatcher.group(0),"io.sc.engine.rule.client.spring-" + project.version + ".jar");
|
|
|
|
}
|
|
|
|
|
|
|
|
file.write(content);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 同步项目,
|
|
|
|
*/
|
|
|
|
tasks.register('sync') {
|
|
|
|
dependsOn 'replaceExportableResourcesPlugins'
|
|
|
|
}
|
|
|
|
|
|
|
|
processResources {
|
|
|
|
dependsOn sync
|
|
|
|
}
|
|
|
|
|
|
|
|
|