Closed gniftygnome closed 6 months ago
if (project.hasProperty("modrinth_required_dependencies")) {
project.getProperty("modrinth_required_dependencies").split(',').map(String::trim).filter(String::isNotEmpty).each {
requires(it)
}
}
gives
...
Caused by: groovy.lang.MissingMethodException: No signature of method: [Ljava.lang.String;.map() is applicable for argument types: (org.codehaus.groovy.runtime.MethodClosure) values: [org.codehaus.groovy.runtime.MethodClosure@310147de]
Possible solutions: max(), max(groovy.lang.Closure), max(java.util.Comparator), tap(groovy.lang.Closure), min(), min(groovy.lang.Closure)
at ferry_mpp_43cy8rxk6t6h3xo6gtpgjvata$_run_closure1.doCall(https://raw.githubusercontent.com/TerraformersMC/GradleScripts/3.0-beta/ferry-mpp.gradle:110)
...
Which is definitely a type issue, but also greek to me.
Nevermind ... I finally figured out something that seems to work.
String[] splitProperty(String property) {
String value = project.findProperty(property)
if (value == null) {
return new String[0];
}
return value.split(', *').findAll { !it.isBlank() }
}
//...
modrinth {
splitProperty("modrinth_required_dependencies").each {
requires(it)
}
}
And here I had issue 42 and I didn't even thank you for all the fish...
I was doing this (which I gather was limited to setting only one of the values):
Today I tried to get it working again with later MPP versions, and arrived at this:
However, the
requires
function does not exist; I assume because of a type mismatch. Is there a reasonable way to achieve what I am trying to do here?