From 6aac914306d15fbf39ce0250ca5650770ec999b2 Mon Sep 17 00:00:00 2001 From: richie Date: Tue, 2 Jun 2020 16:32:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8C=85=E5=92=8C=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E5=86=B2=E7=AA=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin-function/build.gradle | 23 ++++++++++++++--------- plugin-function2/build.gradle | 23 ++++++++++++++--------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/plugin-function/build.gradle b/plugin-function/build.gradle index 5f63ab9..506a8af 100644 --- a/plugin-function/build.gradle +++ b/plugin-function/build.gradle @@ -27,10 +27,12 @@ group = 'com.fr.plugin' version = '10.0' sourceCompatibility = '8' -sourceSets { - main { - java.outputDir = file(outputPath) - output.resourcesDir = file(outputPath) +if (!guard) { + sourceSets { + main { + java.outputDir = file(outputPath) + output.resourcesDir = file(outputPath) + } } } @@ -45,16 +47,19 @@ ant.references["compile.classpath"] = ant.path { classes.dependsOn('clean') task copyFiles(type: Copy,dependsOn: 'classes'){ -// from "$buildDir/classes/java/main" -// from "$buildDir/resources/main" - from outputPath + if (guard) { + from "$buildDir/classes/java/main" + from "$buildDir/resources/main" + } else { + from outputPath + } into "$projectDir/classes" } task preJar(type:Copy,dependsOn: guard ? 'compile_encrypt_javas' : 'compile_plain_javas'){ from "$projectDir/classes" into "$buildDir/classes/java/main" - include "**/*.class" + include "**/*.*" doLast(){ delete file("$projectDir/classes") } @@ -62,7 +67,7 @@ task preJar(type:Copy,dependsOn: guard ? 'compile_encrypt_javas' : 'compile_plai jar.dependsOn("preJar") task makeJar(type: Jar,dependsOn: preJar){ - from fileTree(dir:"$buildDir/classes/java/main") + from fileTree(dir:guard ? "$buildDir/classes/java/main" : outputPath) baseName pluginPre appendix pluginName version pluginVersion diff --git a/plugin-function2/build.gradle b/plugin-function2/build.gradle index 5f63ab9..506a8af 100644 --- a/plugin-function2/build.gradle +++ b/plugin-function2/build.gradle @@ -27,10 +27,12 @@ group = 'com.fr.plugin' version = '10.0' sourceCompatibility = '8' -sourceSets { - main { - java.outputDir = file(outputPath) - output.resourcesDir = file(outputPath) +if (!guard) { + sourceSets { + main { + java.outputDir = file(outputPath) + output.resourcesDir = file(outputPath) + } } } @@ -45,16 +47,19 @@ ant.references["compile.classpath"] = ant.path { classes.dependsOn('clean') task copyFiles(type: Copy,dependsOn: 'classes'){ -// from "$buildDir/classes/java/main" -// from "$buildDir/resources/main" - from outputPath + if (guard) { + from "$buildDir/classes/java/main" + from "$buildDir/resources/main" + } else { + from outputPath + } into "$projectDir/classes" } task preJar(type:Copy,dependsOn: guard ? 'compile_encrypt_javas' : 'compile_plain_javas'){ from "$projectDir/classes" into "$buildDir/classes/java/main" - include "**/*.class" + include "**/*.*" doLast(){ delete file("$projectDir/classes") } @@ -62,7 +67,7 @@ task preJar(type:Copy,dependsOn: guard ? 'compile_encrypt_javas' : 'compile_plai jar.dependsOn("preJar") task makeJar(type: Jar,dependsOn: preJar){ - from fileTree(dir:"$buildDir/classes/java/main") + from fileTree(dir:guard ? "$buildDir/classes/java/main" : outputPath) baseName pluginPre appendix pluginName version pluginVersion