You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.6 KiB
71 lines
1.6 KiB
9 years ago
|
|
||
|
apply plugin: 'java'
|
||
|
tasks.withType(JavaCompile){
|
||
|
options.encoding = 'UTF-8'
|
||
|
}
|
||
8 years ago
|
//指定构建的jdk版本
|
||
8 years ago
|
sourceCompatibility=1.7
|
||
8 years ago
|
//指定生成jar包版本
|
||
9 years ago
|
version='8.0'
|
||
8 years ago
|
//生成jar包重命名
|
||
9 years ago
|
jar{
|
||
|
baseName='fr-designer-core'
|
||
|
}
|
||
|
|
||
|
|
||
9 years ago
|
def srcDir="."
|
||
|
|
||
8 years ago
|
//指定源码路径
|
||
9 years ago
|
sourceSets{
|
||
|
main{
|
||
|
java{
|
||
9 years ago
|
srcDirs=["${srcDir}/src"]
|
||
9 years ago
|
}
|
||
|
}
|
||
|
}
|
||
8 years ago
|
//获取什么分支名
|
||
8 years ago
|
FileTree files =fileTree(dir:'./',include:'build.*.gradle')
|
||
8 years ago
|
def buildDir=files[0].path.substring(0,files[0].path.lastIndexOf ('\\'))
|
||
8 years ago
|
buildDir=buildDir.substring(0,buildDir.lastIndexOf ('\\'))
|
||
8 years ago
|
def branchName=buildDir.substring(buildDir.lastIndexOf ('\\')+1)
|
||
9 years ago
|
|
||
8 years ago
|
//声明外部依赖
|
||
9 years ago
|
dependencies{
|
||
9 years ago
|
|
||
8 years ago
|
compile fileTree(dir:"../../../finereport-lib-stable/${branchName}",include:'**/*.jar')
|
||
8 years ago
|
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar")
|
||
9 years ago
|
|
||
9 years ago
|
testCompile 'junit:junit:4.12'
|
||
|
}
|
||
8 years ago
|
//复制非.java文件到classes文件夹下参与打包
|
||
9 years ago
|
task copyFile(type:Copy,dependsOn:compileJava){
|
||
|
copy{
|
||
9 years ago
|
from ("${srcDir}/src"){
|
||
8 years ago
|
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
|
||
9 years ago
|
}
|
||
|
into 'build/classes/main'
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
8 years ago
|
//压缩项目中的js文件
|
||
9 years ago
|
task compressJS{
|
||
|
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){
|
||
|
classpath {
|
||
8 years ago
|
fileset(dir:'../../../finereport-lib4build-stable',includes:'**/*.jar')
|
||
9 years ago
|
}
|
||
|
}
|
||
8 years ago
|
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false",charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
|
||
9 years ago
|
fileset (dir:"${srcDir}/src"){
|
||
9 years ago
|
include (name:'**/*.js')
|
||
8 years ago
|
include (name:'**/*.css')
|
||
9 years ago
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
jar.dependsOn compressJS
|
||
|
|
||
|
|
||
|
|