Skip to content

Instantly share code, notes, and snippets.

@alllex
Created December 9, 2023 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alllex/393120c044fac75b0feb2812228304e3 to your computer and use it in GitHub Desktop.
Save alllex/393120c044fac75b0feb2812228304e3 to your computer and use it in GitHub Desktop.
Test that allows extending a built-in Wrapper task by a non abstract user-defined class
class TmpIntegrationTest extends AbstractIntegrationSpec {
def "tmp test"() {
settingsFile << """
rootProject.name = "root"
"""
buildFile << """
class MyWrapper extends Wrapper {
// Just to make MyWrapper compile
@Override
public Property<Boolean> getValidateDistributionUrl() { return getServices().get(ObjectFactory.class).property(Boolean.class).convention(true); }
}
tasks.register("myWrapper", MyWrapper)
"""
expect:
file("gradle/wrapper/gradle-wrapper.properties").assertDoesNotExist()
when:
run("myWrapper")
then:
file("gradle/wrapper/gradle-wrapper.properties").exists()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment