mirror of
https://github.com/konsoletyper/teavm.git
synced 2024-11-21 01:00:54 +08:00
wasm gc: support running tests in gradle
This commit is contained in:
parent
ce862b9eaa
commit
5c743bc9a4
@ -25,10 +25,12 @@ import org.teavm.gradle.api.TeaVMWasmTests;
|
||||
class TeaVMTestsImpl implements TeaVMTests {
|
||||
private TeaVMJSTestsImpl js;
|
||||
private TeaVMWasmTestsImpl wasm;
|
||||
private TeaVMWasmTestsImpl wasmGC;
|
||||
|
||||
TeaVMTestsImpl(ObjectFactory objectFactory) {
|
||||
js = new TeaVMJSTestsImpl(objectFactory);
|
||||
wasm = new TeaVMWasmTestsImpl(objectFactory);
|
||||
wasm = new TeaVMWasmTestsImpl(objectFactory, "wasm");
|
||||
wasmGC = new TeaVMWasmTestsImpl(objectFactory, "wasm-gc");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -61,8 +63,24 @@ class TeaVMTestsImpl implements TeaVMTests {
|
||||
config.rehydrate(getWasm(), config.getOwner(), config.getThisObject()).call();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TeaVMWasmTests getWasmGC() {
|
||||
return wasmGC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wasmGC(Action<TeaVMWasmTests> config) {
|
||||
config.execute(wasmGC);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wasmGC(Closure<?> config) {
|
||||
config.rehydrate(getWasmGC(), config.getOwner(), config.getThisObject()).call();
|
||||
}
|
||||
|
||||
void configure(TeaVMBaseExtensionImpl extension) {
|
||||
js.configure(extension);
|
||||
wasm.configure(extension);
|
||||
wasmGC.configure(extension);
|
||||
}
|
||||
}
|
||||
|
@ -23,10 +23,12 @@ import org.teavm.gradle.api.TeaVMWebTestRunner;
|
||||
class TeaVMWasmTestsImpl implements TeaVMWasmTests {
|
||||
private Property<Boolean> enabled;
|
||||
private Property<TeaVMWebTestRunner> runner;
|
||||
private String name;
|
||||
|
||||
TeaVMWasmTestsImpl(ObjectFactory objectFactory) {
|
||||
TeaVMWasmTestsImpl(ObjectFactory objectFactory, String name) {
|
||||
enabled = objectFactory.property(Boolean.class);
|
||||
runner = objectFactory.property(TeaVMWebTestRunner.class);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -40,8 +42,9 @@ class TeaVMWasmTestsImpl implements TeaVMWasmTests {
|
||||
}
|
||||
|
||||
void configure(TeaVMBaseExtensionImpl extension) {
|
||||
enabled.convention(extension.property("tests.wasm.enabled").map(Boolean::parseBoolean).orElse(false));
|
||||
runner.convention(extension.property("tests.wasm.runner").map(s -> TeaVMWebTestRunner.valueOf(s.toUpperCase()))
|
||||
enabled.convention(extension.property("tests." + name + ".enabled").map(Boolean::parseBoolean).orElse(false));
|
||||
runner.convention(extension.property("tests." + name + ".runner")
|
||||
.map(s -> TeaVMWebTestRunner.valueOf(s.toUpperCase()))
|
||||
.orElse(TeaVMWebTestRunner.CHROME));
|
||||
}
|
||||
}
|
||||
|
@ -31,4 +31,10 @@ public interface TeaVMTests {
|
||||
void wasm(Action<TeaVMWasmTests> config);
|
||||
|
||||
void wasm(@DelegatesTo(TeaVMWasmTests.class) Closure<?> config);
|
||||
|
||||
TeaVMWasmTests getWasmGC();
|
||||
|
||||
void wasmGC(Action<TeaVMWasmTests> config);
|
||||
|
||||
void wasmGC(@DelegatesTo(TeaVMWasmTests.class) Closure<?> config);
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2023 Alexey Andreev.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.gradle.api;
|
||||
|
||||
import org.gradle.api.provider.Property;
|
||||
|
||||
public interface TeaVMWasmGCTests {
|
||||
Property<Boolean> getEnabled();
|
||||
|
||||
Property<TeaVMWebTestRunner> getRunner();
|
||||
}
|
Loading…
Reference in New Issue
Block a user