diff --git a/tools/gradle/src/main/java/org/teavm/gradle/TeaVMBaseExtensionImpl.java b/tools/gradle/src/main/java/org/teavm/gradle/TeaVMBaseExtensionImpl.java index 28c3114d9..fe5eb7b96 100644 --- a/tools/gradle/src/main/java/org/teavm/gradle/TeaVMBaseExtensionImpl.java +++ b/tools/gradle/src/main/java/org/teavm/gradle/TeaVMBaseExtensionImpl.java @@ -15,6 +15,7 @@ */ package org.teavm.gradle; +import groovy.lang.Closure; import java.io.File; import java.io.FileReader; import java.io.IOException; @@ -120,4 +121,9 @@ class TeaVMBaseExtensionImpl implements TeaVMBaseExtension { public void tests(Action config) { config.execute(tests); } + + @Override + public void tests(Closure config) { + config.rehydrate(getTests(), config.getOwner(), config.getThisObject()).call(); + } } diff --git a/tools/gradle/src/main/java/org/teavm/gradle/TeaVMTestsImpl.java b/tools/gradle/src/main/java/org/teavm/gradle/TeaVMTestsImpl.java index 13a02f18b..80f71f00a 100644 --- a/tools/gradle/src/main/java/org/teavm/gradle/TeaVMTestsImpl.java +++ b/tools/gradle/src/main/java/org/teavm/gradle/TeaVMTestsImpl.java @@ -15,6 +15,7 @@ */ package org.teavm.gradle; +import groovy.lang.Closure; import org.gradle.api.Action; import org.gradle.api.model.ObjectFactory; import org.teavm.gradle.api.TeaVMJSTests; @@ -40,6 +41,11 @@ class TeaVMTestsImpl implements TeaVMTests { config.execute(js); } + @Override + public void js(Closure config) { + config.rehydrate(getJs(), config.getOwner(), config.getThisObject()).call(); + } + @Override public TeaVMWasmTests getWasm() { return wasm; @@ -50,6 +56,11 @@ class TeaVMTestsImpl implements TeaVMTests { config.execute(wasm); } + @Override + public void wasm(Closure config) { + config.rehydrate(getWasm(), config.getOwner(), config.getThisObject()).call(); + } + void configure(TeaVMBaseExtensionImpl extension) { js.configure(extension); wasm.configure(extension); diff --git a/tools/gradle/src/main/java/org/teavm/gradle/api/TeaVMBaseExtension.java b/tools/gradle/src/main/java/org/teavm/gradle/api/TeaVMBaseExtension.java index 158250236..5d7fecd89 100644 --- a/tools/gradle/src/main/java/org/teavm/gradle/api/TeaVMBaseExtension.java +++ b/tools/gradle/src/main/java/org/teavm/gradle/api/TeaVMBaseExtension.java @@ -15,6 +15,8 @@ */ package org.teavm.gradle.api; +import groovy.lang.Closure; +import groovy.lang.DelegatesTo; import org.gradle.api.Action; import org.gradle.api.provider.Provider; @@ -26,4 +28,6 @@ public interface TeaVMBaseExtension { TeaVMTests getTests(); void tests(Action config); + + void tests(@DelegatesTo(TeaVMTests.class) Closure config); } diff --git a/tools/gradle/src/main/java/org/teavm/gradle/api/TeaVMTests.java b/tools/gradle/src/main/java/org/teavm/gradle/api/TeaVMTests.java index 48a042cb1..11990c338 100644 --- a/tools/gradle/src/main/java/org/teavm/gradle/api/TeaVMTests.java +++ b/tools/gradle/src/main/java/org/teavm/gradle/api/TeaVMTests.java @@ -15,6 +15,8 @@ */ package org.teavm.gradle.api; +import groovy.lang.Closure; +import groovy.lang.DelegatesTo; import org.gradle.api.Action; public interface TeaVMTests { @@ -22,7 +24,11 @@ public interface TeaVMTests { void js(Action config); + void js(@DelegatesTo(TeaVMJSTests.class) Closure config); + TeaVMWasmTests getWasm(); void wasm(Action config); + + void wasm(@DelegatesTo(TeaVMWasmTests.class) Closure config); }