Browse Source

修改饼图插件为gradle,命令行gradle zip进行插件打包

pull/3/head
tianxx7 5 years ago
parent
commit
92cef2e774
  1. 10
      ant_build.xml
  2. 45
      build.gradle

10
ant_build.xml

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project>
<target name="compile_javas" depends="copyFiles">
<echo message="编译${compile_files}下的Java文件"/>
<taskdef name="pretreatment" classname="com.fr.plugin.pack.PluginPretreatmentTask">
<classpath refid="compile.classpath"/>
</taskdef>
<pretreatment baseDir="${projectDir}"/>
</target>
</project>

45
build.gradle

@ -4,12 +4,40 @@ dependencies {
//使jar
implementation fileTree(dir: 'lib', include: ['*.jar'])
}
ant.importBuild("ant_build.xml")
//ant变量
ant.projectDir = projectDir
//ant中的path标签
ant.references["compile.classpath"] = ant.path {
fileset(dir: "lib", includes: '*.jar')
fileset(dir: "$rootDir/webroot/WEB-INF/lib", includes: '*.jar')
fileset(dir: ".",includes:"**/*.jar" )
}
//clean -> classes -> copyFiles -> compile_javas(ant加密) -> preJar -> makeJar->copyFile->zip
classes.dependsOn('clean')
task copyFiles(type: Copy,dependsOn: 'classes'){
from "$buildDir/classes/java/main"
from "$buildDir/resources/main"
into "$projectDir/classes"
}
task preJar(type:Copy,dependsOn: 'compile_javas'){
from "$projectDir/classes"
into "$buildDir/classes/java/main"
include "**/*.class"
doLast(){
delete file("$projectDir/classes")
}
}
jar.dependsOn("preJar")
task makeJar(type: Jar,dependsOn: preJar){
from fileTree(dir:"$buildDir/classes/java/main")
destinationDir = file("$buildDir/libs")
}
//zip
//使form /libs/*.*,
//使from指定具体的文件名
//zip输出到$buildDir下
task copyFile(type:Copy,dependsOn: ["build"]){
task copyFile(type: Copy,dependsOn: ["jar"]){
from "$buildDir/libs"
from "$projectDir/lib"
from "$projectDir/plugin.xml"
@ -18,14 +46,13 @@ task copyFile(type:Copy,dependsOn: ["build"]){
task zip(type:Zip,dependsOn:["copyFile"]){
from "$buildDir/temp"
destinationDir file("$buildDir")
// baseName-appendix-0.0.1.zip
destinationDir file("$buildDir/install")
//: baseName-appendix-0.0.1.zip
// baseName 'baseName'
// appendix 'appendix'
// version '0.0.1'
}
//build
build.mustRunAfter clean
//build时包含哪些文件,
processResources {
// exclude everything

Loading…
Cancel
Save