How to read gradle documentation


(Narahari Lakshminarayana) #1

Friends:

I am trying to get some help here in reading and understanding gradle DSL documentation.

Let me take example of the Test phase http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.testing.Test.html

There is a property called “options” for this. http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.testing.Test.html#org.gradle.api.tasks.testing.Test:options

How am I to read this ? What does it expect, a closure, a value or what ?

Reason I ask is, the following example

.....
......
  test {
     useTestNG()
     options {
             listeners << 'org.uncommons.reportng.HTMLReporter'
             listeners << 'org.uncommons.reportng.JUnitXMLReporter'
     }
}

As you can see above, options looks like it takes a closure, or what is it taking exactly ?

Please educate a Gradle-Newbie.

Regards, -Narahari


(Peter Niederwieser) #2

What you are linking to is a (read-only) property rather than a method, so it doesn’t take any arguments. There is also an equally named method that takes a closure, but unfortunately the method doesn’t currently show up in the docs. I’ve just fixed that.


(Narahari Lakshminarayana) #3

Hmmm:

I am on the gradle doc site but I dont see the update for the options method.

Am I not looking at the right one ?

http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.testing.Test.html

-Narahari


(Luke Daley) #4

The “current” docs are for the latest release, so they won’t be updated until the next release.

Our nightly docs are published, unsurprisingly, every night so you can check them tomorrow.

http://www.gradle.org/docs/nightly/dsl/org.gradle.api.tasks.testing.Test.html