Closed radmanplays closed 5 months ago
This is a configuration problem in your Gradle script, it has nothing to do with TeaVM
@radmanplays configuration relies on enum, but gradle couldn't recognize it without full package. So you should use:
optimization = org.teavm.gradle.api.OptimizationLevel.AGGRESSIVE;
@konsoletyper you can map property values in plugin to simplify configuration, like this:
final ExtraPropertiesExtension extraProps = project.getExtensions().getExtraProperties();
Arrays.asList(OptimizationLevel.values()).forEach(type -> extraProps.set(type.name(), type));
Enum value configuration becomes:
optimization = AGGRESSIVE
(AGGRESSIVE here would be a known gradle property and so would be replaced by complete enum path)
Or longer variant could be used to just avoid the package:
Arrays.asList(OptimizationLevel.values()).forEach(type -> extraProps.set(type.getSimpleName()+"."+type.name(), type));
(for optimization = OptimizationLevel.AGGRESSIVE
)
EDIT: the last variant (longer path) is incorrect, it should be enouth to just map the enum:
extraProps.set(OptimizationLevel.class.getSimpleName(), OptimizationLevel.class.getName());
@xvik, nope, I won't do this trick. First, it pollutes global namespace. Second, it's Groovy-only. Third, users are expected to rarely configure this property manually. Optimization levels are carefully chosen for each particular platform. If a developer wants better debugging experience in their development machine, they can create separate run configuration for compiling debug JS by specifying -P
command line. Another option is to create teavm-local.properties
and exclude it from VCS, then specify all options for building locally. See more in documentation
when i try to set the optimization level in build.gradle I get this error :
this is my build.gradle :