gradle: fix issues with new source file property

This commit is contained in:
Alexey Andreev 2023-11-25 13:41:21 +01:00
parent bdd0193eb8
commit 2bd76e2da5
2 changed files with 7 additions and 1 deletions

View File

@ -21,6 +21,7 @@ import org.gradle.api.Action;
import org.gradle.api.Project; import org.gradle.api.Project;
import org.gradle.api.model.ObjectFactory; import org.gradle.api.model.ObjectFactory;
import org.teavm.gradle.api.OptimizationLevel; import org.teavm.gradle.api.OptimizationLevel;
import org.teavm.gradle.api.SourceFilePolicy;
import org.teavm.gradle.api.TeaVMCConfiguration; import org.teavm.gradle.api.TeaVMCConfiguration;
import org.teavm.gradle.api.TeaVMCommonConfiguration; import org.teavm.gradle.api.TeaVMCommonConfiguration;
import org.teavm.gradle.api.TeaVMExtension; import org.teavm.gradle.api.TeaVMExtension;
@ -67,6 +68,9 @@ class TeaVMExtensionImpl extends TeaVMBaseExtensionImpl implements TeaVMExtensio
js.getAddedToWebApp().convention(property("js.addedToWebApp").map(Boolean::parseBoolean).orElse(false)); js.getAddedToWebApp().convention(property("js.addedToWebApp").map(Boolean::parseBoolean).orElse(false));
js.getOptimization().convention(property("js.optimization").map(OptimizationLevel::valueOf) js.getOptimization().convention(property("js.optimization").map(OptimizationLevel::valueOf)
.orElse(OptimizationLevel.BALANCED)); .orElse(OptimizationLevel.BALANCED));
js.getSourceFilePolicy().convention(property("js.sourceFilePolicy")
.map(SourceFilePolicy::valueOf)
.orElse(SourceFilePolicy.DO_NOTHING));
} }
private void setupWasmDefaults() { private void setupWasmDefaults() {

View File

@ -157,7 +157,9 @@ public class TeaVMPlugin implements Plugin<Project> {
)); ));
var tmpConfig = project.getConfigurations().detachedConfiguration(sourcesDep); var tmpConfig = project.getConfigurations().detachedConfiguration(sourcesDep);
tmpConfig.setTransitive(false); tmpConfig.setTransitive(false);
result.addAll(tmpConfig.getFiles()); if (!tmpConfig.getResolvedConfiguration().hasError()) {
result.addAll(tmpConfig.getResolvedConfiguration().getLenientConfiguration().getFiles());
}
} }
} }
return result; return result;