mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-03 05:44:10 -08:00
gradle: make DSL groovy-friendly
This commit is contained in:
parent
4fdb05905d
commit
27713b78f8
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
plugins {
|
||||
id("org.teavm") version "0.7.0-SNAPSHOT" apply false
|
||||
id("org.teavm") version "0.8.0-SNAPSHOT" apply false
|
||||
id("org.wisepersist.gwt") version "1.1.19" apply false
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package org.teavm.gradle;
|
||||
|
||||
import groovy.lang.Closure;
|
||||
import java.io.File;
|
||||
import org.gradle.api.Action;
|
||||
import org.gradle.api.Project;
|
||||
|
@ -117,6 +118,11 @@ class TeaVMExtensionImpl extends TeaVMBaseExtensionImpl implements TeaVMExtensio
|
|||
action.execute(getJs());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void js(Closure<Void> action) {
|
||||
action.rehydrate(getJs(), action.getOwner(), action.getThisObject()).call();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TeaVMWasmConfiguration getWasm() {
|
||||
return wasm;
|
||||
|
@ -127,6 +133,11 @@ class TeaVMExtensionImpl extends TeaVMBaseExtensionImpl implements TeaVMExtensio
|
|||
action.execute(getWasm());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wasm(Closure<Void> action) {
|
||||
action.rehydrate(getWasm(), action.getOwner(), action.getThisObject()).call();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TeaVMWasiConfiguration getWasi() {
|
||||
return wasi;
|
||||
|
@ -137,6 +148,11 @@ class TeaVMExtensionImpl extends TeaVMBaseExtensionImpl implements TeaVMExtensio
|
|||
action.execute(wasi);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wasi(Closure<Void> action) {
|
||||
action.rehydrate(getWasi(), action.getOwner(), action.getThisObject()).call();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TeaVMCConfiguration getC() {
|
||||
return c;
|
||||
|
@ -147,6 +163,11 @@ class TeaVMExtensionImpl extends TeaVMBaseExtensionImpl implements TeaVMExtensio
|
|||
action.execute(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void c(Closure<Void> action) {
|
||||
action.rehydrate(getC(), action.getOwner(), action.getThisObject()).call();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TeaVMCommonConfiguration getAll() {
|
||||
return all;
|
||||
|
@ -157,6 +178,11 @@ class TeaVMExtensionImpl extends TeaVMBaseExtensionImpl implements TeaVMExtensio
|
|||
action.execute(getAll());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void all(Closure<Void> action) {
|
||||
action.rehydrate(getAll(), action.getOwner(), action.getThisObject()).call();
|
||||
}
|
||||
|
||||
private void inherit(TeaVMCommonConfiguration target, TeaVMCommonConfiguration source) {
|
||||
target.getMainClass().convention(source.getMainClass());
|
||||
target.getOutputDir().convention(source.getOutputDir());
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
package org.teavm.gradle.api;
|
||||
|
||||
import groovy.lang.Closure;
|
||||
import groovy.lang.DelegatesTo;
|
||||
import org.gradle.api.Action;
|
||||
|
||||
public interface TeaVMExtension extends TeaVMBaseExtension {
|
||||
|
@ -22,19 +24,29 @@ public interface TeaVMExtension extends TeaVMBaseExtension {
|
|||
|
||||
void js(Action<TeaVMJSConfiguration> action);
|
||||
|
||||
void js(@DelegatesTo(TeaVMJSConfiguration.class) Closure<Void> action);
|
||||
|
||||
TeaVMWasmConfiguration getWasm();
|
||||
|
||||
void wasm(Action<TeaVMWasmConfiguration> action);
|
||||
|
||||
void wasm(@DelegatesTo(TeaVMWasmConfiguration.class) Closure<Void> action);
|
||||
|
||||
TeaVMWasiConfiguration getWasi();
|
||||
|
||||
void wasi(Action<TeaVMWasiConfiguration> action);
|
||||
|
||||
void wasi(@DelegatesTo(TeaVMWasiConfiguration.class) Closure<Void> action);
|
||||
|
||||
TeaVMCConfiguration getC();
|
||||
|
||||
void c(Action<TeaVMCConfiguration> action);
|
||||
|
||||
void c(@DelegatesTo(TeaVMCConfiguration.class) Closure<Void> action);
|
||||
|
||||
TeaVMCommonConfiguration getAll();
|
||||
|
||||
void all(Action<TeaVMCommonConfiguration> action);
|
||||
|
||||
void all(@DelegatesTo(TeaVMCommonConfiguration.class) Closure<Void> action);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user