Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with ant builder throwing exception on call() #23211

Merged
merged 1 commit into from Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -18,6 +18,7 @@ package org.gradle.internal.extensibility


import org.gradle.integtests.fixtures.AbstractIntegrationSpec
import spock.lang.Issue

class CallablePropertyIntegrationTest extends AbstractIntegrationSpec {

Expand Down Expand Up @@ -95,4 +96,19 @@ class CallablePropertyIntegrationTest extends AbstractIntegrationSpec {
"Inside Project.configure" | "configure(container.foo) { prop() }"
"Inside NDOC.configure" | "container.configure { foo { prop() } }"
}

@Issue('https://github.com/gradle/gradle/issues/23111')
def "can configure dynamic property without call method"() {
buildFile << """
task test {
doLast {
ant { echo(message: 'hello world!') }
}
}
"""

expect:
args('--stacktrace')
succeeds("test")
}
}
Expand Up @@ -56,7 +56,9 @@ public DynamicInvokeResult tryInvokeMethod(String name, Object... arguments) {
return DynamicInvokeResult.found();
}
DynamicObject dynamicObject = DynamicObjectUtil.asDynamicObject(property);
return dynamicObject.tryInvokeMethod("call", arguments);
if (dynamicObject.hasMethod("call", arguments)) {
return dynamicObject.tryInvokeMethod("call", arguments);
}
}
return DynamicInvokeResult.notFound();
}
Expand Down