|
|
@ -4,71 +4,53 @@ tasks.withType(JavaCompile){ |
|
|
|
options.encoding = 'UTF-8' |
|
|
|
options.encoding = 'UTF-8' |
|
|
|
} |
|
|
|
} |
|
|
|
//指定构建的jdk版本 |
|
|
|
//指定构建的jdk版本 |
|
|
|
sourceCompatibility=1.8 |
|
|
|
sourceCompatibility=1.7 |
|
|
|
//指定生成的jar包版本 |
|
|
|
//指定生成jar包的版本 |
|
|
|
version='8.0' |
|
|
|
version='8.0' |
|
|
|
|
|
|
|
|
|
|
|
def srcDir="." |
|
|
|
def srcDir="." |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//对生成的jar包进行重命名 |
|
|
|
|
|
|
|
|
|
|
|
//指明生成jar包的名字 |
|
|
|
|
|
|
|
jar{ |
|
|
|
jar{ |
|
|
|
baseName='fr-designer-report' |
|
|
|
baseName='fr-designer-chart' |
|
|
|
} |
|
|
|
} |
|
|
|
//源码所在位置 |
|
|
|
|
|
|
|
sourceSets{ |
|
|
|
sourceSets{ |
|
|
|
main{ |
|
|
|
main{ |
|
|
|
java{ |
|
|
|
java{ |
|
|
|
srcDirs=["${srcDir}/src", |
|
|
|
srcDirs=["${srcDir}/src"] |
|
|
|
"${srcDir}/../designer/src"] |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//获取什么分支名 |
|
|
|
|
|
|
|
FileTree files =fileTree(dir:'./',include:'build.*.gradle') |
|
|
|
FileTree files =fileTree(dir:'./',include:'build.*.gradle') |
|
|
|
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) |
|
|
|
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\')) |
|
|
|
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) |
|
|
|
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\')) |
|
|
|
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) |
|
|
|
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1) |
|
|
|
|
|
|
|
|
|
|
|
//显示依赖jar包 |
|
|
|
//指定外部依赖 |
|
|
|
FileTree f=fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") |
|
|
|
|
|
|
|
f.each{File file-> |
|
|
|
|
|
|
|
println "----${file.path}" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//声明外部依赖 |
|
|
|
|
|
|
|
dependencies{ |
|
|
|
dependencies{ |
|
|
|
compile fileTree(dir:"../../../finereport-lib-stable/${branchName}",include:'**/*.jar') |
|
|
|
compile fileTree(dir:"../../../finereport-lib-stable/${branchName}",include:'**/*.jar') |
|
|
|
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar") |
|
|
|
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.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文件夹下参与打包 |
|
|
|
//将非.java 文件复制到classes文件夹下参与打包 |
|
|
|
task copyFile(type:Copy,dependsOn:compileJava){ |
|
|
|
task copyFile(type:Copy,dependsOn:compileJava){ |
|
|
|
copy{ |
|
|
|
copy{ |
|
|
|
with dataContent.call("${srcDir}/src") |
|
|
|
from ("${srcDir}/src"){ |
|
|
|
with dataContent.call("${srcDir}/../designer/src") |
|
|
|
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html' |
|
|
|
into ('build/classes/main') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
into 'build/classes/main' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//压缩项目中的js文件 |
|
|
|
//压缩项目中的js文件 |
|
|
|
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:'../../../finereport-lib4build-stable',includes:'**/*.jar') |
|
|
|
fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar') |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -76,11 +58,6 @@ task compressJS{ |
|
|
|
fileset (dir:"${srcDir}/src"){ |
|
|
|
fileset (dir:"${srcDir}/src"){ |
|
|
|
include (name:'**/*.js') |
|
|
|
include (name:'**/*.js') |
|
|
|
include (name:'**/*.css') |
|
|
|
include (name:'**/*.css') |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
fileset (dir:"${srcDir}/../designer/src"){ |
|
|
|
|
|
|
|
include (name:'**/*.js') |
|
|
|
|
|
|
|
include (name:'**/*.css') |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|