barteks2x
10/11/2017, 5:34 PMjlleitschuh
10/11/2017, 6:05 PMtask coreJar(type: Jar) {
//...
}
Is creating a task called coreJar
, not pulling it from some task created by a plugin.
The syntax to convert that to kotlin would be:
task<Jar>("coreJar") {
// Your logic here.
}
barteks2x
10/11/2017, 6:07 PMtasks {
"coreJar"(Jar::class) {
// logic here
}
}
with the same resultjlleitschuh
10/11/2017, 6:08 PMbarteks2x
10/11/2017, 6:08 PM* What went wrong:
A problem occurred configuring root project '1.12'.
> coreJar is not a jar task. Can only reobf jars!
jlleitschuh
10/11/2017, 6:11 PMbarteks2x
10/11/2017, 6:11 PMreobf {
coreJar { mappingType = 'SEARGE' }
}
which is
configure<NamedDomainObjectContainer<ReobfTaskFactory.ReobfTaskWrapper>> {
create("coreJar").apply {
mappingType = ReobfMappingType.SEARGE
}
}
my current code: https://hastebin.com/sicemaruna.scala (this is with addition to my project)jlleitschuh
10/11/2017, 6:13 PMconfigure<NamedDomainObjectContainer<ReobfTaskFactory.ReobfTaskWrapper>>
is equivalent??barteks2x
10/11/2017, 6:15 PMjlleitschuh
10/11/2017, 6:15 PMtask coreJar(type: Jar) {
//...
}
configure<NamedDomainObjectContainer<ReobfTaskFactory.ReobfTaskWrapper>> {
create("coreJar").apply {
mappingType = ReobfMappingType.SEARGE
}
}
barteks2x
10/11/2017, 6:15 PMtasks {
"coreJar"(Jar::class) {
// logic here
}
}
which I saw in samplesjlleitschuh
10/11/2017, 6:16 PMconfigure<NamedDomainObjectContainer<ReobfTaskFactory.ReobfTaskWrapper>> {
create("coreJar").apply {
mappingType = ReobfMappingType.SEARGE
}
}
Into an afterEvaluate
block and see what happensbarteks2x
10/11/2017, 6:18 PMjlleitschuh
10/11/2017, 6:20 PMbarteks2x
10/11/2017, 6:21 PM* What went wrong:
Execution failed for task ':reobfCoreJar'.
> org.gradle.jvm.tasks.Jar_Decorated cannot be cast to org.gradle.api.tasks.bundling.Jar
throw new GradleConfigurationException(jarName + " is not a jar task. Can only reobf jars!");
is in afterEvaluate in that plugin's codejlleitschuh
10/11/2017, 6:28 PMJar
tasks. One is just an interface for the other one.barteks2x
10/11/2017, 6:29 PMjlleitschuh
10/11/2017, 6:33 PMJar
is probably different than the one the plugin expects.barteks2x
10/11/2017, 6:34 PMorg.gradle.api.tasks.bundling.Jar
needs fully qualified name to be used?jlleitschuh
10/11/2017, 6:34 PMbarteks2x
10/11/2017, 6:34 PMjlleitschuh
10/11/2017, 6:35 PMbarteks2x
10/11/2017, 6:35 PMorg.gradle.api.tasks.bundling.Jar
is actually in the API. Shouldn't that one be actually imported by default?jlleitschuh
10/11/2017, 6:41 PMJar
api, why there are two of them, ect... to me again because I still don't really understand.
I know it has something to do with not breaking the API.barteks2x
10/11/2017, 6:42 PMjlleitschuh
10/11/2017, 6:42 PMbarteks2x
10/11/2017, 6:44 PMjlleitschuh
10/11/2017, 6:45 PMbarteks2x
10/11/2017, 6:48 PMjlleitschuh
10/11/2017, 6:48 PMbarteks2x
10/11/2017, 6:48 PMjlleitschuh
10/11/2017, 7:02 PMbarteks2x
10/11/2017, 7:10 PMjlleitschuh
10/11/2017, 7:11 PMbarteks2x
10/11/2017, 7:13 PMeskatos
10/12/2017, 6:34 AMJar
task by default. This will be fixed in the upcoming Gradle 4.3.