Browse Source

更优雅的方式选择是否对插件进行加密保护

master
richie 5 years ago
parent
commit
c87bba18a2
  1. 1
      .gitignore
  2. 14
      plugin-function/build.gradle

1
.gitignore vendored

@ -8,4 +8,5 @@
build build
local.properties local.properties
classes/ classes/
transform-classes/
tomcat.* tomcat.*

14
plugin-function/build.gradle

@ -13,7 +13,7 @@ ext {
/** /**
* class进行加密保护 * class进行加密保护
*/ */
guard = false guard = true
def pluginInfo = getPluginInfo() def pluginInfo = getPluginInfo()
pluginPre = "fine-plugin" pluginPre = "fine-plugin"
@ -27,14 +27,12 @@ group = 'com.fr.plugin'
version = '10.0' version = '10.0'
sourceCompatibility = '8' sourceCompatibility = '8'
if (!guard) {
sourceSets { sourceSets {
main { main {
java.outputDir = file(outputPath) java.outputDir = file(outputPath)
output.resourcesDir = file(outputPath) output.resourcesDir = file(outputPath)
} }
} }
}
ant.importBuild("encrypt.xml") ant.importBuild("encrypt.xml")
//ant变量 //ant变量
@ -47,27 +45,23 @@ ant.references["compile.classpath"] = ant.path {
classes.dependsOn('clean') classes.dependsOn('clean')
task copyFiles(type: Copy,dependsOn: 'classes'){ task copyFiles(type: Copy,dependsOn: 'classes'){
if (guard) {
from "$buildDir/classes/java/main"
from "$buildDir/resources/main"
} else {
from outputPath from outputPath
}
into "$projectDir/classes" into "$projectDir/classes"
} }
task preJar(type:Copy,dependsOn: guard ? 'compile_encrypt_javas' : 'compile_plain_javas'){ task preJar(type:Copy,dependsOn: guard ? 'compile_encrypt_javas' : 'compile_plain_javas'){
from "$projectDir/classes" from "$projectDir/classes"
into "$buildDir/classes/java/main" into "$projectDir/transform-classes"
include "**/*.*" include "**/*.*"
doLast(){ doLast(){
delete file("$projectDir/classes") delete file("$projectDir/classes")
delete file("$projectDir/transform-classes")
} }
} }
jar.dependsOn("preJar") jar.dependsOn("preJar")
task makeJar(type: Jar,dependsOn: preJar){ task makeJar(type: Jar,dependsOn: preJar){
from fileTree(dir:guard ? "$buildDir/classes/java/main" : outputPath) from fileTree(dir: "$projectDir/transform-classes")
baseName pluginPre baseName pluginPre
appendix pluginName appendix pluginName
version pluginVersion version pluginVersion

Loading…
Cancel
Save