Hello Gradle Experts,
Our local Gradle guru is away on a much deserved vacation, leaving us less
versed devs to do some Gradle build tasks. I'm struggling with excluding some
jars from a zip task and including some different ones in place. We basically
generate some obfuscated and un-obfuscated jars. The jars the zip task is
including are the un-obfuscated jars. I'm wanting to exclude those and add the
obfuscated ones in place. I've played around with this for a full day now and
need some insight.
config = copySpec {
from('assets/config') {
exclude 'DevIDE.sh'
}
from('assets/config') {
include 'DevIDE.sh'
fileMode = 0755
}
//copying in expected empty directories and log4j config
from('src/main/resources')
}
dependencies {
compile project(':model')
compile("org.apache.axis2:axis2:1.6.0")
compile("org.apache.axis2:axis2-adb:1.6.0")
compile("org.apache.axis2:axis2-transport-local:1.6.0")
compile("org.apache.axis2:axis2-transport-http:1.6.0")
compile "edu.stanford.ejalbert:browser-launcher:1.0-rc4"
compile "javax.help:javahelp:2.0.02"
compile
files("lib/scriptide-lib/ap-dev-ide-help-1.0/ap-dev-ide-help-1.0.jar")
}
[obfuscate, obfuscateJar]*.enabled = false
distZip.dependsOn ':foundation:obfuscateJar', ':interpreter:obfuscateJar',
':model:obfuscateJar'
distZip { Zip zip ->
into(zip.archiveName - ".zip") {
with config
}
ArrayList<String> projects = [':foundation', ':interpreter', ':model']
List excludeFiles = projects.collect { String projectName ->
"**/" + project(projectName).jar.archiveName
}
exclude(excludeFiles)
}
I have not added the include statement above because I can't even figure this
out. I basically need to do the above to and then include the obfuscated files
in place. I've read the docs and checked the gradle source for the zip task,
but I am missing something. I've tried all kinds of variations:
zip.exclude(...), putting the exclude into the 'into' closure, not using
brackets around the excludeFiles, ....
Thanks in advance for any pointers,
Jared