From 7e6ee95b53b67f9480bafe13381e829cf6dc3c3a Mon Sep 17 00:00:00 2001 From: fangdong sun Date: Tue, 9 Aug 2016 19:47:59 +0800 Subject: [PATCH] =?UTF-8?q?build.gradle=E6=9B=B4=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E5=A4=9A=E5=88=86=E6=94=AF=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 36 +++++++++++++++++------------------- designer_base/build.gradle | 11 ++++++++--- designer_chart/build.gradle | 11 ++++++++--- designer_form/build.gradle | 13 ++++++++++--- 4 files changed, 43 insertions(+), 28 deletions(-) diff --git a/build.gradle b/build.gradle index 6d3190518..11222785b 100644 --- a/build.gradle +++ b/build.gradle @@ -2,34 +2,32 @@ apply plugin: 'java' tasks.withType(JavaCompile){ options.encoding = 'UTF-8' } +def libDir='${libDir}' +def basicDir='../../' +//获取什么分支名 +FileTree files =fileTree(dir:'./',include:'build.gradle') +def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) +def branchName=buildDir.substring(build.DirlastIndexOf ('\\')+1) task appletJar<<{ ant{ - mkdir(dir:'../finereport-lib-stable/tmp') + mkdir(dir:'${libDir}/tmp') mkdir(dir:'build/classes/') copy(todir:'build/classes/'){ - fileset(dir:'../finereport-core-stable/build/classes/main') + fileset(dir:'${basicDir}/finereport-core-stable/${branchName}/build/classes/main') + + fileset(dir:'${basicDir}/finereport-chart-stable/${branchName}/build/classes/main') + fileset(dir:'${basicDir}/finereport-report-stable/${branchName}/build/classes/main') - fileset(dir:'../finereport-chart-stable/build/classes/main') - - - fileset(dir:'../finereport-report-stable/build/classes/main') - - - - fileset(dir:'../finereport-platform-stable/build/classes/main') - - - fileset(dir:'../finereport-performance-stable/build/classes/main') + fileset(dir:'${basicDir}/finereport-platform-stable/${branchName}/build/classes/main') - - + fileset(dir:'${basicDir}/finereport-performance-stable/${branchName}/build/classes/main') } - unjar(src:'../finereport-lib-stable/3rd.jar',dest:'../finereport-lib-stable/tmp') - unjar(src:'../finereport-lib-stable/servlet-api.jar',dest:'../finereport-lib-stable/tmp') + unjar(src:"${libDir}/3rd.jar',dest:'${libDir}/tmp') + unjar(src:'${libDir}/servlet-api.jar',dest:'${libDir}/tmp') jar(jarfile:'build/libs/fr-applet-8.0.jar'){ fileset(dir:'build/classes'){ exclude(name:'*.*') @@ -45,7 +43,7 @@ task appletJar<<{ exclude(name:'com/fr/start/**') exclude(name:'com/fr/process/**') } - fileset(dir:'../finereport-lib-stable/tmp'){ + fileset(dir:'${libDir}/tmp'){ include(name:'javax/mail/**') include(name:'javax/servlet/**') include(name:'org/freehep/**') @@ -61,7 +59,7 @@ task appletJar<<{ include(name:'com/fr/web/attr/*.class') } } - delete(dir:'../finereport-lib-stable/tmp') + delete(dir:'${libDir}/tmp') def jdk6home= 'D:/FineReport/develop/java/jdk1.6u35' def keystore='frapplet.store' def keycert='fr.cert' diff --git a/designer_base/build.gradle b/designer_base/build.gradle index d44d269d5..731deebe3 100644 --- a/designer_base/build.gradle +++ b/designer_base/build.gradle @@ -23,12 +23,17 @@ sourceSets{ } } } +//获取什么分支名 +FileTree files =fileTree(dir:'./',include:'build.gradle') +def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) +buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) +def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) //声明外部依赖 dependencies{ -compile fileTree(dir:'../../finereport-lib-stable',include:'**/*.jar') -compile fileTree(dir:'../../',include:'finereport-*-stable/**/*.jar') +compile fileTree(dir:'../../../finereport-lib-stable',include:'**/*.jar') +compile fileTree(dir:'../../../',include:'finereport-*-stable/**/*.jar') testCompile 'junit:junit:4.12' } @@ -48,7 +53,7 @@ task copyFile(type:Copy,dependsOn:compileJava){ task compressJS{ ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ classpath { - fileset(dir:'../../finereport-build-stable',includes:'**/*.jar') + fileset(dir:'../../../finereport-build-stable',includes:'**/*.jar') } } ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false", , charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ diff --git a/designer_chart/build.gradle b/designer_chart/build.gradle index 288077655..92e221f19 100644 --- a/designer_chart/build.gradle +++ b/designer_chart/build.gradle @@ -23,10 +23,15 @@ sourceSets{ } } } +FileTree files =fileTree(dir:'./',include:'build.gradle') +def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) +buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) +def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) + //指定外部依赖 dependencies{ -compile fileTree(dir:'../../finereport-lib-stable',include:'**/*.jar') -compile fileTree(dir:'../../',include:'finereport-*-stable/**/*.jar') +compile fileTree(dir:'../../../finereport-lib-stable',include:'**/*.jar') +compile fileTree(dir:'../../../',include:'finereport-*-stable/${branchName}/**/*.jar') testCompile 'junit:junit:4.12' } @@ -46,7 +51,7 @@ task copyFile(type:Copy,dependsOn:compileJava){ task compressJS{ ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ classpath { - fileset(dir:'../../finereport-build-stable',includes:'**/*.jar') + fileset(dir:'../../../finereport-build-stable',includes:'**/*.jar') } } ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false", , charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ diff --git a/designer_form/build.gradle b/designer_form/build.gradle index b7a91f113..118215fc8 100644 --- a/designer_form/build.gradle +++ b/designer_form/build.gradle @@ -24,10 +24,17 @@ sourceSets{ } } } + +//获取什么分支名 +FileTree files =fileTree(dir:'./',include:'build.gradle') +def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) +buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) +def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) + //声明外部依赖 dependencies{ -compile fileTree(dir:'../../finereport-lib-stable',include:'**/*.jar') -compile fileTree(dir:'../../',include:'finereport-*-stable/**/*.jar') +compile fileTree(dir:'../../../finereport-lib-stable',include:'**/*.jar') +compile fileTree(dir:'../../../',include:'finereport-*-stable/**/*.jar') testCompile 'junit:junit:4.12' } @@ -56,7 +63,7 @@ task copyFile(type:Copy,dependsOn:compileJava){ task compressJS{ ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ classpath { - fileset(dir:'../../finereport-build-stable',includes:'**/*.jar') + fileset(dir:'../../../finereport-build-stable',includes:'**/*.jar') } } ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false", charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){