Do tasks have a boolean up-to-date property that can be accessed by other tasks?

task1 {
    //do something
  task2 {
    dependsOn task1
    upToDateWhen {
        // task 1 is up-to-date

I want a certain task to be up-to-date if and only if another task is up-to-date. Is there a way to access an up-to-date property?

nvm, getDidWork() does the trick, you can mark this as answered.