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
8 years ago
|
|
||
|
apply plugin: 'java'
|
||
|
tasks.withType(JavaCompile){
|
||
|
options.encoding = 'UTF-8'
|
||
|
}
|
||
8 years ago
|
//指定构建的jdk版本
|
||
8 years ago
|
sourceCompatibility=1.8
|
||
8 years ago
|
//指定生成jar包版本
|
||
8 years ago
|
version='8.0'
|
||
8 years ago
|
//生成jar包重命名
|
||
8 years ago
|
jar{
|
||
|
baseName='fr-designer-core'
|
||
|
}
|
||
|
|
||
|
|
||
8 years ago
|
def srcDir="."
|
||
8 years ago
|
|
||
8 years ago
|
//指定源码路径
|
||
8 years ago
|
sourceSets{
|
||
|
main{
|
||
|
java{
|
||
8 years ago
|
srcDirs=["${srcDir}/src"]
|
||
8 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)
|
||
8 years ago
|
|
||
8 years ago
|
//声明外部依赖
|
||
8 years ago
|
dependencies{
|
||
8 years ago
|
|
||
|
compile fileTree(dir:'../../../finereport-lib-stable',include:'**/*.jar')
|
||
8 years ago
|
compile fileTree(dir:'../../../',include:"finereport-*-stable/${branchName}/**/build/libs/*.jar")
|
||
8 years ago
|
|
||
8 years ago
|
testCompile 'junit:junit:4.12'
|
||
|
}
|
||
8 years ago
|
//复制非.java文件到classes文件夹下参与打包
|
||
8 years ago
|
task copyFile(type:Copy,dependsOn:compileJava){
|
||
|
copy{
|
||
8 years ago
|
from ("${srcDir}/src"){
|
||
|
exclude '**/.setting/**','.classpath','.project','**/*.java','**/*.db','**/*.g','**/package.html'
|
||
8 years ago
|
}
|
||
|
into 'build/classes/main'
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
8 years ago
|
//压缩项目中的js文件
|
||
8 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')
|
||
8 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'){
|
||
8 years ago
|
fileset (dir:"${srcDir}/src"){
|
||
8 years ago
|
include (name:'**/*.js')
|
||
8 years ago
|
include (name:'**/*.css')
|
||
8 years ago
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
jar.dependsOn compressJS
|
||
|
|
||
|
|
||
|
|