Actually,

If I may bother once more;

There is something strange going on with my test build.

Keeping in mind that;  Project A depends on project B (a smaller project)

The build which I shows  you last (project A), pretty much works, except
that the dependency (project B)
doesn't build as expected WHEN BUILT AS A DEPENDENCY OF PROJECT A.

while I try to override the main jar task in exactly the same way as works
for project A, in project B (upon which project A is dependent)
my obfuscation is never called.

The result I get for project B is two jar files, one named B.jar, and the
other B-unobfuscated.jar
both having exactly the same contents (because they were built using the
same classes).
My obfuscated classes are never built, and never included in my main jar.

HOWEVER!!! When I build project B by itself (not simply as a dependency of
project A) all works as expected!!

It is as if, the primary build run has conflicted or interrupted the
isolated run of project B build file.

This is surely my last obstacle to ultimate success! ... I hope this is an
easy fix.

thanks again for any help.

My (other) build file is this:

--------------------------------------------


apply plugin: 'java'

// http://www.gradle.org/java_plugin.html
// http://www.gradle.org/multi_project_builds.html

sourceSets {
    main {
        java {
            srcDir 'src'
        }
        resources {
            srcDir 'src'
        }
    }

    test {
        java {
            srcDir 'test'
        }
        resources {
            srcDir 'test'
        }
    }
}

task obfuscate(dependsOn: classes) << {
 javaexec { // as per
http://mrhaki.blogspot.com/2010/09/gradle-goodness-run-java-application.html
    main = 'ZKM'
    classpath = sourceSets.main.runtimeClasspath
    args "$projectDir/script.txt"
    jvmArgs "-DSaveAllDir=$buildDir/obfuscated-classes-extra"
 }
}

task jar(dependsOn: obfuscate, type: Jar, overwrite: true){ // we provide
our own main jar task
    manifest.from("src/META-INF/MANIFEST.MF") // because our main jar should
be obfuscated
    from project.sourceSets.main.resources
    from "$buildDir/obfuscated-classes-extra"
}

jar.doLast {
println "In doLast for the main jar task"
}

task unobfuscatedJar(dependsOn: classes, type: Jar) { // we also provide an
extra jar task, to provide our unobfuscated jar
       baseName = "${project.name}-unobfuscated"
       manifest.from("src/META-INF/MANIFEST.MF")
       from "$buildDir/classes/main"
}

dependencies {
compile files('../../depends/junit.jar')
runtime files('/mnt/data/dev/zelix/ZKM5.2.4e.jar')
}

Reply via email to