|
|
@ -3,61 +3,39 @@ apply plugin: 'java' |
|
|
|
tasks.withType(JavaCompile){ |
|
|
|
tasks.withType(JavaCompile){ |
|
|
|
options.encoding = 'UTF-8' |
|
|
|
options.encoding = 'UTF-8' |
|
|
|
} |
|
|
|
} |
|
|
|
//指定构建的jdk版本 |
|
|
|
|
|
|
|
sourceCompatibility=1.8 |
|
|
|
|
|
|
|
//指定生成的jar包版本 |
|
|
|
|
|
|
|
version='8.0' |
|
|
|
version='8.0' |
|
|
|
|
|
|
|
|
|
|
|
def srcDir="." |
|
|
|
def srcDir="${System.getenv()['JENKINS_HOME']}/workspace/design" |
|
|
|
|
|
|
|
def libDir="${System.getenv()['JENKINS_HOME']}/workspace/lib" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//指明生成jar包的名字 |
|
|
|
|
|
|
|
jar{ |
|
|
|
jar{ |
|
|
|
baseName='fr-designer-report' |
|
|
|
baseName='fr-designer-report' |
|
|
|
} |
|
|
|
} |
|
|
|
//源码所在位置 |
|
|
|
|
|
|
|
sourceSets{ |
|
|
|
sourceSets{ |
|
|
|
main{ |
|
|
|
main{ |
|
|
|
java{ |
|
|
|
java{ |
|
|
|
srcDirs=["${srcDir}/src", |
|
|
|
srcDirs=["${srcDir}/designer/src", |
|
|
|
"${srcDir}/../designer/src"] |
|
|
|
"${srcDir}/designer_form/src"] |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//获取什么分支名 |
|
|
|
|
|
|
|
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) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FileTree jars=fileTree(dir:'../../../').include "finereport-*-stable/${branchName}/**/*.jar" |
|
|
|
|
|
|
|
jars.each{File file-> |
|
|
|
|
|
|
|
println "-----------this jar path is ${file.path}----------" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//声明外部依赖 |
|
|
|
|
|
|
|
dependencies{ |
|
|
|
dependencies{ |
|
|
|
compile fileTree(dir:'../../../finereport-lib-stable',include:'**/*.jar') |
|
|
|
compile fileTree(dir:'../../',include:'**/*.jar') |
|
|
|
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/*.jar") |
|
|
|
compile fileTree(dir:libDir,include:'*.jar') |
|
|
|
|
|
|
|
compile fileTree(dir:"${libDir}/jetty",include:'*.jar') |
|
|
|
testCompile 'junit:junit:4.12' |
|
|
|
testCompile 'junit:junit:4.12' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//指明无法编译文件所在路径 |
|
|
|
|
|
|
|
def dataContent ={def dir -> |
|
|
|
|
|
|
|
copySpec{ |
|
|
|
|
|
|
|
from ("${dir}"){ |
|
|
|
|
|
|
|
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//将非.java文件复制到classes文件夹下 参与打包 |
|
|
|
|
|
|
|
task copyFile(type:Copy,dependsOn:compileJava){ |
|
|
|
task copyFile(type:Copy,dependsOn:compileJava){ |
|
|
|
copy{ |
|
|
|
copy{ |
|
|
|
with dataContent.call("${srcDir}/src") |
|
|
|
from ("${srcDir}/designer/src"){ |
|
|
|
with dataContent.call("${srcDir}/../designer/src") |
|
|
|
exclude '**/*.java' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
from ("${srcDir}/designer_form/src") |
|
|
|
into ('build/classes/main') |
|
|
|
into ('build/classes/main') |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -68,19 +46,17 @@ task copyFile(type:Copy,dependsOn:compileJava){ |
|
|
|
task compressJS{ |
|
|
|
task compressJS{ |
|
|
|
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ |
|
|
|
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){ |
|
|
|
classpath { |
|
|
|
classpath { |
|
|
|
|
|
|
|
fileset(dir:'../../lib',includes:'*.jar') |
|
|
|
fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar') |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false", charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ |
|
|
|
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false", , charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){ |
|
|
|
fileset (dir:"${srcDir}/src"){ |
|
|
|
fileset (dir:"${srcDir}/designer/src"){ |
|
|
|
include (name:'**/*.js') |
|
|
|
include (name:'**/*.js') |
|
|
|
include (name:'**/*.css') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
fileset (dir:"${srcDir}/../designer/src"){ |
|
|
|
fileset (dir:"${srcDir}/designer_form/src"){ |
|
|
|
include (name:'**/*.js') |
|
|
|
include (name:'**/*.js') |
|
|
|
include (name:'**/*.css') |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|