architectury-templates
architectury-templates copied to clipboard
Kotlin Templates
It would be wonderful if there are templates using Kotlin, just like Adorn
Kotlin templates as in templates using Kotlin or templates in Kotlin? (as gradle.kts)
Kotlin templates as in templates using Kotlin or templates in Kotlin? (as gradle.kts)
Maybe both? For me, it's a little weird that source code uses kotlin, but gradle files use groovy.
kts doesn't support allprojects
and subprojects
block (see https://stackoverflow.com/questions/60142502/gradle-kotlin-dsl-problems-with-subprojects-and-plugins).So it may hard to convert build.gradle to build.gradle.kts .
kts does support them just fine, it's just that the type-safe accessors for configurations, extensions and tasks aren't generated so you have to use strings and getByName
etc. (See for example my build.gradle.kts where I use subprojects
blocks heavily)
@CubeSugarCheese As @Juuxel said, it should support now. This post is outdated.
Also the post is correct and up-to-date afaik, it just says you can't use type-safe accessors but the answer itself is using subprojects
/allprojects
.
(However, it's not exactly correct about the "import statements" etc since plugins and buildscript don't generate imports. plugins
does generate extra type-safe accessors though)
Also the post is correct and up-to-date afaik, it just says you can't use type-safe accessors but the answer itself is using
subprojects
/allprojects
.(However, it's not exactly correct about the "import statements" etc since plugins and buildscript don't generate imports.
plugins
does generate extra type-safe accessors though)
well,I tried to convert groovy to kts but failed. Seeing your build.gradle.kts, I find the different is not a little which in groovy and kts. If it's possible,I want to get official kts support in next template release.
Now, I transform groovy to kts successfully. But it still have some problems. https://github.com/CubeSugarCheese/architectury-template-kotlin-dsl Based on 1.18.2-forge-fabric-quilt-mixin