Hey,
Something along those lines:
task obfuscate(dependsOn: classes) << {
//some interesting logic that puts obfuscated classes into
"$buildDir/obfuscated-classes"
}
task obfuscatedJar(dependsOn: obfuscate, type: Jar) {
baseName = 'obfuscated'
from "$buildDir/obfuscated-classes"
}
More info on jar task:
http://gradle.org/current/docs/dsl/org.gradle.api.tasks.bundling.Jar.html
Hope that helps!
Szczepan
On Thu, May 5, 2011 at 7:50 AM, Sean Van Buggenum <[email protected]> wrote:
> Hi all,
> I've been just now learning how to use the java plugin for building a java
> application.
> I am migrating from ant, and in the existing ant files, an application
> 'Zelix' is used to obfuscate the class files before creating the jar.
> In fact, there are two tasks; One in which the jar is built from the
> original class files, and another where the another (production) jar is
> built from the obfuscated class files.
> So, given that I wanted to be able to keep the original structure of the
> projects as is, i've modified the basic gradle build file (the one liner)
> in order to conform to the existing file structure, as well as include the
> manifest that is provided (see example below).
> However, now I need to get Zelix into the picture, to;
> 1. Invoke zelix on the class files generated by the normal build process,
> generating a parallel set of obfuscated class files
> 2. build two jar files, one based on the obfuscated files, the other based
> on the non-obfuscated files.
> I am finding it difficult to discover how best to customize the jar task in
> order to 'most easily' achieve this.
> Anyone got any advice for me? (not obfuscating is unfortunately not an
> option... i'd like not to bother,... but am forced to).
> here is my current build file:
> ---------------------------------
> apply plugin: 'java'
> sourceSets {
> main {
> java {
> srcDir 'src'
> }
> resources {
> srcDir 'src'
> }
> }
> }
> jar {
> manifest {
> from("src/META-INF/MANIFEST.MF")
> }
> }
> -------------
> thanks in advance!
> sean
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email