Browse Source

插件工程改为gradle,可对插件加密

master
tianxx7 5 years ago
parent
commit
4072654f79
  1. 11
      plugin-function/ant_build.xml
  2. 38
      plugin-function/build.gradle

11
plugin-function/ant_build.xml

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

38
plugin-function/build.gradle

@ -1,11 +1,41 @@
/*
* This file was generated by the Gradle 'init' task.
*/
//zip命令 Gradle -> Tasks -> other -> zip
dependencies {
implementation fileTree(dir: 'lib', include: ['*.jar'])
}
task copyFile(type:Copy,dependsOn: ["build"]){
ant.importBuild("ant_build.xml")
//ant变量
ant.projectDir = projectDir
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() -> 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"
doLast(){
delete file("$projectDir/classes")
}
}
task makeJar(type: Jar,dependsOn: preJar){
from fileTree(dir:"$buildDir/classes/java/main") //assets文件
destinationDir = file("$buildDir/libs")
}
task copyFile(type: Copy,dependsOn: ["makeJar"]){
from "$buildDir/libs"
from "$projectDir/lib"
from "$projectDir/plugin.xml"
@ -20,8 +50,8 @@ task zip(type:Zip,dependsOn:["copyFile"]){
// appendix 'appendix'
// version '0.0.1'
}
//build
build.mustRunAfter clean
//build时包含哪些文件,
processResources {
// exclude everything

Loading…
Cancel
Save