Howdy,

I'm running into a minor issue when using the compile task that I cannot easily solve.

I want to provide a custom debug level for compilation, but Gradle does not seem to support this attribute and I could not get around the Ant task either.

I first tried to configure custom options:

    compile.options.define(
        debug: true,
        debugLevel: 'lines,source',
        deprecation: true,
        optimize: false,
        source: 1.4,
        target: 1.4,
    )

But Gradle complains that "No such property: debugLevel for class: org.gradle.api.tasks.compile.CompileOptions" exists.

Is there a specific reason for not providing the same attributes as the Ant javac task?

"source" and "target" are not supported as well. I know that it's possible to define "sourceCompatibility" and "targetCompatibility", but I would prefer to define all options in one place. If you agree that these attributes should be supported, I will file a bug report.

When looking for a workaround, I came across the following snippet that should allow one to override javac invocation:

    compile.actions[0] = {
        ant {
            mkdir(dir: classesDir)
            javac(includeAntRuntime: false,
                  srcdir: srcDirs.join(':'),
                  destdir: classesDir,
                  classpath: dependencies.antpath('compile'),
                  target: targetCompatibility,
                  source: sourceCompatibility
            )
        }
    }

Taken from
<http://www.mail-archive.com/[email protected]/msg00225.html>

But when I try that, I receive the following error:

java.lang.ClassCastException: build_gradle$_run_closure1_closure5
 at org.gradle.api.internal.AbstractTask.execute(AbstractTask.java:172)
at org.gradle.execution.DefaultTaskExecuter.executeTask(DefaultTaskExecuter.java:161) at org.gradle.execution.DefaultTaskExecuter.execute(DefaultTaskExecuter.java:148) at org.gradle.execution.DefaultTaskExecuter.execute(DefaultTaskExecuter.java:77) at org.gradle.execution.DefaultTaskExecuter.execute(DefaultTaskExecuter.java:88) at org.gradle.execution.TaskNameResolvingBuildExecuter.execute(TaskNameResolvingBuildExecuter.java:104)
 at org.gradle.Gradle.runInternal(Gradle.java:123)
 at org.gradle.Gradle.run(Gradle.java:93)
 at org.gradle.Main.execute(Main.java:232)
 at org.gradle.Main.main(Main.java:77)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at org.gradle.BootstrapMain.main(BootstrapMain.java:53)

I would appreciate any help. Thank you.

Below is some information about my environment.

$ gradle -v

----------------------------------------
Gradle 0.5.2
----------------------------------------

Gradle buildtime: Thursday, January 8, 2009 10:23:01 PM CET
Groovy: 1.5.6
Ant: Apache Ant version 1.7.0 compiled on December 13 2006
Ivy: 2.0.0-rc2
Java: 1.5.0_16
JVM: 1.5.0_16-133
JVM Vendor: Apple Inc.
OS Name: Mac OS X



--
Cheers,
  Marco

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to